Logo Search packages:      
Sourcecode: verlihub version File versions

bool nDirectConnect::cServerDC::AddToList ( cUser usr  ) 

try to add user into userlist, return true on success

adds a user into a user list

Definition at line 372 of file cserverdc.cpp.

References nUtils::tHashArray< DataType >::AddWithHash(), nDirectConnect::cUser::Can(), nDirectConnect::nTables::cDCConf::chat_default_on, DCPublicHS(), cObj::ErrLog(), nDirectConnect::cUser::IsPassive, cObj::Log(), cObj::LogStream(), nDirectConnect::cUserBase::mClass, nDirectConnect::cConnDC::mFeatures, nDirectConnect::nTables::cRegUserInfo::mHideKeys, nDirectConnect::cUserBase::mInList, nDirectConnect::cUserBase::mNick, mOpList, nDirectConnect::cConnDC::mRegInfo, nDirectConnect::nTables::cDCConf::msg_chat_onoff, nServer::cAsyncSocketServer::mTime, nDirectConnect::cUser::mxConn, and nUtils::cTime::Sec().

Referenced by AddRobot(), and DoUserLogin().

{
      if(!usr)
      {
            if(ErrLog(1)) LogStream() << "Adding a NULL user to userlist" << endl;
            return false;
      }
      if(usr->mInList)
      {
            if(ErrLog(2)) LogStream() << "User is already in the user list, he says it " << endl;
            return false;
      }

      tUserHash Hash = mUserList.Nick2Hash(usr->mNick);

      if( !mUserList.AddWithHash(usr, Hash) )
      {
            if(ErrLog(2)) LogStream() << "Adding twice user with same hash " << usr->mNick << endl;
            usr->mInList = false;
            return false;
      }
      
      //cout << "Join: " << usr->mNick << " count = " << mUserList.size() << endl;
      usr->mInList = true;
      if( !usr->IsPassive ) mActiveUsers.AddWithHash(usr, Hash);
      if( usr->mClass >= eUC_OPERATOR && !
            ( usr->mxConn && usr->mxConn->mRegInfo && usr->mxConn->mRegInfo->mHideKeys))
            mOpList.AddWithHash(usr, Hash);
      if( usr->Can(eUR_OPCHAT, mTime.Sec()) ) mOpchatList.AddWithHash(usr, Hash);
      if( usr->mxConn && !(usr->mxConn->mFeatures & eSF_NOHELLO) )
            mHelloUsers.AddWithHash(usr, Hash);
      if( (usr->mClass >= eUC_OPERATOR) || mC.chat_default_on )
            mChatUsers.AddWithHash(usr, Hash);
      else
            DCPublicHS(mC.msg_chat_onoff, usr->mxConn);

      if(usr->mxConn && usr->mxConn->Log(3)) usr->mxConn->LogStream() << "Adding at the end of Nicklist" << endl;

      //mP.Append_MyInfoList(mNickInfoString, usr->mMyINFO, usr->mMyINFO_basic ,false);
      if(usr->mxConn && usr->mxConn->Log(3)) usr->mxConn->LogStream() << "Becomes in list" << endl;

      return true;
}


Generated by  Doxygen 1.6.0   Back to index