/*
* InspIRCd -- Internet Relay Chat Daemon
*
- * Copyright (C) 2015 Attila Molnar <attilamolnar@hush.com>
+ * Copyright (C) 2017-2019 Sadie Powell <sadie@witchery.services>
+ * Copyright (C) 2015, 2017-2018 Attila Molnar <attilamolnar@hush.com>
*
* 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
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")
{
}
Version GetVersion() CXX11_OVERRIDE
{
- return Version("Provides the chghost IRCv3.2 extension", VF_VENDOR);
+ return Version("Provides the IRCv3 chghost client capability.", VF_VENDOR);
}
};