]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/channels.cpp
Move nick change code out of cmd_nick; fixes double-invocation of hooks and may elimi...
[user/henk/code/inspircd.git] / src / channels.cpp
index 31038484eb14baedf93858253908b0af711295da..7c60b54f0ba85d27ac0e8d7dae7d5ae4eae65a12 100644 (file)
@@ -2,7 +2,7 @@
  *       | Inspire Internet Relay Chat Daemon |
  *       +------------------------------------+
  *
- *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
+ *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
  * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
@@ -101,7 +101,7 @@ int Channel::SetTopic(User *u, std::string &ntopic, bool forceset)
                                }
                                if ((this->IsModeSet('t')) && (this->GetPrefixValue(u) < HALFOP_VALUE))
                                {
-                                       u->WriteNumeric(482, "%s %s :You must be at least a half-operator to change the topic on this channel", u->nick.c_str(), this->name.c_str());
+                                       u->WriteNumeric(482, "%s %s :You do not have access to change the topic on this channel", u->nick.c_str(), this->name.c_str());
                                        return CMD_FAILURE;
                                }
                        }
@@ -929,14 +929,14 @@ unsigned int Channel::GetPrefixValue(User* user)
        return m->second->getRank();
 }
 
-void Channel::SetPrefix(User* user, char prefix, bool adding)
+bool Channel::SetPrefix(User* user, char prefix, bool adding)
 {
        ModeHandler* delta_mh = ServerInstance->Modes->FindMode(prefix, MODETYPE_CHANNEL);
        if (!delta_mh)
-               return;
+               return false;
        UserMembIter m = userlist.find(user);
        if (m == userlist.end())
-               return;
+               return false;
        for(unsigned int i=0; i < m->second->modes.length(); i++)
        {
                char mchar = m->second->modes[i];
@@ -947,11 +947,12 @@ void Channel::SetPrefix(User* user, char prefix, bool adding)
                                m->second->modes.substr(0,i) +
                                (adding ? std::string(1, prefix) : "") +
                                m->second->modes.substr(mchar == prefix ? i+1 : i);
-                       return;
+                       return adding != (mchar == prefix);
                }
        }
        if (adding)
                m->second->modes += std::string(1, prefix);
+       return adding;
 }
 
 void Channel::RemoveAllPrefixes(User* user)