diff options
author | Adam <Adam@anope.org> | 2016-12-17 21:44:22 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-12-17 21:44:22 -0500 |
commit | 4fcbbbe4fbc137841b47c8e2372477b85649270a (patch) | |
tree | f2a5fd3b5a77ef0384df6e2712fdd74f832d7dfe /src/users.cpp | |
parent | ed08d1a31119adb379f8bec46d7ad47ee35c4c92 (diff) |
Split ircdproto send functions out into separate services
This makes it easier to see which send functions a protocol module
implements as they are all explicitly registered by the module, and
avoids the problem of subtly breaking other protocol modules when
using inheritance.
Also split the old "core" send implementations out into a module, and
the TS6 ID generator
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/users.cpp b/src/users.cpp index 33a4cdaf6..a9bb432b5 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -30,6 +30,7 @@ #include "sockets.h" #include "uplink.h" #include "event.h" +#include "messages.h" #include "modules/nickserv.h" user_map UserListByNick; @@ -105,7 +106,7 @@ static void CollideKill(User *target, const Anope::string &reason) static void Collide(User *u, const Anope::string &id, const Anope::string &type) { // Kill incoming user - IRCD->SendKill(Me, id, type); + IRCD->Send<messages::Kill>(Me, id, Me->GetName() + " (" + type + ")"); // Quit colliding user CollideKill(u, type); } @@ -383,7 +384,7 @@ void User::Identify(NickServ::Nick *na) na->SetLastSeen(Anope::CurTime); } - IRCD->SendLogin(this, na); + IRCD->Send<messages::Login>(this, na); this->Login(na->GetAccount()); @@ -397,15 +398,12 @@ void User::Identify(NickServ::Nick *na) { this->SetModes(NULL, "%s", m.c_str()); this->SendMessage(Me, "Changing your usermodes to \002{0}\002", m.c_str()); - UserMode *um = ModeManager::FindUserModeByName("OPER"); - if (um && !this->HasMode("OPER") && m.find(um->mchar) != Anope::string::npos) - IRCD->SendOper(this); } if (IRCD->CanSetVHost && !oper->GetVhost().empty()) { this->SendMessage(Me, "Changing your vhost to \002{0}\002", oper->GetVhost()); this->SetDisplayedHost(oper->GetVhost()); - IRCD->SendVhost(this, "", oper->GetVhost()); + IRCD->Send<messages::VhostSet>(this, "", oper->GetVhost()); } } } @@ -571,15 +569,12 @@ void User::SetModeInternal(const MessageSource &source, UserMode *um, const Anop { this->SetModes(NULL, "%s", m.c_str()); this->SendMessage(Me, "Changing your usermodes to \002{0}\002", m); - UserMode *oper = ModeManager::FindUserModeByName("OPER"); - if (oper && !this->HasMode("OPER") && m.find(oper->mchar) != Anope::string::npos) - IRCD->SendOper(this); } if (IRCD->CanSetVHost && !oper->GetVhost().empty()) { this->SendMessage(Me, "Changing your vhost to \002{0}\002", oper->GetVhost()); this->SetDisplayedHost(oper->GetVhost()); - IRCD->SendVhost(this, "", oper->GetVhost()); + IRCD->Send<messages::VhostSet>(this, "", oper->GetVhost()); } } } @@ -769,7 +764,7 @@ void User::Kill(const MessageSource &source, const Anope::string &reason) { Anope::string real_reason = source.GetName() + " (" + reason + ")"; - IRCD->SendSVSKill(source, this, real_reason); + IRCD->SendKill(source, this, real_reason); } void User::KillInternal(const MessageSource &source, const Anope::string &reason) @@ -853,7 +848,7 @@ bool User::BadPassword() User* User::Find(const Anope::string &name, bool nick_only) { - if (!nick_only && IRCD->RequiresID) + if (!nick_only && IRCD && IRCD->RequiresID) { uid_map::iterator it = UserListByUID.find(name); if (it != UserListByUID.end()) |