1
0
mirror of https://github.com/anope/anope.git synced 2026-07-01 01:46:39 +02:00

added protocol support for incoming NOTICEs

This commit is contained in:
DukePyrolator
2013-07-08 05:05:13 +02:00
parent e957c7b2d2
commit 2ea594d677
11 changed files with 66 additions and 22 deletions
+10 -3
View File
@@ -9,14 +9,14 @@
* Based on the original code of Services by Andy Church.
*
*/
#include "protocol.h"
/* Common IRCD messages.
* Protocol modules may chose to include some, none, or all of these handlers
* as they see fit.
*/
namespace Message
{
@@ -94,6 +94,13 @@ namespace Message
void Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
};
struct CoreExport Notice : IRCDMessage
{
Notice(Module *creator, const Anope::string &mname = "NOTICE") : IRCDMessage(creator, mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
void Run(MessageSource &source, const std::vector<Anope::string> &params) 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); }
+7
View File
@@ -973,6 +973,13 @@ class CoreExport Module : public Extensible
*/
virtual EventReturn OnBotPrivmsg(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
/** Called when we receive a NOTICE for one of our clients
* @param u The user sending the NOTICE
* @param bi The target of the NOTICE
* @param message The message
*/
virtual void OnBotNotice(User *u, BotInfo *bi, Anope::string &message) { throw NotImplementedException(); }
/** Called when we receive a PRIVMSG for a registered channel we are in
* @param u The source of the message
* @param c The channel
+2 -1
View File
@@ -484,6 +484,7 @@ class ProtoBahamut : public Module
Message::Kick message_kick;
Message::Kill message_kill;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg;
@@ -543,7 +544,7 @@ class ProtoBahamut : public Module
ProtoBahamut(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_away(this), message_capab(this), message_error(this), message_invite(this),
message_join(this), message_kick(this), message_kill(this), message_motd(this),
message_join(this), message_kick(this), message_kill(this), message_motd(this), message_notice(this),
message_part(this), message_ping(this), message_privmsg(this), message_quit(this),
message_squit(this), message_stats(this), message_time(this), message_version(this), message_whois(this),
+4 -3
View File
@@ -335,6 +335,7 @@ class ProtoCharybdis : public Module
Message::Kill message_kill;
Message::Mode message_mode;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg;
@@ -394,9 +395,9 @@ class ProtoCharybdis : public Module
ProtoCharybdis(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this),
message_kill(this), message_mode(this), message_motd(this), message_part(this), message_ping(this),
message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this),
message_topic(this), message_version(this), message_whois(this),
message_kill(this), message_mode(this), message_motd(this), message_notice(this), message_part(this),
message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this),
message_time(this), message_topic(this), message_version(this), message_whois(this),
message_bmask("IRCDMessage", "charybdis/bmask", "ratbox/bmask"),
message_join("IRCDMessage", "charybdis/join", "ratbox/join"),
+8 -3
View File
@@ -1281,6 +1281,7 @@ class ProtoInspIRCd : public Module
Message::Kick message_kick;
Message::Kill message_kill;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg;
@@ -1314,8 +1315,8 @@ class ProtoInspIRCd : public Module
ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this), ssl(this, "ssl"),
message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this), message_kill(this),
message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this), message_squit(this),
message_stats(this), message_topic(this),
message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this),
message_squit(this), message_stats(this), message_topic(this),
message_chgident(this), message_setname(this, "SETNAME"), message_chgname(this, "FNAME"), message_capab(this), message_endburst(this),
message_fhost(this, "FHOST"), message_sethost(this, "SETHOST"), message_fjoin(this), message_fmode(this), message_ftopic(this),
@@ -1342,8 +1343,12 @@ class ProtoInspIRCd : public Module
{
/* InspIRCd 1.2 doesn't set -r on nick change, remove -r here. Note that if we have to set +r later
* this will cancel out this -r, resulting in no mode changes.
*
* Do not set -r if we dont have a NickServ loaded - DP
*/
u->RemoveMode(Config->GetClient("NickServ"), "REGISTERED");
BotInfo *NickServ = Config->GetClient("NickServ");
if (NickServ)
u->RemoveMode(NickServ, "REGISTERED");
}
};
+3 -2
View File
@@ -674,6 +674,7 @@ class ProtoInspIRCd : public Module
Message::Kick message_kick;
Message::Kill message_kill;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg;
@@ -704,8 +705,8 @@ class ProtoInspIRCd : public Module
ProtoInspIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this),
message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this),
message_quit(this), message_squit(this), message_stats(this), message_topic(this),
message_kill(this), message_motd(this), message_notice(this), message_part(this), message_ping(this),
message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_topic(this),
message_endburst("IRCDMessage", "inspircd20/endburst", "inspircd12/endburst"),
message_fhost("IRCDMessage", "inspircd20/fhost", "inspircd12/fhost"),
+4 -2
View File
@@ -573,6 +573,7 @@ class ProtongIRCd : public Module
Message::Kick message_kick;
Message::Kill message_kill;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg, message_squery;
@@ -644,8 +645,9 @@ class ProtongIRCd : public Module
ProtongIRCd(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_capab(this), message_error(this), message_invite(this), message_kick(this), message_kill(this),
message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_squery(this, "SQUERY"),
message_quit(this), message_squit(this), message_stats(this), message_time(this), message_version(this),
message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this),
message_squery(this, "SQUERY"), message_quit(this), message_squit(this), message_stats(this), message_time(this),
message_version(this),
message_005(this), message_376(this), message_chaninfo(this), message_join(this), message_metadata(this),
message_mode(this), message_nick(this), message_njoin(this), message_pong(this), message_server(this),
+4 -2
View File
@@ -299,6 +299,7 @@ class ProtoPlexus : public Module
Message::Kill message_kill;
Message::Mode message_mode;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg;
@@ -353,8 +354,9 @@ class ProtoPlexus : public Module
ProtoPlexus(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this), message_kill(this),
message_mode(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this), message_quit(this),
message_squit(this), message_stats(this), message_time(this), message_topic(this), message_version(this), message_whois(this),
message_mode(this), message_motd(this), message_notice(this), message_part(this), message_ping(this), message_privmsg(this),
message_quit(this), message_squit(this), message_stats(this), message_time(this), message_topic(this), message_version(this),
message_whois(this),
message_bmask("IRCDMessage", "plexus/bmask", "hybrid/bmask"), message_eob("IRCDMessage", "plexus/eob", "hybrid/eob"),
message_join("IRCDMessage", "plexus/join", "hybrid/join"), message_nick("IRCDMessage", "plexus/nick", "hybrid/nick"),
+4 -3
View File
@@ -192,6 +192,7 @@ class ProtoRatbox : public Module
Message::Kill message_kill;
Message::Mode message_mode;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg;
@@ -236,9 +237,9 @@ class ProtoRatbox : public Module
ProtoRatbox(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_away(this), message_capab(this), message_error(this), message_invite(this), message_kick(this),
message_kill(this), message_mode(this), message_motd(this), message_part(this), message_ping(this),
message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this),
message_topic(this), message_version(this), message_whois(this),
message_kill(this), message_mode(this), message_motd(this), message_notice(this), message_part(this),
message_ping(this), message_privmsg(this), message_quit(this), message_squit(this), message_stats(this),
message_time(this), message_topic(this), message_version(this), message_whois(this),
message_bmask("IRCDMessage", "ratbox/bmask", "hybrid/bmask"), message_join("IRCDMessage", "ratbox/join", "hybrid/join"),
message_nick("IRCDMessage", "ratbox/nick", "hybrid/nick"), message_pong("IRCDMessage", "ratbox/pong", "hybrid/pong"),
+4 -3
View File
@@ -1124,6 +1124,7 @@ class ProtoUnreal : public Module
Message::Kick message_kick;
Message::Kill message_kill;
Message::MOTD message_motd;
Message::Notice message_notice;
Message::Part message_part;
Message::Ping message_ping;
Message::Privmsg message_privmsg;
@@ -1197,9 +1198,9 @@ class ProtoUnreal : public Module
ProtoUnreal(const Anope::string &modname, const Anope::string &creator) : Module(modname, creator, PROTOCOL | VENDOR),
ircd_proto(this),
message_away(this), message_error(this), message_invite(this), message_join(this), message_kick(this),
message_kill(this), message_motd(this), message_part(this), message_ping(this), message_privmsg(this),
message_quit(this), message_squit(this), message_stats(this), message_time(this), message_version(this),
message_whois(this),
message_kill(this), message_motd(this), message_notice(this), message_part(this), message_ping(this),
message_privmsg(this), message_quit(this), message_squit(this), message_stats(this), message_time(this),
message_version(this), message_whois(this),
message_capab(this), message_chghost(this), message_chgident(this), message_chgname(this), message_mode(this, "MODE"),
message_svsmode(this, "SVSMODE"), message_svs2mode(this, "SVS2MODE"), message_netinfo(this), message_nick(this), message_pong(this),
+16
View File
@@ -244,6 +244,22 @@ void MOTD::Run(MessageSource &source, const std::vector<Anope::string> &params)
IRCD->SendNumeric(422, source.GetSource(), ":- MOTD file not found! Please contact your IRC administrator.");
}
void Notice::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
Anope::string message = params[1];
User *u = source.GetUser();
/* ignore channel notices */
if (!IRCD->IsChannelValid(params[0]))
{
BotInfo *bi = BotInfo::Find(params[0]);
if (!bi)
return;
FOREACH_MOD(OnBotNotice, (u, bi, message));
}
}
void Part::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
User *u = source.GetUser();