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