summaryrefslogtreecommitdiff
path: root/modules/protocol
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2015-10-27 18:57:37 -0400
committerAdam <Adam@anope.org>2015-10-27 18:58:48 -0400
commit64dac60071fab652745a6e7a06cf6b7bdbbd3625 (patch)
treef8f30161150451672b381f6370a8fdcab654bbb8 /modules/protocol
parent162fdbe5815bbdf187f549fefac94ff476d72e62 (diff)
parent830361e97d03c74e54cb1cf1bbf329dffdeb66f7 (diff)
Merge branch '2.0' into 2.1
Diffstat (limited to 'modules/protocol')
-rw-r--r--modules/protocol/bahamut.cpp8
-rw-r--r--modules/protocol/charybdis.cpp4
-rw-r--r--modules/protocol/hybrid.cpp27
-rw-r--r--modules/protocol/inspircd20.cpp58
-rw-r--r--modules/protocol/ngircd.cpp14
-rw-r--r--modules/protocol/ratbox.cpp4
-rw-r--r--modules/protocol/unreal.cpp10
7 files changed, 73 insertions, 52 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 52786b361..c320f3a3e 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -378,7 +378,7 @@ struct IRCDMessageNick : IRCDMessage
Server *s = Server::Find(params[6]);
if (s == NULL)
{
- Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[6] << "?";
+ Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[6] << "?";
return;
}
@@ -449,7 +449,7 @@ struct IRCDMessageSJoin : IRCDMessage
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "SJOIN for nonexistant user " << buf << " on " << params[1];
+ Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1];
continue;
}
@@ -466,11 +466,11 @@ struct IRCDMessageTopic : IRCDMessage
{
IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { }
- void Run(MessageSource &, const std::vector<Anope::string> &params) override
+ void Run(MessageSource &source, const std::vector<Anope::string> &params) override
{
Channel *c = Channel::Find(params[0]);
if (c)
- c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
+ c->ChangeTopicInternal(source.GetUser(), params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
}
};
diff --git a/modules/protocol/charybdis.cpp b/modules/protocol/charybdis.cpp
index 8477bc30e..50da90902 100644
--- a/modules/protocol/charybdis.cpp
+++ b/modules/protocol/charybdis.cpp
@@ -230,7 +230,7 @@ struct IRCDMessageEUID : IRCDMessage
}
};
-// we cant use this function from ratbox because we set a local variable here
+// we can't use this function from ratbox because we set a local variable here
struct IRCDMessageServer : IRCDMessage
{
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
@@ -246,7 +246,7 @@ struct IRCDMessageServer : IRCDMessage
}
};
-// we cant use this function from ratbox because we set a local variable here
+// we can't use this function from ratbox because we set a local variable here
struct IRCDMessagePass : IRCDMessage
{
IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index 772b9e0d9..b5c524530 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -1,7 +1,7 @@
/* ircd-hybrid-8 protocol module
*
* (C) 2003-2014 Anope Team
- * (C) 2012-2014 ircd-hybrid development team
+ * (C) 2012-2015 ircd-hybrid development team
*
* Please read COPYING and README for further details.
*
@@ -43,7 +43,7 @@ class HybridProto : public IRCDProto
}
public:
- HybridProto(Module *creator) : IRCDProto(creator, "Hybrid 8.1.x")
+ HybridProto(Module *creator) : IRCDProto(creator, "Hybrid 8.2.x")
{
DefaultPseudoclientModes = "+oi";
CanSVSNick = true;
@@ -55,7 +55,7 @@ class HybridProto : public IRCDProto
CanCertFP = true;
CanSetVHost = true;
RequiresID = true;
- MaxModes = 4;
+ MaxModes = 6;
}
void SendInvite(const MessageSource &source, const Channel *c, User *u) override
@@ -73,11 +73,6 @@ class HybridProto : public IRCDProto
UplinkSocket::Message(bi) << "PRIVMSG $$" << dest->GetName() << " :" << msg;
}
- void SendGlobopsInternal(const MessageSource &source, const Anope::string &buf) override
- {
- UplinkSocket::Message(source) << "GLOBOPS :" << buf;
- }
-
void SendSQLine(User *, XLine *x) override
{
UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << (x->GetExpires() ? x->GetExpires() - Anope::CurTime : 0) << " " << x->GetMask() << " 0 :" << x->GetReason();
@@ -216,7 +211,7 @@ class HybridProto : public IRCDProto
SendServer(Me);
- UplinkSocket::Message() << "SVINFO 6 5 0 :" << Anope::CurTime;
+ UplinkSocket::Message() << "SVINFO 6 6 0 :" << Anope::CurTime;
}
void SendClientIntroduction(User *u) override
@@ -224,7 +219,7 @@ class HybridProto : public IRCDProto
Anope::string modes = "+" + u->GetModes();
UplinkSocket::Message(Me) << "UID " << u->nick << " 1 " << u->timestamp << " " << modes << " "
- << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " 0 :" << u->realname;
+ << u->GetIdent() << " " << u->host << " 0 " << u->GetUID() << " * :" << u->realname;
}
void SendEOB() override
@@ -244,7 +239,7 @@ class HybridProto : public IRCDProto
void SendLogout(User *u) override
{
- IRCD->SendMode(Config->GetClient("NickServ"), u, "+d 0");
+ IRCD->SendMode(Config->GetClient("NickServ"), u, "+d *");
}
void SendChannel(Channel *c) override
@@ -264,7 +259,7 @@ class HybridProto : public IRCDProto
void SendForceNickChange(User *u, const Anope::string &newnick, time_t when) override
{
- UplinkSocket::Message(Me) << "SVSNICK " << u->nick << " " << newnick << " " << when;
+ UplinkSocket::Message(Me) << "SVSNICK " << u->GetUID() << " " << newnick << " " << when;
}
void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string &) override
@@ -472,7 +467,7 @@ struct IRCDMessageSJoin : IRCDMessage
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "SJOIN for nonexistant user " << buf << " on " << params[1];
+ Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1];
continue;
}
@@ -519,7 +514,7 @@ struct IRCDMessageTBurst : IRCDMessage
Channel *c = Channel::Find(params[1]);
if (c)
- c->ChangeTopicInternal(setter, params[4], topic_time);
+ c->ChangeTopicInternal(NULL, setter, params[4], topic_time);
}
};
@@ -553,7 +548,7 @@ struct IRCDMessageUID : IRCDMessage
IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 10) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
/* 0 1 2 3 4 5 6 7 8 9 */
- /* :0MC UID Steve 1 1350157102 +oi ~steve resolved.host 10.0.0.1 0MCAAAAAB 1350157108 :Mining all the time */
+ /* :0MC UID Steve 1 1350157102 +oi ~steve resolved.host 10.0.0.1 0MCAAAAAB Steve :Mining all the time */
void Run(MessageSource &source, const std::vector<Anope::string> &params) override
{
Anope::string ip = params[6];
@@ -562,7 +557,7 @@ struct IRCDMessageUID : IRCDMessage
ip.clear();
NickServ::Nick *na = NULL;
- if (params[8] != "0")
+ if (params[8] != "0" && params[8] != "*")
na = NickServ::FindNick(params[8]);
/* Source is always the server */
diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp
index 4a74995a2..63cdc1973 100644
--- a/modules/protocol/inspircd20.cpp
+++ b/modules/protocol/inspircd20.cpp
@@ -219,6 +219,8 @@ class InspIRCd20Proto : public IRCDProto
{
Anope::string modes = "+" + u->GetModes();
UplinkSocket::Message(Me) << "UID " << u->GetUID() << " " << u->timestamp << " " << u->nick << " " << u->host << " " << u->host << " " << u->GetIdent() << " 0.0.0.0 " << u->timestamp << " " << modes << " :" << u->realname;
+ if (modes.find('o') != Anope::string::npos)
+ UplinkSocket::Message(u) << "OPERTYPE :services";
}
/* SERVER services-dev.chatspike.net password 0 :Description here */
@@ -816,7 +818,10 @@ struct IRCDMessageFHost : IRCDMessage
void Run(MessageSource &source, const std::vector<Anope::string> &params) override
{
- source.GetUser()->SetDisplayedHost(params[0]);
+ User *u = source.GetUser();
+ if (u->HasMode("CLOAK"))
+ u->RemoveModeInternal(source, ModeManager::FindUserModeByName("CLOAK"));
+ u->SetDisplayedHost(params[0]);
}
};
@@ -866,7 +871,7 @@ struct IRCDMessageFJoin : IRCDMessage
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "FJOIN for nonexistant user " << buf << " on " << params[0];
+ Log(LOG_DEBUG) << "FJOIN for non-existent user " << buf << " on " << params[0];
continue;
}
@@ -917,7 +922,7 @@ struct IRCDMessageFTopic : IRCDMessage
Channel *c = Channel::Find(params[0]);
if (c)
- c->ChangeTopicInternal(params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime);
+ c->ChangeTopicInternal(NULL, params[2], params[3], Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime);
}
};
@@ -947,7 +952,15 @@ struct IRCDMessageIdle : IRCDMessage
*/
struct IRCDMessageMetadata : IRCDMessage
{
- IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+ const bool &do_topiclock, &do_mlock;
+
+ IRCDMessageMetadata(Module *creator, const bool &handle_topiclock, const bool &handle_mlock)
+ : IRCDMessage(creator, "METADATA", 3)
+ , do_topiclock(handle_topiclock)
+ , do_mlock(handle_mlock)
+ {
+ SetFlag(IRCDMESSAGE_REQUIRE_SERVER);
+ }
void Run(MessageSource &source, const std::vector<Anope::string> &params) override
{
@@ -982,8 +995,31 @@ struct IRCDMessageMetadata : IRCDMessage
Event::OnFingerprint(&Event::Fingerprint::OnFingerprint, u);
}
}
- else if (params[0][0] == '#')
+ // We deliberately ignore non-bursting servers to avoid pseudoserver fights
+ else if ((params[0][0] == '#') && (!source.GetServer()->IsSynced()))
{
+ Channel *c = Channel::Find(params[0]);
+ if (c && c->ci)
+ {
+ if ((do_mlock) && (params[1] == "mlock"))
+ {
+ ModeLocks *modelocks = c->ci->GetExt<ModeLocks>("modelocks");
+ Anope::string modes;
+ if (modelocks)
+ modes = modelocks->GetMLockAsString(c->ci, false).replace_all_cs("+", "").replace_all_cs("-", "");
+
+ // Mode lock string is not what we say it is?
+ if (modes != params[2])
+ UplinkSocket::Message(Me) << "METADATA " << c->name << " mlock :" << modes;
+ }
+ else if ((do_topiclock) && (params[1] == "topiclock"))
+ {
+ bool mystate = c->ci->GetExt<bool>("TOPICLOCK");
+ bool serverstate = (params[2] == "1");
+ if (mystate != serverstate)
+ UplinkSocket::Message(Me) << "METADATA " << c->name << " topiclock :" << (mystate ? "1" : "");
+ }
+ }
}
else if (params[0] == "*")
{
@@ -1263,7 +1299,6 @@ class ProtoInspIRCd20 : public Module
, public EventHook<Event::DelChan>
, public EventHook<Event::MLockEvents>
, public EventHook<Event::SetChannelOption>
- , public EventHook<Event::ChannelModeUnset>
{
InspIRCd20Proto ircd_proto;
ExtensibleItem<bool> ssl;
@@ -1340,7 +1375,7 @@ class ProtoInspIRCd20 : public Module
, message_fmode(this)
, message_ftopic(this)
, message_idle(this)
- , message_metadata(this)
+ , message_metadata(this, use_server_side_topiclock, use_server_side_mlock)
, message_mode(this)
, message_nick(this)
, message_opertype(this)
@@ -1464,15 +1499,6 @@ class ProtoInspIRCd20 : public Module
return EVENT_CONTINUE;
}
-
- EventReturn OnChannelModeUnset(Channel *c, const MessageSource &setter, ChannelMode *mode, const Anope::string &param) override
- {
- if ((setter.GetUser() && setter.GetUser()->server == Me) || setter.GetServer() == Me || !setter.GetServer())
- if (mode->name == "OPERPREFIX")
- c->SetMode(c->ci->WhoSends(), mode, param, false);
-
- return EVENT_CONTINUE;
- }
};
MODULE_INIT(ProtoInspIRCd20)
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index 6981e32bc..b80f600e3 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -257,7 +257,7 @@ struct IRCDMessageChaninfo : IRCDMessage
if (params.size() == 3)
{
- c->ChangeTopicInternal(source.GetName(), params[2], Anope::CurTime);
+ c->ChangeTopicInternal(NULL, source.GetName(), params[2], Anope::CurTime);
}
else if (params.size() == 5)
{
@@ -271,9 +271,9 @@ struct IRCDMessageChaninfo : IRCDMessage
case 'l':
modes += " " + params[3];
continue;
+ }
}
- }
- c->ChangeTopicInternal(source.GetName(), params[4], Anope::CurTime);
+ c->ChangeTopicInternal(NULL, source.GetName(), params[4], Anope::CurTime);
}
c->SetModesInternal(source, modes);
@@ -451,7 +451,7 @@ struct IRCDMessageNick : IRCDMessage
Server *s = Server::Find(params[4]);
if (s == NULL)
{
- Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[4] << "?";
+ Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[4] << "?";
return;
}
User::OnIntroduce(params[0], params[2], params[3], "", "", s, params[6], Anope::CurTime, params[5], "", NULL);
@@ -500,7 +500,7 @@ struct IRCDMessageNJoin : IRCDMessage
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "NJOIN for nonexistant user " << buf << " on " << params[0];
+ Log(LOG_DEBUG) << "NJOIN for non-existent user " << buf << " on " << params[0];
continue;
}
users.push_back(sju);
@@ -587,10 +587,10 @@ struct IRCDMessageTopic : IRCDMessage
Channel *c = Channel::Find(params[0]);
if (!c)
{
- Log(LOG_DEBUG) << "TOPIC for nonexistant channel " << params[0];
+ Log(LOG_DEBUG) << "TOPIC for non-existent channel " << params[0];
return;
}
- c->ChangeTopicInternal(source.GetName(), params[1], Anope::CurTime);
+ c->ChangeTopicInternal(source.GetUser(), source.GetName(), params[1], Anope::CurTime);
}
};
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index ec3e406b1..9e1ea0710 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -172,7 +172,7 @@ struct IRCDMessageTBurst : IRCDMessage
* params[0] = channel
* params[1] = ts
* params[2] = topic OR who set the topic
- * params[3] = topic if params[2] isnt the topic
+ * params[3] = topic if params[2] isn't the topic
*/
void Run(MessageSource &source, const std::vector<Anope::string> &params) override
{
@@ -185,7 +185,7 @@ struct IRCDMessageTBurst : IRCDMessage
const Anope::string &setter = params.size() == 4 ? params[2] : "",
topic = params.size() == 4 ? params[3] : params[2];
- c->ChangeTopicInternal(setter, topic, topic_time);
+ c->ChangeTopicInternal(NULL, setter, topic, topic_time);
}
};
diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp
index b4b9893d3..6bcaaab26 100644
--- a/modules/protocol/unreal.cpp
+++ b/modules/protocol/unreal.cpp
@@ -576,7 +576,7 @@ class ChannelModeFlood : public ChannelModeParam
while (p < arg.length() && isdigit(arg[p]))
++p;
if (p == arg.length() || !(arg[p] == 'c' || arg[p] == 'j' || arg[p] == 'k' || arg[p] == 'm' || arg[p] == 'n' || arg[p] == 't'))
- continue; /* continue instead of break for forward compatability. */
+ continue; /* continue instead of break for forward compatibility. */
try
{
int v = arg.substr(0, p).is_number_only() ? convertTo<int>(arg.substr(0, p)) : 0;
@@ -745,7 +745,7 @@ struct IRCDMessageNick : IRCDMessage
Server *s = Server::Find(params[5]);
if (s == NULL)
{
- Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[5] << "?";
+ Log(LOG_DEBUG) << "User " << params[0] << " introduced from non-existent server " << params[5] << "?";
return;
}
@@ -829,7 +829,7 @@ struct IRCDMessageSetHost : IRCDMessage
{
User *u = source.GetUser();
- /* When a user sets +x we recieve the new host and then the mode change */
+ /* When a user sets +x we receive the new host and then the mode change */
if (u->HasMode("CLOAK"))
u->SetDisplayedHost(params[0]);
else
@@ -933,7 +933,7 @@ struct IRCDMessageSJoin : IRCDMessage
sju.second = User::Find(buf);
if (!sju.second)
{
- Log(LOG_DEBUG) << "SJOIN for nonexistant user " << buf << " on " << params[1];
+ Log(LOG_DEBUG) << "SJOIN for non-existent user " << buf << " on " << params[1];
continue;
}
@@ -983,7 +983,7 @@ struct IRCDMessageTopic : IRCDMessage
{
Channel *c = Channel::Find(params[0]);
if (c)
- c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
+ c->ChangeTopicInternal(source.GetUser(), params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);
}
};