]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_chgname.cpp
'svn propset -R svn:eol-style CR *' Set to UNIX-style always. Binaries are auto skipp...
[user/henk/code/inspircd.git] / src / modules / m_chgname.cpp
index a4a31714b1bf367ee25f41b92e75d90b06f0ce1d..0bf9004dd981e4f145c8d1521328f06bf0f5d2a3 100644 (file)
@@ -1,89 +1 @@
-/*       +------------------------------------+
- *       | Inspire Internet Relay Chat Daemon |
- *       +------------------------------------+
- *
- *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
- * See: http://www.inspircd.org/wiki/index.php/Credits
- *
- * This program is free but copyrighted software; see
- *            the file COPYING for details.
- *
- * ---------------------------------------------------
- */
-
-#include "inspircd.h"
-#include "users.h"
-#include "modules.h"
-
-/* $ModDesc: Provides support for the CHGNAME command */
-
-/** Handle /CHGNAME
- */
-class cmd_chgname : public command_t
-{
- public:
-       cmd_chgname (InspIRCd* Instance) : command_t(Instance,"CHGNAME", 'o', 2)
-       {
-               this->source = "m_chgname.so";
-               syntax = "<nick> <newname>";
-       }
-       
-       CmdResult Handle(const char** parameters, int pcnt, userrec *user)
-       {
-               userrec* dest = ServerInstance->FindNick(parameters[0]);
-
-               if (!dest)
-               {
-                       user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);
-                       return CMD_FAILURE;
-               }
-               
-               if (!*parameters[1])
-               {
-                       user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick);
-                       return CMD_FAILURE;
-               }
-               
-               if (strlen(parameters[1]) > MAXGECOS)
-               {
-                       user->WriteServ("NOTICE %s :*** GECOS too long", user->nick);
-                       return CMD_FAILURE;
-               }
-               
-               if (IS_LOCAL(dest))
-               {
-                       dest->ChangeName(parameters[1]);
-                       ServerInstance->WriteOpers("%s used CHGNAME to change %s's real name to '%s'", user->nick, dest->nick, dest->fullname);
-                       return CMD_LOCALONLY; /* name change routed by FNAME in spanningtree now */
-               }
-
-               /* route it! */
-               return CMD_SUCCESS;
-       }
-};
-
-
-class ModuleChgName : public Module
-{
-       cmd_chgname* mycommand;
-       
-       
-public:
-       ModuleChgName(InspIRCd* Me) : Module(Me)
-       {
-               mycommand = new cmd_chgname(ServerInstance);
-               ServerInstance->AddCommand(mycommand);
-       }
-       
-       virtual ~ModuleChgName()
-       {
-       }
-       
-       virtual Version GetVersion()
-       {
-               return Version(1,1,0,0,VF_VENDOR,API_VERSION);
-       }
-       
-};
-
-MODULE_INIT(ModuleChgName)
+/*       +------------------------------------+\r *       | Inspire Internet Relay Chat Daemon |\r *       +------------------------------------+\r *\r *  InspIRCd: (C) 2002-2007 InspIRCd Development Team\r * See: http://www.inspircd.org/wiki/index.php/Credits\r *\r * This program is free but copyrighted software; see\r *            the file COPYING for details.\r *\r * ---------------------------------------------------\r */\r\r#include "inspircd.h"\r#include "users.h"\r#include "modules.h"\r\r/* $ModDesc: Provides support for the CHGNAME command */\r\r/** Handle /CHGNAME\r */\rclass cmd_chgname : public command_t\r{\r public:\r  cmd_chgname (InspIRCd* Instance) : command_t(Instance,"CHGNAME", 'o', 2)\r       {\r              this->source = "m_chgname.so";\r         syntax = "<nick> <newname>";\r   }\r      \r       CmdResult Handle(const char** parameters, int pcnt, userrec *user)\r     {\r              userrec* dest = ServerInstance->FindNick(parameters[0]);\r\r              if (!dest)\r             {\r                      user->WriteServ("401 %s %s :No such nick/channel", user->nick, parameters[0]);\r                 return CMD_FAILURE;\r            }\r              \r               if (!*parameters[1])\r           {\r                      user->WriteServ("NOTICE %s :*** GECOS must be specified", user->nick);\r                 return CMD_FAILURE;\r            }\r              \r               if (strlen(parameters[1]) > MAXGECOS)\r          {\r                      user->WriteServ("NOTICE %s :*** GECOS too long", user->nick);\r                  return CMD_FAILURE;\r            }\r              \r               if (IS_LOCAL(dest))\r            {\r                      dest->ChangeName(parameters[1]);\r                       ServerInstance->WriteOpers("%s used CHGNAME to change %s's real name to '%s'", user->nick, dest->nick, dest->fullname);\r                        return CMD_LOCALONLY; /* name change routed by FNAME in spanningtree now */\r            }\r\r             /* route it! */\r                return CMD_SUCCESS;\r    }\r};\r\r\rclass ModuleChgName : public Module\r{\r   cmd_chgname* mycommand;\r        \r       \rpublic:\r       ModuleChgName(InspIRCd* Me) : Module(Me)\r       {\r              mycommand = new cmd_chgname(ServerInstance);\r           ServerInstance->AddCommand(mycommand);\r }\r      \r       virtual ~ModuleChgName()\r       {\r      }\r      \r       virtual Version GetVersion()\r   {\r              return Version(1,1,0,0,VF_VENDOR,API_VERSION);\r }\r      \r};\r\rMODULE_INIT(ModuleChgName)\r
\ No newline at end of file