mirror of
https://github.com/anope/anope.git
synced 2026-07-08 03:03:14 +02:00
Store the setter and ts for all modes and try to restore them.
This is mostly for preserving channel list mode info.
This commit is contained in:
+1
-1
@@ -151,7 +151,7 @@ public:
|
||||
/* The time this account was registered */
|
||||
time_t registered = Anope::CurTime;
|
||||
MemoInfo memos;
|
||||
std::map<Anope::string, Anope::string> last_modes;
|
||||
std::map<Anope::string, ModeData> last_modes;
|
||||
|
||||
/* Nicknames registered that are grouped to this account.
|
||||
* for n in aliases, n->nc == this.
|
||||
|
||||
+7
-7
@@ -36,7 +36,7 @@ class CoreExport Channel final
|
||||
static std::vector<Channel *> deleting;
|
||||
|
||||
public:
|
||||
typedef std::multimap<Anope::string, Anope::string> ModeList;
|
||||
typedef std::multimap<Anope::string, ModeData> ModeList;
|
||||
private:
|
||||
/** A map of channel modes with their parameters set on this channel
|
||||
*/
|
||||
@@ -148,10 +148,10 @@ public:
|
||||
/** Set a mode internally on a channel, this is not sent out to the IRCd
|
||||
* @param setter The setter
|
||||
* @param cm The mode
|
||||
* @param param The param
|
||||
* @param data Data about the mode.
|
||||
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void SetModeInternal(MessageSource &source, ChannelMode *cm, const Anope::string ¶m = "", bool enforce_mlock = true);
|
||||
void SetModeInternal(MessageSource &source, ChannelMode *cm, const ModeData &data = {}, bool enforce_mlock = true);
|
||||
|
||||
/** Remove a mode internally on a channel, this is not sent out to the IRCd
|
||||
* @param setter The Setter
|
||||
@@ -164,19 +164,19 @@ public:
|
||||
/** Set a mode on a channel
|
||||
* @param bi The client setting the modes
|
||||
* @param cm The mode
|
||||
* @param param Optional param arg for the mode
|
||||
* @param data Data about the mode
|
||||
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void SetMode(BotInfo *bi, ChannelMode *cm, const Anope::string ¶m = "", bool enforce_mlock = true);
|
||||
void SetMode(BotInfo *bi, ChannelMode *cm, const ModeData &data = {}, bool enforce_mlock = true);
|
||||
|
||||
/**
|
||||
* Set a mode on a channel
|
||||
* @param bi The client setting the modes
|
||||
* @param name The mode name
|
||||
* @param param Optional param arg for the mode
|
||||
* @param data Data about the mode
|
||||
* @param enforce_mlock true if mlocks should be enforced, false to override mlock
|
||||
*/
|
||||
void SetMode(BotInfo *bi, const Anope::string &name, const Anope::string ¶m = "", bool enforce_mlock = true);
|
||||
void SetMode(BotInfo *bi, const Anope::string &name, const ModeData &data = {}, bool enforce_mlock = true);
|
||||
|
||||
/** Remove a mode from a channel
|
||||
* @param bi The client setting the modes
|
||||
|
||||
@@ -19,6 +19,7 @@ class ChanAccess;
|
||||
class Channel;
|
||||
class ChannelInfo;
|
||||
class ChannelStatus;
|
||||
struct ModeData;
|
||||
struct ChanUserContainer;
|
||||
class ClientSocket;
|
||||
class Command;
|
||||
|
||||
+19
-4
@@ -33,6 +33,20 @@ enum ModeClass
|
||||
MC_USER
|
||||
};
|
||||
|
||||
struct ModeData final
|
||||
{
|
||||
Anope::string value;
|
||||
Anope::string set_by;
|
||||
time_t set_at;
|
||||
|
||||
ModeData(const Anope::string &v = "", const Anope::string &s = "", time_t t = 0)
|
||||
: value(v)
|
||||
, set_by(s)
|
||||
, set_at(t)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/** This class is the basis of all modes in Anope
|
||||
*/
|
||||
class CoreExport Mode
|
||||
@@ -311,6 +325,7 @@ public:
|
||||
class CoreExport ModeManager final
|
||||
{
|
||||
public:
|
||||
using Change = std::multimap<Mode *, std::pair<bool, ModeData>>;
|
||||
|
||||
/* Number of generic channel and user modes we are tracking */
|
||||
static unsigned GenericChannelModes;
|
||||
@@ -378,18 +393,18 @@ public:
|
||||
* @param c The channel
|
||||
* @param cm The channel mode
|
||||
* @param set true for setting, false for removing
|
||||
* @param param The param, if there is one
|
||||
* @param data Data about the mode.
|
||||
*/
|
||||
static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const Anope::string ¶m = "");
|
||||
static void StackerAdd(BotInfo *bi, Channel *c, ChannelMode *cm, bool set, const ModeData &data = {});
|
||||
|
||||
/** Add a mode to the stacker to be set on a user
|
||||
* @param bi The client to set the modes from
|
||||
* @param u The user
|
||||
* @param um The user mode
|
||||
* @param set true for setting, false for removing
|
||||
* @param param The param, if there is one
|
||||
* @param data Data about the mode.
|
||||
*/
|
||||
static void StackerAdd(BotInfo *bi, User *u, UserMode *um, bool set, const Anope::string ¶m = "");
|
||||
static void StackerAdd(BotInfo *bi, User *u, UserMode *um, bool set, const ModeData &data = {});
|
||||
|
||||
/** Process all of the modes in the stacker and send them to the IRCd to be set on channels/users
|
||||
*/
|
||||
|
||||
+2
-2
@@ -871,10 +871,10 @@ public:
|
||||
* @param c The channel
|
||||
* @param setter The user or server that is setting the mode
|
||||
* @param mode The mode
|
||||
* @param param The mode param, if there is one
|
||||
* @param data Data about the mode.
|
||||
* @return EVENT_STOP to make mlock/secureops etc checks not happen
|
||||
*/
|
||||
virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const Anope::string ¶m) ATTR_NOT_NULL(2, 4) { throw NotImplementedException(); }
|
||||
virtual EventReturn OnChannelModeSet(Channel *c, MessageSource &setter, ChannelMode *mode, const ModeData &data) ATTR_NOT_NULL(2, 4) { throw NotImplementedException(); }
|
||||
|
||||
/** Called when a mode is unset on a channel
|
||||
* @param c The channel
|
||||
|
||||
@@ -195,8 +195,10 @@ public:
|
||||
*/
|
||||
virtual void SendSVSKill(const MessageSource &source, User *user, const Anope::string &msg);
|
||||
|
||||
virtual void SendMode(const MessageSource &source, Channel *chan, const ModeManager::Change &change);
|
||||
virtual void SendModeInternal(const MessageSource &source, Channel *chan, const Anope::string &modes, const std::vector<Anope::string> &values);
|
||||
|
||||
virtual void SendMode(const MessageSource &source, User *u, const ModeManager::Change &change);
|
||||
virtual void SendModeInternal(const MessageSource &source, User *u, const Anope::string &modes, const std::vector<Anope::string> &values);
|
||||
|
||||
/** Introduces a client to the rest of the network
|
||||
|
||||
+7
-7
@@ -39,7 +39,7 @@ class CoreExport User
|
||||
static std::list<User *> quitting_users;
|
||||
|
||||
public:
|
||||
typedef std::map<Anope::string, Anope::string> ModeList;
|
||||
typedef std::map<Anope::string, ModeData> ModeList;
|
||||
protected:
|
||||
Anope::string vident;
|
||||
Anope::string ident;
|
||||
@@ -261,9 +261,9 @@ public:
|
||||
/** 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
|
||||
* @param data Data about the mode.
|
||||
*/
|
||||
void SetModeInternal(const MessageSource &setter, UserMode *um, const Anope::string ¶m = "");
|
||||
void SetModeInternal(const MessageSource &setter, UserMode *um, const ModeData &data = {});
|
||||
|
||||
/** Remove a mode internally on the user, the IRCd is not informed
|
||||
* @param setter who/what is setting the mode
|
||||
@@ -274,16 +274,16 @@ public:
|
||||
/** 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
|
||||
* @param data Data about the mode
|
||||
*/
|
||||
void SetMode(BotInfo *bi, UserMode *um, const Anope::string ¶m = "");
|
||||
void SetMode(BotInfo *bi, UserMode *um, const ModeData &data = {});
|
||||
|
||||
/** 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
|
||||
* @param data Data about the mode
|
||||
*/
|
||||
void SetMode(BotInfo *bi, const Anope::string &name, const Anope::string ¶m = "");
|
||||
void SetMode(BotInfo *bi, const Anope::string &name, const ModeData &data = {});
|
||||
|
||||
/** Remove a mode on the user
|
||||
* @param bi The client setting the mode
|
||||
|
||||
Reference in New Issue
Block a user