X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_ircv3_chghost.cpp;h=3c02b20f5721459e537fd3ded7e53d123a950909;hb=HEAD;hp=af3503108a556b58aed417e9981c68dcfe7e22fd;hpb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_ircv3_chghost.cpp b/src/modules/m_ircv3_chghost.cpp index af3503108..3c02b20f5 100644 --- a/src/modules/m_ircv3_chghost.cpp +++ b/src/modules/m_ircv3_chghost.cpp @@ -1,7 +1,8 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2015 Attila Molnar + * Copyright (C) 2017-2019 Sadie Powell + * Copyright (C) 2015, 2018 Attila Molnar * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -24,23 +25,30 @@ class ModuleIRCv3ChgHost : public Module { Cap::Capability cap; + ClientProtocol::EventProvider protoevprov; void DoChgHost(User* user, const std::string& ident, const std::string& host) { - std::string line(1, ':'); - line.append(user->GetFullHost()).append(" CHGHOST ").append(ident).append(1, ' ').append(host); - IRCv3::WriteNeighborsWithCap(user, line, cap); + if (!(user->registered & REG_NICKUSER)) + return; + + ClientProtocol::Message msg("CHGHOST", user); + msg.PushParamRef(ident); + msg.PushParamRef(host); + ClientProtocol::Event protoev(protoevprov, msg); + IRCv3::WriteNeighborsWithCap(user, protoev, cap, true); } public: ModuleIRCv3ChgHost() : cap(this, "chghost") + , protoevprov(this, "CHGHOST") { } void OnChangeIdent(User* user, const std::string& newident) CXX11_OVERRIDE { - DoChgHost(user, newident, user->dhost); + DoChgHost(user, newident, user->GetDisplayedHost()); } void OnChangeHost(User* user, const std::string& newhost) CXX11_OVERRIDE @@ -50,7 +58,7 @@ class ModuleIRCv3ChgHost : public Module Version GetVersion() CXX11_OVERRIDE { - return Version("Provides the chghost IRCv3.2 extension", VF_VENDOR); + return Version("Provides the IRCv3 chghost client capability.", VF_VENDOR); } };