]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_filter.cpp
034b2f21dd9c971cad3ed46c608f7602b127cd54
[user/henk/code/inspircd.git] / src / modules / m_filter.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *          the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "users.h"
16 #include "channels.h"
17 #include "modules.h"
18 #include "xline.h"
19 #include "m_regex.h"
20
21 /* $ModDesc: Text (spam) filtering */
22
23 static std::string RegexEngine = "";
24 static Module* rxengine = NULL;
25
26 enum FilterFlags
27 {
28         FLAG_PART = 2,
29         FLAG_QUIT = 4,
30         FLAG_PRIVMSG = 8,
31         FLAG_NOTICE = 16
32 };
33
34 class FilterResult : public classbase
35 {
36  public:
37         std::string freeform;
38         std::string reason;
39         std::string action;
40         long gline_time;
41         std::string flags;
42
43         bool flag_no_opers;
44         bool flag_part_message;
45         bool flag_quit_message;
46         bool flag_privmsg;
47         bool flag_notice;
48
49         FilterResult(const std::string free, const std::string &rea, const std::string &act, long gt, const std::string &fla) :
50                         freeform(free), reason(rea), action(act), gline_time(gt), flags(fla)
51         {
52                 this->FillFlags(fla);
53         }
54
55         int FillFlags(const std::string &fl)
56         {
57                 flags = fl;
58                 flag_no_opers = flag_part_message = flag_quit_message = flag_privmsg = flag_notice = false;
59                 size_t x = 0;
60
61                 for (std::string::const_iterator n = flags.begin(); n != flags.end(); ++n, ++x)
62                 {
63                         switch (*n)
64                         {
65                                 case 'o':
66                                         flag_no_opers = true;
67                                 break;
68                                 case 'P':
69                                         flag_part_message = true;
70                                 break;
71                                 case 'q':
72                                         flag_quit_message = true;
73                                 break;
74                                 case 'p':
75                                         flag_privmsg = true;
76                                 break;
77                                 case 'n':
78                                         flag_notice = true;
79                                 break;
80                                 case '*':
81                                         flag_no_opers = flag_part_message = flag_quit_message =
82                                                 flag_privmsg = flag_notice = true;
83                                 break;
84                                 default:
85                                         return x;
86                                 break;
87                         }
88                 }
89                 return 0;
90         }
91
92         FilterResult()
93         {
94         }
95
96         virtual ~FilterResult()
97         {
98         }
99 };
100
101 class CommandFilter;
102
103 class FilterBase : public Module
104 {
105         CommandFilter* filtcommand;
106         int flags;
107 protected:
108         std::vector<std::string> exemptfromfilter; // List of channel names excluded from filtering.
109  public:
110         FilterBase(InspIRCd* Me, const std::string &source);
111         virtual ~FilterBase();
112         virtual int OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
113         virtual FilterResult* FilterMatch(User* user, const std::string &text, int flags) = 0;
114         virtual bool DeleteFilter(const std::string &freeform) = 0;
115         virtual void SyncFilters(Module* proto, void* opaque) = 0;
116         virtual void SendFilter(Module* proto, void* opaque, FilterResult* iter);
117         virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration, const std::string &flags) = 0;
118         virtual int OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
119         virtual void OnRehash(User* user, const std::string &parameter);
120         virtual Version GetVersion();
121         std::string EncodeFilter(FilterResult* filter);
122         FilterResult DecodeFilter(const std::string &data);
123         virtual void OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable = false);
124         virtual void OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata);
125         virtual int OnStats(char symbol, User* user, string_list &results) = 0;
126         virtual int OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line);
127         bool AppliesToMe(User* user, FilterResult* filter, int flags);
128         void OnLoadModule(Module* mod, const std::string& name);
129 };
130
131 class CommandFilter : public Command
132 {
133         FilterBase* Base;
134  public:
135         CommandFilter(FilterBase* f, InspIRCd* Me, const std::string &ssource) : Command(Me, "FILTER", "o", 1), Base(f)
136         {
137                 this->source = ssource;
138                 this->syntax = "<filter-definition> <type> <flags> [<gline-duration>] :<reason>";
139         }
140
141         CmdResult Handle(const std::vector<std::string> &parameters, User *user)
142         {
143                 if (parameters.size() == 1)
144                 {
145                         /* Deleting a filter */
146                         if (Base->DeleteFilter(parameters[0]))
147                         {
148                                 user->WriteServ("NOTICE %s :*** Deleted filter '%s'", user->nick.c_str(), parameters[0].c_str());
149                                 return CMD_SUCCESS;
150                         }
151                         else
152                         {
153                                 user->WriteServ("NOTICE %s :*** Filter '%s' not found on list.", user->nick.c_str(), parameters[0].c_str());
154                                 return CMD_FAILURE;
155                         }
156                 }
157                 else
158                 {
159                         /* Adding a filter */
160                         if (parameters.size() >= 4)
161                         {
162                                 std::string freeform = parameters[0];
163                                 std::string type = parameters[1];
164                                 std::string flags = parameters[2];
165                                 std::string reason;
166                                 long duration = 0;
167
168
169                                 if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill") && (type != "silent"))
170                                 {
171                                         user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', 'silent' and 'kill'.", user->nick.c_str(), freeform.c_str());
172                                         return CMD_FAILURE;
173                                 }
174
175                                 if (type == "gline")
176                                 {
177                                         if (parameters.size() >= 5)
178                                         {
179                                                 duration = ServerInstance->Duration(parameters[3]);
180                                                 reason = parameters[4];
181                                         }
182                                         else
183                                         {
184                                                 this->TooFewParams(user, " When setting a gline type filter, a gline duration must be specified as the third parameter.");
185                                                 return CMD_FAILURE;
186                                         }
187                                 }
188                                 else
189                                 {
190                                         reason = parameters[3];
191                                 }
192                                 std::pair<bool, std::string> result = Base->AddFilter(freeform, type, reason, duration, flags);
193                                 if (result.first)
194                                 {
195                                         user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(),
196                                                         type.c_str(), (duration ? " duration: " : ""), (duration ? parameters[3].c_str() : ""),
197                                                         flags.c_str(), reason.c_str());
198                                         return CMD_SUCCESS;
199                                 }
200                                 else
201                                 {
202                                         user->WriteServ("NOTICE %s :*** Filter '%s' could not be added: %s", user->nick.c_str(), freeform.c_str(), result.second.c_str());
203                                         return CMD_FAILURE;
204                                 }
205                         }
206                         else
207                         {
208                                 this->TooFewParams(user, ".");
209                                 return CMD_FAILURE;
210                         }
211
212                 }
213         }
214
215         void TooFewParams(User* user, const std::string &extra_text)
216         {
217                 user->WriteServ("NOTICE %s :*** Not enough parameters%s", user->nick.c_str(), extra_text.c_str());
218         }
219 };
220
221 bool FilterBase::AppliesToMe(User* user, FilterResult* filter, int iflags)
222 {
223         if ((filter->flag_no_opers) && IS_OPER(user))
224                 return false;
225         if ((iflags & FLAG_PRIVMSG) && (!filter->flag_privmsg))
226                 return false;
227         if ((iflags & FLAG_NOTICE) && (!filter->flag_notice))
228                 return false;
229         if ((iflags & FLAG_QUIT)   && (!filter->flag_quit_message))
230                 return false;
231         if ((iflags & FLAG_PART)   && (!filter->flag_part_message))
232                 return false;
233         return true;
234 }
235
236 FilterBase::FilterBase(InspIRCd* Me, const std::string &source) : Module(Me)
237 {
238         Me->Modules->UseInterface("RegularExpression");
239         filtcommand = new CommandFilter(this, Me, source);
240         ServerInstance->AddCommand(filtcommand);
241         Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncOtherMetaData, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash, I_OnLoadModule };
242         ServerInstance->Modules->Attach(eventlist, this, 8);
243 }
244
245 FilterBase::~FilterBase()
246 {
247         ServerInstance->Modules->DoneWithInterface("RegularExpression");
248 }
249
250 int FilterBase::OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
251 {
252         flags = FLAG_PRIVMSG;
253         return OnUserPreNotice(user,dest,target_type,text,status,exempt_list);
254 }
255
256 int FilterBase::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
257 {
258         if (!flags)
259                 flags = FLAG_NOTICE;
260
261         /* Leave ulines alone */
262         if ((ServerInstance->ULine(user->server)) || (!IS_LOCAL(user)))
263                 return 0;
264
265         FilterResult* f = this->FilterMatch(user, text, flags);
266         if (f)
267         {
268                 std::string target = "";
269                 if (target_type == TYPE_USER)
270                 {
271                         User* t = (User*)dest;
272                         target = std::string(t->nick);
273                 }
274                 else if (target_type == TYPE_CHANNEL)
275                 {
276                         Channel* t = (Channel*)dest;
277                         target = std::string(t->name);
278                         std::vector<std::string>::iterator i = find(exemptfromfilter.begin(), exemptfromfilter.end(), target);
279                         if (i != exemptfromfilter.end()) return 0;
280                 }
281                 if (f->action == "block")
282                 {       
283                         ServerInstance->SNO->WriteToSnoMask('A', std::string("FILTER: ")+user->nick+" had their message filtered, target was "+target+": "+f->reason);
284                         user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message has been filtered and opers notified: "+f->reason);
285                 }
286                 if (f->action == "silent")
287                 {
288                         user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message has been filtered: "+f->reason);
289                 }
290                 if (f->action == "kill")
291                 {
292                         ServerInstance->Users->QuitUser(user, "Filtered: " + f->reason);
293                 }
294                 if (f->action == "gline")
295                 {
296                         GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString());
297                         if (ServerInstance->XLines->AddLine(gl,NULL))
298                         {
299                                 ServerInstance->XLines->ApplyLines();
300                         }
301                         else
302                                 delete gl;
303                 }
304
305                 ServerInstance->Logs->Log("FILTER",DEFAULT,"FILTER: "+ user->nick + " had their message filtered, target was " + target + ": " + f->reason + " Action: " + f->action);
306                 return 1;
307         }
308         return 0;
309 }
310
311 int FilterBase::OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
312 {
313         flags = 0;
314         if (validated && IS_LOCAL(user))
315         {
316                 std::string checkline;
317                 int replacepoint = 0;
318                 bool parting = false;
319         
320                 if (command == "QUIT")
321                 {
322                         /* QUIT with no reason: nothing to do */
323                         if (parameters.size() < 1)
324                                 return 0;
325
326                         checkline = parameters[0];
327                         replacepoint = 0;
328                         parting = false;
329                         flags = FLAG_QUIT;
330                 }
331                 else if (command == "PART")
332                 {
333                         /* PART with no reason: nothing to do */
334                         if (parameters.size() < 2)
335                                 return 0;
336
337                         std::vector<std::string>::iterator i = find(exemptfromfilter.begin(), exemptfromfilter.end(), parameters[0]);
338                         if (i != exemptfromfilter.end()) return 0;
339                         checkline = parameters[1];
340                         replacepoint = 1;
341                         parting = true;
342                         flags = FLAG_PART;
343                 }
344                 else
345                         /* We're only messing with PART and QUIT */
346                         return 0;
347
348                 FilterResult* f = NULL;
349                 
350                 if (flags)
351                         f = this->FilterMatch(user, checkline, flags);
352
353                 if (!f)
354                         /* PART or QUIT reason doesnt match a filter */
355                         return 0;
356
357                 /* We cant block a part or quit, so instead we change the reason to 'Reason filtered' */
358                 Command* c = ServerInstance->Parser->GetHandler(command);
359                 if (c)
360                 {
361                         std::vector<std::string> params;
362                         for (int item = 0; item < (int)parameters.size(); item++)
363                                 params.push_back(parameters[item]);
364                         params[replacepoint] = "Reason filtered";
365
366                         /* We're blocking, OR theyre quitting and its a KILL action
367                          * (we cant kill someone whos already quitting, so filter them anyway)
368                          */
369                         if ((f->action == "block") || (((!parting) && (f->action == "kill"))) || (f->action == "silent"))
370                         {
371                                 c->Handle(params, user);
372                                 return 1;
373                         }
374                         else
375                         {
376                                 /* Are they parting, if so, kill is applicable */
377                                 if ((parting) && (f->action == "kill"))
378                                 {
379                                         user->WriteServ("NOTICE %s :*** Your PART message was filtered: %s", user->nick.c_str(), f->reason.c_str());
380                                         ServerInstance->Users->QuitUser(user, "Filtered: " + f->reason);
381                                 }
382                                 if (f->action == "gline")
383                                 {
384                                         /* Note: We gline *@IP so that if their host doesnt resolve the gline still applies. */
385                                         GLine* gl = new GLine(ServerInstance, ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName, f->reason.c_str(), "*", user->GetIPString());
386                                         if (ServerInstance->XLines->AddLine(gl,NULL))
387                                         {
388                                                 ServerInstance->XLines->ApplyLines();
389                                         }
390                                         else
391                                                 delete gl;
392                                 }
393                                 return 1;
394                         }
395                 }
396                 return 0;
397         }
398         return 0;
399 }
400
401 void FilterBase::OnRehash(User* user, const std::string &parameter)
402 {
403         ConfigReader* MyConf = new ConfigReader(ServerInstance);
404         std::vector<std::string>().swap(exemptfromfilter);
405         for (int index = 0; index < MyConf->Enumerate("exemptfromfilter"); ++index)
406         {
407                 std::string chan = MyConf->ReadValue("exemptfromfilter", "channel", index);
408                 if (!chan.empty()) {
409                         exemptfromfilter.push_back(chan);
410                 }
411         }
412         std::string newrxengine = MyConf->ReadValue("filteropts", "engine", 0);
413         if (!RegexEngine.empty())
414         {
415                 if (RegexEngine == newrxengine)
416                         return;
417
418                 ServerInstance->SNO->WriteToSnoMask('A', "Dumping all filters due to regex engine change (was '%s', now '%s')", RegexEngine.c_str(), newrxengine.c_str());
419                 //ServerInstance->XLines->DelAll("R");
420         }
421         rxengine = NULL;
422
423         printf("In Rehash\n");
424         RegexEngine = newrxengine;
425         modulelist* ml = ServerInstance->Modules->FindInterface("RegularExpression");
426         if (ml)
427         {
428                 for (modulelist::iterator i = ml->begin(); i != ml->end(); ++i)
429                 {
430                         if (RegexNameRequest(this, *i).Send() == newrxengine)
431                         {
432                                 ServerInstance->SNO->WriteToSnoMask('A', "Filter now using engine '%s'", RegexEngine.c_str());
433                                 rxengine = *i;
434                         }
435                 }
436         }
437         if (!rxengine)
438         {
439                 ServerInstance->SNO->WriteToSnoMask('A', "WARNING: Regex engine '%s' is not loaded - Filter functionality disabled until this is corrected.", RegexEngine.c_str());
440         }
441
442         delete MyConf;
443 }
444
445 void FilterBase::OnLoadModule(Module* mod, const std::string& name)
446 {
447         if (ServerInstance->Modules->ModuleHasInterface(mod, "RegularExpression"))
448         {
449                 std::string rxname = RegexNameRequest(this, mod).Send();
450                 if (rxname == RegexEngine)
451                 {
452                         ServerInstance->SNO->WriteToSnoMask('A', "Filter now using engine '%s'", RegexEngine.c_str());
453                         rxengine = mod;
454                 }
455         }
456 }
457
458
459 Version FilterBase::GetVersion()
460 {
461         return Version("$Id$", VF_VENDOR | VF_COMMON, API_VERSION);
462 }
463
464
465 std::string FilterBase::EncodeFilter(FilterResult* filter)
466 {
467         std::ostringstream stream;
468         std::string x = filter->freeform;
469
470         /* Hax to allow spaces in the freeform without changing the design of the irc protocol */
471         for (std::string::iterator n = x.begin(); n != x.end(); n++)
472                 if (*n == ' ')
473                         *n = '\7';
474
475         stream << x << " " << filter->action << " " << (filter->flags.empty() ? "-" : filter->flags) << " " << filter->gline_time << " :" << filter->reason;
476         return stream.str();
477 }
478
479 FilterResult FilterBase::DecodeFilter(const std::string &data)
480 {
481         FilterResult res;
482         irc::tokenstream tokens(data);
483         tokens.GetToken(res.freeform);
484         tokens.GetToken(res.action);
485         tokens.GetToken(res.flags);
486         if (res.flags == "-")
487                 res.flags = "";
488         res.FillFlags(res.flags);
489         tokens.GetToken(res.gline_time);
490         tokens.GetToken(res.reason);
491
492         /* Hax to allow spaces in the freeform without changing the design of the irc protocol */
493         for (std::string::iterator n = res.freeform.begin(); n != res.freeform.end(); n++)
494                 if (*n == '\7')
495                         *n = ' ';
496
497         return res;
498 }
499
500 void FilterBase::OnSyncOtherMetaData(Module* proto, void* opaque, bool displayable)
501 {
502         this->SyncFilters(proto, opaque);
503 }
504
505 void FilterBase::SendFilter(Module* proto, void* opaque, FilterResult* iter)
506 {
507         proto->ProtoSendMetaData(opaque, TYPE_OTHER, NULL, "filter", EncodeFilter(iter));
508 }
509
510 void FilterBase::OnDecodeMetaData(int target_type, void* target, const std::string &extname, const std::string &extdata)
511 {
512         if ((target_type == TYPE_OTHER) && (extname == "filter"))
513         {
514                 FilterResult data = DecodeFilter(extdata);
515                 this->AddFilter(data.freeform, data.action, data.reason, data.gline_time, data.flags);
516         }
517 }
518
519 class ImplFilter : public FilterResult
520 {
521  public:
522         Regex* regex;
523
524         ImplFilter(Module* mymodule, const std::string &rea, const std::string &act, long glinetime, const std::string &pat, const std::string &flgs)
525                 : FilterResult(pat, rea, act, glinetime, flgs)
526         {
527                 if (!rxengine)
528                         throw ModuleException("Regex module implementing '"+RegexEngine+"' is not loaded!");
529
530                 regex = RegexFactoryRequest(mymodule, rxengine, pat).Create();
531         }
532
533         ImplFilter()
534         {
535                 delete regex;
536         }
537 };
538
539 class ModuleFilter : public FilterBase
540 {
541         std::vector<ImplFilter> filters;
542         const char *error;
543         int erroffset;
544         ImplFilter fr;
545
546  public:
547         ModuleFilter(InspIRCd* Me)
548         : FilterBase(Me, "m_filter.so")
549         {
550                 OnRehash(NULL,"");
551         }
552
553         virtual ~ModuleFilter()
554         {
555         }
556
557         virtual FilterResult* FilterMatch(User* user, const std::string &text, int flgs)
558         {
559                 for (std::vector<ImplFilter>::iterator index = filters.begin(); index != filters.end(); index++)
560                 {
561                         /* Skip ones that dont apply to us */
562
563                         if (!FilterBase::AppliesToMe(user, dynamic_cast<FilterResult*>(&(*index)), flgs))
564                                 continue;
565
566                         if (index->regex->Matches(text))
567                         {
568                                 fr = *index;
569                                 if (index != filters.begin())
570                                 {
571                                         /* Move to head of list for efficiency */
572                                         filters.erase(index);
573                                         filters.insert(filters.begin(), fr);
574                                 }
575                                 return &fr;
576                         }
577                 }
578                 return NULL;
579         }
580
581         virtual bool DeleteFilter(const std::string &freeform)
582         {
583                 for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
584                 {
585                         if (i->freeform == freeform)
586                         {
587                                 filters.erase(i);
588                                 return true;
589                         }
590                 }
591                 return false;
592         }
593
594         virtual void SyncFilters(Module* proto, void* opaque)
595         {
596                 for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
597                 {
598                         this->SendFilter(proto, opaque, &(*i));
599                 }
600         }
601
602         virtual std::pair<bool, std::string> AddFilter(const std::string &freeform, const std::string &type, const std::string &reason, long duration, const std::string &flgs)
603         {
604                 for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
605                 {
606                         if (i->freeform == freeform)
607                         {
608                                 return std::make_pair(false, "Filter already exists");
609                         }
610                 }
611
612                 try
613                 {
614                         filters.push_back(ImplFilter(this, reason, type, duration, freeform, flgs));
615                 }
616                 catch (ModuleException &e)
617                 {
618                         ServerInstance->Logs->Log("m_filter", DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason());
619                         return std::make_pair(false, e.GetReason());
620                 }
621                 return std::make_pair(true, "");
622         }
623
624         virtual void OnRehash(User* user, const std::string &parameter)
625         {
626                 ConfigReader MyConf(ServerInstance);
627
628                 FilterBase::OnRehash(user, parameter);
629
630                 for (int index = 0; index < MyConf.Enumerate("keyword"); index++)
631                 {
632                         this->DeleteFilter(MyConf.ReadValue("keyword", "pattern", index));
633
634                         std::string pattern = MyConf.ReadValue("keyword", "pattern", index);
635                         std::string reason = MyConf.ReadValue("keyword", "reason", index);
636                         std::string action = MyConf.ReadValue("keyword", "action", index);
637                         std::string flgs = MyConf.ReadValue("keyword", "flags", index);
638                         long gline_time = ServerInstance->Duration(MyConf.ReadValue("keyword", "duration", index));
639                         if (action.empty())
640                                 action = "none";
641                         if (flgs.empty())
642                                 flgs = "*";
643
644                         try
645                         {
646                                 filters.push_back(ImplFilter(this, reason, action, gline_time, pattern, flgs));
647                                 ServerInstance->Logs->Log("m_filter",DEFAULT,"Regular expression %s loaded.", pattern.c_str());
648                         }
649                         catch (ModuleException &e)
650                         {
651                                 ServerInstance->Logs->Log("m_filter",DEFAULT,"Error in regular expression '%s': %s", pattern.c_str(), e.GetReason());
652                         }
653                 }
654         }
655
656         virtual int OnStats(char symbol, User* user, string_list &results)
657         {
658                 if (symbol == 's')
659                 {
660                         std::string sn = ServerInstance->Config->ServerName;
661                         for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
662                         {
663                                 results.push_back(sn+" 223 "+user->nick+" :REGEXP:"+i->freeform+" "+i->flags+" "+i->action+" "+ConvToStr(i->gline_time)+" :"+i->reason);
664                         }
665                         for (std::vector<std::string>::iterator i = exemptfromfilter.begin(); i != exemptfromfilter.end(); ++i)
666                         {
667                                 results.push_back(sn+" 223 "+user->nick+" :EXEMPT "+(*i));
668                         }
669                 }
670                 return 0;
671         }
672 };
673
674 MODULE_INIT(ModuleFilter)
675