]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_filter.cpp
35aca62620ecfd7f41b65536518c2fdde3fa8380
[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, User *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                 if (static_cast<ModuleFilter&>(*creator).DeleteFilter(parameters[0]))
169                 {
170                         user->WriteServ("NOTICE %s :*** Removed filter '%s'", user->nick.c_str(), parameters[0].c_str());
171                         ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'a' : 'A', std::string("FILTER: ")+user->nick+" removed filter '"+parameters[0]+"'");
172                         return CMD_SUCCESS;
173                 }
174                 else
175                 {
176                         user->WriteServ("NOTICE %s :*** Filter '%s' not found in list, try /stats s.", user->nick.c_str(), parameters[0].c_str());
177                         return CMD_FAILURE;
178                 }
179         }
180         else
181         {
182                 /* Adding a filter */
183                 if (parameters.size() >= 4)
184                 {
185                         std::string freeform = parameters[0];
186                         std::string type = parameters[1];
187                         std::string flags = parameters[2];
188                         std::string reason;
189                         long duration = 0;
190
191
192                         if ((type != "gline") && (type != "none") && (type != "block") && (type != "kill") && (type != "silent"))
193                         {
194                                 user->WriteServ("NOTICE %s :*** Invalid filter type '%s'. Supported types are 'gline', 'none', 'block', 'silent' and 'kill'.", user->nick.c_str(), type.c_str());
195                                 return CMD_FAILURE;
196                         }
197
198                         if (type == "gline")
199                         {
200                                 if (parameters.size() >= 5)
201                                 {
202                                         duration = ServerInstance->Duration(parameters[3]);
203                                         reason = parameters[4];
204                                 }
205                                 else
206                                 {
207                                         this->TooFewParams(user, ": When setting a gline type filter, a gline duration must be specified as the third parameter.");
208                                         return CMD_FAILURE;
209                                 }
210                         }
211                         else
212                         {
213                                 reason = parameters[3];
214                         }
215                         std::pair<bool, std::string> result = static_cast<ModuleFilter&>(*creator).AddFilter(freeform, type, reason, duration, flags);
216                         if (result.first)
217                         {
218                                 user->WriteServ("NOTICE %s :*** Added filter '%s', type '%s'%s%s, flags '%s', reason: '%s'", user->nick.c_str(), freeform.c_str(),
219                                                 type.c_str(), (duration ? ", duration " : ""), (duration ? parameters[3].c_str() : ""),
220                                                 flags.c_str(), reason.c_str());
221
222                                 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);
223
224                                 return CMD_SUCCESS;
225                         }
226                         else
227                         {
228                                 user->WriteServ("NOTICE %s :*** Filter '%s' could not be added: %s", user->nick.c_str(), freeform.c_str(), result.second.c_str());
229                                 return CMD_FAILURE;
230                         }
231                 }
232                 else
233                 {
234                         this->TooFewParams(user, ".");
235                         return CMD_FAILURE;
236                 }
237
238         }
239 }
240
241 bool ModuleFilter::AppliesToMe(User* user, FilterResult* filter, int iflags)
242 {
243         if ((filter->flag_no_opers) && IS_OPER(user))
244                 return false;
245         if ((iflags & FLAG_PRIVMSG) && (!filter->flag_privmsg))
246                 return false;
247         if ((iflags & FLAG_NOTICE) && (!filter->flag_notice))
248                 return false;
249         if ((iflags & FLAG_QUIT)   && (!filter->flag_quit_message))
250                 return false;
251         if ((iflags & FLAG_PART)   && (!filter->flag_part_message))
252                 return false;
253         return true;
254 }
255
256 ModuleFilter::ModuleFilter() : filtcommand(this), RegexEngine(this, "regex")
257 {
258 }
259
260 void ModuleFilter::init()
261 {
262         ServerInstance->AddCommand(&filtcommand);
263         Implementation eventlist[] = { I_OnPreCommand, I_OnStats, I_OnSyncNetwork, I_OnDecodeMetaData, I_OnUserPreMessage, I_OnUserPreNotice, I_OnRehash };
264         ServerInstance->Modules->Attach(eventlist, this, 7);
265         OnRehash(NULL);
266 }
267
268 ModuleFilter::~ModuleFilter()
269 {
270 }
271
272 ModResult ModuleFilter::OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
273 {
274         if (!IS_LOCAL(user))
275                 return MOD_RES_PASSTHRU;
276
277         flags = FLAG_PRIVMSG;
278         return OnUserPreNotice(user,dest,target_type,text,status,exempt_list);
279 }
280
281 ModResult ModuleFilter::OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list)
282 {
283         /* Leave ulines alone */
284         if ((ServerInstance->ULine(user->server)) || (!IS_LOCAL(user)))
285                 return MOD_RES_PASSTHRU;
286
287         if (!flags)
288                 flags = FLAG_NOTICE;
289
290         FilterResult* f = this->FilterMatch(user, text, flags);
291         if (f)
292         {
293                 std::string target = "";
294                 if (target_type == TYPE_USER)
295                 {
296                         User* t = (User*)dest;
297                         target = std::string(t->nick);
298                 }
299                 else if (target_type == TYPE_CHANNEL)
300                 {
301                         Channel* t = (Channel*)dest;
302                         target = std::string(t->name);
303                         std::vector<std::string>::iterator i = find(exemptfromfilter.begin(), exemptfromfilter.end(), target);
304                         if (i != exemptfromfilter.end()) return MOD_RES_PASSTHRU;
305                 }
306                 if (f->action == "block")
307                 {
308                         ServerInstance->SNO->WriteGlobalSno('a', std::string("FILTER: ")+user->nick+" had their message filtered, target was "+target+": "+f->reason);
309                         if (target_type == TYPE_CHANNEL)
310                                 user->WriteNumeric(404, "%s %s :Message to channel blocked and opers notified (%s)",user->nick.c_str(), target.c_str(), f->reason.c_str());
311                         else
312                                 user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message to "+target+" was blocked and opers notified: "+f->reason);
313                 }
314                 if (f->action == "silent")
315                 {
316                         if (target_type == TYPE_CHANNEL)
317                                 user->WriteNumeric(404, "%s %s :Message to channel blocked (%s)",user->nick.c_str(), target.c_str(), f->reason.c_str());
318                         else
319                                 user->WriteServ("NOTICE "+std::string(user->nick)+" :Your message to "+target+" was blocked: "+f->reason);
320                 }
321                 if (f->action == "kill")
322                 {
323                         ServerInstance->Users->QuitUser(user, "Filtered: " + f->reason);
324                 }
325                 if (f->action == "gline")
326                 {
327                         GLine* gl = new GLine(ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), "*", user->GetIPString());
328                         if (ServerInstance->XLines->AddLine(gl,NULL))
329                         {
330                                 ServerInstance->XLines->ApplyLines();
331                         }
332                         else
333                                 delete gl;
334                 }
335
336                 ServerInstance->Logs->Log("FILTER",DEFAULT,"FILTER: "+ user->nick + " had their message filtered, target was " + target + ": " + f->reason + " Action: " + f->action);
337                 return MOD_RES_DENY;
338         }
339         return MOD_RES_PASSTHRU;
340 }
341
342 ModResult ModuleFilter::OnPreCommand(std::string &command, std::vector<std::string> &parameters, User *user, bool validated, const std::string &original_line)
343 {
344         flags = 0;
345         if (validated && IS_LOCAL(user))
346         {
347                 std::string checkline;
348                 int replacepoint = 0;
349                 bool parting = false;
350
351                 if (command == "QUIT")
352                 {
353                         /* QUIT with no reason: nothing to do */
354                         if (parameters.size() < 1)
355                                 return MOD_RES_PASSTHRU;
356
357                         checkline = parameters[0];
358                         replacepoint = 0;
359                         parting = false;
360                         flags = FLAG_QUIT;
361                 }
362                 else if (command == "PART")
363                 {
364                         /* PART with no reason: nothing to do */
365                         if (parameters.size() < 2)
366                                 return MOD_RES_PASSTHRU;
367
368                         std::vector<std::string>::iterator i = find(exemptfromfilter.begin(), exemptfromfilter.end(), parameters[0]);
369                         if (i != exemptfromfilter.end()) return MOD_RES_PASSTHRU;
370                         checkline = parameters[1];
371                         replacepoint = 1;
372                         parting = true;
373                         flags = FLAG_PART;
374                 }
375                 else
376                         /* We're only messing with PART and QUIT */
377                         return MOD_RES_PASSTHRU;
378
379                 FilterResult* f = NULL;
380
381                 if (flags)
382                         f = this->FilterMatch(user, checkline, flags);
383
384                 if (!f)
385                         /* PART or QUIT reason doesnt match a filter */
386                         return MOD_RES_PASSTHRU;
387
388                 /* We cant block a part or quit, so instead we change the reason to 'Reason filtered' */
389                 Command* c = ServerInstance->Parser->GetHandler(command);
390                 if (c)
391                 {
392                         std::vector<std::string> params;
393                         for (int item = 0; item < (int)parameters.size(); item++)
394                                 params.push_back(parameters[item]);
395                         params[replacepoint] = "Reason filtered";
396
397                         /* We're blocking, OR theyre quitting and its a KILL action
398                          * (we cant kill someone whos already quitting, so filter them anyway)
399                          */
400                         if ((f->action == "block") || (((!parting) && (f->action == "kill"))) || (f->action == "silent"))
401                         {
402                                 c->Handle(params, user);
403                                 return MOD_RES_DENY;
404                         }
405                         else
406                         {
407                                 /* Are they parting, if so, kill is applicable */
408                                 if ((parting) && (f->action == "kill"))
409                                 {
410                                         user->WriteServ("NOTICE %s :*** Your PART message was filtered: %s", user->nick.c_str(), f->reason.c_str());
411                                         ServerInstance->Users->QuitUser(user, "Filtered: " + f->reason);
412                                 }
413                                 if (f->action == "gline")
414                                 {
415                                         /* Note: We gline *@IP so that if their host doesnt resolve the gline still applies. */
416                                         GLine* gl = new GLine(ServerInstance->Time(), f->gline_time, ServerInstance->Config->ServerName.c_str(), f->reason.c_str(), "*", user->GetIPString());
417                                         if (ServerInstance->XLines->AddLine(gl,NULL))
418                                         {
419                                                 ServerInstance->XLines->ApplyLines();
420                                         }
421                                         else
422                                                 delete gl;
423                                 }
424                                 return MOD_RES_DENY;
425                         }
426                 }
427                 return MOD_RES_PASSTHRU;
428         }
429         return MOD_RES_PASSTHRU;
430 }
431
432 void ModuleFilter::OnRehash(User* user)
433 {
434         ConfigReader MyConf;
435         std::vector<std::string>().swap(exemptfromfilter);
436         for (int index = 0; index < MyConf.Enumerate("exemptfromfilter"); ++index)
437         {
438                 std::string chan = MyConf.ReadValue("exemptfromfilter", "channel", index);
439                 if (!chan.empty()) {
440                         exemptfromfilter.push_back(chan);
441                 }
442         }
443         std::string newrxengine = "regex/" + MyConf.ReadValue("filteropts", "engine", 0);
444         if (newrxengine == "regex/")
445                 newrxengine = "regex";
446         if (RegexEngine.GetProvider() == newrxengine)
447                 return;
448
449         //ServerInstance->SNO->WriteGlobalSno('a', "Dumping all filters due to regex engine change (was '%s', now '%s')", RegexEngine.GetProvider().c_str(), newrxengine.c_str());
450         //ServerInstance->XLines->DelAll("R");
451
452         RegexEngine.SetProvider(newrxengine);
453         if (!RegexEngine)
454         {
455                 ServerInstance->SNO->WriteGlobalSno('a', "WARNING: Regex engine '%s' is not loaded - Filter functionality disabled until this is corrected.", newrxengine.c_str());
456         }
457         ReadFilters(MyConf);
458 }
459
460 Version ModuleFilter::GetVersion()
461 {
462         return Version("Text (spam) filtering", VF_VENDOR | VF_COMMON, RegexEngine ? RegexEngine->name : "");
463 }
464
465
466 std::string ModuleFilter::EncodeFilter(FilterResult* filter)
467 {
468         std::ostringstream stream;
469         std::string x = filter->freeform;
470
471         /* Hax to allow spaces in the freeform without changing the design of the irc protocol */
472         for (std::string::iterator n = x.begin(); n != x.end(); n++)
473                 if (*n == ' ')
474                         *n = '\7';
475
476         stream << x << " " << filter->action << " " << (filter->flags.empty() ? "-" : filter->flags) << " " << filter->gline_time << " :" << filter->reason;
477         return stream.str();
478 }
479
480 FilterResult ModuleFilter::DecodeFilter(const std::string &data)
481 {
482         FilterResult res;
483         irc::tokenstream tokens(data);
484         tokens.GetToken(res.freeform);
485         tokens.GetToken(res.action);
486         tokens.GetToken(res.flags);
487         if (res.flags == "-")
488                 res.flags = "";
489         res.FillFlags(res.flags);
490         tokens.GetToken(res.gline_time);
491         tokens.GetToken(res.reason);
492
493         /* Hax to allow spaces in the freeform without changing the design of the irc protocol */
494         for (std::string::iterator n = res.freeform.begin(); n != res.freeform.end(); n++)
495                 if (*n == '\7')
496                         *n = ' ';
497
498         return res;
499 }
500
501 void ModuleFilter::OnSyncNetwork(Module* proto, void* opaque)
502 {
503         this->SyncFilters(proto, opaque);
504 }
505
506 void ModuleFilter::SendFilter(Module* proto, void* opaque, FilterResult* iter)
507 {
508         proto->ProtoSendMetaData(opaque, NULL, "filter", EncodeFilter(iter));
509 }
510
511 void ModuleFilter::OnDecodeMetaData(Extensible* target, const std::string &extname, const std::string &extdata)
512 {
513         if ((target == NULL) && (extname == "filter"))
514         {
515                 FilterResult data = DecodeFilter(extdata);
516                 this->AddFilter(data.freeform, data.action, data.reason, data.gline_time, data.flags);
517         }
518 }
519
520 ImplFilter::ImplFilter(ModuleFilter* mymodule, const std::string &rea, const std::string &act, long glinetime, const std::string &pat, const std::string &flgs)
521                 : FilterResult(pat, rea, act, glinetime, flgs)
522 {
523         if (!mymodule->RegexEngine)
524                 throw ModuleException("Regex module implementing '"+mymodule->RegexEngine.GetProvider()+"' is not loaded!");
525         regex = mymodule->RegexEngine->Create(pat);
526 }
527
528 FilterResult* ModuleFilter::FilterMatch(User* user, const std::string &text, int flgs)
529 {
530         for (std::vector<ImplFilter>::iterator index = filters.begin(); index != filters.end(); index++)
531         {
532                 /* Skip ones that dont apply to us */
533                 if (!AppliesToMe(user, dynamic_cast<FilterResult*>(&(*index)), flgs))
534                         continue;
535
536                 //ServerInstance->Logs->Log("m_filter", DEBUG, "Match '%s' against '%s'", text.c_str(), index->freeform.c_str());
537                 if (index->regex->Matches(text))
538                 {
539                         //ServerInstance->Logs->Log("m_filter", DEBUG, "MATCH");
540                         ImplFilter fr = *index;
541                         if (index != filters.begin())
542                         {
543                                 /* Move to head of list for efficiency */
544                                 filters.erase(index);
545                                 filters.insert(filters.begin(), fr);
546                         }
547                         return &*filters.begin();
548                 }
549                 //ServerInstance->Logs->Log("m_filter", DEBUG, "NO MATCH");
550         }
551         return NULL;
552 }
553
554 bool ModuleFilter::DeleteFilter(const std::string &freeform)
555 {
556         for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
557         {
558                 if (i->freeform == freeform)
559                 {
560                         delete i->regex;
561                         filters.erase(i);
562                         return true;
563                 }
564         }
565         return false;
566 }
567
568 void ModuleFilter::SyncFilters(Module* proto, void* opaque)
569 {
570         for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
571         {
572                 this->SendFilter(proto, opaque, &(*i));
573         }
574 }
575
576 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)
577 {
578         for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
579         {
580                 if (i->freeform == freeform)
581                 {
582                         return std::make_pair(false, "Filter already exists");
583                 }
584         }
585
586         try
587         {
588                 filters.push_back(ImplFilter(this, reason, type, duration, freeform, flgs));
589         }
590         catch (ModuleException &e)
591         {
592                 ServerInstance->Logs->Log("m_filter", DEFAULT, "Error in regular expression '%s': %s", freeform.c_str(), e.GetReason());
593                 return std::make_pair(false, e.GetReason());
594         }
595         return std::make_pair(true, "");
596 }
597
598 void ModuleFilter::ReadFilters(ConfigReader &MyConf)
599 {
600         for (int index = 0; index < MyConf.Enumerate("keyword"); index++)
601         {
602                 this->DeleteFilter(MyConf.ReadValue("keyword", "pattern", index));
603
604                 std::string pattern = MyConf.ReadValue("keyword", "pattern", index);
605                 std::string reason = MyConf.ReadValue("keyword", "reason", index);
606                 std::string action = MyConf.ReadValue("keyword", "action", index);
607                 std::string flgs = MyConf.ReadValue("keyword", "flags", index);
608                 long gline_time = ServerInstance->Duration(MyConf.ReadValue("keyword", "duration", index));
609                 if (action.empty())
610                         action = "none";
611                 if (flgs.empty())
612                         flgs = "*";
613
614                 try
615                 {
616                         filters.push_back(ImplFilter(this, reason, action, gline_time, pattern, flgs));
617                         ServerInstance->Logs->Log("m_filter", DEFAULT, "Regular expression %s loaded.", pattern.c_str());
618                 }
619                 catch (ModuleException &e)
620                 {
621                         ServerInstance->Logs->Log("m_filter", DEFAULT, "Error in regular expression '%s': %s", pattern.c_str(), e.GetReason());
622                 }
623         }
624 }
625
626 ModResult ModuleFilter::OnStats(char symbol, User* user, string_list &results)
627 {
628         if (symbol == 's')
629         {
630                 std::string sn = ServerInstance->Config->ServerName;
631                 for (std::vector<ImplFilter>::iterator i = filters.begin(); i != filters.end(); i++)
632                 {
633                         results.push_back(sn+" 223 "+user->nick+" :"+RegexEngine.GetProvider()+":"+i->freeform+" "+i->flags+" "+i->action+" "+ConvToStr(i->gline_time)+" :"+i->reason);
634                 }
635                 for (std::vector<std::string>::iterator i = exemptfromfilter.begin(); i != exemptfromfilter.end(); ++i)
636                 {
637                         results.push_back(sn+" 223 "+user->nick+" :EXEMPT "+(*i));
638                 }
639         }
640         return MOD_RES_PASSTHRU;
641 }
642
643 MODULE_INIT(ModuleFilter)