Correct count in /CLONES (reported by t3gah), and format output nicely

using an /fset.

/CLONES now uses the same formats as the /U command.  Also tweaked those
formats at the same time.



git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@98 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2010-09-06 13:40:13 +00:00
parent cb8e8c21ae
commit f71e26acc7
5 changed files with 43 additions and 22 deletions

View File

@@ -1,5 +1,8 @@
[Changes 1.2c01]
* Correct count in /CLONES (reported by t3gah), and format output nicely
using an /fset. (caf)
* Add definition of BIND_8_COMPAT to fix build problem on Mac OS X. (caf)
* Ensure that SHOW_AWAY_ONCE doesn't hide away status in /whois output. (caf)

View File

@@ -700,9 +700,9 @@
#define DEFAULT_FORMAT_USERLIST_FOOTER_FSET "There are $1 users on the userlist"
#define DEFAULT_FORMAT_USERLIST_HEADER_FSET "level nick password host channels"
#define DEFAULT_FORMAT_USERS_FSET "%K[%n%C$5%B$[9]2%K]%K[%n$[41]3%K]%K[%n$0%K]%n$4"
#define DEFAULT_FORMAT_USERS_USER_FSET "%K[%n%C$5%B$[9]2%K]%K[%n%B$[41]3%K]%K[%n$0%K]%n$4"
#define DEFAULT_FORMAT_USERS_SHIT_FSET "%K[%n%C$5%B$[9]2%K]%K[%n%r$[41]3%K]%K[%n$[-15]0%K]%n$4"
#define DEFAULT_FORMAT_USERS_FSET "%K[%C$[1]5%B$[9]2%K][%n$[41]3%K][%n$[15]0%K](%n$4%K)"
#define DEFAULT_FORMAT_USERS_USER_FSET "%K[%C$[1]5%B$[9]2%K][%n%B$[41]3%K][%n$0%K](%n$4%K)"
#define DEFAULT_FORMAT_USERS_SHIT_FSET "%K[%C$[1]5%B$[9]2%K][%n%r$[41]3%K][%n$[-15]0%K](%n$4%K)"
#define DEFAULT_FORMAT_USERS_TITLE_FSET "$G Channel userlist for %W$1%n at ($0):"
#define DEFAULT_FORMAT_USERS_HEADER_FSET NULL /*"%K[ %WC%nhannel %K][ %WN%wickname %K][%n %Wu%wser@host %K][%n %Wl%wevel %K]"*/

View File

@@ -67,7 +67,7 @@ extern LastMsg last_ctcp_reply[2];
extern LastMsg last_sent_ctcp[2];
void put_user (const NickList *, const char *);
void update_stats (int, NickList *, ChannelList *, int);
int check_split (char *, char *);
void BX_userage (char *, char *);

View File

@@ -1853,26 +1853,32 @@ int clones = 0;
for (nptr = next_nicklist(chan, NULL); nptr; nptr = next_nicklist(chan, nptr))
{
char *q;
nptr1 = NULL;
if (nptr->check_clone)
continue;
q = strchr(nptr->host, '@'); q++;
for (nptr1 = next_nicklist(chan, NULL); nptr1; nptr1 = next_nicklist(chan, nptr1))
/* Scan forward from this point, looking for clones */
for (nptr1 = next_nicklist(chan, nptr); nptr1; nptr1 = next_nicklist(chan, nptr1))
{
char *p;
if (nptr1 == nptr)
continue;
p = strchr(nptr1->host, '@'); p++;
if (!strcmp(p, q) && !nptr->check_clone)
if (!strcmp(p, q))
{
/* clone detected */
if (!clones && do_hook(CLONE_LIST, "Clones detected on %s", chan->channel))
bitchsay("Clones detected on %s", chan->channel);
if (!nptr->check_clone++ && do_hook(CLONE_LIST, "%s %s %s", nptr->nick, nptr->host, nick_isop(nptr)? "@":empty_string))
if (!nptr->check_clone++)
{
put_it("\t%s %s %s", nick_isop(nptr) ? "@":space, nptr->nick, nptr->host);
if (do_hook(CLONE_LIST, "%s %s %s", nptr->nick, nptr->host, nick_isop(nptr)? "@":empty_string))
put_user(nptr, chan->channel);
clones++;
}
if (!nptr1->check_clone && do_hook(CLONE_LIST, "%s %s %s", nptr1->nick, nptr1->host, nick_isop(nptr1)? "@":empty_string))
put_it("\t%s %s %s", nick_isop(nptr1) ? "@":space, nptr1->nick, nptr1->host);
if (do_hook(CLONE_LIST, "%s %s %s", nptr1->nick, nptr1->host, nick_isop(nptr1)? "@":empty_string))
put_user(nptr1, chan->channel);
nptr1->check_clone++;
clones++;
}

View File

@@ -4040,7 +4040,27 @@ bad_ignore:
return;
}
void put_user(const NickList *nick, const char *channel)
{
char *users_format;
if (nick->userlist)
users_format = fget_string_var(FORMAT_USERS_USER_FSET);
else if (nick->shitlist)
users_format = fget_string_var(FORMAT_USERS_SHIT_FSET);
else
users_format = fget_string_var(FORMAT_USERS_FSET);
put_it("%s", convert_output_format(users_format, "%s %s %s %s %d %c",
#ifdef WANT_USERLIST
nick->userlist ? convert_flags(nick->userlist->flags) : nick->shitlist?ltoa(nick->shitlist->level):"n/a",
#else
"n/a",
#endif
channel, nick->nick,
nick->host, nick->serverhops,
nick_isop(nick) ? '@' : nick_isvoice(nick)? 'v' : ' '));
}
BUILT_IN_COMMAND(users)
{
@@ -4249,15 +4269,7 @@ int count = 0,
nicks->host, nicks->serverhops,
nick_isop(nicks) ? '@' : nick_isvoice(nicks) ? 'v' :' ')))
{
put_it("%s", convert_output_format(fget_string_var(nicks->userlist?FORMAT_USERS_USER_FSET:nicks->shitlist?FORMAT_USERS_SHIT_FSET:FORMAT_USERS_FSET), "%s %s %s %s %d %s",
#ifdef WANT_USERLIST
nicks->userlist ? convert_flags(nicks->userlist->flags) : nicks->shitlist?ltoa(nicks->shitlist->level):"n/a ",
#else
"n/a ",
#endif
chan->channel, nicks->nick,
nicks->host, nicks->serverhops,
nick_isop(nicks) ? "@" : nick_isvoice(nicks)? "v" : "<EFBFBD>"));
put_user(nicks, chan->channel);
}
}
}