mirror of
https://github.com/anope/anope.git
synced 2026-07-10 08:03:13 +02:00
listnicks and listchans go away, as they aren't all that useful (and way too old.)
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1201 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -162,7 +162,6 @@ E ChannelInfo *chanlists[256];
|
||||
E CSModeUtil csmodeutils[];
|
||||
E LevelInfo levelinfo[];
|
||||
|
||||
E void listchans(int count_only, const char *chan);
|
||||
E void get_chanserv_stats(long *nrec, long *memuse);
|
||||
|
||||
E int delchan(ChannelInfo * ci);
|
||||
@@ -726,12 +725,6 @@ E void syntax_error(char *service, User * u, const char *command,
|
||||
int msgnum);
|
||||
|
||||
|
||||
/**** list.c ****/
|
||||
|
||||
E void do_listnicks(int ac, char **av);
|
||||
E void do_listchans(int ac, char **av);
|
||||
|
||||
|
||||
/**** log.c ****/
|
||||
|
||||
E int open_log(void);
|
||||
@@ -916,7 +909,6 @@ E unsigned int guestnum;
|
||||
E void insert_requestnick(NickRequest * nr);
|
||||
E void alpha_insert_alias(NickAlias * na);
|
||||
E void insert_core(NickCore * nc);
|
||||
E void listnicks(int count_only, const char *nick);
|
||||
E void get_aliases_stats(long *nrec, long *memuse);
|
||||
E void get_core_stats(long *nrec, long *memuse);
|
||||
E void collide(NickAlias * na, int from_timeout);
|
||||
|
||||
+3
-7
@@ -1,14 +1,14 @@
|
||||
MYSQL_OBJ = $(MYSQL:.c=.o)
|
||||
RDB_OBJ = $(RDB:.c=.o)
|
||||
OBJS = actions.o base64.o botserv.o channels.o chanserv.o commands.o compat.o \
|
||||
config.o datafiles.o encrypt.o events.o helpserv.o hostserv.o init.o ircd.o language.o list.o log.o mail.o main.o \
|
||||
config.o datafiles.o encrypt.o events.o helpserv.o hostserv.o init.o ircd.o language.o log.o mail.o main.o \
|
||||
memory.o memoserv.o messages.o misc.o modules.o news.o nickserv.o operserv.o \
|
||||
process.o send.o servers.o sessions.o slist.o sockutil.o timeout.o users.o \
|
||||
$(RDB_OBJ) $(MYSQL_OBJ)
|
||||
SRCS = actions.c base64.c botserv.c channels.c chanserv.c commands.c compat.c \
|
||||
config.c datafiles.c encrypt.c events.c helpserv.c hostserv.c init.c ircd.c language.c list.c log.c mail.c main.c \
|
||||
config.c datafiles.c encrypt.c events.c helpserv.c hostserv.c init.c ircd.c language.c log.c mail.c main.c \
|
||||
memory.c memoserv.c messages.c misc.c modules.c news.c nickserv.c operserv.c \
|
||||
process.c send.c servers.c sessions.c slist.c sockutil.c timeout.c users.c \
|
||||
process.c send.c servers.c sessions.c s sockutil.c timeout.c users.c \
|
||||
$(RDB) $(MYSQL)
|
||||
|
||||
INCLUDES = ../include/commands.h ../include/defs.h ../include/language.h \
|
||||
@@ -52,7 +52,6 @@ ircd.o: ircd.c $(INCLUDES)
|
||||
helpserv.o: helpserv.c $(INCLUDES)
|
||||
hostserv.o: hostserv.c $(INCLUDES)
|
||||
language.o: language.c $(INCLUDES)
|
||||
list.o: list.c $(INCLUDES)
|
||||
log.o: log.c $(INCLUDES)
|
||||
mail.o: mail.c $(INCLUDES)
|
||||
main.o: main.c $(INCLUDES)
|
||||
@@ -111,9 +110,6 @@ install: services
|
||||
test -d ${BINDEST} || mkdir ${BINDEST}
|
||||
$(INSTALL) services $(BINDEST)/services
|
||||
$(INSTALL) bin/anoperc $(BINDEST)/anoperc
|
||||
rm -f $(BINDEST)/listnicks $(BINDEST)/listchans
|
||||
ln $(BINDEST)/services $(BINDEST)/listnicks
|
||||
ln $(BINDEST)/services $(BINDEST)/listchans
|
||||
(cd ../lang ; $(MAKE) install)
|
||||
$(CP) ../data/* $(DATDEST)
|
||||
$(INSTALL) bin/mydbgen $(DATDEST)/mydbgen
|
||||
|
||||
-119
@@ -182,125 +182,6 @@ char *get_mlock_modes(ChannelInfo * ci, int complete)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Display total number of registered channels and info about each; or, if
|
||||
* a specific channel is given, display information about that channel
|
||||
* (like /msg ChanServ INFO <channel>). If count_only != 0, then only
|
||||
* display the number of registered channels (the channel parameter is
|
||||
* ignored).
|
||||
*/
|
||||
|
||||
void listchans(int count_only, const char *chan)
|
||||
{
|
||||
int count = 0;
|
||||
ChannelInfo *ci;
|
||||
int i;
|
||||
|
||||
if (count_only) {
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
for (ci = chanlists[i]; ci; ci = ci->next)
|
||||
count++;
|
||||
}
|
||||
printf("%d channels registered.\n", count);
|
||||
|
||||
} else if (chan) {
|
||||
|
||||
struct tm *tm;
|
||||
char buf[BUFSIZE];
|
||||
|
||||
if (!(ci = cs_findchan(chan))) {
|
||||
printf("Channel %s not registered.\n", chan);
|
||||
return;
|
||||
}
|
||||
if (ci->flags & CI_VERBOTEN) {
|
||||
printf("Channel %s is FORBIDden.\n", ci->name);
|
||||
} else {
|
||||
printf("Information about channel %s:\n", ci->name);
|
||||
printf(" Founder: %s\n", ci->founder->display);
|
||||
printf(" Description: %s\n", ci->desc);
|
||||
tm = localtime(&ci->time_registered);
|
||||
strftime(buf, sizeof(buf),
|
||||
getstring(NULL, STRFTIME_DATE_TIME_FORMAT), tm);
|
||||
printf(" Registered: %s\n", buf);
|
||||
tm = localtime(&ci->last_used);
|
||||
strftime(buf, sizeof(buf),
|
||||
getstring(NULL, STRFTIME_DATE_TIME_FORMAT), tm);
|
||||
printf(" Last used: %s\n", buf);
|
||||
if (ci->last_topic) {
|
||||
printf(" Last topic: %s\n", ci->last_topic);
|
||||
printf(" Topic set by: %s\n", ci->last_topic_setter);
|
||||
}
|
||||
if (ci->url)
|
||||
printf(" URL: %s\n", ci->url);
|
||||
if (ci->email)
|
||||
printf(" E-mail address: %s\n", ci->email);
|
||||
printf(" Options: ");
|
||||
if (!ci->flags) {
|
||||
printf("None\n");
|
||||
} else {
|
||||
int need_comma = 0;
|
||||
static const char commastr[] = ", ";
|
||||
if (ci->flags & CI_PRIVATE) {
|
||||
printf("Private");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->flags & CI_KEEPTOPIC) {
|
||||
printf("%sTopic Retention",
|
||||
need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->flags & CI_TOPICLOCK) {
|
||||
printf("%sTopic Lock", need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->flags & CI_SECUREOPS) {
|
||||
printf("%sSecure Ops", need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->flags & CI_RESTRICTED) {
|
||||
printf("%sRestricted Access",
|
||||
need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->flags & CI_SECURE) {
|
||||
printf("%sSecure", need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (ci->flags & CI_NO_EXPIRE) {
|
||||
printf("%sNo Expire", need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
if (ci->mlock_on || ci->mlock_off) {
|
||||
printf(" Mode lock: %s\n", get_mlock_modes(ci, 1));
|
||||
}
|
||||
if (ci->flags & CI_SUSPENDED) {
|
||||
printf
|
||||
("This nickname is currently suspended by %s, reason: %s\n",
|
||||
ci->forbidby,
|
||||
(ci->forbidreason ? ci->forbidreason : "No reason"));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
for (i = 0; i < 256; i++) {
|
||||
for (ci = chanlists[i]; ci; ci = ci->next) {
|
||||
printf(" %s %-20s %s\n",
|
||||
ci->flags & CI_NO_EXPIRE ? "!" : " ", ci->name,
|
||||
ci->flags & CI_VERBOTEN ?
|
||||
"Disallowed (FORBID)" : (ci->flags & CI_SUSPENDED ?
|
||||
"Disallowed (SUSPENDED)" :
|
||||
ci->desc));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
printf("%d channels registered.\n", count);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Return information on memory use. Assumes pointers are valid. */
|
||||
|
||||
-196
@@ -1,196 +0,0 @@
|
||||
/* Routines to handle `listnicks' and `listchans' invocations.
|
||||
*
|
||||
* (C) 2003-2008 Anope Team
|
||||
* Contact us at info@anope.org
|
||||
*
|
||||
* Please read COPYING and README for further details.
|
||||
*
|
||||
* Based on the original code of Epona by Lara.
|
||||
* Based on the original code of Services by Andy Church.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#include "services.h"
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* List all register nicks
|
||||
* @param ac Number of Arguments
|
||||
* @param av Array if Arguments
|
||||
* @return void
|
||||
*/
|
||||
void do_listnicks(int ac, char **av)
|
||||
{
|
||||
int count = 0; /* Count only rather than display? */
|
||||
int usage = 0; /* Display command usage? (>0 also indicates error) */
|
||||
int i;
|
||||
|
||||
i = 1;
|
||||
while (i < ac) {
|
||||
if (av[i][0] == '-') {
|
||||
switch (av[i][1]) {
|
||||
case 'h':
|
||||
usage = -1;
|
||||
break;
|
||||
case 'c':
|
||||
if (i > 1)
|
||||
usage = 1;
|
||||
count = 1;
|
||||
break;
|
||||
case 'd':
|
||||
if (av[i][2]) {
|
||||
services_dir = av[i] + 2;
|
||||
} else {
|
||||
if (i >= ac - 1) {
|
||||
usage = 1;
|
||||
break;
|
||||
}
|
||||
ac--;
|
||||
memmove(av + i, av + i + 1, sizeof(char *) * ac - i);
|
||||
services_dir = av[i];
|
||||
}
|
||||
default:
|
||||
usage = 1;
|
||||
break;
|
||||
} /* switch */
|
||||
ac--;
|
||||
if (i < ac)
|
||||
memmove(av + i, av + i + 1, sizeof(char *) * ac - i);
|
||||
} else {
|
||||
if (count)
|
||||
usage = 1;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (usage) {
|
||||
fprintf(stderr, "\
|
||||
\n\
|
||||
Usage: listnicks [-c] [-d data-dir] [nick [nick...]]\n\
|
||||
-c: display only count of registered nicks\n\
|
||||
(cannot be combined with nicks)\n\
|
||||
nick: nickname(s) to display information for\n\
|
||||
\n\
|
||||
If no nicks are given, the entire nickname database is printed out in\n\
|
||||
compact format followed by the number of registered nicks (with -c, the\n\
|
||||
list is suppressed and only the count is printed). If one or more nicks\n\
|
||||
are given, detailed information about those nicks is displayed.\n\
|
||||
\n");
|
||||
exit(usage > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
if (chdir(services_dir) < 0) {
|
||||
fprintf(stderr, "chdir(%s): %s\n", services_dir, strerror(errno));
|
||||
ModuleRunTimeDirCleanUp();
|
||||
exit(1);
|
||||
}
|
||||
if (!read_config(0)) {
|
||||
ModuleRunTimeDirCleanUp();
|
||||
exit(1);
|
||||
}
|
||||
load_ns_dbase();
|
||||
|
||||
lang_init();
|
||||
|
||||
if (ac > 1) {
|
||||
for (i = 1; i < ac; i++)
|
||||
listnicks(0, av[i]);
|
||||
} else {
|
||||
listnicks(count, NULL);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/**
|
||||
* List all register channels
|
||||
* @param ac Number of Arguments
|
||||
* @param av Array if Arguments
|
||||
* @return void
|
||||
*/
|
||||
void do_listchans(int ac, char **av)
|
||||
{
|
||||
int count = 0; /* Count only rather than display? */
|
||||
int usage = 0; /* Display command usage? (>0 also indicates error) */
|
||||
int i;
|
||||
|
||||
i = 1;
|
||||
while (i < ac) {
|
||||
if (av[i][0] == '-') {
|
||||
switch (av[i][1]) {
|
||||
case 'h':
|
||||
usage = -1;
|
||||
break;
|
||||
case 'c':
|
||||
if (i > 1)
|
||||
usage = 1;
|
||||
count = 1;
|
||||
break;
|
||||
case 'd':
|
||||
if (av[i][2]) {
|
||||
services_dir = av[i] + 2;
|
||||
} else {
|
||||
if (i >= ac - 1) {
|
||||
usage = 1;
|
||||
break;
|
||||
}
|
||||
ac--;
|
||||
memmove(av + i, av + i + 1, sizeof(char *) * ac - i);
|
||||
services_dir = av[i];
|
||||
}
|
||||
default:
|
||||
usage = 1;
|
||||
break;
|
||||
} /* switch */
|
||||
ac--;
|
||||
if (i < ac)
|
||||
memmove(av + i, av + i + 1, sizeof(char *) * ac - i);
|
||||
} else {
|
||||
if (count)
|
||||
usage = 1;
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (usage) {
|
||||
fprintf(stderr, "\
|
||||
\n\
|
||||
Usage: listchans [-c] [-d data-dir] [channel [channel...]]\n\
|
||||
-c: display only count of registered channels\n\
|
||||
(cannot be combined with channels)\n\
|
||||
channel: channel(s) to display information for\n\
|
||||
\n\
|
||||
If no channels are given, the entire channel database is printed out in\n\
|
||||
compact format followed by the number of registered channels (with -c, the\n\
|
||||
list is suppressed and only the count is printed). If one or more channels\n\
|
||||
are given, detailed information about those channels is displayed.\n\
|
||||
\n");
|
||||
exit(usage > 0 ? 1 : 0);
|
||||
}
|
||||
|
||||
if (chdir(services_dir) < 0) {
|
||||
fprintf(stderr, "chdir(%s): %s\n", services_dir, strerror(errno));
|
||||
ModuleRunTimeDirCleanUp();
|
||||
exit(1);
|
||||
}
|
||||
if (!read_config(0)) {
|
||||
ModuleRunTimeDirCleanUp();
|
||||
exit(1);
|
||||
}
|
||||
load_ns_dbase();
|
||||
load_cs_dbase();
|
||||
|
||||
lang_init();
|
||||
|
||||
if (ac > 1) {
|
||||
for (i = 1; i < ac; i++)
|
||||
listchans(0, av[i]);
|
||||
} else {
|
||||
listchans(count, NULL);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
-25
@@ -553,31 +553,6 @@ int main(int ac, char **av, char **envp)
|
||||
else
|
||||
progname = av[0];
|
||||
|
||||
#ifdef _WIN32
|
||||
if (strcmp(progname, "listnicks.exe") == 0)
|
||||
#else
|
||||
if (strcmp(progname, "listnicks") == 0)
|
||||
#endif
|
||||
{
|
||||
do_listnicks(ac, av);
|
||||
modules_unload_all(1, 0);
|
||||
modules_unload_all(1, 1);
|
||||
ModuleRunTimeDirCleanUp();
|
||||
return 0;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else if (strcmp(progname, "listchans.exe") == 0)
|
||||
#else
|
||||
else if (strcmp(progname, "listchans") == 0)
|
||||
#endif
|
||||
{
|
||||
do_listchans(ac, av);
|
||||
modules_unload_all(1, 0);
|
||||
modules_unload_all(1, 1);
|
||||
ModuleRunTimeDirCleanUp();
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialization stuff. */
|
||||
if ((i = init_secondary(ac, av)) != 0)
|
||||
return i;
|
||||
|
||||
-110
@@ -41,116 +41,6 @@ void moduleAddNickServCmds(void) {
|
||||
/* *INDENT-ON* */
|
||||
/*************************************************************************/
|
||||
|
||||
/* Display total number of registered nicks and info about each; or, if
|
||||
* a specific nick is given, display information about that nick (like
|
||||
* /msg NickServ INFO <nick>). If count_only != 0, then only display the
|
||||
* number of registered nicks (the nick parameter is ignored).
|
||||
*/
|
||||
|
||||
void listnicks(int count_only, const char *nick)
|
||||
{
|
||||
int count = 0;
|
||||
NickAlias *na;
|
||||
int i;
|
||||
char *end;
|
||||
|
||||
if (count_only) {
|
||||
|
||||
for (i = 0; i < 1024; i++) {
|
||||
for (na = nalists[i]; na; na = na->next)
|
||||
count++;
|
||||
}
|
||||
printf("%d nicknames registered.\n", count);
|
||||
|
||||
} else if (nick) {
|
||||
|
||||
struct tm *tm;
|
||||
char buf[512];
|
||||
static const char commastr[] = ", ";
|
||||
int need_comma = 0;
|
||||
|
||||
if (!(na = findnick(nick))) {
|
||||
printf("%s not registered.\n", nick);
|
||||
return;
|
||||
} else if (na->status & NS_VERBOTEN) {
|
||||
printf("%s is FORBIDden.\n", nick);
|
||||
return;
|
||||
}
|
||||
printf("%s is %s\n", nick, na->last_realname);
|
||||
printf("Last seen address: %s\n", na->last_usermask);
|
||||
tm = localtime(&na->time_registered);
|
||||
strftime(buf, sizeof(buf),
|
||||
getstring(NULL, STRFTIME_DATE_TIME_FORMAT), tm);
|
||||
printf(" Time registered: %s\n", buf);
|
||||
tm = localtime(&na->last_seen);
|
||||
strftime(buf, sizeof(buf),
|
||||
getstring(NULL, STRFTIME_DATE_TIME_FORMAT), tm);
|
||||
printf(" Last seen time: %s\n", buf);
|
||||
if (na->nc->url)
|
||||
printf(" URL: %s\n", na->nc->url);
|
||||
if (na->nc->email)
|
||||
printf(" E-mail address: %s\n", na->nc->email);
|
||||
if (na->nc->icq)
|
||||
printf(" ICQ #: %d\n", na->nc->icq);
|
||||
if (na->nc->greet)
|
||||
printf(" Greet: %s\n", na->nc->greet);
|
||||
*buf = 0;
|
||||
end = buf;
|
||||
if (na->nc->flags & NI_KILLPROTECT) {
|
||||
end +=
|
||||
snprintf(end, sizeof(buf) - (end - buf),
|
||||
"Kill protection");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (na->nc->flags & NI_SECURE) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%sSecurity",
|
||||
need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (na->nc->flags & NI_PRIVATE) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%sPrivate",
|
||||
need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
if (na->status & NS_NO_EXPIRE) {
|
||||
end += snprintf(end, sizeof(buf) - (end - buf), "%sNo Expire",
|
||||
need_comma ? commastr : "");
|
||||
need_comma = 1;
|
||||
}
|
||||
printf(" Options: %s\n", *buf ? buf : "None");
|
||||
|
||||
if (na->nc->flags & NI_SUSPENDED) {
|
||||
if (na->last_quit) {
|
||||
printf
|
||||
("This nickname is currently suspended, reason: %s\n",
|
||||
na->last_quit);
|
||||
} else {
|
||||
printf("This nickname is currently suspended.\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
for (i = 0; i < 1024; i++) {
|
||||
for (na = nalists[i]; na; na = na->next) {
|
||||
printf(" %s %-20s %s\n",
|
||||
na->status & NS_NO_EXPIRE ? "!" : " ",
|
||||
na->nick, na->status & NS_VERBOTEN ?
|
||||
"Disallowed (FORBID)" : (na->nc->
|
||||
flags & NI_SUSPENDED ?
|
||||
"Disallowed (SUSPENDED)" :
|
||||
na->last_usermask));
|
||||
count++;
|
||||
}
|
||||
}
|
||||
printf("%d nicknames registered.\n", count);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/*************************************************************************/
|
||||
|
||||
/* Return information on memory use. Assumes pointers are valid. */
|
||||
|
||||
void get_aliases_stats(long *nrec, long *memuse)
|
||||
|
||||
Reference in New Issue
Block a user