ソースを参照

* FiSH key in .chanset instead of .setkey

ducch 14 年 前
コミット
ff690e2fb4

+ 1 - 0
src/chan.h

@@ -185,6 +185,7 @@ struct chanset_t {
   interval_t auto_delay;
   int knock_flags;
   int protect_backup;
+  char fish_key[50];
 /* Chanint template 
  *int temp;
  */

+ 10 - 3
src/mod/channels.mod/chanmisc.c

@@ -565,7 +565,15 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item,
         return ERROR;
       }
       chan->protect_backup = atoi(item[i]);
-     
+    } else if (!strcmp(item[i], "fish-key")) {
+      i++;
+      if (i >= items) {
+        set_fish_key(chan->dname, "");
+        return ERROR;
+      }
+      set_fish_key(chan->dname, item[i]);
+      strlcpy(chan->fish_key, item[i], sizeof(chan->fish_key));
+    }
 
 /* Chanint template
  *  } else if (!strcmp(item[i], "temp")) {
@@ -577,8 +585,6 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item,
  *    }
  *    chan->temp = atoi(item[i]);
  */
-    }
-
 
     else if (!strcmp(item[i], "+enforcebans"))
       chan->status |= CHAN_ENFORCEBANS;
@@ -1009,6 +1015,7 @@ int channel_add(char *result, const char *newname, char *options, bool isdefault
     chan->groups = new bd::Array<bd::String>;
     *(chan->groups) << "main";
     chan->protect_backup = 1;
+    chan->fish_key[0] = 0;
     chan->knock_flags = 0;
     chan->flood_lock_time = 120;
     chan->flood_exempt_mode = 0;

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

@@ -1256,6 +1256,8 @@ static void cmd_chaninfo(int idx, char *par)
     SHOW_INT("Protect-backup: ", chan->protect_backup, "Do!", "Don't!");
     SHOW_INT("Voice-non-ident: ", chan->voice_non_ident, "Do!", "Don't!");
 
+    dprintf(idx, "FiSH Key: %s\n", FishKeys.contains(chan->dname) && FishKeys[chan->dname]->sharedKey.length() ? FishKeys[chan->dname]->sharedKey.c_str() : "not set");
+
     dprintf(idx, "Flood settings:   chan ctcp join kick deop nick mjoin\n");
     dprintf(idx, "  number:          %3d  %3d  %3d  %3d  %3d  %3d  %3d\n",
 	    chan->flood_pub_thr, chan->flood_ctcp_thr,

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

@@ -719,7 +719,7 @@ 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 \
 exempt-time %d invite-time %d voice-non-ident %d auto-delay %d \
-flood-exempt %d flood-lock-time %d knock %d \
+flood-exempt %d flood-lock-time %d knock %d fish_key { %s } \
 %cmeankicks %cenforcebans %cdynamicbans %cuserbans %cbitch \
 %cprivate %ccycle %cinactive %cdynamicexempts %cuserexempts \
 %cdynamicinvites %cuserinvites %cnodesynch %cclosed %cvoice \
@@ -758,6 +758,7 @@ flood-exempt %d flood-lock-time %d knock %d \
         chan->flood_exempt_mode,
         chan->flood_lock_time,
         chan->knock_flags,
+        chan->fish_key,
  	PLSMNS(channel_meankicks(chan)),
  	PLSMNS(channel_enforcebans(chan)),
 	PLSMNS(channel_dynamicbans(chan)),