X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_silence.cpp;h=c423506a0c5338aebf68c8b2198b6acaa15772ef;hb=d70ae11ab22d10e40cae525ff28022e596a7c6f0;hp=3ac1719e9695e92e3c27f6920c7b23878f006173;hpb=1e1e483f9199bb8745aa7a5613305bc9bd3294bf;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 3ac1719e9..c423506a0 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -14,12 +14,16 @@ * --------------------------------------------------- */ +using namespace std; + #include #include #include #include "users.h" #include "channels.h" #include "modules.h" +#include "helperfuncs.h" +#include "hashcomp.h" /* $ModDesc: Provides support for the /SILENCE command */ @@ -65,7 +69,9 @@ void handle_silence(char **parameters, int pcnt, userrec *user) for (silencelist::iterator i = sl->begin(); i != sl->end(); i++) { // search through for the item - if (!strcasecmp(i->c_str(),nick)) + irc::string listitem = i->c_str(); + irc::string target = nick; + if (listitem == target) { sl->erase(i); WriteServ(user->fd,"950 %s %s :Removed %s!*@* from silence list",user->nick, user->nick,nick); @@ -95,6 +101,16 @@ void handle_silence(char **parameters, int pcnt, userrec *user) user->Extend(std::string("silence_list"),(char*)sl); } // add the nick to it -- silence only takes nicks for some reason even though its list shows masks + for (silencelist::iterator n = sl->begin(); n != sl->end(); n++) + { + irc::string listitem = n->c_str(); + irc::string target = nick; + if (listitem == target) + { + WriteServ(user->fd,"952 %s %s :%s is already on your silence list",user->nick, user->nick,nick); + return; + } + } sl->push_back(std::string(nick)); WriteServ(user->fd,"951 %s %s :Added %s!*@* to silence list",user->nick, user->nick,nick); return; @@ -112,7 +128,7 @@ class ModuleSilence : public Module ModuleSilence() { Srv = new Server; - Srv->AddCommand("SILENCE",handle_silence,0,0); + Srv->AddCommand("SILENCE",handle_silence,0,0,"m_silence.so"); } virtual void OnUserQuit(userrec* user) @@ -126,6 +142,12 @@ class ModuleSilence : public Module user->Shrink("silence_list"); } } + + virtual void On005Numeric(std::string &output) + { + // we don't really have a limit... + output = output + " SILENCE=999"; + } virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string &text) { @@ -141,7 +163,9 @@ class ModuleSilence : public Module { for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++) { - if (!strcasecmp(c->c_str(),user->nick)) + irc::string listitem = c->c_str(); + irc::string target = user->nick; + if (listitem == target) { return 1; } @@ -161,7 +185,9 @@ class ModuleSilence : public Module { for (silencelist::const_iterator c = sl->begin(); c != sl->end(); c++) { - if (!strcasecmp(c->c_str(),user->nick)) + irc::string listitem = c->c_str(); + irc::string target = user->nick; + if (listitem == target) { return 1; } @@ -178,7 +204,7 @@ class ModuleSilence : public Module virtual Version GetVersion() { - return Version(1,0,0,0); + return Version(1,0,0,1,VF_VENDOR); } };