-
-
-#if 0
-/*
- * m_list
- *
- * parv[0] = sender prefix
- * parv[1] = channel list or user/time limit
- * parv[2...] = more user/time limits
- */
-int m_list(struct Client* cptr, struct Client *sptr, int parc, char *parv[])
-{
- struct Channel *chptr;
- char *name, *p = 0;
- int show_usage = 0, show_channels = 0, param;
- struct ListingArgs args = {
- 2147483647, /* max_time */
- 0, /* min_time */
- 4294967295U, /* max_users */
- 0, /* min_users */
- 0, /* topic_limits */
- 2147483647, /* max_topic_time */
- 0, /* min_topic_time */
- 0 /* chptr */
- };
-
- if (sptr->listing) /* Already listing ? */
- {
- sptr->listing->chptr->mode.mode &= ~MODE_LISTED;
- MyFree(sptr->listing);
- sptr->listing = 0;
- sendto_one(sptr, rpl_str(RPL_LISTEND), me.name, sptr->name); /* XXX DEAD */
- if (parc < 2)
- return 0; /* Let LIST abort a listing. */
- }
-
- if (parc < 2) /* No arguments given to /LIST ? */
- {
-#ifdef DEFAULT_LIST_PARAM
- static char *defparv[MAXPARA + 1];
- static int defparc = 0;
- static char lp[] = DEFAULT_LIST_PARAM;
- int i;
-
- if (!defparc)
- {
- char *s = lp, *t;
-
- defparc = 1;
- defparv[defparc++] = t = strtok(s, " ");
- while (t && defparc < MAXPARA)
- {
- if ((t = strtok(0, " ")))
- defparv[defparc++] = t;
- }
- }
- for (i = 1; i < defparc; i++)
- parv[i] = defparv[i];
- parv[i] = 0;
- parc = defparc;
-#endif /* DEFAULT_LIST_PARAM */
- }
-
- /* Decode command */
- for (param = 1; !show_usage && parv[param]; param++)
- {
- char *p = parv[param];
- do
- {
- int is_time = 0;
- switch (*p)
- {
- case 'T':
- case 't':
- is_time++;
- args.topic_limits = 1;
- /* Fall through */
- case 'C':
- case 'c':
- is_time++;
- p++;
- if (*p != '<' && *p != '>')
- {
- show_usage = 1;
- break;
- }
- /* Fall through */
- case '<':
- case '>':
- {
- p++;
- if (!IsDigit(*p))
- show_usage = 1;
- else
- {
- if (is_time)
- {
- time_t val = atoi(p);
- if (p[-1] == '<')
- {
- if (val < 80000000) /* Toggle UTC/offset */
- {
- /*
- * Demands that
- * 'TStime() - chptr->creationtime < val * 60'
- * Which equals
- * 'chptr->creationtime > TStime() - val * 60'
- */
- if (is_time == 1)
- args.min_time = TStime() - val * 60;
- else
- args.min_topic_time = TStime() - val * 60;
- }
- else if (is_time == 1) /* Creation time in UTC was entered */
- args.max_time = val;
- else /* Topic time in UTC was entered */
- args.max_topic_time = val;
- }
- else if (val < 80000000)
- {
- if (is_time == 1)
- args.max_time = TStime() - val * 60;
- else
- args.max_topic_time = TStime() - val * 60;
- }
- else if (is_time == 1)
- args.min_time = val;
- else
- args.min_topic_time = val;
- }
- else if (p[-1] == '<')
- args.max_users = atoi(p);
- else
- args.min_users = atoi(p);
- if ((p = strchr(p, ',')))
- p++;
- }
- break;
- }
- default:
- if (!IsChannelName(p))
- {
- show_usage = 1;
- break;
- }
- if (parc != 2) /* Don't allow a mixture of channels with <,> */
- show_usage = 1;
- show_channels = 1;
- p = 0;
- break;
- }
- }
- while (!show_usage && p); /* p points after comma, or is NULL */
- }
-
- if (show_usage)
- {
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- "Usage: \002/QUOTE LIST\002 \037parameters\037");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- "Where \037parameters\037 is a space or comma seperated "
- "list of one or more of:");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- " \002<\002\037max_users\037 ; Show all channels with less "
- "than \037max_users\037.");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- " \002>\002\037min_users\037 ; Show all channels with more "
- "than \037min_users\037.");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- " \002C<\002\037max_minutes\037 ; Channels that exist less "
- "than \037max_minutes\037.");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- " \002C>\002\037min_minutes\037 ; Channels that exist more "
- "than \037min_minutes\037.");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- " \002T<\002\037max_minutes\037 ; Channels with a topic last "
- "set less than \037max_minutes\037 ago.");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- " \002T>\002\037min_minutes\037 ; Channels with a topic last "
- "set more than \037min_minutes\037 ago.");
- sendto_one(sptr, rpl_str(RPL_LISTUSAGE), me.name, parv[0], /* XXX DEAD */
- "Example: LIST <3,>1,C<10,T>0 ; 2 users, younger than 10 min., "
- "topic set.");
- return 0;
- }
-
- sendto_one(sptr, rpl_str(RPL_LISTSTART), me.name, parv[0]); /* XXX DEAD */
-
- if (!show_channels)
- {
- if (args.max_users > args.min_users + 1 && args.max_time > args.min_time &&
- args.max_topic_time > args.min_topic_time) /* Sanity check */
- {
- sptr->listing = (struct ListingArgs*) MyMalloc(sizeof(struct ListingArgs));
- assert(0 != sptr->listing);
- memcpy(sptr->listing, &args, sizeof(struct ListingArgs));
- if ((sptr->listing->chptr = GlobalChannelList)) {
- int m = GlobalChannelList->mode.mode & MODE_LISTED;
- list_next_channels(sptr, 64);
- GlobalChannelList->mode.mode |= m;
- return 0;
- }
- MyFree(sptr->listing);
- sptr->listing = 0;
- }
- sendto_one(sptr, rpl_str(RPL_LISTEND), me.name, parv[0]); /* XXX DEAD */
- return 0;
- }
-
- for (; (name = ircd_strtok(&p, parv[1], ",")); parv[1] = 0)
- {
- chptr = FindChannel(name);
- if (chptr && ShowChannel(sptr, chptr) && sptr->user)
- sendto_one(sptr, rpl_str(RPL_LIST), me.name, parv[0], /* XXX DEAD */
- ShowChannel(sptr, chptr) ? chptr->chname : "*",
- chptr->users - number_of_zombies(chptr), chptr->topic);
- }
-
- sendto_one(sptr, rpl_str(RPL_LISTEND), me.name, parv[0]); /* XXX DEAD */
- return 0;
-}
-#endif /* 0 */
-