Sfoglia il codice sorgente

* Add chanset 'groups'

Bryan Drewery 14 anni fa
parent
commit
09f5cae351

+ 1 - 0
doc/UPDATES

@@ -1,4 +1,5 @@
 * Add [bot]set var 'groups' to configure what groups bots are in
+* Add chanset 'groups' to take a list of groups that should join. 'chanset #chan groups { main backup }'
 
 1.4.0 - http://wraith.botpack.net/milestone/1.4.0
   * Updated server list, 'set -yes servers -' and 'set -yes servers6 -' to get new list.

+ 6 - 2
doc/help.txt

@@ -359,8 +359,12 @@ See also: link
 ###  $bchaninfo$b <channel>
    This lists all the settings for the bot on the given channel.
    It shows any of the following:
-        $bchanmode$b   These modes are enforced on the channel. Both + and -
-                   modes can be enforced.
+        $bchanmode$b         These modes are enforced on the channel.
+                          Both + and - modes can be enforced. Use {} to
+                          add a key. '%dchanset #chan chanmode { +nt key }'
+        $bgroups$b            List of groups that should join the channel.
+                          Use {} to add multiple groups. See also '%dhelp set'
+                          '%dchanset #chan groups { main alt }'
 %{+m|m}
         $bauto-delay$b        Amount of seconds to wait before auto opping,
                               or auto voicing a client based on flags or

+ 1 - 0
src/chan.h

@@ -210,6 +210,7 @@ struct chanset_t {
   char pls[21];			/* positive mode changes		*/
   char mns[21];			/* negative mode changes		*/
   char key_prot[121];		/* desired password			*/
+  char groups[1024];		/* groups that should join */
 /* Chanchar template
  *char temp[121];
  */

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

@@ -336,6 +336,17 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item,
       }
       strlcpy(s, item[i], sizeof(s));
       set_mode_protect(chan, s);
+    } else if (!strcmp(item[i], "groups")) {
+      i++;
+      if (i >= items) {
+	if (result)
+	  strlcpy(result, "channel groups needs argument", RESULT_LEN);
+	return ERROR;
+      }
+      // Get string into right format
+      bd::String changroups(item[i]);
+      changroups.trim();
+      strlcpy(chan->groups, changroups.c_str(), sizeof(chan->groups));
     } else if (!strcmp(item[i], "topic")) {
       char *p = NULL;
 

+ 1 - 0
src/mod/channels.mod/cmdschan.c

@@ -1228,6 +1228,7 @@ static void cmd_chaninfo(int idx, char *par)
 /* FIXME: SHOW_CHAR() here */
     get_mode_protect(chan, work, sizeof(work));
     dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "None");
+    dprintf(idx, "Groups: %s\n", chan->groups[0] ? bd::String(chan->groups).c_str() : "None");
 //    dprintf(idx, "Protect topic (topic)   : %s\n", chan->topic[0] ? chan->topic : "");
 /* Chanchar template
  *  dprintf(idx, "String temp: %s\n", chan->temp[0] ? chan->temp : "NULL");

+ 2 - 1
src/mod/channels.mod/userchan.c

@@ -717,7 +717,7 @@ bd::String channel_to_string(struct chanset_t* chan, bool force_inactive) {
 
   get_mode_protect(chan, w, sizeof(w));
   return bd::String::printf("\
-chanmode { %s } bad-cookie %d manop %d mdop %d mop %d limit %d ban-type %d \
+chanmode { %s } groups { %s } bad-cookie %d manop %d mdop %d mop %d limit %d ban-type %d \
 flood-chan %d:%d flood-ctcp %d:%d flood-join %d:%d \
 flood-kick %d:%d flood-deop %d:%d flood-nick %d:%d flood-mjoin %d:%d \
 closed-ban %d closed-invite %d closed-private %d ban-time %d \
@@ -732,6 +732,7 @@ flood-exempt %d flood-lock-time %d knock %d \
  *      temp,
  * also include temp %s in dprintf.
  */
+        chan->groups,
 	chan->bad_cookie,
 	chan->manop,
 	chan->mdop,