summaryrefslogtreecommitdiff
path: root/modules/protocol
diff options
context:
space:
mode:
Diffstat (limited to 'modules/protocol')
-rw-r--r--modules/protocol/bahamut.cpp6
-rw-r--r--modules/protocol/hybrid.cpp5
-rw-r--r--modules/protocol/inspircd20.cpp44
-rw-r--r--modules/protocol/ngircd.cpp27
-rw-r--r--modules/protocol/plexus.cpp3
-rw-r--r--modules/protocol/unreal.cpp3
6 files changed, 76 insertions, 12 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index cd92b43cf..cae16dcb9 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -333,8 +333,12 @@ struct IRCDMessageMode : IRCDMessage
}
catch (const ConvertException &) { }
+ Anope::string modes = params[2];
+ for (unsigned int i = 3; i < params.size(); ++i)
+ modes += " " + params[i];
+
if (c)
- c->SetModesInternal(source, params[2], ts);
+ c->SetModesInternal(source, modes, ts);
}
else
{
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index 5561213bf..1e63ed448 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -51,6 +51,11 @@ class HybridProto : public IRCDProto
MaxModes = 4;
}
+ void SendInvite(const MessageSource &source, const Channel *c, User *u) override
+ {
+ UplinkSocket::Message(source) << "INVITE " << u->GetUID() << " " << c->name << " " << c->creation_time;
+ }
+
void SendGlobalNotice(ServiceBot *bi, const Server *dest, const Anope::string &msg) override
{
UplinkSocket::Message(bi) << "NOTICE $$" << dest->GetName() << " :" << msg;
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index b28145385..e7a315261 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -1453,6 +1453,48 @@ struct IRCDMessageRSQuit : IRCDMessage
}
};
+struct IRCDMessageSave : IRCDMessage
+{
+ time_t last_collide;
+
+ IRCDMessageSave(Module *creator) : IRCDMessage(creator, "SAVE", 2), last_collide(0) { }
+
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override
+ {
+ User *targ = User::Find(params[0]);
+ time_t ts;
+
+ try
+ {
+ ts = convertTo<time_t>(params[1]);
+ }
+ catch (const ConvertException &)
+ {
+ return;
+ }
+
+ if (!targ || targ->timestamp != ts)
+ return;
+
+ BotInfo *bi;
+ if (targ->server == Me && (bi = dynamic_cast<BotInfo *>(targ)))
+ {
+ if (last_collide == Anope::CurTime)
+ {
+ Anope::QuitReason = "Nick collision fight on " + targ->nick;
+ Anope::Quitting = true;
+ return;
+ }
+
+ IRCD->SendKill(Me, targ->nick, "Nick collision");
+ IRCD->SendNickChange(targ, targ->nick);
+ last_collide = Anope::CurTime;
+ }
+ else
+ targ->ChangeNick(targ->GetUID());
+ }
+};
+
struct IRCDMessageServer : IRCDMessage
{
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 5) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
@@ -1595,6 +1637,7 @@ class ProtoInspIRCd20 : public Module
IRCDMessageNick message_nick;
IRCDMessageOperType message_opertype;
IRCDMessageRSQuit message_rsquit;
+ IRCDMessageSave message_save;
IRCDMessageServer message_server;
IRCDMessageSQuit message_squit;
IRCDMessageTime message_time;
@@ -1640,6 +1683,7 @@ class ProtoInspIRCd20 : public Module
, message_nick(this)
, message_opertype(this)
, message_rsquit(this)
+ , message_save(this)
, message_server(this)
, message_squit(this)
, message_time(this)
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index f7d848a71..9101a6788 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -169,6 +169,11 @@ class ngIRCdProto : public IRCDProto
{
this->SendVhost(u, u->GetIdent(), "");
}
+
+ Anope::string Format(const Anope::string &source, const Anope::string &message) override
+ {
+ return IRCDProto::Format(source.empty() ? Me->GetSID() : source, message);
+ }
};
struct IRCDMessage005 : IRCDMessage
@@ -443,7 +448,14 @@ struct IRCDMessageNick : IRCDMessage
else if (params.size() == 7)
{
// a new user is connecting to the network
- User::OnIntroduce(params[0], params[2], params[3], "", "", source.GetServer(), params[6], Anope::CurTime, params[5], "", NULL);
+ Server *s = Server::Find(params[4]);
+ if (s == NULL)
+ {
+ Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[4] << "?";
+ return;
+ }
+ User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL);
+ Log(LOG_DEBUG) << "Registered nick \"" << params[0] << "\" on server " << s->GetName() << ".";
}
else
{
@@ -519,18 +531,17 @@ struct IRCDMessageServer : IRCDMessage
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
/*
+ * New directly linked server:
+ *
* SERVER tolsun.oulu.fi 1 :Experimental server
* New server tolsun.oulu.fi introducing itself
* and attempting to register.
*
- * RFC 2813 says the server has to send a hopcount
- * AND a servertoken. Not quite sure what ngIRCd is
- * sending here.
- *
* params[0] = servername
- * params[1] = hop count (or servertoken?)
+ * params[1] = hop count
* params[2] = server description
*
+ * New remote server in the network:
*
* :tolsun.oulu.fi SERVER csd.bu.edu 5 34 :BU Central Server
* Server tolsun.oulu.fi is our uplink for csd.bu.edu
@@ -549,13 +560,13 @@ struct IRCDMessageServer : IRCDMessage
if (params.size() == 3)
{
// our uplink is introducing itself
- new Server(Me, params[0], 1, params[2], "");
+ new Server(Me, params[0], 1, params[2], "1");
}
else
{
// our uplink is introducing a new server
unsigned int hops = params[1].is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0;
- new Server(source.GetServer(), params[0], hops, params[2], params[3]);
+ new Server(source.GetServer(), params[0], hops, params[3], params[2]);
}
/*
* ngIRCd does not send an EOB, so we send a PING immediately
diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp
index 2ff32c935..32eeaeaba 100644
--- a/modules/protocol/plexus.cpp
+++ b/modules/protocol/plexus.cpp
@@ -341,6 +341,7 @@ class ProtoPlexus : public Module
ModeManager::AddUserMode(new UserMode("REGPRIV", 'R'));
ModeManager::AddUserMode(new UserModeOperOnly("SNOMASK", 's'));
ModeManager::AddUserMode(new UserModeNoone("SSL", 'S'));
+ ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'U'));
ModeManager::AddUserMode(new UserMode("WALLOPS", 'w'));
ModeManager::AddUserMode(new UserModeNoone("WEBIRC", 'W'));
ModeManager::AddUserMode(new UserMode("CLOAK", 'x'));
@@ -350,7 +351,6 @@ class ProtoPlexus : public Module
ModeManager::AddChannelMode(new ChannelModeList("BAN", 'b'));
ModeManager::AddChannelMode(new ChannelModeList("EXCEPT", 'e'));
ModeManager::AddChannelMode(new ChannelModeList("INVITEOVERRIDE", 'I'));
- ModeManager::AddUserMode(new UserModeNoone("PROTECTED", 'U'));
/* v/h/o/a/q */
ModeManager::AddChannelMode(new ChannelModeStatus("VOICE", 'v', '+', 0));
@@ -376,7 +376,6 @@ class ProtoPlexus : public Module
ModeManager::AddChannelMode(new ChannelMode("SECRET", 's'));
ModeManager::AddChannelMode(new ChannelMode("TOPIC", 't'));
ModeManager::AddChannelMode(new ChannelModeOperOnly("OPERONLY", 'O'));
- ModeManager::AddChannelMode(new ChannelMode("REGMODERATED", 'M'));
ModeManager::AddChannelMode(new ChannelMode("REGISTEREDONLY", 'R'));
ModeManager::AddChannelMode(new ChannelMode("SSL", 'S'));
ModeManager::AddChannelMode(new ChannelMode("PERM", 'z'));
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index dc85c6f89..6324d18ca 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -345,7 +345,8 @@ class UnrealIRCdProto : public IRCDProto
void SendLogin(User *u, NickServ::Nick *na) override
{
- if (Servers::Capab.count("ESVID") > 0)
+ /* 3.2.10.4+ treats users logged in with accounts as fully registered, even if -r, so we can not set this here. Just use the timestamp. */
+ if (Servers::Capab.count("ESVID") > 0 && !na->GetAccount()->HasFieldS("UNCONFIRMED"))
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %s", na->GetAccount()->GetDisplay().c_str());
else
IRCD->SendMode(Config->GetClient("NickServ"), u, "+d %d", u->signon);