]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_customtitle.cpp
Make rehash work more than once per run, and fix some uninitialized values in connect...
[user/henk/code/inspircd.git] / src / modules / m_customtitle.cpp
index 4cfbeb7151a30b3b7dce1533fb728bacb83b18fa..d2d7e1c5d0998e993b19b64cc4bb8797fb1b89e9 100644 (file)
@@ -3,7 +3,7 @@
  *       +------------------------------------+
  *
  *  InspIRCd: (C) 2002-2009 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
+ * See: http://wiki.inspircd.org/Credits
  *
  * This program is free but copyrighted software; see
  *            the file COPYING for details.
@@ -43,9 +43,6 @@ class CommandTitle : public Command
 
        CmdResult Handle(const std::vector<std::string> &parameters, User* user)
        {
-               if (!IS_LOCAL(user))
-                       return CMD_LOCALONLY;
-
                char TheHost[MAXBUF];
                char TheIP[MAXBUF];
 
@@ -79,22 +76,14 @@ class CommandTitle : public Command
                                if (!vhost.empty())
                                        user->ChangeDisplayedHost(vhost.c_str());
 
-                               if (!ServerInstance->ULine(user->server))
-                                       // Ulines set TITLEs silently
-                                       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.c_str(), title.c_str());
 
-                               return CMD_SUCCESS;
+                               return CMD_LOCALONLY;
                        }
                }
 
-               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.c_str(), user->ident.c_str(), user->host.c_str(), parameters[0].c_str());
-
                user->WriteServ("NOTICE %s :Invalid title credentials",user->nick.c_str());
-               return CMD_SUCCESS;
+               return CMD_LOCALONLY;
        }
 
 };
@@ -191,12 +180,16 @@ class ModuleCustomTitle : public Module
                if ((target_type == TYPE_USER) && (extname == "ctitle"))
                {
                        User* dest = (User*)target;
-                       // if they dont already have an ctitle field, accept the remote server's
                        std::string* text;
-                       if (!dest->GetExt("ctitle", text))
+                       if (dest->GetExt("ctitle", text))
+                       {
+                               dest->Shrink("ctitle");
+                               delete text;
+                       }
+                       if (!extdata.empty())
                        {
-                               std::string* ntext = new std::string(extdata);
-                               dest->Extend("ctitle",ntext);
+                               text = new std::string(extdata);
+                               dest->Extend("ctitle", text);
                        }
                }
        }