]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_customtitle.cpp
Update wiki links to use HTTPS and point to the correct pages.
[user/henk/code/inspircd.git] / src / modules / m_customtitle.cpp
index fd5ec6f0955f065883c2172905d1353c525fccc2..c65645bc9209426d0382f3e81cfdc2725daca441 100644 (file)
@@ -33,7 +33,6 @@ class CommandTitle : public Command
                ctitle("ctitle", Creator)
        {
                syntax = "<user> <password>";
-               TRANSLATE3(TR_NICK, TR_TEXT, TR_END);
        }
 
        bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
@@ -58,17 +57,17 @@ class CommandTitle : public Command
                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;
-               for (int i=0; i<Conf.Enumerate("title"); i++)
+               ConfigTagList tags = ServerInstance->Config->ConfTags("title");
+               for (ConfigIter i = tags.first; i != tags.second; ++i)
                {
-                       std::string Name = Conf.ReadValue("title", "name", "", i);
-                       std::string pass = Conf.ReadValue("title", "password", "", i);
-                       std::string hash = Conf.ReadValue("title", "hash", "", i);
-                       std::string host = Conf.ReadValue("title", "host", "*@*", i);
-                       std::string title = Conf.ReadValue("title", "title", "", i);
-                       std::string vhost = Conf.ReadValue("title", "vhost", "", i);
-
-                       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 Name = i->second->getString("name");
+                       std::string pass = i->second->getString("password");
+                       std::string hash = i->second->getString("hash");
+                       std::string host = i->second->getString("host", "*@*");
+                       std::string title = i->second->getString("title");
+                       std::string vhost = i->second->getString("vhost");
+
+                       if (Name == parameters[0] && !ServerInstance->PassCompare(user, pass, parameters[1], hash) && OneOfMatches(TheHost,TheIP,host.c_str()) && !title.empty())
                        {
                                ctitle.set(user, title);
 
@@ -96,8 +95,12 @@ class ModuleCustomTitle : public Module
  public:
        ModuleCustomTitle() : cmd(this)
        {
-               ServerInstance->AddCommand(&cmd);
-               ServerInstance->Extensions.Register(&cmd.ctitle);
+       }
+
+       void init()
+       {
+               ServerInstance->Modules->AddService(cmd);
+               ServerInstance->Modules->AddService(cmd.ctitle);
                ServerInstance->Modules->Attach(I_OnWhoisLine, this);
        }