From bf0a45920d6ef4d39f46b3923a03d3a89fcf4972 Mon Sep 17 00:00:00 2001 From: Keith Buck Date: Sun, 22 May 2011 20:30:49 -0700 Subject: [PATCH 1/3] modules/m_list.c: Change operspy LIST syntax to match everything else that accepts operspy. --- help/opers/operspy | 3 ++- modules/m_list.c | 54 +++++++++++++++++++++++++--------------------- 2 files changed, 32 insertions(+), 25 deletions(-) diff --git a/help/opers/operspy b/help/opers/operspy index 3633d772..a667d7b9 100644 --- a/help/opers/operspy +++ b/help/opers/operspy @@ -12,4 +12,5 @@ mode !#channel - Gives the full modes of a channel including any keys. chantrace !#channel - Gives full output despite not being on channel. masktrace !nick!user@host :gecos - Lists matching users on all servers. topic !#channel - Gives full output despite not being on channel. -list ![,options...] - Lists all channels, including secret channels. +list !#channel - Gives full output despite not being on channel. +list ![options...] - Lists all channels, including secret channels. diff --git a/modules/m_list.c b/modules/m_list.c index c94eb3db..d60c8328 100644 --- a/modules/m_list.c +++ b/modules/m_list.c @@ -63,7 +63,7 @@ static void safelist_client_release(struct Client *); static void safelist_one_channel(struct Client *source_p, struct Channel *chptr); static void safelist_iterate_client(struct Client *source_p); static void safelist_iterate_clients(void *unused); -static void safelist_channel_named(struct Client *source_p, const char *name); +static void safelist_channel_named(struct Client *source_p, const char *name, int operspy); struct Message list_msgtab = { "LIST", 0, 0, 0, MFLG_SLOW, @@ -157,8 +157,10 @@ static int m_list(struct Client *client_p, struct Client *source_p, int parc, co static int mo_list(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { struct ListClient *params; - char *p, *args; + char *p; + char *args = NULL; int i; + int operspy = 0; if (source_p->localClient->safelist_data != NULL) { @@ -167,10 +169,22 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c return 0; } - /* Single channel. */ - if (parc > 1 && IsChannelName(parv[1])) + if (parc > 1) { - safelist_channel_named(source_p, parv[1]); + args = LOCAL_COPY(parv[1]); + } + + if (args && *args == '!' && IsOperSpy(source_p)) + { + args++; + report_operspy(source_p, "LIST", args); + operspy = 1; + } + + /* Single channel. */ + if (args && IsChannelName(args)) + { + safelist_channel_named(source_p, args, operspy); return 0; } @@ -180,14 +194,12 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c /* XXX rather arbitrary -- jilles */ params->users_min = 3; params->users_max = INT_MAX; - params->operspy = 0; + params->operspy = operspy; params->created_min = params->topic_min = params->created_max = params->topic_max = 0; - if (parc > 1 && !EmptyString(parv[1])) + if (args && !EmptyString(args)) { - args = LOCAL_COPY(parv[1]); - /* Cancel out default minimum. */ params->users_min = 0; @@ -260,12 +272,6 @@ static int mo_list(struct Client *client_p, struct Client *source_p, int parc, c } } } - /* Only accept operspy as the first option. */ - else if (*args == '!' && IsOperSpy(source_p) && i == 0) - { - params->operspy = 1; - report_operspy(source_p, "LIST", p); - } if (EmptyString(p)) break; @@ -353,39 +359,39 @@ static void safelist_client_release(struct Client *client_p) /* * safelist_channel_named() * - * inputs - client pointer, channel name + * inputs - client pointer, channel name, operspy * outputs - none * side effects - a named channel is listed */ -static void safelist_channel_named(struct Client *source_p, const char *name) +static void safelist_channel_named(struct Client *source_p, const char *name, int operspy) { struct Channel *chptr; char *p; - char *n = LOCAL_COPY(name); sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name); - if ((p = strchr(n, ','))) + if ((p = strchr(name, ','))) *p = '\0'; - if (*n == '\0') + if (*name == '\0') { sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), name); sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name); return; } - chptr = find_channel(n); + chptr = find_channel(name); if (chptr == NULL) { - sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), n); + sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), name); sendto_one(source_p, form_str(RPL_LISTEND), me.name, source_p->name); return; } - if (!SecretChannel(chptr) || IsMember(source_p, chptr)) - sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, "", + if (!SecretChannel(chptr) || IsMember(source_p, chptr) || operspy) + sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, + (operspy && SecretChannel(chptr)) ? "!" : "", chptr->chname, rb_dlink_list_length(&chptr->members), chptr->topic == NULL ? "" : chptr->topic); From a4eeda898e06362535494b4dfa1b163ecf8eb9bb Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 24 May 2011 00:30:45 +0200 Subject: [PATCH 2/3] operspy list: Show '!' prefix for otherwise hidden channels rather than +s ones. This is consistent with operspy whois. --- modules/m_list.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/m_list.c b/modules/m_list.c index d60c8328..d8f70607 100644 --- a/modules/m_list.c +++ b/modules/m_list.c @@ -367,6 +367,7 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in { struct Channel *chptr; char *p; + int visible; sendto_one(source_p, form_str(RPL_LISTSTART), me.name, source_p->name); @@ -389,9 +390,10 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in return; } - if (!SecretChannel(chptr) || IsMember(source_p, chptr) || operspy) + visible = !SecretChannel(chptr) || IsMember(source_p, chptr); + if (visible || operspy) sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, - (operspy && SecretChannel(chptr)) ? "!" : "", + visible ? "" : "!", chptr->chname, rb_dlink_list_length(&chptr->members), chptr->topic == NULL ? "" : chptr->topic); @@ -410,8 +412,10 @@ static void safelist_channel_named(struct Client *source_p, const char *name, in static void safelist_one_channel(struct Client *source_p, struct Channel *chptr) { struct ListClient *safelist_data = source_p->localClient->safelist_data; + int visible; - if (SecretChannel(chptr) && !IsMember(source_p, chptr) && !safelist_data->operspy) + visible = !SecretChannel(chptr) || IsMember(source_p, chptr); + if (!visible && !safelist_data->operspy) return; if ((unsigned int)chptr->members.length < safelist_data->users_min @@ -433,7 +437,7 @@ static void safelist_one_channel(struct Client *source_p, struct Channel *chptr) return; sendto_one(source_p, form_str(RPL_LIST), me.name, source_p->name, - (safelist_data->operspy && SecretChannel(chptr)) ? "!" : "", + visible ? "" : "!", chptr->chname, rb_dlink_list_length(&chptr->members), chptr->topic == NULL ? "" : chptr->topic); } From 61fae4b4b8e7a13f51537f35a7cca784d1378560 Mon Sep 17 00:00:00 2001 From: Jilles Tjoelker Date: Tue, 24 May 2011 00:33:28 +0200 Subject: [PATCH 3/3] Add additional version.c variants to gitignore. --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 6ad82c9c..5415aa20 100644 --- a/.gitignore +++ b/.gitignore @@ -20,11 +20,13 @@ libratbox/include/stamp-h1 libratbox/libratbox.pc libratbox/libtool libratbox/src/version.c +libratbox/src/version.c.last scripts/*.tbz2 scripts/*.tgz servlink/servlink src/ircd src/lex.yy.c +src/version.c src/version.c.last src/y.tab.h src/y.tab.c