$Log$
+Revision 653.6 2005/07/21 15:02:27 ajc
+* Server-side LIST command now accepts a search string.
+
Revision 653.5 2005/07/19 20:04:31 ajc
* MSG4 command now outputs content type *and* charset
Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
* Initial CVS import
+
}
else if (!strncasecmp(cmdbuf,"LIST",4)) {
- cmd_list();
+ cmd_list(&cmdbuf[5]);
}
else if (!strncasecmp(cmdbuf,"CHEK",4)) {
Unlisted entries will also be listed to Aides logged into the server, but
not to ordinary users.
+
+ The LIST command accepts an optional single argument, which is a simple,
+case-insensitive search string. If this argument is present, only usernames
+in which the search string is present will be returned. It is a simple
+substring search, not a regular expression search. If this string is empty
+or not present, all users will be returned.
REGI (send REGIstration)
*/
void ListThisUser(struct ctdluser *usbuf, void *data)
{
+ char *searchstring;
+
+ searchstring = (char *)data;
+ if (bmstrstr(usbuf->fullname, searchstring, strncasecmp) == NULL) {
+ return;
+ }
+
if (usbuf->axlevel > 0) {
if ((CC->user.axlevel >= 6)
|| ((usbuf->flags & US_UNLISTED) == 0)
}
/*
- * List users
+ * List users (searchstring may be empty to list all users)
*/
-void cmd_list(void)
+void cmd_list(char *cmdbuf)
{
+ char searchstring[256];
+ extract_token(searchstring, cmdbuf, 0, '|', sizeof searchstring);
+ striplt(searchstring);
cprintf("%d \n", LISTING_FOLLOWS);
- ForEachUser(ListThisUser, NULL);
+ ForEachUser(ListThisUser, (void *)searchstring );
cprintf("000\n");
}
void ForEachUser(void (*CallBack)(struct ctdluser *EachUser, void *out_data),
void *in_data);
void ListThisUser(struct ctdluser *usbuf, void *data);
-void cmd_list (void);
+void cmd_list (char *);
void cmd_chek (void);
void cmd_qusr (char *who);
void cmd_agup (char *cmdbuf);