summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2013-02-13 17:42:01 -0500
committerAdam <Adam@anope.org>2013-02-14 01:20:18 -0500
commit9e544a6443117861c3d6406e435043f1cf0f7099 (patch)
treee7449fb01e377576e8a09f386117d2c251de0596 /include
parent225b7c38c127fbc6aac6724012f71c9483a4da77 (diff)
Store what channels have references to accounts in NickCore to prevent having to iterate over all channels and then all access entries when nicks expire or from nickserv/alist
Diffstat (limited to 'include')
-rw-r--r--include/account.h6
-rw-r--r--include/regchannel.h5
2 files changed, 10 insertions, 1 deletions
diff --git a/include/account.h b/include/account.h
index 8ce457a72..98827fd81 100644
--- a/include/account.h
+++ b/include/account.h
@@ -147,6 +147,8 @@ class CoreExport NickAlias : public Serializable, public Extensible
*/
class CoreExport NickCore : public Serializable, public Extensible
{
+ /* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */
+ Serialize::Checker<std::map<ChannelInfo *, int> > chanaccess;
public:
/* Name of the account. Find(display)->nc == this. */
Anope::string display;
@@ -293,6 +295,10 @@ class CoreExport NickCore : public Serializable, public Extensible
* @return The account, if it exists
*/
static NickCore* Find(const Anope::string &nick);
+
+ void AddChannelReference(ChannelInfo *ci);
+ void RemoveChannelReference(ChannelInfo *ci);
+ void GetChannelReferences(std::deque<ChannelInfo *> &queue);
};
/* A request to check if an account/password is valid. These can exist for
diff --git a/include/regchannel.h b/include/regchannel.h
index 02d637800..ab369ce2b 100644
--- a/include/regchannel.h
+++ b/include/regchannel.h
@@ -159,6 +159,7 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
{
private:
Serialize::Reference<NickCore> founder; /* Channel founder */
+ Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */
Serialize::Checker<std::vector<ChanAccess *> > access; /* List of authorized users */
Serialize::Checker<std::vector<AutoKick *> > akick; /* List of users to kickban */
Serialize::Checker<std::vector<BadWord *> > badwords; /* List of badwords */
@@ -174,7 +175,6 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
Serialize::Checker<std::vector<LogSetting *> > log_settings;
Anope::string name; /* Channel name */
- Serialize::Reference<NickCore> successor; /* Who gets the channel if the founder nick is dropped or expires */
Anope::string desc;
time_t time_registered;
@@ -223,6 +223,9 @@ class CoreExport ChannelInfo : public Serializable, public Extensible
*/
NickCore *GetFounder() const;
+ void SetSuccessor(NickCore *nc);
+ NickCore *GetSuccessor() const;
+
/** Find which bot should send mode/topic/etc changes for this channel
* @return The bot
*/