From 02ccf82812a189c46d0495580b7d96ada34851b5 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 6 Jan 2007 16:15:35 +0000 Subject: Fix desync with halfop and voice when opped (this happens because we were ORing the wrong value in chanrec::ForceChan) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6232 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/channels.cpp | 7 ++++--- src/mode.cpp | 5 +++++ src/modes/cmode_h.cpp | 8 ++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/channels.cpp b/src/channels.cpp index 36436cdc5..4aea42ac8 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -385,13 +385,13 @@ chanrec* chanrec::ForceChan(InspIRCd* Instance, chanrec* Ptr, userrec* user, con * must stick to ::find(). */ case '@': - user->chans[Ptr] |= STATUS_OP; + user->chans[Ptr] |= UCMODE_OP; break; case '%': - user->chans[Ptr] |= STATUS_HOP; + user->chans[Ptr] |= UCMODE_HOP; break; case '+': - user->chans[Ptr] |= STATUS_VOICE; + user->chans[Ptr] |= UCMODE_VOICE; break; } } @@ -976,6 +976,7 @@ int chanrec::GetStatus(userrec *user) void chanrec::SetPrefix(userrec* user, char prefix, unsigned int prefix_value, bool adding) { + ServerInstance->Log(DEBUG,"Setting prefix: %c on user %s in %s to %d", prefix, user->nick, this->name, adding); prefixlist::iterator n = prefixes.find(user); prefixtype pfx = std::make_pair(prefix,prefix_value); if (adding) diff --git a/src/mode.cpp b/src/mode.cpp index 62dd61f4c..11fecf06a 100644 --- a/src/mode.cpp +++ b/src/mode.cpp @@ -185,6 +185,7 @@ const char* ModeParser::Grant(userrec *d,chanrec *chan,int MASK) { if (n->second & MASK) { + ServerInstance->Log(DEBUG,"User already has privilage %d (privset: %d)", MASK, n->second); return ""; } n->second = n->second | MASK; @@ -203,6 +204,10 @@ const char* ModeParser::Grant(userrec *d,chanrec *chan,int MASK) ServerInstance->Log(DEBUG,"grant: %s %s",n->first->name,d->nick); return d->nick; } + else + { + ServerInstance->Log(DEBUG,"Channel %s not in users joined list", chan->name); + } return ""; } diff --git a/src/modes/cmode_h.cpp b/src/modes/cmode_h.cpp index 9bd061cd2..a77366c82 100644 --- a/src/modes/cmode_h.cpp +++ b/src/modes/cmode_h.cpp @@ -84,6 +84,8 @@ ModeAction ModeChannelHalfOp::OnModeChange(userrec* source, userrec* dest, chanr int status = channel->GetStatus(source); + ServerInstance->Log(DEBUG,"Halfop handler, source=%s channel=%s parameter=%s adding=%d",source->nick, channel->name, parameter.c_str(), adding); + /* Call the correct method depending on wether we're adding or removing the mode */ if (adding) { @@ -108,6 +110,8 @@ std::string ModeChannelHalfOp::AddHalfOp(userrec *user,const char* dest,chanrec { userrec *d = ServerInstance->Modes->SanityChecks(user,dest,chan,status); + ServerInstance->Log(DEBUG,"Add halfop"); + if (d) { if (IS_LOCAL(user)) @@ -127,6 +131,7 @@ std::string ModeChannelHalfOp::AddHalfOp(userrec *user,const char* dest,chanrec } } + ServerInstance->Log(DEBUG,"Calling Grant"); return ServerInstance->Modes->Grant(d,chan,UCMODE_HOP); } return ""; @@ -136,6 +141,8 @@ std::string ModeChannelHalfOp::DelHalfOp(userrec *user,const char *dest,chanrec { userrec *d = ServerInstance->Modes->SanityChecks(user,dest,chan,status); + ServerInstance->Log(DEBUG,"Del halfop"); + if (d) { if (IS_LOCAL(user)) @@ -155,6 +162,7 @@ std::string ModeChannelHalfOp::DelHalfOp(userrec *user,const char *dest,chanrec } } + ServerInstance->Log(DEBUG,"Calling revoke"); return ServerInstance->Modes->Revoke(d,chan,UCMODE_HOP); } return ""; -- cgit v1.2.3