1
0
mirror of https://github.com/anope/anope.git synced 2026-07-06 06:13:13 +02:00

Made Anope keep track of channels its clients are in if it splits from its uplink, then burst them back to its uplink once connection is reestablished.

Also made Anope use TS enforcement to change persistant channels creation time to the time they were registered.
This commit is contained in:
Adam
2010-08-21 01:40:36 -04:00
parent 931b0777fb
commit fb551f0d5d
25 changed files with 435 additions and 411 deletions
+16 -2
View File
@@ -71,8 +71,22 @@ class CoreExport BotInfo : public User, public Flags<BotFlag, BI_END>
*/
void UnAssign(User *u, ChannelInfo *ci);
void Join(Channel *c);
void Join(const Anope::string &chname);
/** Join this bot to a channel
* @param c The channel
* @param update_ts Assume we're updating the TS for this channel
*/
void Join(Channel *c, bool update_ts = false);
/** Join this bot to a channel
* @param chname The channel name
* @param update_ts Assume we're updating the TS for this channel
*/
void Join(const Anope::string &chname, bool update_ts = false);
/** Part this bot from a channel
* @param c The channel
* @param reason The reason we're parting
*/
void Part(Channel *c, const Anope::string &reason = "");
};
+21 -5
View File
@@ -44,7 +44,7 @@ struct UserContainer
{
User *user;
UserData ud;
Flags<ChannelModeName> *Status;
ChannelStatus *Status;
UserContainer(User *u) : user(u) { }
virtual ~UserContainer() { }
@@ -104,6 +104,11 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
int16 bouncy_modes; /* Did we fail to set modes here? */
int16 topic_sync; /* Is the topic in sync? */
/** Call if we need to unset all modes and clear all user status (internally).
* Only useful if we get a SJOIN with a TS older than what we have here
*/
void Reset();
/** Restore the channel topic, set mlock (key), set stickied bans, etc
*/
void Sync();
@@ -217,23 +222,27 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
/** Clear all the modes from the channel
* @param bi The client unsetting the modes
* @param internal Only remove the modes internally
*/
void ClearModes(BotInfo *bi = NULL);
void ClearModes(BotInfo *bi = NULL, bool internal = false);
/** Clear all the bans from the channel
* @param bi The client unsetting the modes
* @param internal Only remove the modes internally
*/
void ClearBans(BotInfo *bi = NULL);
void ClearBans(BotInfo *bi = NULL, bool internal = false);
/** Clear all the excepts from the channel
* @param bi The client unsetting the modes
* @param internal Only remove the modes internally
*/
void ClearExcepts(BotInfo *bi = NULL);
void ClearExcepts(BotInfo *bi = NULL, bool internal = false);
/** Clear all the invites from the channel
* @param bi The client unsetting the modes
* @param internal Only remove the modes internally
*/
void ClearInvites(BotInfo *bi = NULL);
void ClearInvites(BotInfo *bi = NULL, bool internal = false);
/** Get a param from the channel
* @param Name The mode
@@ -268,6 +277,13 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags>
* @return true if the kick was scucessful, false if a module blocked the kick
*/
bool Kick(BotInfo *bi, User *u, const char *reason = NULL, ...);
/** Get a string of the modes set on this channel
* @param complete Include mode parameters
* @param plus If set to false (with complete), mode parameters will not be given for modes requring no parameters to be unset
* @return A mode string
*/
Anope::string GetModes(bool complete, bool plus);
};
#endif // CHANNELS_H
-2
View File
@@ -66,8 +66,6 @@ E void ChanSetInternalModes(Channel *c, int ac, const char **av);
E User *nc_on_chan(Channel *c, const NickCore *nc);
E Anope::string chan_get_modes(Channel *chan, int complete, int plus);
E int get_access_level(ChannelInfo *ci, NickAlias *na);
E int get_access_level(ChannelInfo *ci, NickCore *nc);
E Anope::string get_xop_level(int level);
+7 -1
View File
@@ -420,7 +420,7 @@ class CoreExport ModeManager
public:
/* List of all modes Anope knows about */
static std::list<Mode *> Modes;
static std::map<Anope::string, Mode *> Modes;
/* User modes */
static std::map<char, UserMode *> UserModesByChar;
@@ -468,6 +468,12 @@ class CoreExport ModeManager
*/
static UserMode *FindUserModeByName(UserModeName Name);
/** Find a mode by name
* @param name The mode name
* @return The mode
*/
static Mode *FindModeByName(const Anope::string &name);
/** Gets the channel mode char for a symbol (eg + returns v)
* @param Value The symbol
* @return The char
+6 -4
View File
@@ -730,13 +730,13 @@ struct LevelInfo
/*************************************************************************/
#include "users.h"
#include "bots.h"
/* This structure stocks ban data since it must not be removed when
* user is kicked.
*/
#include "users.h"
#include "bots.h"
struct BanData
{
BanData *next, *prev;
@@ -973,7 +973,8 @@ class CoreExport IRCDProto
virtual void SendQuit(const BotInfo *bi, 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);
virtual void SendJoin(const BotInfo *bi, const Anope::string &, time_t) = 0;
virtual void SendJoin(const BotInfo *, const Anope::string &, time_t) = 0;
virtual void SendJoin(BotInfo *, const ChannelContainer *);
virtual void SendSQLineDel(const XLine *x) = 0;
virtual void SendInvite(const BotInfo *bi, const Anope::string &chan, const Anope::string &nick);
virtual void SendPart(const BotInfo *bi, const Channel *chan, const char *fmt, ...);
@@ -998,6 +999,7 @@ class CoreExport IRCDProto
virtual void SendSVSJoin(const Anope::string &, const Anope::string &, const Anope::string &, const Anope::string &) { }
virtual void SendSVSPart(const Anope::string &, const Anope::string &, const Anope::string &) { }
virtual void SendSWhois(const Anope::string &, const Anope::string &, const Anope::string &) { }
virtual void SendBOB() { }
virtual void SendEOB() { }
virtual void SendServer(const Server *) = 0;
virtual bool IsNickValid(const Anope::string &) { return true; }
+8 -1
View File
@@ -17,10 +17,17 @@ typedef unordered_map_namespace::unordered_map<Anope::string, User *, Anope::has
extern CoreExport user_map UserListByNick;
extern CoreExport user_uid_map UserListByUID;
class ChannelStatus : public Flags<ChannelModeName>
{
public:
Anope::string BuildCharPrefixList() const;
Anope::string BuildModePrefixList() const;
};
struct ChannelContainer
{
Channel *chan;
Flags<ChannelModeName> *Status;
ChannelStatus *Status;
ChannelContainer(Channel *c) : chan(c) { }
virtual ~ChannelContainer() { }