Fix a few bugs that made LIST work confusingly with T and C qualifiers.
authorMichael Poole <mdpoole@troilus.org>
Mon, 5 Nov 2007 02:42:11 +0000 (02:42 +0000)
committerMichael Poole <mdpoole@troilus.org>
Mon, 5 Nov 2007 02:42:11 +0000 (02:42 +0000)
git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1840 c9e4aea6-c8fd-4c43-8297-357d70d61c8c

ChangeLog
ircd/m_list.c

index e1f630c6f4da2e30940ad01dccbf7298e9e1d9c8..91d249bf5b689fb2128fb3f86598be51383ed4a7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-11-04  Michael Poole <mdpoole@troilus.org>
+
+       * ircd/m_list.c (param_parse): Reverse comparison direction when
+       converting from minutes to time_t, and which bound is set (so that
+       T<time_t works correctly).  Also switch is_time cases so that 'T'
+       and 'C' work as documented.  Remove a "break" after a "return".
+
+       (m_list): Remove a "break" after a "return".
+
 2007-10-29  Michael Poole <mdpoole@troilus.org>
 
        * ircd/ircd_lexer.l (YY_INPUT): Redefine to use fbgets().
index 381c14ada554d0f027b66babc38c0fcb07245c5e..e634caa9ba2edccadb9cbf31aa536aee575559e7 100644 (file)
@@ -220,8 +220,11 @@ param_parse(struct Client *sptr, const char *param, struct ListingArgs *args,
       if (*param != ',' && *param != ' ' && *param != '\0') /* check syntax */
        return show_usage(sptr);
 
-      if (is_time && val < 80000000) /* Toggle UTC/offset */
-       val = TStime() - val * 60;
+      if (is_time && val < 80000000) {
+        /* Convert age to timestamp and reverse direction */
+        val = TStime() - val * 60;
+        dir = (dir == '>') ? '<' : '>';
+      }
       
       switch (is_time) {
       case 0: /* number of users on channel */
@@ -231,18 +234,18 @@ param_parse(struct Client *sptr, const char *param, struct ListingArgs *args,
          args->min_users = val;
        break;
 
-      case 1: /* channel topic */
+      case 1: /* channel creation time */
        if (dir == '<')
-         args->min_topic_time = val;
+         args->max_time = val;
        else
-         args->max_topic_time = val;
+         args->min_time = val;
        break;
 
-      case 2: /* channel creation time */
+      case 2: /* channel topic */
        if (dir == '<')
-         args->min_time = val;
+         args->max_topic_time = val;
        else
-         args->max_time = val;
+         args->min_topic_time = val;
        break;
       }
       break;
@@ -304,7 +307,6 @@ param_parse(struct Client *sptr, const char *param, struct ListingArgs *args,
        return show_usage(sptr);
 
       return LPARAM_CHANNEL;
-      break;
     }
 
     if (!*param) /* hit end of string? */
@@ -360,7 +362,6 @@ int m_list(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       switch (param_parse(sptr, parv[param], &args, parc == 2)) {
       case LPARAM_ERROR: /* error encountered, usage already sent, return */
        return 0;
-       break;
 
       case LPARAM_CHANNEL: /* show channel instead */
        show_channels++;