Logo Search packages:      
Sourcecode: verlihub version File versions

bool nDirectConnect::cServerDC::RemoveNick ( cUser User  ) 

removes user with given nick from uselist, return true on success

Definition at line 417 of file cserverdc.cpp.

References nUtils::tHashArray< DataType >::ContainsHash(), nDirectConnect::nTables::cDCConf::delayed_myinfo, nDirectConnect::cUserBase::mInList, nDirectConnect::cUserBase::mNick, mOpList, nDirectConnect::cUser::mxConn, nUtils::tHashArray< DataType >::RemoveByHash(), nDirectConnect::cUserCollection::SendToAll(), and nDirectConnect::nTables::cDCConf::show_tags.

Referenced by VerifyUniqueNick().

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

      //cout << "Leave: " << User->mNick << " count = " << this->mUserList.size() << " then ";
      if(mUserList.ContainsHash(Hash)) {
            #ifndef WITHOUT_PLUGINS
            mCallBacks.mOnUserLogout.CallAll(User);
            #endif
                // make sure that the user we want to remove is the correct one!
                cUser *other = mUserList.GetUserByNick(User->mNick);
            if(!User->mxConn)
            {
                  //cout << "Removing robot user" << endl;
                  mUserList.RemoveByHash(Hash);
            }
                else if(other && other->mxConn && User->mxConn && other->mxConn == User->mxConn)
                {
                        //cout << "Leave: " << User->mNick << " count = " << mUserList.size() << endl;
                  mUserList.RemoveByHash(Hash);
            }
            else
            {
                  // this may cause problems when user is robot with 0 connection
                  //cout << "NOT found the correct user!, skip removing: " << User->mNick << endl;
                      return false;
            }
      }
      if(mOpList.ContainsHash(Hash)) mOpList.RemoveByHash(Hash);
      if(mOpchatList.ContainsHash(Hash)) mOpchatList.RemoveByHash(Hash);
      if(mActiveUsers.ContainsHash(Hash)) mActiveUsers.RemoveByHash(Hash);
      if(mHelloUsers.ContainsHash(Hash)) mHelloUsers.RemoveByHash(Hash);
      if(mChatUsers.ContainsHash(Hash)) mChatUsers.RemoveByHash(Hash);
      if(mInProgresUsers.ContainsHash(Hash)) mInProgresUsers.RemoveByHash(Hash);

      if (User->mInList)
      {
            User->mInList=false;

            //cout << this->mUserList.size() << endl;
            static string omsg;
            omsg = "";
            cDCProto::Create_Quit(omsg, User->mNick);

            // delayed myinfo implies delay of quit too, otherwise there would be mess in peoples userslists
            mUserList.SendToAll(omsg,mC.delayed_myinfo, true);
            if(mC.show_tags == 1)
            {
                  mOpchatList.SendToAll(omsg,mC.delayed_myinfo, true);
            }
      }
      return true;
}


Generated by  Doxygen 1.6.0   Back to index