From 243d781e999bdf557bcca5b673d03e462a897ecd Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Thu, 22 Aug 2013 14:33:17 +0100 Subject: Add login support for ngIRCd This is implemented via the accountname METADATA command --- modules/protocol/ngircd.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'modules/protocol/ngircd.cpp') diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index d32d87a73..9f9464f24 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -109,9 +109,15 @@ class ngIRCdProto : public IRCDProto UplinkSocket::Message(source) << "KICK " << chan->name << " " << user->nick; } - void SendLogin(User *u) anope_override { } + void SendLogin(User *u) anope_override + { + UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :" << u->Account()->display; + } - void SendLogout(User *u) anope_override { } + void SendLogout(User *u) anope_override + { + UplinkSocket::Message(Me) << "METADATA " << u->GetUID() << " accountname :"; + } void SendModeInternal(const MessageSource &source, const Channel *dest, const Anope::string &buf) anope_override { @@ -312,6 +318,7 @@ struct IRCDMessageMetadata : IRCDMessage * params[3] = data * * following commands are supported: + * - "accountname": the account name of a client (can't be empty) * - "host": the hostname of a client (can't be empty) * - "cloakhost" : the cloaked hostname of a client * - "info": info text ("real name") of a client @@ -327,7 +334,13 @@ struct IRCDMessageMetadata : IRCDMessage Log() << "received METADATA for non-existent user " << params[0]; return; } - if (params[1].equals_cs("host")) + if (params[1].equals_cs("accountname")) + { + NickCore *nc = NickCore::Find(params[2]); + if (nc) + u->Login(nc); + } + else if (params[1].equals_cs("host")) { u->SetCloakedHost(params[2]); } -- cgit From 9b59925144f32e1ac953d7812a3dd1444207c437 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Thu, 22 Aug 2013 14:34:20 +0100 Subject: For ngIRCd, on nick change set mode -R --- modules/protocol/ngircd.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/protocol/ngircd.cpp') diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 9f9464f24..6aa36f8a0 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -677,7 +677,7 @@ class ProtongIRCd : public Module void OnUserNickChange(User *u, const Anope::string &) anope_override { - u->RemoveModeInternal(Me, ModeManager::FindUserModeByName("REGISTERED")); + u->RemoveMode(Config->GetClient("NickServ"), "REGISTERED"); } }; -- cgit From 76f5d4b31606312531f013682aec5726d0859ba3 Mon Sep 17 00:00:00 2001 From: "Federico G. Schwindt" Date: Thu, 22 Aug 2013 14:38:35 +0100 Subject: Sort parameters and correct comments --- modules/protocol/ngircd.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'modules/protocol/ngircd.cpp') diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp index 6aa36f8a0..a604792e1 100644 --- a/modules/protocol/ngircd.cpp +++ b/modules/protocol/ngircd.cpp @@ -315,15 +315,15 @@ struct IRCDMessageMetadata : IRCDMessage * * params[0] = nick of the user * params[1] = command - * params[3] = data + * params[2] = data * * following commands are supported: * - "accountname": the account name of a client (can't be empty) + * - "certfp": the certificate fingerprint of a client (can't be empty) + * - "cloakhost" : the cloaked hostname of a client * - "host": the hostname of a client (can't be empty) - * - "cloakhost" : the cloaked hostname of a client * - "info": info text ("real name") of a client * - "user": the user name (ident) of a client (can't be empty) - * - "certfp": the certificate fingerprint of a client */ void Run(MessageSource &source, const std::vector ¶ms) anope_override @@ -340,15 +340,20 @@ struct IRCDMessageMetadata : IRCDMessage if (nc) u->Login(nc); } - else if (params[1].equals_cs("host")) + else if (params[1].equals_cs("certfp")) { - u->SetCloakedHost(params[2]); + u->fingerprint = params[2]; + FOREACH_MOD(OnFingerprint, (u)); } else if (params[1].equals_cs("cloakhost")) { if (!params[2].empty()) u->SetDisplayedHost(params[2]); } + else if (params[1].equals_cs("host")) + { + u->SetCloakedHost(params[2]); + } else if (params[1].equals_cs("info")) { u->SetRealname(params[2]); @@ -357,11 +362,6 @@ struct IRCDMessageMetadata : IRCDMessage { u->SetVIdent(params[2]); } - else if (params[1].equals_cs("certfp")) - { - u->fingerprint = params[2]; - FOREACH_MOD(OnFingerprint, (u)); - } } }; -- cgit