]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_auditorium.cpp
Fix various rline bugs, implement /stats R, and fix the issue where you get no error...
[user/henk/code/inspircd.git] / src / modules / m_auditorium.cpp
index 0ed4566e84929b6ce7416ca266a144b02d41d138..023cb7adf431f0194aae55111773aaa956cab399 100644 (file)
@@ -26,7 +26,7 @@ class AuditoriumMode : public ModeHandler
                {
                        if (IS_LOCAL(source) && (channel->GetStatus(source) < STATUS_OP))
                        {
-                               source->WriteNumeric(482, "%s %s :Only channel operators may %sset channel mode +u", source->nick, channel->name, adding ? "" : "un");
+                               source->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :Only channel operators may %sset channel mode +u", source->nick.c_str(), channel->name.c_str(), adding ? "" : "un");
                                return MODEACTION_DENY;
                        }
                        else
@@ -67,7 +67,7 @@ class ModuleAuditorium : public Module
                Me->Modules->Attach(eventlist, this, 6);
 
        }
-       
+
        virtual ~ModuleAuditorium()
        {
                ServerInstance->Modes->DelMode(aum);
@@ -83,10 +83,10 @@ class ModuleAuditorium : public Module
 
        virtual Version GetVersion()
        {
-               return Version(1, 2, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION);
+               return Version("$Id$", VF_COMMON | VF_VENDOR, API_VERSION);
        }
 
-        virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick)
+       virtual void OnNamesListItem(User* issuer, User* user, Channel* channel, std::string &prefixes, std::string &nick)
        {
                if (!channel->IsModeSet('u'))
                        return;
@@ -113,31 +113,31 @@ class ModuleAuditorium : public Module
                        return;
                }
        }
-       
+
        virtual void OnUserJoin(User* user, Channel* channel, bool sync, bool &silent)
        {
                if (channel->IsModeSet('u'))
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos joining (but only them of course) */
-                       user->WriteFrom(user, "JOIN %s", channel->name);
+                       user->WriteFrom(user, "JOIN %s", channel->name.c_str());
                        if (ShowOps)
-                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "JOIN %s", channel->name);
+                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "JOIN %s", channel->name.c_str());
                }
        }
 
-       void OnUserPart(User* user, Channel* channel, const std::string &partmessage, bool &silent)
+       void OnUserPart(User* user, Channel* channel, std::string &partmessage, bool &silent)
        {
                if (channel->IsModeSet('u'))
                {
                        silent = true;
                        /* Because we silenced the event, make sure it reaches the user whos leaving (but only them of course) */
-                       user->WriteFrom(user, "PART %s%s%s", channel->name,
+                       user->WriteFrom(user, "PART %s%s%s", channel->name.c_str(),
                                        partmessage.empty() ? "" : " :",
                                        partmessage.empty() ? "" : partmessage.c_str());
                        if (ShowOps)
                        {
-                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "PART %s%s%s", channel->name, partmessage.empty() ? "" : " :",
+                               channel->WriteAllExcept(user, false, channel->GetStatus(user) >= STATUS_OP ? 0 : '@', except_list, "PART %s%s%s", channel->name.c_str(), partmessage.empty() ? "" : " :",
                                                partmessage.empty() ? "" : partmessage.c_str());
                        }
                }
@@ -149,11 +149,11 @@ class ModuleAuditorium : public Module
                {
                        silent = true;
                        /* Send silenced event only to the user being kicked and the user doing the kick */
-                       source->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
+                       source->WriteFrom(source, "KICK %s %s %s", chan->name.c_str(), user->nick.c_str(), reason.c_str());
                        if (ShowOps)
-                               chan->WriteAllExcept(source, false, chan->GetStatus(source) >= STATUS_OP ? 0 : '@', except_list, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
+                               chan->WriteAllExcept(source, false, chan->GetStatus(source) >= STATUS_OP ? 0 : '@', except_list, "KICK %s %s %s", chan->name.c_str(), user->nick.c_str(), reason.c_str());
                        else
-                               user->WriteFrom(source, "KICK %s %s %s", chan->name, user->nick, reason.c_str());
+                               user->WriteFrom(source, "KICK %s %s %s", chan->name.c_str(), user->nick.c_str(), reason.c_str());
                }
        }
 
@@ -161,7 +161,6 @@ class ModuleAuditorium : public Module
        {
                Command* parthandler = ServerInstance->Parser->GetHandler("PART");
                std::vector<std::string> to_leave;
-               const char* parameters[2];
                if (parthandler)
                {
                        for (UCListIter f = user->chans.begin(); f != user->chans.end(); f++)
@@ -172,9 +171,10 @@ class ModuleAuditorium : public Module
                        /* We cant do this neatly in one loop, as we are modifying the map we are iterating */
                        for (std::vector<std::string>::iterator n = to_leave.begin(); n != to_leave.end(); n++)
                        {
-                               parameters[0] = n->c_str();
+                               std::vector<std::string> parameters;
+                               parameters.push_back(*n);
                                /* This triggers our OnUserPart, above, making the PART silent */
-                               parthandler->Handle(parameters, 1, user);
+                               parthandler->Handle(parameters, user);
                        }
                }
        }