mirror of
https://github.com/anope/anope.git
synced 2026-06-29 10:16:39 +02:00
Change the return type of ircdmessage to void now that we don't use it, add an ircd message module event, and a few more fixups
This commit is contained in:
+18
-18
@@ -24,28 +24,28 @@ namespace Message
|
||||
{
|
||||
Away(Module *creator, const Anope::string &mname = "AWAY") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Capab : IRCDMessage
|
||||
{
|
||||
Capab(Module *creator, const Anope::string &mname = "CAPAB") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Error : IRCDMessage
|
||||
{
|
||||
Error(Module *creator, const Anope::string &mname = "ERROR") : IRCDMessage(creator, mname, 1) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Join : IRCDMessage
|
||||
{
|
||||
Join(Module *creator, const Anope::string &mname = "JOIN") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
|
||||
typedef std::pair<ChannelStatus, User *> SJoinUser;
|
||||
|
||||
@@ -63,98 +63,98 @@ namespace Message
|
||||
{
|
||||
Kick(Module *creator, const Anope::string &mname = "KICK") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Kill : IRCDMessage
|
||||
{
|
||||
Kill(Module *creator, const Anope::string &mname = "KILL") : IRCDMessage(creator, mname, 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Mode : IRCDMessage
|
||||
{
|
||||
Mode(Module *creator, const Anope::string &mname = "MODE") : IRCDMessage(creator, mname, 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport MOTD : IRCDMessage
|
||||
{
|
||||
MOTD(Module *creator, const Anope::string &mname = "MOTD") : IRCDMessage(creator, mname, 1) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Part : IRCDMessage
|
||||
{
|
||||
Part(Module *creator, const Anope::string &mname = "PART") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Ping : IRCDMessage
|
||||
{
|
||||
Ping(Module *creator, const Anope::string &mname = "PPING") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Privmsg : IRCDMessage
|
||||
{
|
||||
Privmsg(Module *creator, const Anope::string &mname = "PRIVMSG") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Quit : IRCDMessage
|
||||
{
|
||||
Quit(Module *creator, const Anope::string &mname = "QUIT") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport SQuit : IRCDMessage
|
||||
{
|
||||
SQuit(Module *creator, const Anope::string &mname = "SQUIT") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Stats : IRCDMessage
|
||||
{
|
||||
Stats(Module *creator, const Anope::string &mname = "STATS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Time : IRCDMessage
|
||||
{
|
||||
Time(Module *creator, const Anope::string &mname = "TIME") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Topic : IRCDMessage
|
||||
{
|
||||
Topic(Module *creator, const Anope::string &mname = "TOPIC") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Version : IRCDMessage
|
||||
{
|
||||
Version(Module *creator, const Anope::string &mname = "VERSION") : IRCDMessage(creator, mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
struct CoreExport Whois : IRCDMessage
|
||||
{
|
||||
Whois(Module *creator, const Anope::string &mname = "WHOIS") : IRCDMessage(creator, mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override;
|
||||
};
|
||||
|
||||
} // namespace Message
|
||||
|
||||
@@ -957,6 +957,14 @@ class CoreExport Module : public Extensible
|
||||
* @return EVENT_STOP to halt immediately
|
||||
*/
|
||||
virtual EventReturn OnSetNickOption(CommandSource &source, Command *cmd, NickCore *nc, const Anope::string &setting) { return EVENT_CONTINUE; }
|
||||
|
||||
/** Called whenever a message is received from the uplink
|
||||
* @param source The source of the message
|
||||
* @param command The command being executed
|
||||
* @param params Parameters
|
||||
* @return EVENT_STOP to prevent the protocol module from processing this message
|
||||
*/
|
||||
virtual EventReturn OnMessage(MessageSource &source, Anope::string &command, std::vector<Anope::string> ¶m) { return EVENT_CONTINUE; }
|
||||
};
|
||||
|
||||
/** Implementation-specific flags which may be set in ModuleManager::Attach()
|
||||
@@ -1007,6 +1015,7 @@ enum Implementation
|
||||
I_OnEncrypt, I_OnDecrypt,
|
||||
I_OnChannelModeSet, I_OnChannelModeUnset, I_OnUserModeSet, I_OnUserModeUnset, I_OnChannelModeAdd, I_OnUserModeAdd,
|
||||
I_OnMLock, I_OnUnMLock, I_OnServerSync, I_OnUplinkSync, I_OnBotPrivmsg, I_OnPrivmsg, I_OnLog, I_OnDnsRequest,
|
||||
I_OnMessage,
|
||||
|
||||
I_OnSerializeCheck, I_OnSerializableConstruct, I_OnSerializableDestruct, I_OnSerializableUpdate,
|
||||
I_END
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ class CoreExport IRCDMessage : public Flags<IRCDMessageFlag>, public Service
|
||||
public:
|
||||
IRCDMessage(Module *owner, const Anope::string &n, unsigned p = 0);
|
||||
unsigned GetParamCount() const;
|
||||
virtual bool Run(MessageSource &, const std::vector<Anope::string> ¶ms) = 0;
|
||||
virtual void Run(MessageSource &, const std::vector<Anope::string> ¶ms) = 0;
|
||||
};
|
||||
|
||||
extern CoreExport IRCDProto *IRCD;
|
||||
|
||||
@@ -198,12 +198,11 @@ class NSGhost : public Module
|
||||
std::map<Anope::string, ChannelStatus>::iterator it = ei->find(c->name);
|
||||
if (it != ei->end())
|
||||
{
|
||||
ei->erase(it);
|
||||
|
||||
for (size_t j = CMODE_BEGIN + 1; j < CMODE_END; ++j)
|
||||
if (it->second.HasFlag(static_cast<ChannelModeName>(j)))
|
||||
c->SetMode(c->ci->WhoSends(), ModeManager::FindChannelModeByName(static_cast<ChannelModeName>(j)), u->GetUID());
|
||||
|
||||
ei->erase(it);
|
||||
if (ei->empty())
|
||||
u->Shrink("ns_ghost_info");
|
||||
}
|
||||
|
||||
@@ -308,7 +308,7 @@ struct IRCDMessageBurst : IRCDMessage
|
||||
{
|
||||
IRCDMessageBurst(Module *creator) : IRCDMessage(creator, "BURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* If we found a server with the given source, that one just
|
||||
* finished bursting. If there was no source, then our uplink
|
||||
@@ -319,7 +319,6 @@ struct IRCDMessageBurst : IRCDMessage
|
||||
s = Me->GetLinks().front();
|
||||
if (s)
|
||||
s->Sync(true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -327,7 +326,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
{
|
||||
IRCDMessageMode(Module *creator, const Anope::string &sname) : IRCDMessage(creator, sname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.size() > 2 && IRCD->IsChannelValid(params[0]))
|
||||
{
|
||||
@@ -349,8 +348,6 @@ struct IRCDMessageMode : IRCDMessage
|
||||
if (u)
|
||||
u->SetModesInternal("%s", params[1].c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -376,7 +373,7 @@ struct IRCDMessageNick : IRCDMessage
|
||||
{
|
||||
IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.size() == 10)
|
||||
{
|
||||
@@ -384,7 +381,7 @@ struct IRCDMessageNick : IRCDMessage
|
||||
if (s == NULL)
|
||||
{
|
||||
Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[6] << "?";
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
User *user = new User(params[0], params[4], params[5], "", params[8], s, params[9], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[3]);
|
||||
@@ -404,8 +401,6 @@ struct IRCDMessageNick : IRCDMessage
|
||||
}
|
||||
else
|
||||
source.GetUser()->ChangeNick(params[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -413,11 +408,10 @@ struct IRCDMessageServer : IRCDMessage
|
||||
{
|
||||
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0;
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[2]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -425,7 +419,7 @@ struct IRCDMessageSJoin : IRCDMessage
|
||||
{
|
||||
IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Anope::string modes;
|
||||
if (params.size() >= 4)
|
||||
@@ -481,8 +475,6 @@ struct IRCDMessageSJoin : IRCDMessage
|
||||
|
||||
time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime;
|
||||
Message::Join::SJoin(source, params[1], ts, modes, users);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -490,12 +482,11 @@ struct IRCDMessageTopic : IRCDMessage
|
||||
{
|
||||
IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 4) { }
|
||||
|
||||
bool Run(MessageSource &, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &, const std::vector<Anope::string> ¶ms) anope_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);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+17
-34
@@ -249,7 +249,7 @@ struct IRCDMessageBMask : IRCDMessage
|
||||
|
||||
/* 0 1 2 3 */
|
||||
/* :0MC BMASK 1350157102 #channel b :*!*@*.test.com */
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Channel *c = Channel::Find(params[1]);
|
||||
|
||||
@@ -271,8 +271,6 @@ struct IRCDMessageBMask : IRCDMessage
|
||||
c->SetModeInternal(source, invex, token);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -280,10 +278,9 @@ struct IRCDMessageEOB : IRCDMessage
|
||||
{
|
||||
IRCDMessageEOB(Module *craetor) : IRCDMessage(craetor, "EOB", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetServer()->Sync(true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -291,10 +288,10 @@ struct IRCDMessageJoin : Message::Join
|
||||
{
|
||||
IRCDMessageJoin(Module *creator) : Message::Join(creator, "JOIN") { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.size() < 2)
|
||||
return true;
|
||||
return;
|
||||
|
||||
std::vector<Anope::string> p = params;
|
||||
p.erase(p.begin());
|
||||
@@ -309,10 +306,9 @@ struct IRCDMessageNick : IRCDMessage
|
||||
|
||||
/* 0 1 */
|
||||
/* :0MCAAAAAB NICK newnick 1350157102 */
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->ChangeNick(params[0], convertTo<time_t>(params[1]));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -322,10 +318,9 @@ struct IRCDMessagePass : IRCDMessage
|
||||
|
||||
/* 0 1 2 3 */
|
||||
/* PASS password TS 6 0MC */
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
UplinkSID = params[3];
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -333,10 +328,9 @@ struct IRCDMessagePong : IRCDMessage
|
||||
{
|
||||
IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetServer()->Sync(false);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -346,16 +340,15 @@ struct IRCDMessageServer : IRCDMessage
|
||||
|
||||
/* 0 1 2 */
|
||||
/* SERVER hades.arpa 1 :ircd-hybrid test server */
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* Servers other than our immediate uplink are introduced via SID */
|
||||
if (params[1] != "1")
|
||||
return true;
|
||||
return;
|
||||
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID);
|
||||
|
||||
IRCD->SendPing(Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -365,13 +358,12 @@ struct IRCDMessageSID : IRCDMessage
|
||||
|
||||
/* 0 1 2 3 */
|
||||
/* :0MC SID hades.arpa 2 4XY :ircd-hybrid test server */
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
unsigned int hops = params[1].is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0;
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[3], params[2]);
|
||||
|
||||
IRCD->SendPing(Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -379,7 +371,7 @@ struct IRCDMessageSJoin : IRCDMessage
|
||||
{
|
||||
IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Anope::string modes;
|
||||
if (params.size() >= 3)
|
||||
@@ -424,8 +416,6 @@ struct IRCDMessageSJoin : IRCDMessage
|
||||
|
||||
time_t ts = Anope::string(params[0]).is_pos_number_only() ? convertTo<time_t>(params[0]) : Anope::CurTime;
|
||||
Message::Join::SJoin(source, params[1], ts, modes, users);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -439,17 +429,16 @@ struct IRCDMessageSVSMode : IRCDMessage
|
||||
* parv[2] = mode
|
||||
* parv[3] = optional argument (services id)
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (!u)
|
||||
return true;
|
||||
return;
|
||||
|
||||
if (!params[1].is_pos_number_only() || convertTo<time_t>(params[1]) != u->timestamp)
|
||||
return true;
|
||||
return;
|
||||
|
||||
u->SetModesInternal("%s", params[2].c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -457,7 +446,7 @@ struct IRCDMessageTBurst : IRCDMessage
|
||||
{
|
||||
IRCDMessageTBurst(Module *creator) : IRCDMessage(creator, "TBURST", 5) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Anope::string setter;
|
||||
sepstream(params[3], '!').GetToken(setter, 0);
|
||||
@@ -466,8 +455,6 @@ struct IRCDMessageTBurst : IRCDMessage
|
||||
|
||||
if (c)
|
||||
c->ChangeTopicInternal(setter, params[4], topic_time);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -475,7 +462,7 @@ struct IRCDMessageTMode : IRCDMessage
|
||||
{
|
||||
IRCDMessageTMode(Module *creator) : IRCDMessage(creator, "TMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
time_t ts = 0;
|
||||
|
||||
@@ -493,8 +480,6 @@ struct IRCDMessageTMode : IRCDMessage
|
||||
|
||||
if (c)
|
||||
c->SetModesInternal(source, modes, ts);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -504,7 +489,7 @@ struct IRCDMessageUID : IRCDMessage
|
||||
|
||||
/* 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 */
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Anope::string ip = params[6];
|
||||
|
||||
@@ -534,8 +519,6 @@ struct IRCDMessageUID : IRCDMessage
|
||||
else
|
||||
NickServService->Validate(user);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -338,7 +338,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
{
|
||||
IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params[0].equals_cs("START"))
|
||||
{
|
||||
@@ -542,21 +542,21 @@ struct IRCDMessageCapab : Message::Capab
|
||||
UplinkSocket::Message() << "ERROR :m_globops is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "ERROR: Remote server does not have the m_globops module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!has_servicesmod)
|
||||
{
|
||||
UplinkSocket::Message() << "ERROR :m_services is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "ERROR: Remote server does not have the m_services module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!has_hidechansmod)
|
||||
{
|
||||
UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "ERROR: Remote server deos not have the m_hidechans module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!IRCD->CanSVSHold)
|
||||
Log() << "SVSHOLD missing, Usage disabled until module is loaded.";
|
||||
@@ -566,7 +566,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
Log() << "CHGIDENT missing, Usage disabled until module is loaded.";
|
||||
}
|
||||
|
||||
return Message::Capab::Run(source, params);
|
||||
Message::Capab::Run(source, params);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -574,17 +574,16 @@ struct IRCDMessageChgIdent : IRCDMessage
|
||||
{
|
||||
IRCDMessageChgIdent(Module *creator, const Anope::string &n) : IRCDMessage(creator, n, 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (!u)
|
||||
{
|
||||
Log(LOG_DEBUG) << "CHGIDENT for nonexistent user " << params[0];
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
u->SetIdent(params[1]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -592,10 +591,9 @@ struct IRCDMessageChgName : IRCDMessage
|
||||
{
|
||||
IRCDMessageChgName(Module *creator, const Anope::string &n) : IRCDMessage(creator, n, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -603,10 +601,9 @@ struct IRCDMessageEndBurst : IRCDMessage
|
||||
{
|
||||
IRCDMessageEndBurst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { }
|
||||
|
||||
bool Run(MessageSource &, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Me->GetLinks().front()->Sync(true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -614,10 +611,9 @@ struct IRCDMessageFHost : IRCDMessage
|
||||
{
|
||||
IRCDMessageFHost(Module *creator, const Anope::string &n) : IRCDMessage(creator, n, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -625,7 +621,7 @@ struct IRCDMessageFJoin : IRCDMessage
|
||||
{
|
||||
IRCDMessageFJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
std::list<Message::Join::SJoinUser> users;
|
||||
|
||||
@@ -664,8 +660,6 @@ struct IRCDMessageFJoin : IRCDMessage
|
||||
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime;
|
||||
Message::Join::SJoin(source, params[0], ts, "", users);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -673,13 +667,13 @@ struct IRCDMessageFMode : IRCDMessage
|
||||
{
|
||||
IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* :source FMODE #test 12345678 +nto foo */
|
||||
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
if (!c)
|
||||
return true;
|
||||
return;
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : 0;
|
||||
|
||||
/* TS's are equal now, so we can proceed with parsing */
|
||||
@@ -689,7 +683,6 @@ struct IRCDMessageFMode : IRCDMessage
|
||||
modes += " " + params[n];
|
||||
|
||||
c->SetModesInternal(source, modes, ts);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -697,13 +690,11 @@ struct IRCDMessageFTopic : IRCDMessage
|
||||
{
|
||||
IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
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);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -711,11 +702,10 @@ struct IRCDMessageIdle : IRCDMessage
|
||||
{
|
||||
IRCDMessageIdle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const BotInfo *bi = BotInfo::Find(params[0]);
|
||||
UplinkSocket::Message(bi) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " " << (bi ? Anope::CurTime - bi->lastmsg : 0);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -723,7 +713,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
{
|
||||
IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (IRCD->IsChannelValid(params[0]))
|
||||
{
|
||||
@@ -748,8 +738,6 @@ struct IRCDMessageMode : IRCDMessage
|
||||
if (u)
|
||||
u->SetModesInternal("%s", params[1].c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -757,7 +745,7 @@ struct IRCDMessageNick : IRCDMessage
|
||||
{
|
||||
IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.size() == 8 && source.GetServer())
|
||||
{
|
||||
@@ -781,8 +769,6 @@ struct IRCDMessageNick : IRCDMessage
|
||||
}
|
||||
else if (params.size() == 1 && source.GetUser())
|
||||
source.GetUser()->ChangeNick(params[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -790,15 +776,13 @@ struct IRCDMessageOperType : IRCDMessage
|
||||
{
|
||||
IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* opertype is equivalent to mode +o because servers
|
||||
dont do this directly */
|
||||
User *u = source.GetUser();
|
||||
if (!u->HasMode(UMODE_OPER))
|
||||
u->SetModesInternal("+o");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -806,10 +790,10 @@ struct IRCDMessageRSQuit : IRCDMessage
|
||||
{
|
||||
IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.empty() || params.size() > 3)
|
||||
return true;
|
||||
return;
|
||||
|
||||
Server *s;
|
||||
/* Horrible workaround to an insp bug (#) in how RSQUITs are sent - mark */
|
||||
@@ -819,8 +803,6 @@ struct IRCDMessageRSQuit : IRCDMessage
|
||||
s = Server::Find(params[0]);
|
||||
|
||||
source.GetServer()->Delete(source.GetServer()->GetName() + " " + (s ? s->GetName() : "<unknown>"));
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -828,11 +810,10 @@ struct IRCDMessageServer : IRCDMessage
|
||||
{
|
||||
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0;
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[2]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
{
|
||||
IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params[0].equals_cs("START"))
|
||||
{
|
||||
@@ -726,21 +726,21 @@ struct IRCDMessageCapab : Message::Capab
|
||||
UplinkSocket::Message() << "ERROR :m_globops is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "Remote server does not have the m_globops module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!has_servicesmod)
|
||||
{
|
||||
UplinkSocket::Message() << "ERROR :m_services_account.so is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!has_hidechansmod)
|
||||
{
|
||||
UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!IRCD->CanSVSHold)
|
||||
Log() << "SVSHOLD missing, Usage disabled until module is loaded.";
|
||||
@@ -750,9 +750,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
Log() << "CHGIDENT missing, Usage disabled until module is loaded.";
|
||||
}
|
||||
|
||||
Servers::Capab.insert("NOQUIT");
|
||||
|
||||
return Message::Capab::Run(source, params);
|
||||
Message::Capab::Run(source, params);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -760,12 +758,11 @@ struct IRCDMessageChgIdent : IRCDMessage
|
||||
{
|
||||
IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (u)
|
||||
u->SetIdent(params[1]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -773,10 +770,9 @@ struct IRCDMessageChgName : IRCDMessage
|
||||
{
|
||||
IRCDMessageChgName(Module *creator, const Anope::string &n) : IRCDMessage(creator, n, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->SetRealname(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -784,14 +780,13 @@ struct IRCDMessageEndburst : IRCDMessage
|
||||
{
|
||||
IRCDMessageEndburst(Module *creator) : IRCDMessage(creator, "ENDBURST", 0) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Server *s = source.GetServer();
|
||||
|
||||
Log(LOG_DEBUG) << "Processed ENDBURST for " << s->GetName();
|
||||
|
||||
s->Sync(true);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -799,10 +794,9 @@ struct IRCDMessageFHost : IRCDMessage
|
||||
{
|
||||
IRCDMessageFHost(Module *creator, const Anope::string &n) : IRCDMessage(creator, n, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->SetDisplayedHost(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -810,7 +804,7 @@ struct IRCDMessageFJoin : IRCDMessage
|
||||
{
|
||||
IRCDMessageFJoin(Module *creator) : IRCDMessage(creator, "FJOIN", 2) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Anope::string modes;
|
||||
if (params.size() >= 3)
|
||||
@@ -856,8 +850,6 @@ struct IRCDMessageFJoin : IRCDMessage
|
||||
|
||||
time_t ts = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime;
|
||||
Message::Join::SJoin(source, params[0], ts, "", users);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -865,7 +857,7 @@ struct IRCDMessageFMode : IRCDMessage
|
||||
{
|
||||
IRCDMessageFMode(Module *creator) : IRCDMessage(creator, "FMODE", 3) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* :source FMODE #test 12345678 +nto foo */
|
||||
|
||||
@@ -887,8 +879,6 @@ struct IRCDMessageFMode : IRCDMessage
|
||||
|
||||
if (c)
|
||||
c->SetModesInternal(source, modes, ts);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -896,15 +886,13 @@ struct IRCDMessageFTopic : IRCDMessage
|
||||
{
|
||||
IRCDMessageFTopic(Module *creator) : IRCDMessage(creator, "FTOPIC", 4) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* :source FTOPIC channel topicts setby :topic */
|
||||
|
||||
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);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -912,12 +900,11 @@ struct IRCDMessageIdle : IRCDMessage
|
||||
{
|
||||
IRCDMessageIdle(Module *creator) : IRCDMessage(creator, "IDLE", 1) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
const BotInfo *bi = BotInfo::Find(params[0]);
|
||||
if (bi)
|
||||
UplinkSocket::Message(bi) << "IDLE " << source.GetSource() << " " << Anope::StartTime << " " << (Anope::CurTime - bi->lastmsg);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -931,7 +918,7 @@ struct IRCDMessageMetadata : IRCDMessage
|
||||
{
|
||||
IRCDMessageMetadata(Module *creator) : IRCDMessage(creator, "METADATA", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (isdigit(params[0][0]))
|
||||
{
|
||||
@@ -964,7 +951,7 @@ struct IRCDMessageMetadata : IRCDMessage
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (!u)
|
||||
return true;
|
||||
return;
|
||||
std::string data = params[2].c_str();
|
||||
size_t pos1 = data.find(' ') + 1;
|
||||
size_t pos2 = data.find(' ', pos1);
|
||||
@@ -987,11 +974,11 @@ struct IRCDMessageMetadata : IRCDMessage
|
||||
// only interested when it comes from our uplink
|
||||
Server* server = source.GetServer();
|
||||
if (!server || server->GetUplink() != Me)
|
||||
return true;
|
||||
return;
|
||||
|
||||
bool plus = (params[2][0] == '+');
|
||||
if (!plus && params[2][0] != '-')
|
||||
return true;
|
||||
return;
|
||||
|
||||
bool required = false;
|
||||
Anope::string module = params[2].substr(1);
|
||||
@@ -1011,7 +998,7 @@ struct IRCDMessageMetadata : IRCDMessage
|
||||
else if (module.equals_cs("m_topiclock.so"))
|
||||
has_svstopic_topiclock = plus;
|
||||
else
|
||||
return true;
|
||||
return;
|
||||
|
||||
if (required)
|
||||
{
|
||||
@@ -1025,8 +1012,6 @@ struct IRCDMessageMetadata : IRCDMessage
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1034,7 +1019,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
{
|
||||
IRCDMessageMode(Module *creator) : IRCDMessage(creator, "MODE", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (IRCD->IsChannelValid(params[0]))
|
||||
{
|
||||
@@ -1062,8 +1047,6 @@ struct IRCDMessageMode : IRCDMessage
|
||||
if (u)
|
||||
u->SetModesInternal("%s", params[1].c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1071,10 +1054,9 @@ struct IRCDMessageNick : IRCDMessage
|
||||
{
|
||||
IRCDMessageNick(Module *creator) : IRCDMessage(creator, "NICK", 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->ChangeNick(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1082,27 +1064,25 @@ struct IRCDMessageOperType : IRCDMessage
|
||||
{
|
||||
IRCDMessageOperType(Module *creator) : IRCDMessage(creator, "OPERTYPE", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* opertype is equivalent to mode +o because servers
|
||||
dont do this directly */
|
||||
User *u = source.GetUser();
|
||||
if (!u->HasMode(UMODE_OPER))
|
||||
u->SetModesInternal("+o");
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
struct IRCDMessageRSQuit : IRCDMessage
|
||||
{
|
||||
IRCDMessageRSQuit(Module *creator) : IRCDMessage(creator, "RSQUIT", 1) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Server *s = Server::Find(params[0]);
|
||||
if (!s)
|
||||
return true;
|
||||
return;
|
||||
|
||||
/* On InspIRCd we must send a SQUIT when we recieve RSQUIT for a server we have juped */
|
||||
if (s->HasFlag(SERVER_JUPED))
|
||||
@@ -1111,8 +1091,6 @@ struct IRCDMessageRSQuit : IRCDMessage
|
||||
FOREACH_MOD(I_OnServerQuit, OnServerQuit(s));
|
||||
|
||||
s->Delete(s->GetName() + " " + s->GetUplink()->GetName());
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1120,10 +1098,9 @@ struct IRCDMessageSetIdent : IRCDMessage
|
||||
{
|
||||
IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->SetIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1139,11 +1116,10 @@ struct IRCDMessageServer : IRCDMessage
|
||||
* 3: numeric
|
||||
* 4: desc
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
unsigned int hops = Anope::string(params[2]).is_pos_number_only() ? convertTo<unsigned>(params[2]) : 0;
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], hops, params[4], params[3]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1151,10 +1127,9 @@ struct IRCDMessageTime : IRCDMessage
|
||||
{
|
||||
IRCDMessageTime(Module *creator) : IRCDMessage(creator, "TIME", 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
UplinkSocket::Message(Me) << "TIME " << source.GetSource() << " " << params[1] << " " << Anope::CurTime;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1175,7 +1150,7 @@ struct IRCDMessageUID : IRCDMessage
|
||||
* 8+: modes and params -- IMPORTANT, some modes (e.g. +s) may have parameters. So don't assume a fixed position of realname!
|
||||
* last: realname
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
time_t ts = convertTo<time_t>(params[1]);
|
||||
|
||||
@@ -1186,8 +1161,6 @@ struct IRCDMessageUID : IRCDMessage
|
||||
User *u = new User(params[2], params[5], params[3], params[4], params[6], source.GetServer(), params[params.size() - 1], ts, modes, params[0]);
|
||||
if (u->server->IsSynced() && NickServService)
|
||||
NickServService->Validate(u);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1247,6 +1220,8 @@ class ProtoInspIRCd : public Module
|
||||
Implementation i[] = { I_OnUserNickChange, I_OnServerSync };
|
||||
ModuleManager::Attach(i, this, sizeof(i) / sizeof(Implementation));
|
||||
|
||||
Servers::Capab.insert("NOQUIT");
|
||||
|
||||
if (Config->Numeric.empty())
|
||||
{
|
||||
Anope::string numeric = Servers::TS6_SID_Retrieve();
|
||||
|
||||
@@ -172,7 +172,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
{
|
||||
IRCDMessageCapab(Module *creator) : Message::Capab(creator, "CAPAB") { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params[0].equals_cs("START"))
|
||||
{
|
||||
@@ -184,7 +184,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
UplinkSocket::Message() << "ERROR :Protocol mismatch, no or invalid protocol version given in CAPAB START";
|
||||
Anope::QuitReason = "Protocol mismatch, no or invalid protocol version given in CAPAB START";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
|
||||
/* reset CAPAB */
|
||||
@@ -479,14 +479,14 @@ struct IRCDMessageCapab : Message::Capab
|
||||
UplinkSocket::Message() << "ERROR :m_services_account.so is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "ERROR: Remote server does not have the m_services_account module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!ModeManager::FindUserModeByName(UMODE_PRIV))
|
||||
{
|
||||
UplinkSocket::Message() << "ERROR :m_hidechans.so is not loaded. This is required by Anope";
|
||||
Anope::QuitReason = "ERROR: Remote server does not have the m_hidechans module loaded, and this is required.";
|
||||
Anope::Quitting = true;
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
if (!IRCD->CanSVSHold)
|
||||
Log() << "SVSHOLD missing, Usage disabled until module is loaded.";
|
||||
@@ -498,9 +498,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
Log() << "m_topiclock missing, server side topic locking disabled until module is loaded.";
|
||||
}
|
||||
|
||||
Servers::Capab.insert("NOQUIT");
|
||||
|
||||
return Message::Capab::Run(source, params);
|
||||
Message::Capab::Run(source, params);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -508,16 +506,16 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
{
|
||||
IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (Anope::Match(Me->GetSID(), params[0]) == false)
|
||||
return true;
|
||||
return;
|
||||
|
||||
if (params[1] == "CHGIDENT")
|
||||
{
|
||||
User *u = User::Find(params[2]);
|
||||
if (!u || u->server != Me)
|
||||
return true;
|
||||
return;
|
||||
|
||||
u->SetIdent(params[3]);
|
||||
UplinkSocket::Message(u) << "FIDENT " << params[3];
|
||||
@@ -526,7 +524,7 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
{
|
||||
User *u = User::Find(params[2]);
|
||||
if (!u || u->server != Me)
|
||||
return true;
|
||||
return;
|
||||
|
||||
u->SetDisplayedHost(params[3]);
|
||||
UplinkSocket::Message(u) << "FHOST " << params[3];
|
||||
@@ -535,7 +533,7 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
{
|
||||
User *u = User::Find(params[2]);
|
||||
if (!u || u->server != Me)
|
||||
return true;
|
||||
return;
|
||||
|
||||
u->SetRealname(params[3]);
|
||||
UplinkSocket::Message(u) << "FNAME " << params[3];
|
||||
@@ -578,26 +576,24 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
|
||||
size_t p = decoded.find('\0');
|
||||
if (p == Anope::string::npos)
|
||||
return true;
|
||||
return;
|
||||
decoded = decoded.substr(p + 1);
|
||||
|
||||
p = decoded.find('\0');
|
||||
if (p == Anope::string::npos)
|
||||
return true;
|
||||
return;
|
||||
|
||||
Anope::string acc = decoded.substr(0, p),
|
||||
pass = decoded.substr(p + 1);
|
||||
|
||||
if (acc.empty() || pass.empty())
|
||||
return true;
|
||||
return;
|
||||
|
||||
IdentifyRequest *req = new InspIRCDSASLIdentifyRequest(this->owner, params[2], acc, pass);
|
||||
FOREACH_MOD(I_OnCheckAuthentication, OnCheckAuthentication(NULL, req));
|
||||
req->Dispatch();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -605,10 +601,9 @@ struct IRCDMessageFIdent : IRCDMessage
|
||||
{
|
||||
IRCDMessageFIdent(Module *creator) : IRCDMessage(creator, "FIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->SetIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+13
-26
@@ -178,7 +178,7 @@ struct IRCDMessage005 : IRCDMessage
|
||||
IRCDMessage005(Module *creator) : IRCDMessage(creator, "005", 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
// Please see <http://www.irc.org/tech_docs/005.html> for details.
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
size_t pos;
|
||||
Anope::string parameter, data;
|
||||
@@ -205,7 +205,6 @@ struct IRCDMessage005 : IRCDMessage
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -221,9 +220,8 @@ struct IRCDMessage376 : IRCDMessage
|
||||
*
|
||||
*/
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -248,7 +246,7 @@ struct IRCDMessageChaninfo : IRCDMessage
|
||||
* a channel has no user limit (the parameter <modes> doesn't list the "l"
|
||||
* channel mode). In this case <limit> should be "0".
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
@@ -279,7 +277,6 @@ struct IRCDMessageChaninfo : IRCDMessage
|
||||
}
|
||||
|
||||
c->SetModesInternal(source, modes);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -293,7 +290,7 @@ struct IRCDMessageJoin : Message::Join
|
||||
*
|
||||
* if a user joins a new channel, the ircd sends <channelname>\7<umode>
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *user = source.GetUser();
|
||||
size_t pos = params[0].find('\7');
|
||||
@@ -320,8 +317,6 @@ struct IRCDMessageJoin : Message::Join
|
||||
if (c)
|
||||
c->SetModesInternal(source, modes);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -342,13 +337,13 @@ struct IRCDMessageMetadata : IRCDMessage
|
||||
* - "user": the user name (ident) of a client (can't be empty)
|
||||
*/
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (!u)
|
||||
{
|
||||
Log() << "received METADATA for non-existent user " << params[0];
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (params[1].equals_cs("host"))
|
||||
{
|
||||
@@ -362,7 +357,6 @@ struct IRCDMessageMetadata : IRCDMessage
|
||||
{
|
||||
u->SetVIdent(params[2]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -378,7 +372,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
* params[n] = parameters
|
||||
*/
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Anope::string modes = params[1];
|
||||
|
||||
@@ -399,7 +393,6 @@ struct IRCDMessageMode : IRCDMessage
|
||||
if (u)
|
||||
u->SetModesInternal("%s", params[1].c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -426,7 +419,7 @@ struct IRCDMessageNick : IRCDMessage
|
||||
* params[0] = newnick
|
||||
*
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.size() == 1)
|
||||
{
|
||||
@@ -444,7 +437,6 @@ struct IRCDMessageNick : IRCDMessage
|
||||
{
|
||||
Log(LOG_DEBUG) << "Received NICK with invalid number of parameters. source = " << source.GetName() << "params[0] = " << params[0] << "params.size() = " << params.size();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -463,7 +455,7 @@ struct IRCDMessageNJoin : IRCDMessage
|
||||
*
|
||||
* Received: :dev.anope.de NJOIN #test :DukeP2,@DukeP,%test,+test2
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
std::list<Message::Join::SJoinUser> users;
|
||||
|
||||
@@ -497,8 +489,6 @@ struct IRCDMessageNJoin : IRCDMessage
|
||||
}
|
||||
|
||||
Message::Join::SJoin(source, params[0], 0, "", users);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -511,11 +501,10 @@ struct IRCDMessagePong : IRCDMessage
|
||||
* when receiving a new server and then finish sync once we
|
||||
* get a pong back from that server.
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!source.GetServer()->IsSynced())
|
||||
source.GetServer()->Sync(false);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -549,7 +538,7 @@ struct IRCDMessageServer : IRCDMessage
|
||||
* params[3] = server description
|
||||
*/
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.size() == 3)
|
||||
{
|
||||
@@ -568,7 +557,6 @@ struct IRCDMessageServer : IRCDMessage
|
||||
* get a pong back from that server.
|
||||
*/
|
||||
IRCD->SendPing(Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -577,16 +565,15 @@ struct IRCDMessageTopic : IRCDMessage
|
||||
IRCDMessageTopic(Module *creator) : IRCDMessage(creator, "TOPIC", 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
// Received: :DukeP TOPIC #anope :test
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
if (!c)
|
||||
{
|
||||
Log(LOG_DEBUG) << "TOPIC for nonexistant channel " << params[0];
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
c->ChangeTopicInternal(source.GetName(), params[1], Anope::CurTime);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
{
|
||||
IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/*
|
||||
* Received: :dev.anope.de ENCAP * SU DukePyrolator DukePyrolator
|
||||
@@ -194,7 +194,7 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
FOREACH_MOD(I_OnFingerprint, OnFingerprint(u));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -202,10 +202,9 @@ struct IRCDMessagePass : IRCDMessage
|
||||
{
|
||||
IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
UplinkSID = params[3];
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -215,15 +214,13 @@ struct IRCDMessageServer : IRCDMessage
|
||||
|
||||
/* 0 1 2 */
|
||||
/* SERVER hades.arpa 1 :ircd-hybrid test server */
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* Servers other than our immediate uplink are introduced via SID */
|
||||
if (params[1] != "1")
|
||||
return true;
|
||||
return;
|
||||
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -245,7 +242,7 @@ struct IRCDMessageUID : IRCDMessage
|
||||
params[10] = info
|
||||
*/
|
||||
// :42X UID Adam 1 1348535644 +aow Adam 192.168.0.5 192.168.0.5 42XAAAAAB 0 192.168.0.5 :Adam
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* An IP of 0 means the user is spoofed */
|
||||
Anope::string ip = params[6];
|
||||
@@ -261,8 +258,6 @@ struct IRCDMessageUID : IRCDMessage
|
||||
}
|
||||
else if (user && user->server->IsSynced() && NickServService)
|
||||
NickServService->Validate(user);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
IRCDMessageEncap(Module *creator) : IRCDMessage(creator, "ENCAP", 3) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
// Debug: Received: :00BAAAAAB ENCAP * LOGIN Adam
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params[1] == "LOGIN" || params[1] == "SU")
|
||||
{
|
||||
@@ -102,15 +102,13 @@ struct IRCDMessageEncap : IRCDMessage
|
||||
|
||||
NickCore *nc = NickCore::Find(params[2]);
|
||||
if (!nc)
|
||||
return true;
|
||||
return;
|
||||
u->Login(nc);
|
||||
|
||||
const NickAlias *user_na = NickAlias::Find(u->nick);
|
||||
if (!Config->NoNicknameOwnership && user_na && user_na->nc == nc && user_na->nc->HasFlag(NI_UNCONFIRMED) == false)
|
||||
u->SetMode(NickServ, UMODE_REGISTERED);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -118,10 +116,9 @@ struct IRCDMessagePass : IRCDMessage
|
||||
{
|
||||
IRCDMessagePass(Module *creator) : IRCDMessage(creator, "PASS", 4) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
UplinkSID = params[3];
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -130,14 +127,13 @@ struct IRCDMessageServer : IRCDMessage
|
||||
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
// SERVER hades.arpa 1 :ircd-ratbox test server
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
// Servers other then our immediate uplink are introduced via SID
|
||||
if (params[1] != "1")
|
||||
return true;
|
||||
return;
|
||||
new Server(source.GetServer() == NULL ? Me : source.GetServer(), params[0], 1, params[2], UplinkSID);
|
||||
IRCD->SendPing(Config->ServerName, params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -151,20 +147,18 @@ struct IRCDMessageTBurst : IRCDMessage
|
||||
* params[2] = topic OR who set the topic
|
||||
* params[3] = topic if params[2] isnt the topic
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
time_t topic_time = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime;
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
|
||||
if (!c)
|
||||
return true;
|
||||
return;
|
||||
|
||||
const Anope::string &setter = params.size() == 4 ? params[2] : "",
|
||||
topic = params.size() == 4 ? params[3] : params[2];
|
||||
|
||||
c->ChangeTopicInternal(setter, topic, topic_time);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -173,14 +167,12 @@ struct IRCDMessageUID : IRCDMessage
|
||||
IRCDMessageUID(Module *creator) : IRCDMessage(creator, "UID", 9) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
// :42X UID Adam 1 1348535644 +aow Adam 192.168.0.5 192.168.0.5 42XAAAAAB :Adam
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
/* Source is always the server */
|
||||
User *user = new User(params[0], params[4], params[5], "", params[6], source.GetServer(), params[8], params[2].is_pos_number_only() ? convertTo<time_t>(params[2]) : 0, params[3], params[7]);
|
||||
if (user && user->server->IsSynced() && NickServService)
|
||||
NickServService->Validate(user);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+33
-49
@@ -469,9 +469,16 @@ class ChannelModeFlood : public ChannelModeParam
|
||||
++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. */
|
||||
int v = arg.substr(0, p).is_number_only() ? convertTo<int>(arg.substr(0, p)) : 0;
|
||||
if (v < 1 || v > 999)
|
||||
try
|
||||
{
|
||||
int v = arg.substr(0, p).is_number_only() ? convertTo<int>(arg.substr(0, p)) : 0;
|
||||
if (v < 1 || v > 999)
|
||||
return false;
|
||||
}
|
||||
catch (const ConvertException &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -495,7 +502,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
{
|
||||
IRCDMessageCapab(Module *creator) : Message::Capab(creator, "PROTOCTL") { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
for (unsigned i = 0; i < params.size(); ++i)
|
||||
{
|
||||
@@ -642,7 +649,7 @@ struct IRCDMessageCapab : Message::Capab
|
||||
}
|
||||
}
|
||||
|
||||
return Message::Capab::Run(source, params);
|
||||
Message::Capab::Run(source, params);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -650,12 +657,11 @@ struct IRCDMessageChgHost : IRCDMessage
|
||||
{
|
||||
IRCDMessageChgHost(Module *creator) : IRCDMessage(creator, "CHGHOST", 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (u)
|
||||
u->SetDisplayedHost(params[1]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -663,12 +669,11 @@ struct IRCDMessageChgIdent : IRCDMessage
|
||||
{
|
||||
IRCDMessageChgIdent(Module *creator) : IRCDMessage(creator, "CHGIDENT", 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (u)
|
||||
u->SetVIdent(params[1]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -676,12 +681,11 @@ struct IRCDMessageChgName : IRCDMessage
|
||||
{
|
||||
IRCDMessageChgName(Module *creator) : IRCDMessage(creator, "CHGNAME", 2) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (u)
|
||||
u->SetRealname(params[1]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -689,7 +693,7 @@ struct IRCDMessageMode : IRCDMessage
|
||||
{
|
||||
IRCDMessageMode(Module *creator, const Anope::string &mname) : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
bool server_source = source.GetServer() != NULL;
|
||||
Anope::string modes = params[1];
|
||||
@@ -717,8 +721,6 @@ struct IRCDMessageMode : IRCDMessage
|
||||
if (u)
|
||||
u->SetModesInternal("%s", params[1].c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -736,10 +738,9 @@ struct IRCDMessageNetInfo : IRCDMessage
|
||||
{
|
||||
IRCDMessageNetInfo(Module *creator) : IRCDMessage(creator, "NETINFO", 8) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
UplinkSocket::Message() << "AO " << MaxUserCount << " " << Anope::CurTime << " " << convertTo<int>(params[2]) << " " << params[3] << " 0 0 0 :" << params[7];
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -767,7 +768,7 @@ struct IRCDMessageNick : IRCDMessage
|
||||
** parv[0] = new nickname
|
||||
** parv[1] = hopcount
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (params.size() == 11)
|
||||
{
|
||||
@@ -793,7 +794,7 @@ struct IRCDMessageNick : IRCDMessage
|
||||
if (s == NULL)
|
||||
{
|
||||
Log(LOG_DEBUG) << "User " << params[0] << " introduced from nonexistant server " << params[5] << "?";
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
User *user = new User(params[0], params[3], params[4], vhost, ip, s, params[10], user_ts, params[7]);
|
||||
@@ -823,8 +824,6 @@ struct IRCDMessageNick : IRCDMessage
|
||||
}
|
||||
else
|
||||
source.GetUser()->ChangeNick(params[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -841,11 +840,10 @@ struct IRCDMessagePong : IRCDMessage
|
||||
{
|
||||
IRCDMessagePong(Module *creator) : IRCDMessage(creator, "PONG", 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
if (!source.GetServer()->IsSynced())
|
||||
source.GetServer()->Sync(false);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -888,11 +886,11 @@ struct IRCDMessageSASL : IRCDMessage
|
||||
* Received: :irc.foonet.com SASL services.localhost.net irc.foonet.com!3.56270 C QWRhbQBBZGFtAHF3ZXJ0eQ==
|
||||
* uid base64(account\0account\0pass)
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
size_t p = params[1].find('!');
|
||||
if (!Config->NSSASL || p == Anope::string::npos)
|
||||
return true;
|
||||
return;
|
||||
|
||||
if (params[2] == "S")
|
||||
UplinkSocket::Message() << "SASL " << params[1].substr(0, p) << " " << params[1] << " C +";
|
||||
@@ -903,25 +901,23 @@ struct IRCDMessageSASL : IRCDMessage
|
||||
|
||||
p = decoded.find('\0');
|
||||
if (p == Anope::string::npos)
|
||||
return true;
|
||||
return;
|
||||
decoded = decoded.substr(p + 1);
|
||||
|
||||
p = decoded.find('\0');
|
||||
if (p == Anope::string::npos)
|
||||
return true;
|
||||
return;
|
||||
|
||||
Anope::string acc = decoded.substr(0, p),
|
||||
pass = decoded.substr(p + 1);
|
||||
|
||||
if (acc.empty() || pass.empty())
|
||||
return true;
|
||||
return;
|
||||
|
||||
IdentifyRequest *req = new UnrealSASLIdentifyRequest(this->owner, params[1], acc, pass);
|
||||
FOREACH_MOD(I_OnCheckAuthentication, OnCheckAuthentication(NULL, req));
|
||||
req->Dispatch();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -929,10 +925,9 @@ struct IRCDMessageSDesc : IRCDMessage
|
||||
{
|
||||
IRCDMessageSDesc(Module *creator) : IRCDMessage(creator, "SDESC", 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetServer()->SetDescription(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -940,7 +935,7 @@ struct IRCDMessageSetHost : IRCDMessage
|
||||
{
|
||||
IRCDMessageSetHost(Module *creator) : IRCDMessage(creator, "SETHOST", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
|
||||
@@ -949,8 +944,6 @@ struct IRCDMessageSetHost : IRCDMessage
|
||||
u->SetDisplayedHost(params[0]);
|
||||
else
|
||||
u->SetCloakedHost(params[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -958,11 +951,10 @@ struct IRCDMessageSetIdent : IRCDMessage
|
||||
{
|
||||
IRCDMessageSetIdent(Module *creator) : IRCDMessage(creator, "SETIDENT", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
u->SetVIdent(params[0]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -970,12 +962,11 @@ struct IRCDMessageSetName : IRCDMessage
|
||||
{
|
||||
IRCDMessageSetName(Module *creator) : IRCDMessage(creator, "SETNAME", 1) { }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
if (u)
|
||||
u->SetRealname(params[1]);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -983,7 +974,7 @@ struct IRCDMessageServer : IRCDMessage
|
||||
{
|
||||
IRCDMessageServer(Module *creator) : IRCDMessage(creator, "SERVER", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
unsigned int hops = Anope::string(params[1]).is_pos_number_only() ? convertTo<unsigned>(params[1]) : 0;
|
||||
|
||||
@@ -998,8 +989,6 @@ struct IRCDMessageServer : IRCDMessage
|
||||
new Server(source.GetServer(), params[0], hops, params[2]);
|
||||
|
||||
IRCD->SendPing(Config->ServerName, params[0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1007,7 +996,7 @@ struct IRCDMessageSJoin : IRCDMessage
|
||||
{
|
||||
IRCDMessageSJoin(Module *creator) : IRCDMessage(creator, "SJOIN", 3) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
Anope::string modes;
|
||||
if (params.size() >= 4)
|
||||
@@ -1078,7 +1067,7 @@ struct IRCDMessageSJoin : IRCDMessage
|
||||
Channel *c = Channel::Find(params[1]);
|
||||
|
||||
if (!c || c->creation_time != ts)
|
||||
return true;
|
||||
return;
|
||||
|
||||
ChannelMode *ban = ModeManager::FindChannelModeByName(CMODE_BAN),
|
||||
*except = ModeManager::FindChannelModeByName(CMODE_EXCEPT),
|
||||
@@ -1094,8 +1083,6 @@ struct IRCDMessageSJoin : IRCDMessage
|
||||
for (std::list<Anope::string>::iterator it = invites.begin(), it_end = invites.end(); it != it_end; ++it)
|
||||
c->SetModeInternal(source, invex, *it);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1110,13 +1097,11 @@ struct IRCDMessageTopic : IRCDMessage
|
||||
** parv[2] = topic time
|
||||
** parv[3] = topic text
|
||||
*/
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_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);
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1125,10 +1110,9 @@ struct IRCDMessageUmode2 : IRCDMessage
|
||||
{
|
||||
IRCDMessageUmode2(Module *creator) : IRCDMessage(creator, "UMODE2", 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
|
||||
|
||||
bool Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
void Run(MessageSource &source, const std::vector<Anope::string> ¶ms) anope_override
|
||||
{
|
||||
source.GetUser()->SetModesInternal("%s", params[0].c_str());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ endif(WIN32)
|
||||
|
||||
# If we have eventfd, use it
|
||||
if(HAVE_EVENTFD)
|
||||
append_to_list(SRC_SRCS socketengines/pipeengine_eventfd.cpp)
|
||||
append_to_list(SRC_SRCS socketengines/pipeengine_pipe.cpp)
|
||||
# Else fall back to pipe
|
||||
else(HAVE_EVENTFD)
|
||||
append_to_list(SRC_SRCS socketengines/pipeengine_pipe.cpp)
|
||||
|
||||
+36
-52
@@ -23,13 +23,12 @@
|
||||
|
||||
using namespace Message;
|
||||
|
||||
bool Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Away::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
FOREACH_MOD(I_OnUserAway, OnUserAway(source.GetUser(), params.empty() ? "" : params[0]));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (params.size() == 1)
|
||||
{
|
||||
@@ -41,19 +40,16 @@ bool Capab::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
else
|
||||
for (unsigned i = 0; i < params.size(); ++i)
|
||||
Servers::Capab.insert(params[i]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Error::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Error::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Log(LOG_TERMINAL) << "ERROR: " << params[0];
|
||||
Anope::QuitReason = "Received ERROR from uplink: " + params[0];
|
||||
Anope::Quitting = true;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *user = source.GetUser();
|
||||
const Anope::string &channels = params[0];
|
||||
@@ -85,8 +81,6 @@ bool Join::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
Channel *chan = Channel::Find(channel);
|
||||
SJoin(source, channel, chan ? chan->creation_time : Anope::CurTime, "", users);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, const Anope::string &modes, const std::list<SJoinUser> &users)
|
||||
@@ -154,7 +148,7 @@ void Join::SJoin(MessageSource &source, const Anope::string &chan, time_t ts, co
|
||||
}
|
||||
}
|
||||
|
||||
bool Kick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Kick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
const Anope::string &channel = params[0];
|
||||
const Anope::string &users = params[1];
|
||||
@@ -162,23 +156,22 @@ bool Kick::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
|
||||
Channel *c = Channel::Find(channel);
|
||||
if (!c)
|
||||
return true;
|
||||
return;
|
||||
|
||||
Anope::string user;
|
||||
commasepstream sep(users);
|
||||
|
||||
while (sep.GetToken(user))
|
||||
c->KickInternal(source, user, reason);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
BotInfo *bi;
|
||||
|
||||
if (!u)
|
||||
return true;
|
||||
return;
|
||||
|
||||
/* Recover if someone kills us. */
|
||||
if (u->server == Me && (bi = dynamic_cast<BotInfo *>(u)))
|
||||
@@ -189,7 +182,7 @@ bool Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Anope::QuitReason = "Kill loop detected. Are Services U:Lined?";
|
||||
Anope::Quitting = true;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
last_time = Anope::CurTime;
|
||||
|
||||
@@ -202,11 +195,9 @@ bool Kill::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
}
|
||||
else
|
||||
u->KillInternal(source.GetSource(), params[1]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Message::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Message::Mode::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
if (IRCD->IsChannelValid(params[0]))
|
||||
{
|
||||
@@ -222,16 +213,14 @@ bool Message::Mode::Run(MessageSource &source, const std::vector<Anope::string>
|
||||
if (u)
|
||||
u->SetModesInternal("%s", params[1].c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* XXX We should cache the file somewhere not open/read/close it on every request */
|
||||
bool MOTD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void MOTD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Server *s = Server::Find(params[0]);
|
||||
if (s != Me)
|
||||
return true;
|
||||
return;
|
||||
|
||||
FILE *f = fopen(Config->MOTDFilename.c_str(), "r");
|
||||
if (f)
|
||||
@@ -248,11 +237,9 @@ bool MOTD::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
}
|
||||
else
|
||||
IRCD->SendNumeric(422, source.GetSource(), ":- MOTD file not found! Please contact your IRC administrator.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Part::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Part::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
const Anope::string &reason = params.size() > 1 ? params[1] : "";
|
||||
@@ -273,17 +260,14 @@ bool Part::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
c->DeleteUser(u);
|
||||
FOREACH_MOD(I_OnPartChannel, OnPartChannel(u, c, ChannelName, !reason.empty() ? reason : ""));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Ping::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Ping::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
IRCD->SendPong(params.size() > 1 ? params[1] : Me->GetSID(), params[0]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
const Anope::string &receiver = params[0];
|
||||
Anope::string message = params[1];
|
||||
@@ -309,16 +293,16 @@ bool Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m
|
||||
Anope::string servername(receiver.begin() + s + 1, receiver.end());
|
||||
botname = botname.substr(0, s);
|
||||
if (!servername.equals_ci(Config->ServerName))
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
else if (Config->UseStrictPrivMsg)
|
||||
{
|
||||
const BotInfo *bi = BotInfo::Find(receiver);
|
||||
if (!bi)
|
||||
return true;
|
||||
return;
|
||||
Log(LOG_DEBUG) << "Ignored PRIVMSG without @ from " << u->nick;
|
||||
u->SendMessage(bi, _("\"/msg %s\" is no longer supported. Use \"/msg %s@%s\" or \"/%s\" instead."), bi->nick.c_str(), bi->nick.c_str(), Config->ServerName.c_str(), bi->nick.c_str());
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
BotInfo *bi = BotInfo::Find(botname);
|
||||
@@ -328,7 +312,7 @@ bool Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m
|
||||
EventReturn MOD_RESULT;
|
||||
FOREACH_RESULT(I_OnBotPrivmsg, OnBotPrivmsg(u, bi, message));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return true;
|
||||
return;
|
||||
|
||||
if (message[0] == '\1' && message[message.length() - 1] == '\1')
|
||||
{
|
||||
@@ -344,17 +328,17 @@ bool Privmsg::Run(MessageSource &source, const std::vector<Anope::string> ¶m
|
||||
Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
|
||||
IRCD->SendCTCP(bi, u->nick, "VERSION Anope-%s %s :%s - (%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), IRCD->GetProtocolName().c_str(), enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str());
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bi->OnMessage(u, message);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
const Anope::string &reason = params[0];
|
||||
User *user = source.GetUser();
|
||||
@@ -370,27 +354,27 @@ bool Quit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
FOREACH_MOD(I_OnUserQuit, OnUserQuit(user, reason));
|
||||
delete user;
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void SQuit::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Server *s = Server::Find(params[0]);
|
||||
|
||||
if (!s)
|
||||
{
|
||||
Log() << "SQUIT for nonexistent server " << params[0];
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
FOREACH_MOD(I_OnServerQuit, OnServerQuit(s));
|
||||
|
||||
s->Delete(s->GetName() + " " + s->GetUplink()->GetName());
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = source.GetUser();
|
||||
|
||||
@@ -438,10 +422,10 @@ bool Stats::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
IRCD->SendNumeric(219, source.GetSource(), "%c :End of /STATS report.", params[0][0]);
|
||||
}
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
time_t t;
|
||||
time(&t);
|
||||
@@ -449,26 +433,26 @@ bool Time::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
char buf[64];
|
||||
strftime(buf, sizeof(buf), "%a %b %d %H:%M:%S %Y %Z", tm);
|
||||
IRCD->SendNumeric(391, source.GetSource(), "%s :%s", Config->ServerName.c_str(), buf);
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Topic::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Channel *c = Channel::Find(params[0]);
|
||||
if (c)
|
||||
c->ChangeTopicInternal(source.GetSource(), params[1], Anope::CurTime);
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool Version::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Version::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
Module *enc = ModuleManager::FindFirstOf(ENCRYPTION);
|
||||
IRCD->SendNumeric(351, source.GetSource(), "Anope-%s %s :%s -(%s) -- %s", Anope::Version().c_str(), Config->ServerName.c_str(), IRCD->GetProtocolName().c_str(), enc ? enc->name.c_str() : "unknown", Anope::VersionBuildString().c_str());
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
bool Whois::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
void Whois::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
{
|
||||
User *u = User::Find(params[0]);
|
||||
|
||||
@@ -486,6 +470,6 @@ bool Whois::Run(MessageSource &source, const std::vector<Anope::string> ¶ms)
|
||||
else
|
||||
IRCD->SendNumeric(401, source.GetSource(), "%s :No such user.", params[0].c_str());
|
||||
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
+6
-3
@@ -75,8 +75,13 @@ void Anope::Process(const Anope::string &buffer)
|
||||
}
|
||||
|
||||
static const Anope::string proto_name = ModuleManager::FindFirstOf(PROTOCOL) ? ModuleManager::FindFirstOf(PROTOCOL)->name : "";
|
||||
|
||||
MessageSource src(source);
|
||||
|
||||
// event
|
||||
EventReturn MOD_RESULT;
|
||||
FOREACH_RESULT(I_OnMessage, OnMessage(src, command, params));
|
||||
if (MOD_RESULT == EVENT_STOP)
|
||||
return;
|
||||
|
||||
ServiceReference<IRCDMessage> m("IRCDMessage", proto_name + "/" + command.lower());
|
||||
if (!m)
|
||||
@@ -85,8 +90,6 @@ void Anope::Process(const Anope::string &buffer)
|
||||
return;
|
||||
}
|
||||
|
||||
MessageSource src(source);
|
||||
|
||||
if (m->HasFlag(IRCDMESSAGE_SOFT_LIMIT) ? (params.size() < m->GetParamCount()) : (params.size() != m->GetParamCount()))
|
||||
Log(LOG_DEBUG) << "invalid parameters for " << command << ": " << params.size() << " != " << m->GetParamCount();
|
||||
else if (m->HasFlag(IRCDMESSAGE_REQUIRE_USER) && !src.GetUser())
|
||||
|
||||
@@ -27,7 +27,11 @@ Pipe::Pipe() : Socket(-1), write_pipe(-1)
|
||||
flags = fcntl(fds[1], F_GETFL, 0);
|
||||
fcntl(fds[1], F_SETFL, flags | O_NONBLOCK);
|
||||
|
||||
this->~Pipe();
|
||||
SocketEngine::Change(this, false, SF_READABLE);
|
||||
SocketEngine::Change(this, false, SF_WRITABLE);
|
||||
anope_close(this->sock);
|
||||
this->io->Destroy();
|
||||
SocketEngine::Sockets.erase(this->sock);
|
||||
|
||||
this->sock = fds[0];
|
||||
this->write_pipe = fds[1];
|
||||
|
||||
Reference in New Issue
Block a user