Support ELIST
authorJelmer Vernooij <jelmer@samba.org>
Sat, 7 Apr 2007 01:10:46 +0000 (03:10 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 7 Apr 2007 01:10:46 +0000 (03:10 +0200)
NEWS
src/isupport.c
src/isupport.h

diff --git a/NEWS b/NEWS
index 41096796ef8476be88a99b4ba61e1bb1acb12637..81d14d85ad0061ab32949ca66389df98ba578570 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -64,7 +64,7 @@ Ctrlproxy 3.0.2 UNRELEASED
                AWAYLEN, MAXTARGETS, WALLCHOPS, WALLVOICES, RFC2812, PENALTY,
                FNC, SAFELIST, USERIP, CNOTICE, KNOCK, VCHANNELS, WHOX, CALLERID,
                ACCEPT, KEYLEN, USERLEN, HOSTLEN, MAXCHANNELLEN, 
-               MAXNICKLEN, DEAF and SILENCE
+               MAXNICKLEN, DEAF, ELIST and SILENCE
 
        * Default to binding to 127.0.0.1 if no IP was specified in the 
          listener, instead of 0.0.0.0.
index 0d49db00c6f4c9d78863acd4ba0ae9abf8f003ea..60699d25f5b0473a1f79544331af717d6ee667e4 100644 (file)
@@ -181,6 +181,26 @@ char *network_info_string(struct network_info *info)
        if (info->invex_mode != '\0')
                fs = g_list_append(fs, g_strdup_printf("INVEX=%c", info->invex_mode));
 
+       if (info->elist_mask_search ||
+               info->elist_inverse_mask_search ||
+               info->elist_usercount_search ||
+               info->elist_creation_time_search ||
+               info->elist_topic_search) {
+               char elist[100];
+               strcpy(elist, "");
+               if (info->elist_mask_search)
+                       strncat(elist, "M", sizeof(elist));
+               if (info->elist_inverse_mask_search)
+                       strncat(elist, "N", sizeof(elist));
+               if (info->elist_usercount_search)
+                       strncat(elist, "U", sizeof(elist));
+               if (info->elist_creation_time_search)
+                       strncat(elist, "C", sizeof(elist));
+               if (info->elist_topic_search)
+                       strncat(elist, "T", sizeof(elist));
+               fs = g_list_append(fs, g_strdup_printf("ELIST=%s", elist));
+       }
+       
        if (info->deaf_mode != '\0')
                fs = g_list_append(fs, g_strdup_printf("DEAF=%c", info->deaf_mode));
 
@@ -312,6 +332,20 @@ void network_info_parse(struct network_info *info, const char *parameter)
                        log_global(LOG_WARNING, "Invalid length invex value: %s", val);
                else
                        info->invex_mode = val[0];
+       } else if (!g_strcasecmp(key, "ELIST")) {
+               int i;
+               for (i = 0; val[i]; i++) {
+                       switch (val[i]) {
+                       case 'M': info->elist_mask_search = TRUE; break;
+                       case 'N': info->elist_inverse_mask_search = TRUE; break;
+                       case 'T': info->elist_topic_search = TRUE; break;
+                       case 'U': info->elist_usercount_search = TRUE; break;
+                       case 'C': info->elist_creation_time_search = TRUE; break;
+                       default:
+                                 log_global(LOG_WARNING, "Unknown ELIST parameter '%c'", val[i]);
+                                 break;
+                       }
+               }
        } else if (!g_strcasecmp(key, "DEAF")) {
                if (val == NULL) 
                        info->deaf_mode = 'D';
index 09fd06d03966305cf61ffe3de6e40d7472f777fb..fe9797ecf9bb6dc1088a5846360d28ea0207613c 100644 (file)
@@ -72,6 +72,15 @@ struct network_info
        /* FIXME: Should be a hash table */
        char *maxlist;
 
+       /** The server supports extentions for the LIST command. 
+        * The tokens specify which extention are supported. *
+        */
+       gboolean elist_mask_search;
+       gboolean elist_inverse_mask_search;
+       gboolean elist_usercount_search;
+       gboolean elist_creation_time_search;
+       gboolean elist_topic_search;
+
        /** The ID length for channels with an ID. The prefix says for which 
         * channel type it is, and the number how long it is. See RFC 2811 for 
         * more information. */