Jelajahi Sumber

Added channel setting templates: Chanint Chanchar Chanflag

svn: 28
Bryan Drewery 23 tahun lalu
induk
melakukan
1f3ae357e5

+ 14 - 1
src/chan.h

@@ -149,6 +149,9 @@ struct chanset_t {
   int status;
   int ircnet_status;
   int limitraise;
+/* Chanint template 
+ *int temp;
+ */
   int jointime;
   int parttime;
   int idle_kick;
@@ -171,6 +174,9 @@ struct chanset_t {
   int limit_prot;		/* desired limit			*/
   char key_prot[121];		/* desired password			*/
   char topic_prot[501];		/* desired topic			*/
+/* Chanchar template
+ *char temp[121];
+ */
   /* queued mode changes: */
   char pls[21];			/* positive mode changes		*/
   char mns[21];			/* negative mode changes		*/
@@ -208,6 +214,11 @@ struct chanset_t {
 };
 
 /* behavior modes for the channel */
+
+/* Chanflag template 
+ * #define CHAN_TEMP           0x0000
+ */
+
 #define CHAN_ENFORCEBANS    0x0001	   /* kick people who match channel bans */
 #define CHAN_DYNAMICBANS    0x0002	   /* only activate bans when needed     */
 #define CHAN_NOUSERBANS     0x0004	   /* don't let non-bots place bans      */
@@ -297,7 +308,9 @@ struct chanset_t *findchan_by_dname(const char *name);
 #define channel_voice(chan) (chan->status & CHAN_VOICE)
 #define channel_fastop(chan) (chan->status & CHAN_FASTOP)
 #define channel_private(chan) (chan->status & CHAN_PRIVATE)
-
+/* Chanflag template
+ *#define channel_temp(chan) (chan->status & CHAN_PRIVATE)
+ */
 
 
 

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

@@ -701,6 +701,10 @@ static void channels_report(int idx, int details)
           i += my_strcpy(s + i, "manop ");
         if (channel_voice(chan))
           i += my_strcpy(s + i, "voice ");
+/* Chanflag template
+ *	if (channel_temp(chan))
+ *	  i += my_strcpy(s + i, "temp ");
+*/
         if (channel_fastop(chan))
           i += my_strcpy(s + i, "fastop ");
         if (channel_private(chan))

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

@@ -1397,6 +1397,9 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
     get_mode_protect(chan, work);
     dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "None");
     dprintf(idx, "Protect topic: %s\n", chan->topic_prot[0] ? chan->topic_prot : "None");
+/* Chanchar template
+ *  dprintf(idx, "String temp: %s\n", chan->temp[0] ? chan->temp : "NULL");
+ */
     if (chan->idle_kick)
       dprintf(idx, "Idle Kick after (idle-kick): %d\n", chan->idle_kick);
     else
@@ -1417,6 +1420,12 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
       dprintf(idx, "ban-time: %d\n", chan->ban_time);
     else
       dprintf(idx, "ban-time: 0\n");
+/* Chanint template
+ *  if (chan->temp)
+ *   dprintf(idx, "temp: %d\n", chan->temp);
+ * else
+ *   dprintf(idx, temp: 0\n");
+ */
 #ifdef S_IRCNET
     if (chan->exempt_time)
       dprintf(idx, "exempt-time: %d\n", chan->exempt_time);
@@ -1473,6 +1482,10 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
     dprintf(idx, "     %cvoice          %cfastop\n",
 	    (chan->status & CHAN_VOICE) ? '+' : '-',
 	    (chan->status & CHAN_FASTOP) ? '+' : '-');
+/* Chanflag template
+ *          (chan->status & CHAN_TEMP) ? '+' : '-',
+ * also include %ctemp in dprintf.
+ */
 
 
     ii = 1;

+ 48 - 0
src/mod/channels.mod/tclchan.c

@@ -752,6 +752,10 @@ static int tcl_channel_info(Tcl_Interp * irp, struct chanset_t *chan)
   Tcl_AppendElement(irp, s);
   simple_sprintf(s, "%d", chan->ban_time);
   Tcl_AppendElement(irp, s);
+/* Chanint template 
+ *simple_sprintf(s, "%s", chan->temp);
+ *Tcl_AppendElement(irp, s);
+ */
 #ifdef S_IRCNET
   simple_sprintf(s, "%d", chan->exempt_time);
   Tcl_AppendElement(irp, s);
@@ -848,6 +852,12 @@ static int tcl_channel_info(Tcl_Interp * irp, struct chanset_t *chan)
     Tcl_AppendElement(irp, "+voice");
   else
     Tcl_AppendElement(irp, "-voice");
+/* Chanflag template
+ *if (chan->status & CHAN_TEMP)
+ *  Tcl_AppendElement(irp, "+temp");
+ *else
+ *  Tcl_AppendElement(irp, "-temp");
+ */
   if (chan->status & CHAN_FASTOP)
     Tcl_AppendElement(irp, "+fastop");
   else
@@ -915,6 +925,9 @@ static int tcl_channel_get(Tcl_Interp * irp, struct chanset_t *chan, char *setti
   else if (CHECK("flood-kick"))    simple_sprintf(s, "%d %d", chan->flood_kick_thr, chan->flood_kick_time);
   else if (CHECK("flood-deop"))    simple_sprintf(s, "%d %d", chan->flood_deop_thr, chan->flood_deop_time);
   else if (CHECK("flood-nick"))    simple_sprintf(s, "%d %d", chan->flood_nick_thr, chan->flood_nick_time);
+/* Chanint template
+ *else if (CHECK("temp"))	   simple_sprintf(s, "%s", chan->temp);
+ */
   else if (CHECK("ban-time"))  	   simple_sprintf(s, "%d", chan->ban_time);
 #ifdef S_IRCNET
   else if (CHECK("exempt-time"))   simple_sprintf(s, "%d", chan->exempt_time);
@@ -946,6 +959,9 @@ static int tcl_channel_get(Tcl_Interp * irp, struct chanset_t *chan, char *setti
   else if CHKFLAG_POS(CHAN_VOICE,          "voice",          chan->status)
   else if CHKFLAG_POS(CHAN_FASTOP,          "fastop",          chan->status)
   else if CHKFLAG_POS(CHAN_PRIVATE,          "private",          chan->status)
+/* Chanflag template
+ *else if CHKFLAG_POS(CHAN_TEMP,	   "temp",		chan->status)
+ */
 
   else {
     /* Hopefully it's a user-defined flag. */
@@ -1173,6 +1189,16 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
       }
       chan->invite_time = atoi(item[i]);
 #endif
+/* Chanint template
+ *  } else if (!strcmp(item[i], "temp")) {
+ *    i++;
+ *    if (i >= items) {
+ *      if (irp)
+ *        Tcl_AppendResult(irp, "channel temp needs argument", NULL);
+ *      return TCL_ERROR;
+ *    }
+ *    chan->temp = atoi(item[i]);
+ */
     } else if (!strcmp(item[i], "topic")) {
       i++;
       if (i >= items) {
@@ -1183,6 +1209,19 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
       strncpyz(chan->topic_prot, item[i], sizeof(chan->topic_prot));
       check_topic(chan);
     }
+/* Chanchar template
+    } else if (!strcmp(item[i], "temp")) {
+      i++;
+      if (i >= items) {
+        if (irp)
+          Tcl_AppendResult(irp, "channel temp needs argument", NULL);
+        return TCL_ERROR;
+      }
+      strncpyz(chan->temp, item[i], sizeof(chan->temp));
+      //Entry just changed so update/recheck it's purpose?
+      check_temp(chan);
+    }
+ */
     else if (!strcmp(item[i], "+enforcebans"))
       chan->status |= CHAN_ENFORCEBANS;
     else if (!strcmp(item[i], "-enforcebans"))
@@ -1273,6 +1312,12 @@ static int tcl_channel_modify(Tcl_Interp * irp, struct chanset_t *chan,
       chan->status |= CHAN_VOICE;
     else if (!strcmp(item[i], "-voice"))
       chan->status &= ~CHAN_VOICE;
+/* Chanflag template
+ *  else if (!strcmp(item[i], "+temp"))
+ *    chan->status |= CHAN_TEMP;
+ *  else if (!strcmp(item[i], "-temp"))
+ *    chan->status &= ~CHAN_TEMP;
+ */
     else if (!strcmp(item[i], "+fastop")) {
       chan->status |= CHAN_FASTOP;
     }
@@ -1805,6 +1850,9 @@ static int tcl_channel_add(Tcl_Interp *irp, char *newname, char *options)
 
     chan->limit_prot = 0;
     chan->limit = 0;
+/* Chanint template
+ *  chan->temp = 0;
+ */
     chan->flood_pub_thr = gfld_chan_thr;
     chan->flood_pub_time = gfld_chan_time;
     chan->flood_ctcp_thr = gfld_ctcp_thr;

+ 18 - 0
src/mod/channels.mod/userchan.c

@@ -1283,6 +1283,9 @@ static int write_chans(FILE *f, int idx)
 
   char w[1024], w2[1024], name[163];
   char topic[1002], udefs[2048] = "", sadd[5], buf[2048];
+/* Chanchar template
+ *char temp[121];
+ */
   struct chanset_t *chan;
   struct udef_struct *ul;
 
@@ -1310,6 +1313,9 @@ static int write_chans(FILE *f, int idx)
      get_mode_protect(chan, w);
      convert_element(w, w2);
      convert_element(chan->topic_prot, topic);
+/* Chanchar template
+ *   convert_element(chan->temp, temp);
+ */
      for (ul = udef; ul; ul = ul->next) { //put the udefs into one string
        memset(buf,'\0',2048);
        if (ul->defined && ul->name) { 
@@ -1343,6 +1349,10 @@ exempt-time %d invite-time %d \
 	channel_static(chan) ? " " : " { ",
 	w2,
         topic,
+/* Chanchar template
+ *      temp,
+ * also include temp %s in dprintf.
+ */
 	chan->idle_kick, /* idle-kick 0 is same as dont-idle-kick (lcode)*/
         chan->limitraise,
 	chan->stopnethack_mode,
@@ -1353,6 +1363,10 @@ exempt-time %d invite-time %d \
         chan->flood_kick_thr, chan->flood_kick_time,
         chan->flood_deop_thr, chan->flood_deop_time,
 	chan->flood_nick_thr, chan->flood_nick_time,
+/* Chanint template
+ *      chan->temp,
+ * also include temp %d in dprintf
+ */
         chan->ban_time,
 #ifdef S_IRCNET
         chan->exempt_time,
@@ -1382,6 +1396,10 @@ exempt-time %d invite-time %d \
 	PLSMNS(channel_manop(chan)),
 	PLSMNS(channel_voice(chan)),
 	PLSMNS(channel_fastop(chan)),
+/* Chanflag template
+ * also include a %ctemp above.
+ *      PLSMNS(channel_temp(chan)),
+ */
         udefs,
         sadd) == EOF)
           return 0;