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