Support SILENCE without arguments.
authorJelmer Vernooij <jelmer@samba.org>
Thu, 19 Jul 2007 22:50:43 +0000 (00:50 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Thu, 19 Jul 2007 22:50:43 +0000 (00:50 +0200)
NEWS
src/isupport.c
src/isupport.h

diff --git a/NEWS b/NEWS
index 918a2faf8f5e470420aaa93aa7e13eaeeb29965b..7052488bd606cb9b8556cdf07fb2bbb9530c5ee1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,8 @@ Ctrlproxy 3.0.3 UNRELEASED
 
        * Only send PRIVMSG and NOTICE lines during the BACKLOG command. (#143)
 
+    * Support SILENCE without arguments. 
+
   INTERNALS
 
     * Use GIOChannels for reading the motd. 
index 5ce4639919ed752d81c3ec95e2bc1c4483ca4aa7..04f8758f176965716a9482ee34f4c5c35102e0e2 100644 (file)
@@ -172,8 +172,13 @@ char *network_info_string(struct network_info *info)
        if (info->keylen != 0)
                fs = g_list_append(fs, g_strdup_printf("KEYLEN=%d", info->keylen));
 
-       if (info->silence != 0)
-               fs = g_list_append(fs, g_strdup_printf("SILENCE=%d", info->silence));
+       if (info->silence) {
+               if (info->silence_limit != 0)
+                       fs = g_list_append(fs, 
+                                       g_strdup_printf("SILENCE=%d", info->silence_limit));
+               else 
+                       fs = g_list_append(fs, g_strdup("SILENCE"));
+       }
 
        if (info->chantypes != NULL)
                fs = g_list_append(fs, g_strdup_printf("CHANTYPES=%s", info->chantypes));
@@ -340,7 +345,11 @@ void network_info_parse(struct network_info *info, const char *parameter)
        } else if (!g_strcasecmp(key, "KEYLEN")) {
                info->keylen = atoi(val);
        } else if (!g_strcasecmp(key, "SILENCE")) {
-               info->silence = atoi(val);
+               if (val) {
+                       info->silence_limit = atoi(val);
+                       info->silence = TRUE;
+               } else
+                       info->silence = TRUE;
        } else if (!g_strcasecmp(key, "CHANTYPES")) {
                g_free(info->chantypes);
                info->chantypes = g_strdup(val);
index 2a1e84c7502a8c5996b4f55c14c19668fe7bcf5b..b738c24d36ef0479b25591a500e8555987aeae09 100644 (file)
@@ -106,9 +106,12 @@ struct network_info
        /* Maximum key length */
        int keylen;
 
-       /* The server support the SILENCE command. 
-        * The number is the maximum number of allowed entries in the list. */
-       int silence;
+       /* The server support the SILENCE command.  */
+       gboolean silence;
+
+       /* The number is the maximum number of allowed entries in the silence 
+        * list. */
+       int silence_limit;
 
        /* Maximum channel name length */
        int channellen;