summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2012-10-01 01:56:57 -0400
committerAdam <Adam@anope.org>2012-10-01 01:56:57 -0400
commit89428a9d1032e3c2a6e397629a32862b3e58d708 (patch)
treed507904b3fa1cc084f0f3e688c839bcdd47f79d7 /include
parentb937d6310d9a7c0e2434200306b63d513cb2ae61 (diff)
Cleanup of all of the protocol modules, rewrote message handling system to be a bit more C++ ish
Diffstat (limited to 'include')
-rw-r--r--include/anope.h6
-rw-r--r--include/channels.h17
-rw-r--r--include/defs.h1
-rw-r--r--include/extern.h28
-rw-r--r--include/messages.h119
-rw-r--r--include/module.h1
-rw-r--r--include/modules.h25
-rw-r--r--include/protocol.h130
-rw-r--r--include/servers.h8
-rw-r--r--include/users.h24
10 files changed, 222 insertions, 137 deletions
diff --git a/include/anope.h b/include/anope.h
index e67fafc8d..3c13d68ab 100644
--- a/include/anope.h
+++ b/include/anope.h
@@ -324,12 +324,6 @@ namespace Anope
*/
extern CoreExport bool Match(const string &str, const string &mask, bool case_sensitive = false, bool use_regex = false);
- /** Find a message in the message table
- * @param name The name of the message were looking for
- * @return NULL if we cant find it, or a pointer to the Message if we can
- */
- extern CoreExport std::vector<Message *> FindMessage(const string &name);
-
/** Converts a string to hex
* @param the data to be converted
* @return a anope::string containing the hex value
diff --git a/include/channels.h b/include/channels.h
index b64ae84f4..7dee744c2 100644
--- a/include/channels.h
+++ b/include/channels.h
@@ -140,7 +140,7 @@ class CoreExport Channel : public virtual Base, public Extensible, public Flags<
* @param param The param
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
*/
- void SetModeInternal(User *setter, ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
+ void SetModeInternal(MessageSource &source, ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
/** Remove a mode internally on a channel, this is not sent out to the IRCd
* @param setter The Setter
@@ -148,7 +148,7 @@ class CoreExport Channel : public virtual Base, public Extensible, public Flags<
* @param param The param
* @param EnforceMLock true if mlocks should be enforced, false to override mlock
*/
- void RemoveModeInternal(User *setter, ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
+ void RemoveModeInternal(MessageSource &source, ChannelMode *cm, const Anope::string &param = "", bool EnforceMLock = true);
/** Set a mode on a channel
* @param bi The client setting the modes
@@ -199,18 +199,18 @@ class CoreExport Channel : public virtual Base, public Extensible, public Flags<
void SetModes(BotInfo *bi, bool EnforceMLock, const char *cmodes, ...);
/** Set a string of modes internally on a channel
- * @param setter the setter (if it is a user)
+ * @param source The setter
* @param mode the modes
* @param EnforceMLock true to enforce mlock
*/
- void SetModesInternal(User *setter, const Anope::string &mode, bool EnforceMLock = true);
+ void SetModesInternal(MessageSource &source, const Anope::string &mode, time_t ts = Anope::CurTime, bool EnforceMLock = true);
/** Kick a user from a channel internally
* @param source The sender of the kick
* @param nick The nick being kicked
* @param reason The reason for the kick
*/
- void KickInternal(const Anope::string &source, const Anope::string &nick, const Anope::string &reason);
+ void KickInternal(MessageSource &source, const Anope::string &nick, const Anope::string &reason);
/** Kick a user from the channel
* @param bi The sender, can be NULL for the service bot for this channel
@@ -228,7 +228,7 @@ class CoreExport Channel : public virtual Base, public Extensible, public Flags<
Anope::string GetModes(bool complete, bool plus);
/** Update the topic of the channel internally, and reset it if topiclock etc says to
- * @param user THe user setting the new topic
+ * @param user The user setting the new topic
* @param newtopic The new topic
* @param ts The time the new topic is being set
*/
@@ -250,11 +250,6 @@ extern CoreExport Channel *findchan(const Anope::string &chan);
extern CoreExport User *nc_on_chan(Channel *c, const NickCore *nc);
-extern CoreExport void do_cmode(const Anope::string &source, const Anope::string &channel, const Anope::string &modes, const Anope::string &ts);
-extern CoreExport void do_join(const Anope::string &source, const Anope::string &channels, const Anope::string &ts);
-extern CoreExport void do_kick(const Anope::string &source, const Anope::string &channel, const Anope::string &users, const Anope::string &reason);
-extern CoreExport void do_part(const Anope::string &source, const Anope::string &channels, const Anope::string &reason);
-
extern CoreExport void chan_set_correct_modes(const User *user, Channel *c, int give_modes, bool check_noop);
#endif // CHANNELS_H
diff --git a/include/defs.h b/include/defs.h
index 2df0a2c15..d58f7fed6 100644
--- a/include/defs.h
+++ b/include/defs.h
@@ -49,6 +49,7 @@ struct BadWord;
struct DNSQuery;
struct Exception;
struct MemoInfo;
+struct MessageSource;
struct ModeLock;
struct Oper;
diff --git a/include/extern.h b/include/extern.h
index 5eb7dcb58..e8a47c209 100644
--- a/include/extern.h
+++ b/include/extern.h
@@ -71,34 +71,6 @@ E int CurrentUplink;
E void save_databases();
E void sighandler(int signum);
-/**** messages.cpp ****/
-
-E void init_core_messages();
-
-E bool OnStats(const Anope::string &source, const std::vector<Anope::string> &);
-E bool OnTime(const Anope::string &source, const std::vector<Anope::string> &);
-E bool OnVersion(const Anope::string &source, const std::vector<Anope::string> &);
-
-E bool On436(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnAway(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnJoin(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnKick(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnKill(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnMode(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnNick(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnUID(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnPart(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnPing(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnPrivmsg(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnQuit(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnServer(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnSQuit(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnTopic(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnWhois(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnCapab(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnSJoin(const Anope::string &, const std::vector<Anope::string> &);
-E bool OnError(const Anope::string &, const std::vector<Anope::string> &);
-
/**** misc.c ****/
E bool IsFile(const Anope::string &filename);
diff --git a/include/messages.h b/include/messages.h
new file mode 100644
index 000000000..115f659af
--- /dev/null
+++ b/include/messages.h
@@ -0,0 +1,119 @@
+#include "protocol.h"
+
+/* Common IRCD messages.
+ * Protocol modules may chose to include some, none, or all of these handlers
+ * as they see fit.
+ */
+
+struct CoreIRCDMessageAway : IRCDMessage
+{
+ CoreIRCDMessageAway(const Anope::string &mname = "AWAY") : IRCDMessage(mname, 0) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageCapab : IRCDMessage
+{
+ CoreIRCDMessageCapab(const Anope::string &mname = "CAPAB") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageError : IRCDMessage
+{
+ CoreIRCDMessageError(const Anope::string &mname = "ERROR") : IRCDMessage(mname, 1) { }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageJoin : IRCDMessage
+{
+ CoreIRCDMessageJoin(const Anope::string &mname = "JOIN") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageKill : IRCDMessage
+{
+ CoreIRCDMessageKill(const Anope::string &mname = "KILL") : IRCDMessage(mname, 2) { }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageMOTD : IRCDMessage
+{
+ CoreIRCDMessageMOTD(const Anope::string &mname = "MOTD") : IRCDMessage(mname, 1) { }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessagePart : IRCDMessage
+{
+ CoreIRCDMessagePart(const Anope::string &mname = "PART") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessagePing : IRCDMessage
+{
+ CoreIRCDMessagePing(const Anope::string &mname = "PING") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessagePrivmsg : IRCDMessage
+{
+ CoreIRCDMessagePrivmsg(const Anope::string &mname = "PRIVMSG") : IRCDMessage(mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageQuit : IRCDMessage
+{
+ CoreIRCDMessageQuit(const Anope::string &mname = "QUIT") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageSQuit : IRCDMessage
+{
+ CoreIRCDMessageSQuit(const Anope::string &mname = "SQUIT") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_SERVER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageStats : IRCDMessage
+{
+ CoreIRCDMessageStats(const Anope::string &mname = "STATS") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_REQUIRE_USER); SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageTime : IRCDMessage
+{
+ CoreIRCDMessageTime(const Anope::string &mname = "TIME") : IRCDMessage(mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageTopic : IRCDMessage
+{
+ CoreIRCDMessageTopic(const Anope::string &mname = "TOPIC") : IRCDMessage(mname, 2) { SetFlag(IRCDMESSAGE_REQUIRE_USER); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageVersion : IRCDMessage
+{
+ CoreIRCDMessageVersion(const Anope::string &mname = "VERSION") : IRCDMessage(mname, 0) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
+struct CoreIRCDMessageWhois : IRCDMessage
+{
+ CoreIRCDMessageWhois(const Anope::string &mname = "WHOIS") : IRCDMessage(mname, 1) { SetFlag(IRCDMESSAGE_SOFT_LIMIT); }
+
+ bool Run(MessageSource &source, const std::vector<Anope::string> &params) anope_override;
+};
+
diff --git a/include/module.h b/include/module.h
index 6865a2c17..bba901741 100644
--- a/include/module.h
+++ b/include/module.h
@@ -31,6 +31,7 @@
#include "logger.h"
#include "mail.h"
#include "memo.h"
+#include "messages.h"
#include "modes.h"
#include "modules.h"
#include "oper.h"
diff --git a/include/modules.h b/include/modules.h
index 939b98b34..9d3d701e3 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -141,9 +141,6 @@ enum Priority { PRIORITY_FIRST, PRIORITY_DONTCARE, PRIORITY_LAST, PRIORITY_BEFOR
/* Module types, in the order in which they are unloaded. The order these are in is IMPORTANT */
enum ModType { MT_BEGIN, THIRD, SUPPORTED, CORE, DATABASE, ENCRYPTION, PROTOCOL, MT_END };
-typedef std::multimap<Anope::string, Message *> message_map;
-extern CoreExport message_map MessageMap;
-
extern CoreExport std::list<Module *> Modules;
class ModuleVersion
@@ -268,7 +265,7 @@ class CoreExport Module : public Extensible
* @param source The nick of the sender.
* @param kickmsg The reason for the kick.
*/
- virtual void OnUserKicked(Channel *c, User *target, const Anope::string &source, const Anope::string &kickmsg) { }
+ virtual void OnUserKicked(Channel *c, User *target, MessageSource &source, const Anope::string &kickmsg) { }
/** Called when Services' configuration has been loaded.
*/
@@ -439,7 +436,7 @@ class CoreExport Module : public Extensible
* @param setter The user who set the new topic
* @param topic The new topic
*/
- virtual void OnTopicUpdated(Channel *c, User *setter, const Anope::string &topic) { }
+ virtual void OnTopicUpdated(Channel *c, const Anope::string &user, const Anope::string &topic) { }
/** Called before a channel expires
* @param ci The channel
@@ -828,21 +825,21 @@ class CoreExport Module : public Extensible
/** Called when a mode is set on a channel
* @param c The channel
- * @param setter The user who is setting the mode
+ * @param setter The user or server that is setting the mode
* @param Name The mode name
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
- virtual EventReturn OnChannelModeSet(Channel *c, User *setter, ChannelModeName Name, const Anope::string &param) { return EVENT_CONTINUE; }
+ virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelModeName Name, const Anope::string &param) { return EVENT_CONTINUE; }
/** Called when a mode is unset on a channel
* @param c The channel
- * @param setter the user who is unsetting the mode
+ * @param setter The user or server that is unsetting the mode
* @param Name The mode name
* @param param The mode param, if there is one
* @return EVENT_STOP to make mlock/secureops etc checks not happen
*/
- virtual EventReturn OnChannelModeUnset(Channel *c, User *setter, ChannelModeName Name, const Anope::string &param) { return EVENT_CONTINUE; }
+ virtual EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelModeName Name, const Anope::string &param) { return EVENT_CONTINUE; }
/** Called when a mode is set on a user
* @param u The user
@@ -1121,14 +1118,4 @@ class CoreExport CallBack : public Timer
virtual ~CallBack();
};
-class CoreExport Message
-{
-public:
- Anope::string name;
- bool (*func)(const Anope::string &source, const std::vector<Anope::string> &params);
-
- Message(const Anope::string &n, bool (*f)(const Anope::string &, const std::vector<Anope::string> &));
- ~Message();
-};
-
#endif // MODULES_H
diff --git a/include/protocol.h b/include/protocol.h
index 5fb9da403..d4ff79082 100644
--- a/include/protocol.h
+++ b/include/protocol.h
@@ -17,39 +17,15 @@
#include "services.h"
#include "anope.h"
-/* Protocol tweaks */
-
-struct IRCDVar
-{
- const char *name; /* Name of the IRCd command */
- const char *pseudoclient_mode; /* Mode used by BotServ Bots */
- int svsnick; /* Supports SVSNICK */
- int vhost; /* Supports vhost */
- int snline; /* Supports SNline */
- int sqline; /* Supports SQline */
- int szline; /* Supports SZline */
- int join2msg; /* Join 2 Message */
- int chansqline; /* Supports Channel Sqlines */
- int quitonkill; /* IRCD sends QUIT when kill */
- int vident; /* Supports vidents */
- int svshold; /* Supports svshold */
- int tsonmode; /* Timestamp on mode changes */
- int omode; /* On the fly o:lines */
- int umode; /* change user modes */
- int knock_needs_i; /* Check if we needed +i when setting NOKNOCK */
- int svsmode_ucmode; /* Can remove User Channel Modes with SVSMODE */
- int sglineenforce;
- int ts6; /* ircd is TS6 */
- const char *globaltldprefix; /* TLD prefix used for Global */
- unsigned maxmodes; /* Max modes to send per line */
- int certfp; /* IRCd sends a SSL users certificate fingerprint */
-};
-
-
class CoreExport IRCDProto
{
+ Anope::string proto_name;
+
+ IRCDProto() { }
protected:
- virtual void SendSVSKillInternal(const BotInfo *, const User *, const Anope::string &);
+ IRCDProto(const Anope::string &proto_name);
+
+ virtual void SendSVSKillInternal(const BotInfo *, User *, const Anope::string &);
virtual void SendModeInternal(const BotInfo *, const Channel *, const Anope::string &);
virtual void SendModeInternal(const BotInfo *, const User *, const Anope::string &) = 0;
virtual void SendKickInternal(const BotInfo *, const Channel *, const User *, const Anope::string &);
@@ -62,14 +38,40 @@ class CoreExport IRCDProto
virtual void SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf);
virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf);
public:
- virtual ~IRCDProto() { }
+ virtual ~IRCDProto();
+
+ const Anope::string &GetProtocolName();
+ /* Modes used by default by our clients */
+ Anope::string DefaultPseudoclientModes;
+ /* Can we force change a users's nick */
+ bool CanSVSNick;
+ /* Can we set vhosts/vidents on users? */
+ bool CanSetVHost, CanSetVIdent;
+ /* Can we ban specific gecos from being used? */
+ bool CanSNLine;
+ /* Can we ban specific nicknames from being used? */
+ bool CanSQLine;
+ /* Can we ban sepcific channel names from being used? */
+ bool CanSQLineChannel;
+ /* Can we ban by IP? */
+ bool CanSZLine;
+ /* Can we place temporary holds on specific nicknames? */
+ bool CanSVSHold;
+ /* See os_oline */
+ bool CanSVSO;
+ /* See ns_cert */
+ bool CanCertFP;
+ /* Whether this IRCd requires unique IDs for each user or server. See TS6/P10. */
+ bool RequiresID;
+ /* The maximum number of modes we are allowed to set with one MODE command */
+ unsigned MaxModes;
virtual void SendSVSNOOP(const Server *, bool) { }
virtual void SendTopic(BotInfo *, Channel *);
virtual void SendVhostDel(User *) { }
virtual void SendAkill(User *, XLine *) = 0;
virtual void SendAkillDel(const XLine *) = 0;
- virtual void SendSVSKill(const BotInfo *source, const User *user, const char *fmt, ...);
+ virtual void SendSVSKill(const BotInfo *source, User *user, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const Channel *dest, const char *fmt, ...);
virtual void SendMode(const BotInfo *bi, const User *u, const char *fmt, ...);
virtual void SendClientIntroduction(const User *u) = 0;
@@ -78,8 +80,8 @@ class CoreExport IRCDProto
virtual void SendNotice(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendAction(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
virtual void SendPrivmsg(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...);
- virtual void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg);
- virtual void SendGlobalPrivmsg(const BotInfo *bi, const Server *desc, const Anope::string &msg);
+ virtual void SendGlobalNotice(const BotInfo *bi, const Server *dest, const Anope::string &msg) = 0;
+ virtual void SendGlobalPrivmsg(const BotInfo *bi, const Server *desc, const Anope::string &msg) = 0;
virtual void SendQuit(const User *u, const char *fmt, ...);
virtual void SendPing(const Anope::string &servname, const Anope::string &who);
@@ -120,36 +122,44 @@ class CoreExport IRCDProto
virtual void SendChannel(Channel *c) { }
};
-class CoreExport IRCdMessage
+enum IRCDMessageFlag
{
+ IRCDMESSAGE_SOFT_LIMIT,
+ IRCDMESSAGE_REQUIRE_SERVER,
+ IRCDMESSAGE_REQUIRE_USER
+};
+
+class CoreExport MessageSource
+{
+ Anope::string source;
+ User *u;
+ Server *s;
+
public:
- virtual bool On436(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnAway(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnJoin(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnKick(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnKill(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnMode(const Anope::string &, const std::vector<Anope::string> &) = 0;
- virtual bool OnUID(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnNick(const Anope::string &, const std::vector<Anope::string> &) = 0;
- virtual bool OnPart(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnPing(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnPrivmsg(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnQuit(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnServer(const Anope::string &, const std::vector<Anope::string> &) = 0;
- virtual bool OnSQuit(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnTopic(const Anope::string &, const std::vector<Anope::string> &) = 0;
- virtual bool OnWhois(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnCapab(const Anope::string &, const std::vector<Anope::string> &);
- virtual bool OnSJoin(const Anope::string &, const std::vector<Anope::string> &) = 0;
- virtual bool OnError(const Anope::string &, const std::vector<Anope::string> &);
+ MessageSource(const Anope::string &);
+ MessageSource(User *u);
+ MessageSource(Server *s);
+ const Anope::string GetName();
+ const Anope::string &GetSource();
+ User *GetUser();
+ Server *GetServer();
};
-extern CoreExport IRCDVar *ircd;
-extern CoreExport IRCDProto *ircdproto;
-extern CoreExport IRCdMessage *ircdmessage;
+class CoreExport IRCDMessage : public Flags<IRCDMessageFlag, 3>
+{
+ static std::map<Anope::string, std::vector<IRCDMessage *> > messages;
-extern CoreExport void pmodule_ircd_proto(IRCDProto *);
-extern CoreExport void pmodule_ircd_var(IRCDVar *ircdvar);
-extern CoreExport void pmodule_ircd_message(IRCdMessage *message);
+ Anope::string name;
+ unsigned param_count;
+ public:
+ static const std::vector<IRCDMessage *> *Find(const Anope::string &name);
+
+ IRCDMessage(const Anope::string &n, unsigned p = 0);
+ ~IRCDMessage();
+ unsigned GetParamCount() const;
+ virtual bool Run(MessageSource &, const std::vector<Anope::string> &params) = 0;
+};
+
+extern CoreExport IRCDProto *ircdproto;
#endif // PROTOCOL_H
diff --git a/include/servers.h b/include/servers.h
index 7b85a182a..94dc5491e 100644
--- a/include/servers.h
+++ b/include/servers.h
@@ -7,8 +7,6 @@
/* Anope */
extern CoreExport Server *Me;
-extern CoreExport void do_server(const Anope::string &source, const Anope::string &servername, unsigned int hops, const Anope::string &descript, const Anope::string &numeric);
-
extern CoreExport const Anope::string ts6_uid_retrieve();
extern CoreExport const Anope::string ts6_sid_retrieve();
@@ -57,12 +55,14 @@ class CoreExport Server : public Flags<ServerFlag>
* @param sid Server sid/numeric
* @param flag An optional server flag
*/
- Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid, ServerFlag flag = SERVER_NONE);
+ Server(Server *uplink, const Anope::string &name, unsigned hops, const Anope::string &description, const Anope::string &sid = "", ServerFlag flag = SERVER_NONE);
+ private:
/** Destructor
*/
~Server();
+ public:
/** Delete this server with a reason
* @param reason The reason
*/
@@ -93,7 +93,7 @@ class CoreExport Server : public Flags<ServerFlag>
*/
void SetSID(const Anope::string &sid);
- /** Get the server numeric/SID
+ /** Get the server numeric/SID, else the server name
* @return The numeric/SID
*/
const Anope::string &GetSID() const;
diff --git a/include/users.h b/include/users.h
index fab5fa868..502cc0a7c 100644
--- a/include/users.h
+++ b/include/users.h
@@ -82,9 +82,15 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param snick The nickname of the user.
* @param sident The username of the user
* @param shost The hostname of the user
+ * @param svhost The vhost of the user
+ * @param sip The ip of the user
+ * @param sserver The server of the user
+ * @param srealname The realname/gecos of teh user
+ * @param ssignon User's timestamp
+ * @param smodes User's modes
* @param suid The unique identifier of the user.
*/
- User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &suid = "");
+ User(const Anope::string &snick, const Anope::string &sident, const Anope::string &shost, const Anope::string &svhost, const Anope::string &sip, Server *sserver, const Anope::string &srealname, time_t ssignon, const Anope::string &smodes, const Anope::string &suid = "");
/** Destroy a user.
*/
@@ -93,7 +99,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
/** Update the nickname of a user record accordingly, should be
* called from ircd protocol.
*/
- void SetNewNick(const Anope::string &newnick);
+ void ChangeNick(const Anope::string &newnick);
/** Update the displayed (vhost) of a user record.
* This is used (if set) instead of real host.
@@ -116,8 +122,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
*/
const Anope::string &GetCloakedHost() const;
- /** Retrieves the UID of the user, where applicable, if set.
- * This is not used on some IRCds, but is for a lot e.g. P10, TS6 protocols.
+ /** Retrieves the UID of the user, if set, else the nick.
* @return The UID of the user.
*/
const Anope::string &GetUID() const;
@@ -302,6 +307,12 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe
* @param reason The reason for the kill
*/
void Kill(const Anope::string &source, const Anope::string &reason);
+
+ /** Process a kill for a user
+ * @param source The user/server doing the kill
+ * @param reason The reason for the kill
+ */
+ void KillInternal(const Anope::string &source, const Anope::string &reason);
};
extern CoreExport int32_t opcnt;
@@ -310,11 +321,6 @@ extern CoreExport time_t maxusertime;
extern CoreExport User *finduser(const Anope::string &nick);
-extern CoreExport User *do_nick(const Anope::string &source, const Anope::string &nick, const Anope::string &username, const Anope::string &host, const Anope::string &server, const Anope::string &realname, time_t ts, const Anope::string &ip, const Anope::string &vhost, const Anope::string &uid, const Anope::string &modes);
-
-extern CoreExport void do_umode(const Anope::string &user, const Anope::string &modes);
-extern CoreExport void do_kill(User *user, const Anope::string &reason);
-
extern CoreExport bool matches_list(Channel *c, User *user, ChannelModeName mode);
extern CoreExport Anope::string create_mask(User *u);