- virtual int OnExtendedMode(userrec* user, void* target, char modechar, int type, bool mode_on, string_list ¶ms)
- {
- if ((modechar == 'g') && (type == MT_CHANNEL))
- {
- chanrec* chan = (chanrec*)target;
-
- irc::string word = params[0].c_str();
-
- if (word == "")
- return -1;
-
- if (mode_on)
- {
- SpamList* spamlist = (SpamList*)chan->GetExt("spam_list");
- if (!spamlist)
- {
- spamlist = new SpamList;
- chan->Extend("spam_list",(char*)spamlist);
- }
- if (spamlist->size() < (unsigned)MaxEntries)
- {
- if (word.length() > 35)
- {
- WriteServ(user->fd,"935 %s %s %s :word is too long for censor list",user->nick, chan->name,word.c_str());
- return -1;
- }
- for (SpamList::iterator i = spamlist->begin(); i != spamlist->end(); i++)
- {
- if (*i == word)
- {
- WriteServ(user->fd,"937 %s %s :The word %s is already on the spamfilter list",user->nick, chan->name,word.c_str());
- return -1;
- }
- }
- spamlist->push_back(word);
- return 1;
- }
- WriteServ(user->fd,"939 %s %s :Channel spamfilter list is full",user->nick, chan->name);
- return -1;
- }
- else
- {
- SpamList* spamlist = (SpamList*)chan->GetExt("spam_list");
- if (spamlist)
- {
- for (SpamList::iterator i = spamlist->begin(); i != spamlist->end(); i++)
- {
- if (*i == word)
- {
- spamlist->erase(i);
- return 1;
- }
- }
- }
- WriteServ(user->fd,"938 %s %s :No such spamfilter word is set",user->nick, chan->name);
- return -1;
- }
- return -1;
- }
- return 0;
- }
-
- virtual void OnSendList(userrec* user, chanrec* channel, char mode)