diff options
author | Adam <Adam@anope.org> | 2010-09-15 16:40:55 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-09-15 16:40:55 -0400 |
commit | 813185105823daa6a1b574d86053950382343589 (patch) | |
tree | 793d4f54cddc88275b4372839f93bba01301b427 /include | |
parent | 6239b5a053fc8fd94b798495f8e189a2e2bda285 (diff) |
Rewrote all of the topic code, fixes a few topic related problems on some older IRCds
Diffstat (limited to 'include')
-rw-r--r-- | include/channels.h | 24 | ||||
-rw-r--r-- | include/extern.h | 5 | ||||
-rw-r--r-- | include/regchannel.h | 18 | ||||
-rw-r--r-- | include/services.h | 5 |
4 files changed, 35 insertions, 17 deletions
diff --git a/include/channels.h b/include/channels.h index 73c97d3aa..d82e61037 100644 --- a/include/channels.h +++ b/include/channels.h @@ -71,7 +71,7 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> /* Modes set on the channel */ Flags<ChannelModeName, CMODE_END * 2> modes; - + public: /** Default constructor * @param name The channel name @@ -86,9 +86,6 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> Anope::string name; /* Channel name */ ChannelInfo *ci; /* Corresponding ChannelInfo */ time_t creation_time; /* When channel was created */ - Anope::string topic; - Anope::string topic_setter; - time_t topic_time; /* When topic was set */ EList *bans; EList *excepts; @@ -97,6 +94,10 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> /* List of users in the channel */ CUserList users; + Anope::string topic; /* Current topic of the channel */ + Anope::string topic_setter; /* Who set the topic */ + time_t topic_time; /* When the topic was set*/ + std::list<BanData *> bd; time_t server_modetime; /* Time of last server MODE */ @@ -104,7 +105,6 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> int16 server_modecount; /* Number of server MODEs this second */ int16 chanserv_modecount; /* Number of check_mode()'s this sec */ 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 @@ -286,6 +286,20 @@ class CoreExport Channel : public Extensible, public Flags<ChannelFlags> * @return A mode string */ 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 newtopic The new topic + * @param ts The time the new topic is being set + */ + void ChangeTopicInternal(const Anope::string &user, const Anope::string &newtopic, time_t ts = Anope::CurTime); + + /** Update the topic of the channel, and reset it if topiclock etc says to + * @param user The user setting the topic + * @param newtopic The new topic + * @param ts The time when the new topic is being set + */ + void ChangeTopic(const Anope::string &user, const Anope::string &newtopic, time_t ts = Anope::CurTime); }; #endif // CHANNELS_H diff --git a/include/extern.h b/include/extern.h index e0e6a6a9b..50d806189 100644 --- a/include/extern.h +++ b/include/extern.h @@ -73,11 +73,9 @@ E void do_cmode(const Anope::string &source, int ac, const char **av); E void do_join(const Anope::string &source, int ac, const char **av); E void do_kick(const Anope::string &source, int ac, const char **av); E void do_part(const Anope::string &source, int ac, const char **av); -E void do_topic(const Anope::string &source, int ac, const char **av); E void MassChannelModes(BotInfo *bi, const Anope::string &modes); E void chan_set_correct_modes(User *user, Channel *c, int give_modes); -E void restore_unsynced_topics(); E Entry *entry_create(const Anope::string &mask); E Entry *entry_add(EList *list, const Anope::string &mask); @@ -112,9 +110,6 @@ E void cs_remove_nick(const NickCore *nc); E void check_modes(Channel *c); E int check_valid_admin(User *user, Channel *chan, int servermode); E int check_valid_op(User *user, Channel *chan, int servermode); -E void record_topic(const Anope::string &chan); -E void restore_topic(const Anope::string &chan); -E int check_topiclock(Channel *c, time_t topic_time); E ChannelInfo *cs_findchan(const Anope::string &chan); E int check_access(User *user, ChannelInfo *ci, int what); diff --git a/include/regchannel.h b/include/regchannel.h index fb6810220..2b7ea67f4 100644 --- a/include/regchannel.h +++ b/include/regchannel.h @@ -89,9 +89,10 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, time_t time_registered; time_t last_used; - Anope::string last_topic; /* Last topic on the channel */ - Anope::string last_topic_setter; /* Who set the last topic */ - time_t last_topic_time; /* When the last topic was set */ + + Anope::string last_topic; /* The last topic that was set on this channel */ + Anope::string last_topic_setter; /* Setter */ + time_t last_topic_time; /* Time */ Anope::string forbidby; Anope::string forbidreason; @@ -286,6 +287,17 @@ class CoreExport ChannelInfo : public Extensible, public Flags<ChannelInfoFlag, * @return true if they are allowed, false if they aren't and were kicked */ bool CheckKick(User *user); + + /** Check the channel topic + * If topic lock is enabled will change the topic back, else it records + * the new topic in the ChannelInfo + */ + void CheckTopic(); + + /** Restore the channel topic, used on channel creation when not syncing with the uplink + * and after uplink sync + */ + void RestoreTopic(); }; #endif // REGCHANNEL_H diff --git a/include/services.h b/include/services.h index e0ed8709f..3034613b4 100644 --- a/include/services.h +++ b/include/services.h @@ -436,10 +436,7 @@ struct IRCDVar int snline; /* Supports SNline */ int sqline; /* Supports SQline */ int szline; /* Supports SZline */ - int join2set; /* Join 2 Set Modes */ int join2msg; /* Join 2 Message */ - int topictsforward; /* TS on Topics Forward */ - int topictsbackward; /* TS on Topics Backward */ int chansqline; /* Supports Channel Sqlines */ int quitonkill; /* IRCD sends QUIT when kill */ int svsmode_unban; /* svsmode can be used to unban */ @@ -949,7 +946,7 @@ class CoreExport IRCDProto virtual ~IRCDProto() { } virtual void SendSVSNOOP(const Anope::string &, int) { } - virtual void SendTopic(const BotInfo *, const Channel *, const Anope::string &, const Anope::string &) = 0; + virtual void SendTopic(BotInfo *, Channel *) = 0; virtual void SendVhostDel(User *) { } virtual void SendAkill(const XLine *) = 0; virtual void SendAkillDel(const XLine *) = 0; |