X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_customtitle.cpp;h=b86bf1809182f6e7041c02b8a0b7d86c62e360ea;hb=aa05a6fd4d5c11dc8e8adc469134a2802446fe9f;hp=0153530869e3ac6380b0005f1fc385660de71142;hpb=6c7a3ceb6c674a9af09da955ee0238e9291cf29a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_customtitle.cpp b/src/modules/m_customtitle.cpp index 015353086..b86bf1809 100644 --- a/src/modules/m_customtitle.cpp +++ b/src/modules/m_customtitle.cpp @@ -28,7 +28,7 @@ class CommandTitle : public Command public: StringExtItem ctitle; CommandTitle(Module* Creator) : Command(Creator,"TITLE", 2), - ctitle("ctitle", Creator) + ctitle("ctitle", ExtensionItem::EXT_USER, Creator) { syntax = " "; } @@ -48,7 +48,7 @@ class CommandTitle : public Command 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) && + if (Name == parameters[0] && ServerInstance->PassCompare(user, pass, parameters[1], hash) && InspIRCd::MatchMask(host, userHost, userIP) && !title.empty()) { ctitle.set(user, title); @@ -56,7 +56,7 @@ class CommandTitle : public Command ServerInstance->PI->SendMetaData(user, "ctitle", title); if (!vhost.empty()) - user->ChangeDisplayedHost(vhost.c_str()); + user->ChangeDisplayedHost(vhost); user->WriteNotice("Custom title set to '" + title + "'"); @@ -70,26 +70,28 @@ class CommandTitle : public Command }; -class ModuleCustomTitle : public Module +class ModuleCustomTitle : public Module, public Whois::LineEventListener { CommandTitle cmd; public: - ModuleCustomTitle() : cmd(this) + ModuleCustomTitle() + : Whois::LineEventListener(this) + , cmd(this) { } // :kenny.chatspike.net 320 Brain Azhrarn :is getting paid to play games. - ModResult OnWhoisLine(User* user, User* dest, int &numeric, std::string &text) CXX11_OVERRIDE + ModResult OnWhoisLine(Whois::Context& whois, unsigned int& numeric, std::string& text) CXX11_OVERRIDE { /* We use this and not OnWhois because this triggers for remote, too */ if (numeric == 312) { /* Insert our numeric before 312 */ - const std::string* ctitle = cmd.ctitle.get(dest); + const std::string* ctitle = cmd.ctitle.get(whois.GetTarget()); if (ctitle) { - ServerInstance->SendWhoisLine(user, dest, 320, "%s :%s", dest->nick.c_str(), ctitle->c_str()); + whois.SendLine(320, ":%s", ctitle->c_str()); } } /* Don't block anything */