Bläddra i källkod

* Started base for topiclock

svn: 933
Bryan Drewery 22 år sedan
förälder
incheckning
972424453b
2 ändrade filer med 27 tillägg och 22 borttagningar
  1. 1 0
      src/mod/channels.mod/cmdschan.c
  2. 26 22
      src/mod/channels.mod/tclchan.c

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

@@ -1155,6 +1155,7 @@ static void cmd_chaninfo(struct userrec *u, int idx, char *par)
 /* FIXME: SHOW_CHAR() here */
     get_mode_protect(chan, work);
     dprintf(idx, "Protect modes (chanmode): %s\n", work[0] ? work : "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");
  */

+ 26 - 22
src/mod/channels.mod/tclchan.c

@@ -294,6 +294,17 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
   char s[121] = "";
 
   for (i = 0; i < items; i++) {
+/* Chanchar template
+    } else if (!strcmp(item[i], "temp")) {
+      i++;
+      if (i >= items) {
+        if (result)
+          sprintf(result, "channel temp needs argument");
+        return ERROR;
+      }
+      strncpyz(chan->temp, item[i], sizeof(chan->temp));
+      check_temp(chan);
+ */
     if (!strcmp(item[i], "chanmode")) {
       i++;
       if (i >= items) {
@@ -301,14 +312,25 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
 	  sprintf(result, "channel chanmode needs argument");
 	return ERROR;
       }
-      strncpy(s, item[i], 120);
-      s[120] = 0;
+      strncpyz(s, item[i], 121);
       set_mode_protect(chan, s);
+    } else if (!strcmp(item[i], "topic")) {
+      char *p = NULL;
+
+      i++;
+      if (i >= items) {
+	if (result)
+	  sprintf(result, "topic needs argument");
+	return ERROR;
+      }
+      p = replace(item[i], "{", "[");
+      p = replace(p, "}", "]");
+      strncpyz(chan->topic, p, 121);
     } else if (!strcmp(item[i], "addedby")) {
       i++;
       if (i >= items) {
 	if (result)
-	  sprintf(result, "addedby chanmode needs argument");
+	  sprintf(result, "addedby needs argument");
 	return ERROR;
       }
       strncpyz(chan->added_by, item[i], NICKLEN);
@@ -316,7 +338,7 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
       i++;
       if (i >= items) {
 	if (result)
-	  sprintf(result, "addedts chanmode needs argument");
+	  sprintf(result, "addedts needs argument");
 	return ERROR;
       }
       chan->added_ts = atoi(item[i]);
@@ -405,24 +427,6 @@ int channel_modify(char *result, struct chanset_t *chan, int items, char **item)
  *    }
  *    chan->temp = atoi(item[i]);
  */
-/* Chanchar template
-    } else if (!strcmp(item[i], "temp")) {
-      i++;
-      if (i >= items) {
-        if (result)
-          sprintf(result, "channel temp needs argument");
-        return ERROR;
-      }
-      strncpyz(chan->temp, item[i], sizeof(chan->temp));
-      check_temp(chan);
- */
-    } else if (!strcmp(item[i], "topic")) { /* this is here for compatability */
-      i++;
-      if (i >= items) {
-        if (result)
-          sprintf(result, "channel topic needs argument");
-        return ERROR;
-      }
     }