]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_gecosban.cpp
Add method for writing server notices.
[user/henk/code/inspircd.git] / src / modules / m_gecosban.cpp
index e7eca6d8fd20a7ac4a8f6561ef4fda7e8c7992e0..b33362a8df281f1905256df66f026b981bd5e0b7 100644 (file)
 class ModuleGecosBan : public Module
 {
  public:
-       ModuleGecosBan()
+       void init()
        {
                Implementation eventlist[] = { I_OnCheckBan, I_On005Numeric };
-               ServerInstance->Modules->Attach(eventlist, this, 2);
-       }
-
-       ~ModuleGecosBan()
-       {
+               ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation));
        }
 
        Version GetVersion()
@@ -41,7 +37,7 @@ class ModuleGecosBan : public Module
 
        ModResult OnCheckBan(User *user, Channel *c, const std::string& mask)
        {
-               if (mask[0] == 'r' && mask[1] == ':')
+               if ((mask.length() > 2) && (mask[0] == 'r') && (mask[1] == ':'))
                {
                        if (InspIRCd::Match(user->fullname, mask.substr(2)))
                                return MOD_RES_DENY;
@@ -49,9 +45,9 @@ class ModuleGecosBan : public Module
                return MOD_RES_PASSTHRU;
        }
 
-       void On005Numeric(std::string &output)
+       void On005Numeric(std::map<std::string, std::string>& tokens)
        {
-               ServerInstance->AddExtBanChar('r');
+               tokens["EXTBAN"].push_back('r');
        }
 };