m_setname.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include "inspircd.h"
00015
00016
00017
00018
00019
00020 class CommandSetname : public Command
00021 {
00022 public:
00023 CommandSetname (InspIRCd* Instance) : Command(Instance,"SETNAME", 0, 1, 1)
00024 {
00025 this->source = "m_setname.so";
00026 syntax = "<new-gecos>";
00027 TRANSLATE2(TR_TEXT, TR_END);
00028 }
00029
00030 CmdResult Handle (const std::vector<std::string>& parameters, User *user)
00031 {
00032 if (parameters.size() == 0)
00033 {
00034 user->WriteServ("NOTICE %s :*** SETNAME: GECOS must be specified", user->nick.c_str());
00035 return CMD_FAILURE;
00036 }
00037
00038 if (parameters[0].size() > ServerInstance->Config->Limits.MaxGecos)
00039 {
00040 user->WriteServ("NOTICE %s :*** SETNAME: GECOS too long", user->nick.c_str());
00041 return CMD_FAILURE;
00042 }
00043
00044 if (user->ChangeName(parameters[0].c_str()))
00045 {
00046 ServerInstance->SNO->WriteToSnoMask('A', "%s used SETNAME to change their GECOS to %s", user->nick.c_str(), parameters[0].c_str());
00047 return CMD_SUCCESS;
00048 }
00049
00050 return CMD_SUCCESS;
00051 }
00052 };
00053
00054
00055 class ModuleSetName : public Module
00056 {
00057 CommandSetname* mycommand;
00058 public:
00059 ModuleSetName(InspIRCd* Me)
00060 : Module(Me)
00061 {
00062
00063 mycommand = new CommandSetname(ServerInstance);
00064 ServerInstance->AddCommand(mycommand);
00065
00066 }
00067
00068 virtual ~ModuleSetName()
00069 {
00070 }
00071
00072 virtual Version GetVersion()
00073 {
00074 return Version("$Id: m_setname.cpp 10718 2008-10-25 16:41:13Z w00t $", VF_COMMON | VF_VENDOR, API_VERSION);
00075 }
00076
00077 };
00078
00079 MODULE_INIT(ModuleSetName)