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