Răsfoiți Sursa

Add fields to track roles per chan

channel_t.bot_roles	Hash of roles for each bot
channel_t.role_bots	Hash of list of bots for each role
Bryan Drewery 12 ani în urmă
părinte
comite
5247b92512
3 a modificat fișierele cu 10 adăugiri și 0 ștergeri
  1. 6 0
      src/chan.h
  2. 2 0
      src/mod/channels.mod/chanmisc.c
  3. 2 0
      src/mod/channels.mod/channels.c

+ 6 - 0
src/chan.h

@@ -257,6 +257,12 @@ struct chanset_t {
   char added_by[HANDLEN + 1];	/* who added the channel? */
   char dname[81];               /* what the users know the channel as like !eggdev */
   char name[81];                /* what the servers know the channel as, like !ABCDEeggdev */
+
+  // bitmask of roles for each bot
+  bd::HashTable<bd::String, int> *bot_roles;
+
+  // List of bots for each role
+  bd::HashTable<short, bd::Array<bd::String> > *role_bots;
 };
 
 /* behavior modes for the channel */

+ 2 - 0
src/mod/channels.mod/chanmisc.c

@@ -1159,6 +1159,8 @@ int channel_add(char *result, const char *newname, char *options, bool isdefault
     chan->channel.last_eI = 0;
     chan->channel.floodtime = NULL;
     chan->channel.floodnum = NULL;
+    chan->bot_roles = new bd::HashTable<bd::String, int>;
+    chan->role_bots = new bd::HashTable<short, bd::Array<bd::String> >;
 
     /* We _only_ put the dname (display name) in here so as not to confuse
      * any code later on. chan->name gets updated with the channel name as

+ 2 - 0
src/mod/channels.mod/channels.c

@@ -712,6 +712,8 @@ void remove_channel(struct chanset_t *chan)
    if (chan->groups) {
      delete(chan->groups);
    }
+   delete chan->bot_roles;
+   delete chan->role_bots;
    delete chan->channel.floodtime;
    delete chan->channel.floodnum;
    free(chan);