summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/channels.cpp27
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 */