diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-30 11:16:00 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-30 11:16:00 +0000 |
commit | beb18cb120477fe85f60393c47151744713efe59 (patch) | |
tree | 3c85acd4f79ccd15a72b350c62a68e83e6075f6c | |
parent | 428f1b5d7e363431585b49e9d99c5aad37d813c1 (diff) |
Fix mode desync when setting custom prefixes on joining users (trigger the mode handler explicitly)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5359 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/channels.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/channels.cpp b/src/channels.cpp index f4a6db2b3..3f74698d5 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -385,33 +385,30 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr,ucrec *a,userrec* user, const std::string &privs) { + userrec* dummyuser = new userrec(Instance); + std::string nick = user->nick; + a->uc_modes = 0; + dummyuser->SetFd(FD_MAGIC_NUMBER); + + a->channel = Ptr; + Ptr->AddUser(user); + user->ModChannelCount(1); for (std::string::const_iterator x = privs.begin(); x != privs.end(); x++) { const char status = *x; - switch (status) - { - case '@': - a->uc_modes |= UCMODE_OP; - break; - case '%': - a->uc_modes |= UCMODE_HOP; - break; - case '+': - a->uc_modes |= UCMODE_VOICE; - break; - } ModeHandler* mh = Instance->Modes->FindPrefix(status); if (mh) { Ptr->SetPrefix(user, status, mh->GetPrefixRank(), true); + /* Make sure that the mode handler knows this mode was now set */ + mh->OnModeChange(dummyuser, dummyuser, Ptr, nick, true); } } - a->channel = Ptr; - Ptr->AddUser(user); - user->ModChannelCount(1); + delete dummyuser; + Ptr->WriteChannel(user,"JOIN :%s",Ptr->name); /* Theyre not the first ones in here, make sure everyone else sees the modes we gave the user */ |