X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_customtitle.cpp;h=da28ea8af0bcc463bc558833752b49ea6e1181a2;hb=b669f920eaa9fb795d0a103d724943898a0df4b2;hp=57b525e42ac25f688cc8cb59293c321801a05606;hpb=51a377d4dec9f3f50a9d54eaa1bf81bb38b4a6b1;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 57b525e42..da28ea8af 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -12,23 +12,21 @@ */ #include "inspircd.h" -#include "users.h" -#include "channels.h" -#include "modules.h" #include "wildcard.h" /* $ModDesc: Provides the TITLE command which allows setting of CUSTOM WHOIS TITLE line */ /** Handle /TITLE */ -class cmd_title : public command_t +class CommandTitle : public Command { public: - cmd_title (InspIRCd* Instance) : command_t(Instance,"TITLE",0,2) + CommandTitle (InspIRCd* Instance) : Command(Instance,"TITLE",0,2) { this->source = "m_customtitle.so"; syntax = " "; + TRANSLATE3(TR_NICK, TR_TEXT, TR_END); } bool OneOfMatches(const char* host, const char* ip, const char* hostlist) @@ -45,7 +43,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) return false; } - CmdResult Handle(const char** parameters, int pcnt, userrec* user) + CmdResult Handle(const char** parameters, int pcnt, User* user) { if (!IS_LOCAL(user)) return CMD_LOCALONLY; @@ -73,7 +71,7 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) if (text) { user->Shrink("ctitle"); - DELETE(text); + delete text; } text = new std::string(title); @@ -112,13 +110,13 @@ bool OneOfMatches(const char* host, const char* ip, const char* hostlist) class ModuleCustomTitle : public Module { - cmd_title* mycommand; + CommandTitle* mycommand; public: ModuleCustomTitle(InspIRCd* Me) : Module(Me) { - mycommand = new cmd_title(ServerInstance); + mycommand = new CommandTitle(ServerInstance); ServerInstance->AddCommand(mycommand); } @@ -128,7 +126,7 @@ class ModuleCustomTitle : public Module } // :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games. - int OnWhoisLine(userrec* user, userrec* dest, int &numeric, std::string &text) + int OnWhoisLine(User* user, User* dest, int &numeric, std::string &text) { /* We use this and not OnWhois because this triggers for remote, too */ if (numeric == 312) @@ -146,11 +144,11 @@ class ModuleCustomTitle : public Module } // Whenever the linking module wants to send out data, but doesnt know what the data - // represents (e.g. it is metadata, added to a userrec or chanrec by a module) then + // represents (e.g. it is metadata, added to a User or Channel by a module) then // this method is called. We should use the ProtoSendMetaData function after we've // corrected decided how the data should look, to send the metadata on its way if // it is ours. - virtual void OnSyncUserMetaData(userrec* user, Module* proto, void* opaque, const std::string &extname, bool displayable) + virtual void OnSyncUserMetaData(User* user, Module* proto, void* opaque, const std::string &extname, bool displayable) { // check if the linking module wants to know about OUR metadata if (extname == "ctitle") @@ -168,14 +166,14 @@ class ModuleCustomTitle : public Module } // when a user quits, tidy up their metadata - virtual void OnUserQuit(userrec* user, const std::string &message, const std::string &oper_message) + virtual void OnUserQuit(User* user, const std::string &message, const std::string &oper_message) { std::string* ctitle; user->GetExt("ctitle", ctitle); if (ctitle) { user->Shrink("ctitle"); - DELETE(ctitle); + delete ctitle; } } @@ -184,13 +182,13 @@ class ModuleCustomTitle : public Module { if (target_type == TYPE_USER) { - userrec* user = (userrec*)item; + User* user = (User*)item; std::string* ctitle; user->GetExt("ctitle", ctitle); if (ctitle) { user->Shrink("ctitle"); - DELETE(ctitle); + delete ctitle; } } } @@ -207,7 +205,7 @@ class ModuleCustomTitle : public Module // check if its our metadata key, and its associated with a user if ((target_type == TYPE_USER) && (extname == "ctitle")) { - userrec* dest = (userrec*)target; + 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)) @@ -224,7 +222,7 @@ class ModuleCustomTitle : public Module virtual Version GetVersion() { - return Version(1,1,0,0,VF_VENDOR,API_VERSION); + return Version(1, 1, 0, 0, VF_COMMON | VF_VENDOR, API_VERSION); } };