]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_customtitle.cpp
Forward port r9782: show IP (not unknown) for unauthed connections
[user/henk/code/inspircd.git] / src / modules / m_customtitle.cpp
index 5d0e77ffe4a73c9d2af696a802b10006ef334e98..b7e67b5073da25ad3f1011ce3f5e63a599ae7300 100644 (file)
@@ -35,7 +35,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
     std::string xhost;
     while (hl >> xhost)
     {
-        if (match(host,xhost.c_str()) || match(ip,xhost.c_str(),true))
+        if (match(host, xhost) || match(ip,xhost, true))
         {
             return true;
         }
@@ -43,7 +43,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
     return false;
 }
 
-       CmdResult Handle(const char* const* parameters, int pcnt, User* user)
+       CmdResult Handle(const std::vector<std::string> &parameters, User* user)
        {
                if (!IS_LOCAL(user))
                        return CMD_LOCALONLY;
@@ -51,8 +51,8 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
                char TheHost[MAXBUF];
                char TheIP[MAXBUF];
 
-               snprintf(TheHost,MAXBUF,"%s@%s",user->ident,user->host);
-               snprintf(TheIP, MAXBUF,"%s@%s",user->ident,user->GetIPString());
+               snprintf(TheHost,MAXBUF,"%s@%s",user->ident.c_str(), user->host.c_str());
+               snprintf(TheIP, MAXBUF,"%s@%s",user->ident.c_str(), user->GetIPString());
 
                ConfigReader Conf(ServerInstance);
                for (int i=0; i<Conf.Enumerate("title"); i++)
@@ -64,7 +64,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
                        std::string title = Conf.ReadValue("title", "title", "", i);
                        std::string vhost = Conf.ReadValue("title", "vhost", "", i);
 
-                       if (!strcmp(name.c_str(),parameters[0]) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1], hash.c_str()) && OneOfMatches(TheHost,TheIP,host.c_str()) && !title.empty())
+                       if (!strcmp(name.c_str(),parameters[0].c_str()) && !ServerInstance->PassCompare(user, pass.c_str(), parameters[1].c_str(), hash.c_str()) && OneOfMatches(TheHost,TheIP,host.c_str()) && !title.empty())
                        {
                                std::string* text;
                                user->GetExt("ctitle", text);
@@ -85,9 +85,9 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
 
                                if (!ServerInstance->ULine(user->server))
                                        // Ulines set TITLEs silently
-                                       ServerInstance->SNO->WriteToSnoMask('A', "%s used TITLE to set custom title '%s'",user->nick,title.c_str());
+                                       ServerInstance->SNO->WriteToSnoMask('A', "%s used TITLE to set custom title '%s'",user->nick.c_str(),title.c_str());
 
-                               user->WriteServ("NOTICE %s :Custom title set to '%s'",user->nick, title.c_str());
+                               user->WriteServ("NOTICE %s :Custom title set to '%s'",user->nick.c_str(), title.c_str());
 
                                return CMD_SUCCESS;
                        }
@@ -95,9 +95,9 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
 
                if (!ServerInstance->ULine(user->server))
                        // Ulines also fail TITLEs silently
-                       ServerInstance->SNO->WriteToSnoMask('A', "Failed TITLE attempt by %s!%s@%s using login '%s'",user->nick,user->ident,user->host,parameters[0]);
+                       ServerInstance->SNO->WriteToSnoMask('A', "Failed TITLE attempt by %s!%s@%s using login '%s'", user->nick.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str());
 
-               user->WriteServ("NOTICE %s :Invalid title credentials",user->nick);
+               user->WriteServ("NOTICE %s :Invalid title credentials",user->nick.c_str());
                return CMD_SUCCESS;
        }
 
@@ -129,7 +129,7 @@ class ModuleCustomTitle : public Module
                        dest->GetExt("ctitle", ctitle);
                        if (ctitle)
                        {
-                               ServerInstance->SendWhoisLine(user, dest, 320, "%s %s :%s",user->nick,dest->nick,ctitle->c_str());
+                               ServerInstance->SendWhoisLine(user, dest, 320, "%s %s :%s",user->nick.c_str(), dest->nick.c_str(), ctitle->c_str());
                        }
                }
                /* Dont block anything */