From 1e625b6837fdf96616cfc49700aa28d184a7c171 Mon Sep 17 00:00:00 2001 From: Adam Date: Thu, 1 Aug 2013 13:16:18 +0000 Subject: Use MessageSource as the source for many IRCDProto funcs Keep track of what user modes are oper only/server only/etc --- include/channels.h | 2 +- include/commands.h | 2 +- include/logger.h | 20 ++++----- include/mail.h | 2 +- include/modes.h | 71 +++++++++++++------------------ include/modules.h | 10 +++-- include/modules/pseudoclients/global.h | 2 +- include/protocol.h | 77 +++++++++++++++++----------------- include/servers.h | 2 +- include/uplink.h | 9 ++-- include/users.h | 34 +++++++++------ 11 files changed, 113 insertions(+), 118 deletions(-) (limited to 'include') diff --git a/include/channels.h b/include/channels.h index 377b4eebf..9add089bc 100644 --- a/include/channels.h +++ b/include/channels.h @@ -225,7 +225,7 @@ class CoreExport Channel : public Base, public Extensible * @param nick The nick being kicked * @param reason The reason for the kick */ - void KickInternal(MessageSource &source, const Anope::string &nick, const Anope::string &reason); + void KickInternal(const 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 diff --git a/include/commands.h b/include/commands.h index 06bb74c7b..abd01e41f 100644 --- a/include/commands.h +++ b/include/commands.h @@ -46,7 +46,7 @@ struct CommandInfo struct CoreExport CommandReply { virtual ~CommandReply() { } - virtual void SendMessage(const BotInfo *source, const Anope::string &msg) = 0; + virtual void SendMessage(BotInfo *source, const Anope::string &msg) = 0; }; /* The source for a command */ diff --git a/include/logger.h b/include/logger.h index b24d7bbd6..8bba26aeb 100644 --- a/include/logger.h +++ b/include/logger.h @@ -54,11 +54,11 @@ class CoreExport Log { public: /* Bot that should log this message */ - const BotInfo *bi; + BotInfo *bi; /* For commands, the user executing the command, but might not always exist */ - const User *u; - /* For commands, the account executing teh command, but will not always exist */ - const NickCore *nc; + User *u; + /* For commands, the account executing the command, but will not always exist */ + NickCore *nc; /* For commands, the command being executed */ Command *c; /* For commands, the command source */ @@ -76,21 +76,21 @@ class CoreExport Log std::stringstream buf; - Log(LogType type = LOG_NORMAL, const Anope::string &category = "", const BotInfo *bi = NULL); + Log(LogType type = LOG_NORMAL, const Anope::string &category = "", BotInfo *bi = NULL); /* LOG_COMMAND/OVERRIDE/ADMIN */ - Log(LogType type, CommandSource &source, Command *c, const ChannelInfo *ci = NULL); + Log(LogType type, CommandSource &source, Command *c, ChannelInfo *ci = NULL); /* LOG_CHANNEL */ - Log(const User *u, Channel *c, const Anope::string &category = ""); + Log(User *u, Channel *c, const Anope::string &category = ""); /* LOG_USER */ - explicit Log(const User *u, const Anope::string &category = "", const BotInfo *bi = NULL); + Log(User *u, const Anope::string &category = "", BotInfo *bi = NULL); /* LOG_SERVER */ - explicit Log(Server *s, const Anope::string &category = "", const BotInfo *bi = NULL); + Log(Server *s, const Anope::string &category = "", BotInfo *bi = NULL); - explicit Log(const BotInfo *b, const Anope::string &category = ""); + Log(BotInfo *b, const Anope::string &category = ""); Log(Module *m, const Anope::string &category = ""); diff --git a/include/mail.h b/include/mail.h index 5f4809d51..59e33c8b9 100644 --- a/include/mail.h +++ b/include/mail.h @@ -20,7 +20,7 @@ namespace Mail { - extern CoreExport bool Send(User *from, NickCore *to, const BotInfo *service, const Anope::string &subject, const Anope::string &message); + extern CoreExport bool Send(User *from, NickCore *to, BotInfo *service, const Anope::string &subject, const Anope::string &message); extern CoreExport bool Send(NickCore *to, const Anope::string &subject, const Anope::string &message); extern CoreExport bool Validate(const Anope::string &email); diff --git a/include/modes.h b/include/modes.h index 807b91c25..66cbcfdc5 100644 --- a/include/modes.h +++ b/include/modes.h @@ -56,6 +56,11 @@ class CoreExport Mode : public Base */ Mode(const Anope::string &mname, ModeClass mclass, char mc, ModeType type); virtual ~Mode(); + + /** Can a user set this mode, used for mlock + * @param u The user + */ + virtual bool CanSet(User *u) const; }; /** This class is a user mode, all user modes use this/inherit from this @@ -68,7 +73,6 @@ class CoreExport UserMode : public Mode * @param mc The mode char */ UserMode(const Anope::string &name, char mc); - virtual ~UserMode(); }; class CoreExport UserModeParam : public UserMode @@ -97,16 +101,10 @@ class CoreExport ChannelMode : public Mode * @param mc The mode char */ ChannelMode(const Anope::string &name, char mc); - virtual ~ChannelMode(); - /** Can a user set this mode, used for mlock - * NOTE: User CAN be NULL, this is for checking if it can be locked with defcon - * @param u The user, or NULL - */ - virtual bool CanSet(User *u) const; + bool CanSet(User *u) const anope_override; }; - /** This is a mode for lists, eg b/e/I. These modes should inherit from this */ class CoreExport ChannelModeList : public ChannelMode @@ -118,10 +116,6 @@ class CoreExport ChannelModeList : public ChannelMode */ ChannelModeList(const Anope::string &name, char mc); - /** destructor - */ - virtual ~ChannelModeList(); - /** Is the mask valid * @param mask The mask * @return true for yes, false for no @@ -161,10 +155,6 @@ class CoreExport ChannelModeParam : public ChannelMode */ ChannelModeParam(const Anope::string &name, char mc, bool minus_no_arg = false); - /** destructor - */ - virtual ~ChannelModeParam(); - /* Should we send an arg when unsetting this mode? */ bool minus_no_arg; @@ -194,10 +184,6 @@ class CoreExport ChannelModeStatus : public ChannelMode * @param mlevel A level for the mode, which is usually determined by the PREFIX capab */ ChannelModeStatus(const Anope::string &name, char mc, char msymbol, short mlevel); - - /** destructor - */ - virtual ~ChannelModeStatus(); }; /* The status a user has on a channel (+v, +h, +o) etc */ @@ -216,49 +202,50 @@ class CoreExport ChannelStatus Anope::string BuildModePrefixList() const; }; -/** Channel mode +k (key) - */ -class CoreExport ChannelModeKey : public ChannelModeParam +class CoreExport UserModeOperOnly : public UserMode { public: - ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { } + UserModeOperOnly(const Anope::string &mname, char um) : UserMode(mname, um) { } - bool IsValid(const Anope::string &value) const anope_override; + bool CanSet(User *u) const anope_override; }; -/** This class is used for channel mode +A (Admin only) - * Only opers can mlock it - */ -class CoreExport ChannelModeAdmin : public ChannelMode +class CoreExport UserModeNoone : public UserMode { public: - ChannelModeAdmin(char mc) : ChannelMode("ADMINONLY", mc) { } + UserModeNoone(const Anope::string &mname, char um) : UserMode(mname, um) { } - /* Opers only */ bool CanSet(User *u) const anope_override; }; -/** This class is used for channel mode +O (Opers only) - * Only opers can mlock it +/** Channel mode +k (key) + */ +class CoreExport ChannelModeKey : public ChannelModeParam +{ + public: + ChannelModeKey(char mc) : ChannelModeParam("KEY", mc) { } + + bool IsValid(const Anope::string &value) const anope_override; +}; + +/** This class is used for oper only channel modes */ -class CoreExport ChannelModeOper : public ChannelMode +class CoreExport ChannelModeOperOnly : public ChannelMode { public: - ChannelModeOper(char mc) : ChannelMode("OPERONLY", mc) { } + ChannelModeOperOnly(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } /* Opers only */ bool CanSet(User *u) const anope_override; }; -/** This class is used for channel mode +r (registered channel) - * No one may mlock r +/** This class is used for channel modes only servers may set */ -class CoreExport ChannelModeRegistered : public ChannelMode +class CoreExport ChannelModeNoone : public ChannelMode { public: - ChannelModeRegistered(char mc) : ChannelMode("REGISTERED", mc) { } + ChannelModeNoone(const Anope::string &mname, char mc) : ChannelMode(mname, mc) { } - /* No one mlocks +r */ bool CanSet(User *u) const anope_override; }; @@ -347,7 +334,7 @@ class CoreExport ModeManager * @param set true for setting, false for removing * @param param The param, if there is one */ - static void StackerAdd(const BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string ¶m = ""); + static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string ¶m = ""); /** Add a mode to the stacker to be set on a user * @param bi The client to set the modes from @@ -356,7 +343,7 @@ class CoreExport ModeManager * @param set true for setting, false for removing * @param param The param, if there is one */ - static void StackerAdd(const BotInfo *bi, User *u, UserMode *um, bool set, const Anope::string ¶m = ""); + static void StackerAdd(BotInfo *bi, User *u, UserMode *um, bool set, const Anope::string ¶m = ""); /** Process all of the modes in the stacker and send them to the IRCd to be set on channels/users */ diff --git a/include/modules.h b/include/modules.h index 98bb02f23..b217b1b0e 100644 --- a/include/modules.h +++ b/include/modules.h @@ -294,7 +294,7 @@ class CoreExport Module : public Extensible * @param cu The user, channel, and status of the user being kicked * @param kickmsg The reason for the kick. */ - virtual void OnPreUserKicked(MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) { throw NotImplementedException(); } + virtual void OnPreUserKicked(const MessageSource &source, ChanUserContainer *cu, const Anope::string &kickmsg) { throw NotImplementedException(); } /** Called when a user has been kicked from a channel. * @param source The kicker @@ -303,7 +303,7 @@ class CoreExport Module : public Extensible * @param status The status the kicked user had on the channel before they were kicked * @param kickmsg The reason for the kick. */ - virtual void OnUserKicked(MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); } + virtual void OnUserKicked(const MessageSource &source, User *target, const Anope::string &channel, ChannelStatus &status, const Anope::string &kickmsg) { throw NotImplementedException(); } /** Called when Services' configuration is being (re)loaded. * @param conf The config that is being built now and will replace the global Config object @@ -908,16 +908,18 @@ class CoreExport Module : public Extensible virtual EventReturn OnChannelModeUnset(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) { throw NotImplementedException(); } /** Called when a mode is set on a user + * @param setter who/what is setting the mode * @param u The user * @param mname The mode name */ - virtual void OnUserModeSet(User *u, const Anope::string &mname) { throw NotImplementedException(); } + virtual void OnUserModeSet(const MessageSource &setter, User *u, const Anope::string &mname) { throw NotImplementedException(); } /** Called when a mode is unset from a user + * @param setter who/what is setting the mode * @param u The user * @param mname The mode name */ - virtual void OnUserModeUnset(User *u, const Anope::string &mname) { throw NotImplementedException(); } + virtual void OnUserModeUnset(const MessageSource &setter, User *u, const Anope::string &mname) { throw NotImplementedException(); } /** Called when a channel mode is introducted into Anope * @param cm The mode diff --git a/include/modules/pseudoclients/global.h b/include/modules/pseudoclients/global.h index 52afc4a23..1511214c9 100644 --- a/include/modules/pseudoclients/global.h +++ b/include/modules/pseudoclients/global.h @@ -13,7 +13,7 @@ class GlobalService : public Service * @param source The sender of the global * @param message The message */ - virtual void SendGlobal(const BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0; + virtual void SendGlobal(BotInfo *sender, const Anope::string &source, const Anope::string &message) = 0; }; #endif // GLOBAL_H diff --git a/include/protocol.h b/include/protocol.h index 874fbbe2c..2744dde0d 100644 --- a/include/protocol.h +++ b/include/protocol.h @@ -27,16 +27,16 @@ class CoreExport IRCDProto : public Service public: virtual ~IRCDProto(); - 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 &); - virtual void SendKickInternal(const BotInfo *, const Channel *, const User *, const Anope::string &); - virtual void SendNoticeInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &msg); - virtual void SendPrivmsgInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf); - virtual void SendQuitInternal(const User *u, const Anope::string &buf); - virtual void SendPartInternal(const BotInfo *bi, const Channel *chan, const Anope::string &buf); - virtual void SendGlobopsInternal(const BotInfo *source, const Anope::string &buf); - virtual void SendCTCPInternal(const BotInfo *bi, const Anope::string &dest, const Anope::string &buf); + virtual void SendSVSKillInternal(const MessageSource &, User *, const Anope::string &); + virtual void SendModeInternal(const MessageSource &, const Channel *, const Anope::string &); + virtual void SendModeInternal(const MessageSource &, User *, const Anope::string &); + virtual void SendKickInternal(const MessageSource &, const Channel *, User *, const Anope::string &); + virtual void SendNoticeInternal(const MessageSource &, const Anope::string &dest, const Anope::string &msg); + virtual void SendPrivmsgInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf); + virtual void SendQuitInternal(User *, const Anope::string &buf); + virtual void SendPartInternal(User *, const Channel *chan, const Anope::string &buf); + virtual void SendGlobopsInternal(const MessageSource &, const Anope::string &buf); + virtual void SendCTCPInternal(const MessageSource &, const Anope::string &dest, const Anope::string &buf); virtual void SendNumericInternal(int numeric, const Anope::string &dest, const Anope::string &buf); const Anope::string &GetProtocolName(); @@ -78,7 +78,7 @@ class CoreExport IRCDProto : public Service * @param bi The bot to set the topic from * @param c The channel to set the topic on. The topic being set is Channel::topic */ - virtual void SendTopic(BotInfo *, Channel *); + virtual void SendTopic(const MessageSource &, Channel *); /** Sets a vhost on a user. * @param u The user @@ -110,31 +110,31 @@ class CoreExport IRCDProto : public Service virtual void SendSQLineDel(const XLine *x) { } /** Kills a user - * @param source The client used to kill the user, if any + * @param source Who is doing the kill * @param user The user to be killed * @param fmt Kill reason */ - virtual void SendSVSKill(const BotInfo *source, User *user, const char *fmt, ...); + virtual void SendSVSKill(const MessageSource &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 SendMode(const MessageSource &source, const Channel *dest, const char *fmt, ...); + virtual void SendMode(const MessageSource &source, User *u, const char *fmt, ...); /** Introduces a client to the rest of the network * @param u The client to introduce */ - virtual void SendClientIntroduction(const User *u) = 0; + virtual void SendClientIntroduction(User *u) = 0; - virtual void SendKick(const BotInfo *bi, const Channel *chan, const User *user, const char *fmt, ...); + virtual void SendKick(const MessageSource &source, const Channel *chan, User *user, const char *fmt, ...); - virtual void SendNotice(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 SendAction(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...); - virtual void SendCTCP(const BotInfo *bi, const Anope::string &dest, const char *fmt, ...); + virtual void SendNotice(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); + virtual void SendPrivmsg(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); + virtual void SendAction(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); + virtual void SendCTCP(const MessageSource &source, const Anope::string &dest, const char *fmt, ...); - 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 SendGlobalNotice(BotInfo *bi, const Server *dest, const Anope::string &msg) = 0; + virtual void SendGlobalPrivmsg(BotInfo *bi, const Server *desc, const Anope::string &msg) = 0; - virtual void SendQuit(const User *u, const char *fmt, ...); + virtual void SendQuit(User *u, const char *fmt, ...); virtual void SendPing(const Anope::string &servname, const Anope::string &who); virtual void SendPong(const Anope::string &servname, const Anope::string &who); @@ -146,7 +146,7 @@ class CoreExport IRCDProto : public Service * stacker to be set "soon". */ virtual void SendJoin(User *u, Channel *c, const ChannelStatus *status) = 0; - virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...); + virtual void SendPart(User *u, const Channel *chan, const char *fmt, ...); /** Force joins a user that isn't ours to a channel. * @param bi The source of the message @@ -154,30 +154,30 @@ class CoreExport IRCDProto : public Service * @param chan The channel to join the user to * @param param Channel key? */ - virtual void SendSVSJoin(const BotInfo *bi, const User *u, const Anope::string &chan, const Anope::string ¶m) { } + virtual void SendSVSJoin(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) { } /** Force parts a user that isn't ours from a channel. - * @param bi The source of the message + * @param source The source of the message * @param u The user to part * @param chan The channel to part the user from * @param param part reason, some IRCds don't support this */ - virtual void SendSVSPart(const BotInfo *bi, const User *u, const Anope::string &chan, const Anope::string ¶m) { } + virtual void SendSVSPart(const MessageSource &source, User *u, const Anope::string &chan, const Anope::string ¶m) { } - virtual void SendInvite(const BotInfo *bi, const Channel *c, const User *u); - virtual void SendGlobops(const BotInfo *source, const char *fmt, ...); + virtual void SendInvite(const MessageSource &source, const Channel *c, User *u); + virtual void SendGlobops(const MessageSource &source, const char *fmt, ...); /** Sets oper flags on a user, currently only supported by Unreal */ - virtual void SendSVSO(const BotInfo *, const Anope::string &, const Anope::string &) { } + virtual void SendSVSO(BotInfo *, const Anope::string &, const Anope::string &) { } /** Sends a nick change of one of our clients. */ - virtual void SendNickChange(const User *u, const Anope::string &newnick); + virtual void SendNickChange(User *u, const Anope::string &newnick); /** Forces a nick change of a user that isn't ours (SVSNICK) */ - virtual void SendForceNickChange(const User *u, const Anope::string &newnick, time_t when); + virtual void SendForceNickChange(User *u, const Anope::string &newnick, time_t when); /** Used to introduce ourselves to our uplink. Usually will SendServer(Me) and any other * initial handshake requirements. @@ -193,7 +193,7 @@ class CoreExport IRCDProto : public Service virtual void SendSVSHold(const Anope::string &, time_t) { } virtual void SendSVSHoldDel(const Anope::string &) { } - virtual void SendSWhois(const BotInfo *bi, const Anope::string &, const Anope::string &) { } + virtual void SendSWhois(const MessageSource &, const Anope::string &, const Anope::string &) { } /** Introduces a server to the uplink */ @@ -237,10 +237,11 @@ class CoreExport MessageSource MessageSource(const Anope::string &); MessageSource(User *u); MessageSource(Server *s); - const Anope::string GetName(); - const Anope::string &GetSource(); - User *GetUser(); - Server *GetServer(); + const Anope::string &GetName() const; + const Anope::string &GetSource() const; + User *GetUser() const; + BotInfo *GetBot() const; + Server *GetServer() const; }; enum IRCDMessageFlag diff --git a/include/servers.h b/include/servers.h index fe5f40365..04a174e5b 100644 --- a/include/servers.h +++ b/include/servers.h @@ -173,7 +173,7 @@ class CoreExport Server : public Extensible * @param source The source of the message * @param message The message */ - void Notice(const BotInfo *source, const Anope::string &message); + void Notice(BotInfo *source, const Anope::string &message); /** Find a server * @param name The name or SID/numeric diff --git a/include/uplink.h b/include/uplink.h index 1c92f6941..ac62e659d 100644 --- a/include/uplink.h +++ b/include/uplink.h @@ -14,6 +14,7 @@ #define UPLINK_H #include "sockets.h" +#include "protocol.h" namespace Uplink { @@ -33,16 +34,12 @@ class UplinkSocket : public ConnectionSocket, public BufferedSocket /* A message sent over the uplink socket */ class CoreExport Message { - private: - /* The source of the message, can be a server (Me), or any user (one of our bots) */ - const Server *server; - const User *user; + MessageSource source; std::stringstream buffer; public: Message(); - explicit Message(const Server *); - explicit Message(const User *); + Message(const MessageSource &); ~Message(); template Message &operator<<(const T &val) { diff --git a/include/users.h b/include/users.h index 4a4ea845f..26aeb24bb 100644 --- a/include/users.h +++ b/include/users.h @@ -36,6 +36,9 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe bool quit; /* Users that are in the process of quitting */ static std::list quitting_users; + + public: + typedef std::map ModeList; protected: Anope::string vident; Anope::string ident; @@ -43,7 +46,7 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe /* If the user is on the access list of the nick theyre on */ bool on_access; /* Map of user modes and the params this user has (if any) */ - std::map modes; + ModeList modes; /* NickCore account the user is currently loggged in as, if they are logged in */ Serialize::Reference nc; @@ -185,8 +188,8 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe * @param fmt Format of the Message * @param ... any number of parameters */ - void SendMessage(const BotInfo *source, const char *fmt, ...); - void SendMessage(const BotInfo *source, const Anope::string &msg) anope_override; + void SendMessage(BotInfo *source, const char *fmt, ...); + void SendMessage(BotInfo *source, const Anope::string &msg) anope_override; /** Identify the user to a nick. * updates last_seen, logs the user in, @@ -250,58 +253,63 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe bool HasMode(const Anope::string &name) const; /** Set a mode internally on the user, the IRCd is not informed + * @param setter who/what is setting the mode * @param um The user mode * @param Param The param, if there is one */ - void SetModeInternal(UserMode *um, const Anope::string ¶m = ""); + void SetModeInternal(const MessageSource &setter, UserMode *um, const Anope::string ¶m = ""); /** Remove a mode internally on the user, the IRCd is not informed + * @param setter who/what is setting the mode * @param um The user mode */ - void RemoveModeInternal(UserMode *um); + void RemoveModeInternal(const MessageSource &setter, UserMode *um); /** Set a mode on the user * @param bi The client setting the mode * @param um The user mode * @param Param Optional param for the mode */ - void SetMode(const BotInfo *bi, UserMode *um, const Anope::string ¶m = ""); + void SetMode(BotInfo *bi, UserMode *um, const Anope::string ¶m = ""); /** Set a mode on the user * @param bi The client setting the mode * @param name The mode name * @param Param Optional param for the mode */ - void SetMode(const BotInfo *bi, const Anope::string &name, const Anope::string ¶m = ""); + void SetMode(BotInfo *bi, const Anope::string &name, const Anope::string ¶m = ""); /** Remove a mode on the user * @param bi The client setting the mode * @param um The user mode */ - void RemoveMode(const BotInfo *bi, UserMode *um); + void RemoveMode(BotInfo *bi, UserMode *um); /** Remove a mode from the user * @param bi The client setting the mode * @param name The mode name */ - void RemoveMode(const BotInfo *bi, const Anope::string &name); + void RemoveMode(BotInfo *bi, const Anope::string &name); /** Set a string of modes on a user * @param bi The client setting the modes * @param umodes The modes */ - void SetModes(const BotInfo *bi, const char *umodes, ...); + void SetModes(BotInfo *bi, const char *umodes, ...); /** Set a string of modes on a user internally + * @param setter who/what is setting the mode * @param umodes The modes */ - void SetModesInternal(const char *umodes, ...); + void SetModesInternal(const MessageSource &source, const char *umodes, ...); /** Get modes set for this user. * @return A string of modes set on the user */ Anope::string GetModes() const; + const ModeList &GetModeList() const; + /** Find the channel container for Channel c that the user is on * This is preferred over using FindUser in Channel, as there are usually more users in a channel * than channels a user is in @@ -319,13 +327,13 @@ class CoreExport User : public virtual Base, public Extensible, public CommandRe * @param source The user/server doing the kill * @param reason The reason for the kill */ - void Kill(const Anope::string &source, const Anope::string &reason); + void Kill(const MessageSource &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); + void KillInternal(const MessageSource &source, const Anope::string &reason); /** Processes a quit for the user, and marks them as quit * @param reason The reason for the quit -- cgit