summaryrefslogtreecommitdiff
path: root/modules/protocol/ngircd.cpp
diff options
context:
space:
mode:
authorFederico G. Schwindt <fgsch@lodoss.net>2013-08-22 14:33:17 +0100
committerFederico G. Schwindt <fgsch@lodoss.net>2013-08-24 17:56:46 +0100
commit243d781e999bdf557bcca5b673d03e462a897ecd (patch)
treef164eae0cb1151ba88a8c695d623c00415c5e3fd /modules/protocol/ngircd.cpp
parent8be5f53f1fde1ea84a9f2a6669d78756f4f3ee5a (diff)
Add login support for ngIRCd
This is implemented via the accountname METADATA command
Diffstat (limited to 'modules/protocol/ngircd.cpp')
-rw-r--r--modules/protocol/ngircd.cpp19
1 files changed, 16 insertions, 3 deletions
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]);
}