Change NICKSORT_OP to NICKSORT_STAT (sorts nicks by channel status -

chanop first, then halops, voices and others).  Added /SCAN -stat
to sort nicks using NICKSORT_OP.  Removed NICKSORT_VOICE - it was broken
anyway.

Removed "scan" plugin, this functionality is now covered by /SCAN -stat.


git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@52 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
Kevin Easton
2008-06-14 06:45:05 +00:00
parent 5ecddf62fd
commit 708e4b6f19
11 changed files with 46 additions and 366 deletions

View File

@@ -1,5 +1,12 @@
[Changes 1.2c01 ]
* Removed "scan" plugin, this functionality is now covered by /SCAN -stat.
* Change NICKSORT_OP to NICKSORT_STAT (sorts nicks by channel status -
chanop first, then halops, voices and others). Added /SCAN -stat
to sort nicks using NICKSORT_OP. Removed NICKSORT_VOICE - it was broken
anyway.
* Add halfop nick prefix to default status line, and change the voice prefix
so it appears whether or not you're opped. (caf)

View File

@@ -39,3 +39,16 @@ look by setting these formats:
Also, the NAMES header and NAMES_FOOTER formats are now called with $3 set
to the total number of nicks in the channel, and $4 to the mask given to
/SCAN (if any).
/SCAN now supports a new sort flag "-stat", which sorts the output by
channel status (chanops, then halfops, then voices, then the riff-raff).
PLUGINS
-------
The "scan" plugin has been removed - its functionality is now built-in,
accessed by /scan -stat (see above). If you want this to be the default,
just set this alias (the double-slash is REQUIRED):
/ALIAS SCAN { //SCAN -STAT }

3
configure vendored
View File

@@ -14982,7 +14982,7 @@ _ACEOF
ac_config_files="$ac_config_files Makefile BitchX.spec gtkBitchX.spec bx-conf/Makefile doc/BitchX.bat doc/Makefile dll/Makefile dll/abot/Makefile dll/acro/Makefile dll/aim/Makefile dll/aim/toc/Makefile dll/amp/Makefile dll/arcfour/Makefile dll/autocycle/Makefile dll/blowfish/Makefile dll/cavlink/Makefile dll/cdrom/Makefile dll/encrypt/Makefile dll/europa/Makefile dll/fserv/Makefile dll/hint/Makefile dll/identd/Makefile dll/nap/Makefile dll/nicklist/Makefile dll/pkga/Makefile dll/possum/Makefile dll/qbx/Makefile dll/qmail/Makefile dll/scan/Makefile dll/wavplay/Makefile dll/xmms/Makefile source/Makefile"
ac_config_files="$ac_config_files Makefile BitchX.spec gtkBitchX.spec bx-conf/Makefile doc/BitchX.bat doc/Makefile dll/Makefile dll/abot/Makefile dll/acro/Makefile dll/aim/Makefile dll/aim/toc/Makefile dll/amp/Makefile dll/arcfour/Makefile dll/autocycle/Makefile dll/blowfish/Makefile dll/cavlink/Makefile dll/cdrom/Makefile dll/encrypt/Makefile dll/europa/Makefile dll/fserv/Makefile dll/hint/Makefile dll/identd/Makefile dll/nap/Makefile dll/nicklist/Makefile dll/pkga/Makefile dll/possum/Makefile dll/qbx/Makefile dll/qmail/Makefile dll/wavplay/Makefile dll/xmms/Makefile source/Makefile"
ac_config_commands="$ac_config_commands default"
@@ -15495,7 +15495,6 @@ do
"dll/possum/Makefile" ) CONFIG_FILES="$CONFIG_FILES dll/possum/Makefile" ;;
"dll/qbx/Makefile" ) CONFIG_FILES="$CONFIG_FILES dll/qbx/Makefile" ;;
"dll/qmail/Makefile" ) CONFIG_FILES="$CONFIG_FILES dll/qmail/Makefile" ;;
"dll/scan/Makefile" ) CONFIG_FILES="$CONFIG_FILES dll/scan/Makefile" ;;
"dll/wavplay/Makefile" ) CONFIG_FILES="$CONFIG_FILES dll/wavplay/Makefile" ;;
"dll/xmms/Makefile" ) CONFIG_FILES="$CONFIG_FILES dll/xmms/Makefile" ;;
"source/Makefile" ) CONFIG_FILES="$CONFIG_FILES source/Makefile" ;;

View File

@@ -1021,7 +1021,6 @@ dll/pkga/Makefile
dll/possum/Makefile
dll/qbx/Makefile
dll/qmail/Makefile
dll/scan/Makefile
dll/wavplay/Makefile
dll/xmms/Makefile
source/Makefile ])

View File

@@ -13,7 +13,6 @@ CP=cp
$GCC -c init.cc
$GCC -c fixup.cc
$GCC -I../include -c pkga.c
$GCC -I../include -c scan.c
echo EXPORTS > pkga.def
$NM pkga.o init.o fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> pkga.def
@@ -33,24 +32,6 @@ $LD pkga.exp --dll -o pkga.dll pkga.o init.o fixup.o\
# Build the pkgaB.a lib to link to:
$DLLTOOL --as=$AS --dllname pkga.dll --def pkga.def --output-lib pkga.a
echo EXPORTS > scan.def
$NM scan.o init.o fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> scan.def
# Link DLL.
$LD --base-file scan.base --dll -o scan.dll scan.o init.o fixup.o\
$LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
$DLLTOOL --as=$AS --dllname scan.dll --def scan.def --base-file\
scan.base --output-exp scan.exp
$LD --base-file scan.base scan.exp --dll -o scan.dll scan.o\
init.o fixup.o $LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
$DLLTOOL --as=$AS --dllname scan.dll --def scan.def --base-file\
scan.base --output-exp scan.exp
$LD scan.exp --dll -o scan.dll scan.o init.o fixup.o\
$LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
# Build the scanB.a lib to link to:
$DLLTOOL --as=$AS --dllname scan.dll --def scan.def --output-lib scan.a
$RM *.base *.def *.exp
(cd abot; sh ./abot.sh)
(cd acro; sh ./acro.sh)

View File

@@ -160,9 +160,9 @@ MFLAGS = \
## Makefile starts here.
ALL_PLUGINS = abot acro aim amp arcfour autocycle blowfish cavlink cdrom encrypt europa fserv hint identd nap nicklist pkga possum qbx qmail scan wavplay xmms
ALL_PLUGINS = abot acro aim amp arcfour autocycle blowfish cavlink cdrom encrypt europa fserv hint identd nap nicklist pkga possum qbx qmail wavplay xmms
#PLUGINS = abot acro aim arcfour autocycle blowfish cavlink encrypt europa fserv hint identd nap pkga possum qbx qmail scan wavplay
#PLUGINS = abot acro aim arcfour autocycle blowfish cavlink encrypt europa fserv hint identd nap pkga possum qbx qmail wavplay
PLUGINS = @PLUGINS@
.c.o:

View File

@@ -1,180 +0,0 @@
SHELL = @SHELL@
srcdir = @srcdir@
VPATH = @srcdir@
top_srcdir = @top_srcdir@
topdir = @topdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = @oldincludedir@
local_dir = $(HOME)
# Where the BitchX binary will be installed.
# "make install" will compile and install the program.
INSTALL_IRC = @INSTALL_IRC@
# Where the BitchX library will be. Generally this is the place that
# you put the scripts, help pages and translation tables. It is
# very important that you set this correctly.
IRCLIB = @IRCLIB@
CC = @CC@
DEFS = @INCLUDES@
LIBS = @LIBS@
# Tcl library.
TCL_LIBS = @TCL_LIBS@
# These are for Tcl support.
TCL_OBJS = @TCL_OBJS@
# You don't have the following, so you'll want to leave this blank.
TCL_SRCS = @TCL_SRCS@
# Set this to -g if you want to be able to debug the client, otherwise
# use -O to have the compiler do some optimization instead.
CFLAGS = @CFLAGS@
# Set this to -s if you want the binary to be stripped.
LDFLAGS = @LDFLAGS@
# These are for the cd device player.
CD_SRCS = @CD_SRCS@
CD_OBJS = @CD_OBJS@
# This is the executable suffix for the target operating system.
EXEEXT = @EXEEXT@
# Extra files.
DEFAULT_CTOOLZ_DIR = @DEFAULT_CTOOLZ_DIR@
DEFAULT_MSGLOGFILE = @DEFAULT_MSGLOGFILE@
DEFAULT_BITCHX_HELP_FILE = @DEFAULT_BITCHX_HELP_FILE@
DEFAULT_SCRIPT_HELP_FILE = @DEFAULT_SCRIPT_HELP_FILE@
DEFAULT_BITCHX_KICK_FILE = @DEFAULT_BITCHX_KICK_FILE@
DEFAULT_BITCHX_QUIT_FILE = @DEFAULT_BITCHX_QUIT_FILE@
DEFAULT_BITCHX_IRCNAME_FILE = @DEFAULT_BITCHX_IRCNAME_FILE@
# Full path of the directory for BitchX help files.
HELPDIR = @HELPDIR@
# Full path of the directory for the BitchX scripts.
INSTALL_SCRIPT = @INSTALL_SCRIPT@
# Default setting for IRCPATH where BitchX will look for
# its script files if the environment variable is undefined.
# Usually, this should contain the same path as used for INSTALL_SCRIPT in
# the Makefile, but it can contain multiple path elements
# separated by colons. The path MUST lead to an existing directory,
# because the 'global' script is expected to be found there.
IRCPATH = @IRCPATH@
# Path for TRANSLATION variable.
TRANSLATION_PATH = @TRANSLATION_PATH@
# This command will be used to install the BitchX help files. If you don't
# want to install them, replace with the following:
# INSTALL_HELP_CMD = @echo The help files have not been installed.
INSTALL_HELP_CMD = @INSTALL_HELP_CMD@
# This is where the optional plugins will be copied to.
PLUGINDIR = @PLUGINDIR@
# Plugin flags.
SHLIB_LD = @SHLIB_LD@
SHLIB_CFLAGS = @SHLIB_CFLAGS@
SHLIB_SUFFIX = @SHLIB_SUFFIX@
# This command will be used to install the BitchX files on Win32/OS2EMX
# systems.
WINNT_INSTALL = @WINNT_INSTALL@
# This program allows you to use screen/xterm's to put new BitchX windows
# on new screen/xterm windows.
INSTALL_WSERV = @INSTALL_WSERV@
# This program allows you to screen BitchX and reattach to it later.
INSTALL_SCRBX = @INSTALL_SCRBX@
# Set gzip and bzip2 options.
GZIP_ENV = @GZIP_ENV@
BZIP2 = @BZIP2@
# Standard programs.
RM = @RM@
LN = @LN_S@
CP = @CP@
MV = @MV@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
VERSION = @VERSION@
_VERSION_ = @_VERSION_@
MAKE_BIN = @MAKE@
MAKE = $(MAKE_BIN) $(MFLAGS)
MFLAGS = \
'local_dir=$(HOME)' \
'INSTALL_IRC=$(INSTALL_IRC)' \
'IRCLIB=$(IRCLIB)' \
'CC=$(CC)' \
'CFLAGS=$(CFLAGS)' \
'HELPDIR=$(HELPDIR)' \
'INSTALL_WSERV=$(INSTALL_WSERV)' \
'IRCPATH=$(IRCPATH)' \
'TRANSLATION_PATH=$(TRANSLATION_PATH)' \
'LDFLAGS=$(LDFLAGS)' \
'LIBS=$(LIBS)' \
'LN=$(LN)' \
'RM=$(RM)' \
'TCL_SRCS=$(TCL_SRCS)' \
'TCL_OBJS=$(TCL_OBJS)' \
'CD_PLAY=$(CD_PLAY)' \
'CD_SRCS=$(CD_SRCS)' \
'CD_OBJS=$(CD_OBJS)' \
'TCL_LIBS=$(TCL_LIBS)' \
'PLUGINDIR=$(PLUGINDIR)' \
'_VERSION_=$(_VERSION_)' \
'VERSION=$(VERSION)' \
'INSTALL_DATA=$(INSTALL_DATA)' \
'INSTALL_SCRIPT=$(INSTALL_SCRIPT)' \
'EXEEXT=$(EXEEXT)' \
'SHLIB_CFLAGS=$(SHLIB_CFLAGS)' \
'SHLIB_SUFFIX=$(SHLIB_SUFFIX)'
## Makefile starts here.
PLUGIN_NAME = scan
all: Makefile scan$(SHLIB_SUFFIX)
Makefile: Makefile.in
cd $(topdir) \
&& ./config.status
scan.o: $(srcdir)/scan.c
$(CC) $(DEFS) $(CFLAGS) -c $(srcdir)/scan.c
scan$(SHLIB_SUFFIX): scan.o ../dllinit.o
$(SHLIB_LD) scan.o ../dllinit.o $(SHLIB_CFLAGS) -o scan$(SHLIB_SUFFIX)
clean:
$(RM) *~ *.o scan$(SHLIB_SUFFIX) *.a *.dll *.def .#*
distclean: clean
$(RM) Makefile
install:
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(PLUGINDIR)

View File

@@ -1,128 +0,0 @@
/*
* By: Q-bert][@Efnet qbert@clark.net (Rich Schuler)
* this can be under whatever bX's license is
*/
#include <stdio.h>
#include <stdlib.h>
#include "irc.h"
#include "cset.h"
#include "ircaux.h"
#include "status.h"
#include "screen.h"
#include "vars.h"
#include "misc.h"
#include "output.h"
#include "module.h"
#include "hash.h"
#include "hash2.h"
#define INIT_MODULE
#include "modval.h"
void sort_scan (IrcCommandDll *, char *, char *, char *);
void sort_scan (IrcCommandDll *this_not_used, char *called, char *args, char *subargs)
{
int numberofpeople = 0, server = -1;
char *channel = NULL, *qbert = NULL;
ChannelList *chanlist;
NickList *anick, *ops = NULL, *nops = NULL, *voice = NULL, *tmp = NULL;
if (!(chanlist = prepare_command (&server, channel, NO_OP)) )
return;
for (anick = next_nicklist (chanlist, NULL); anick; anick = next_nicklist (chanlist, anick))
{
if (!nick_isop(anick) && !nick_isvoice(anick))
{
tmp = (NickList *)new_malloc (sizeof (NickList));
memcpy (tmp, anick, sizeof (NickList));
tmp -> next = NULL;
add_to_list ((List **)&nops, (List *)tmp);
}
else if (nick_isvoice(anick) && !nick_isop(anick))
{
tmp = (NickList *)new_malloc (sizeof (NickList));
memcpy (tmp, anick, sizeof (NickList));
tmp -> next = NULL;
add_to_list ((List **)&voice, (List *)tmp);
}
else if (nick_isop(anick))
{
tmp = (NickList *)new_malloc (sizeof (NickList));
memcpy (tmp, anick, sizeof (NickList));
tmp -> next = NULL;
add_to_list ((List **)&ops, (List *)tmp);
}
numberofpeople++;
}
put_it ("%s", convert_output_format (fget_string_var (FORMAT_NAMES_FSET), "%s %s %d %s", update_clock (GET_TIME), chanlist -> channel, numberofpeople, space));
numberofpeople = 0;
for (anick = ops; anick; anick = anick -> next)
{
malloc_strcat (&qbert, convert_output_format (fget_string_var (FORMAT_NAMES_OPCOLOR_FSET), "@ %s", anick -> nick));
malloc_strcat (&qbert, space);
if (numberofpeople++ == 4)
{
if (fget_string_var (FORMAT_NAMES_BANNER_FSET))
put_it ("%s%s", convert_output_format (fget_string_var(FORMAT_NAMES_BANNER_FSET), NULL, NULL), qbert);
else
put_it ("%s", qbert);
new_free (&qbert);
numberofpeople = 0;
}
}
for (anick = voice; anick; anick = anick -> next)
{
malloc_strcat (&qbert, convert_output_format (fget_string_var(FORMAT_NAMES_VOICECOLOR_FSET), "+ %s", anick -> nick));
malloc_strcat (&qbert, space);
if (numberofpeople++ == 4)
{
if (fget_string_var (FORMAT_NAMES_BANNER_FSET))
put_it ("%s%s", convert_output_format (fget_string_var(FORMAT_NAMES_BANNER_FSET), NULL, NULL), qbert);
else
put_it ("%s", qbert);
new_free (&qbert);
numberofpeople = 0;
}
}
for (anick = nops; anick; anick = anick -> next)
{
malloc_strcat (&qbert, convert_output_format (fget_string_var(FORMAT_NAMES_NICKCOLOR_FSET), "$ %s", anick -> nick));
malloc_strcat (&qbert, space);
if (numberofpeople++ == 4)
{
if (fget_string_var (FORMAT_NAMES_BANNER_FSET))
put_it ("%s%s", convert_output_format (fget_string_var(FORMAT_NAMES_BANNER_FSET), NULL, NULL), qbert);
else
put_it ("%s", qbert);
new_free (&qbert);
numberofpeople = 0;
}
}
if (numberofpeople && qbert)
{
if (fget_string_var (FORMAT_NAMES_BANNER_FSET))
put_it ("%s%s", convert_output_format (fget_string_var (FORMAT_NAMES_BANNER_FSET), NULL, NULL), qbert);
else
put_it ("%s", qbert);
}
new_free (&qbert);
if (fget_string_var (FORMAT_NAMES_FOOTER_FSET))
put_it ("%s", convert_output_format (fget_string_var (FORMAT_NAMES_FOOTER_FSET), NULL, NULL));
clear_sorted_nicklist (&ops);
clear_sorted_nicklist (&nops);
clear_sorted_nicklist (&voice);
}
int Scan_Init (IrcCommandDll **intp, Function_ptr *global_func)
{
set_global_func(global_func);
set_dll_name("scan");
add_module_proc (COMMAND_PROC, "scan", "SCAN", "This is just like /scan except it goes +o +v -o",
0, 0, sort_scan, NULL);
return 0;
}

View File

@@ -48,15 +48,15 @@ int nick_match(NickList *nick, char *mask);
NickList *BX_sorted_nicklist(ChannelList *, int);
void BX_clear_sorted_nicklist(NickList **);
/* Warning: These numeric values can be taken directly from scripts via
* the $channel() function - so BEWARE if you change them! */
#define NICKSORT_NORMAL 0
#define NICKSORT_NONE 1
#define NICKSORT_NICK 2
#define NICKSORT_HOST 3
#define NICKSORT_TIME 4
#define NICKSORT_IP 5
#define NICKSORT_OP 6
#define NICKSORT_VOICE 7
#define NICKSORT_STAT 6
Flooding *BX_find_name_in_floodlist(char *, char *, HashEntry *, unsigned int, int);
Flooding *BX_add_name_to_floodlist(char *, char *, char *, HashEntry *, unsigned int);

View File

@@ -1407,6 +1407,8 @@ BUILT_IN_COMMAND(do_scan)
sorted = NICKSORT_NICK;
else if (!my_strnicmp(s, "-host", 3))
sorted = NICKSORT_HOST;
else if (!my_strnicmp(s, "-stat", 3))
sorted = NICKSORT_STAT;
continue;
}

View File

@@ -752,34 +752,23 @@ unsigned long at, bt;
return strcmp(a1->nick, b1->nick);
}
int cmp_op (List *a, List *b)
/* Compare two Nicks by channel status, chanop > halfop > voice */
int cmp_stat (List *a, List *b)
{
NickList *a1 = (NickList *)a, *b1 = (NickList *)b;
int a_isop, b_isop;
a_isop = nick_isop(a1);
b_isop = nick_isop(b1);
if ((!a_isop && !b_isop))
return strcmp(a1->nick, b1->nick);
if (!a_isop)
return 1;
if (!b_isop)
return -1;
return 0;
}
int a_status =
nick_isop(a1) ? 0 : nick_ishalfop(a1) ? 1 : nick_isvoice(a1) ? 2 : 3;
int b_status =
nick_isop(b1) ? 0 : nick_ishalfop(b1) ? 1 : nick_isvoice(b1) ? 2 : 3;
int cmp;
int cmp_voice (List *a, List *b)
{
NickList *a1 = (NickList *)a, *b1 = (NickList *)b;
int a_isvoice, b_isvoice;
a_isvoice = nick_isvoice(a1);
b_isvoice = nick_isvoice(b1);
if ((!a_isvoice && !b_isvoice) || (a_isvoice && b_isvoice))
return strcmp(a1->nick, b1->nick);
if (!a_isvoice)
return -1;
if (!b_isvoice)
return 1;
return 0;
cmp = a_status - b_status;
/* Equal status */
if (cmp == 0)
cmp = strcmp(a1->nick, b1->nick);
return cmp;
}
/* Determines if the Nick matches the nick!user@host mask given. */
@@ -807,11 +796,8 @@ NickList *BX_sorted_nicklist(ChannelList *chan, int sort)
case NICKSORT_HOST:
add_to_list_ext((List **)&list, (List *)l, cmp_host);
break;
case NICKSORT_OP:
add_to_list_ext((List **)&list, (List *)l, cmp_op);
break;
case NICKSORT_VOICE:
add_to_list_ext((List **)&list, (List *)l, cmp_voice);
case NICKSORT_STAT:
add_to_list_ext((List **)&list, (List *)l, cmp_stat);
break;
case NICKSORT_TIME:
add_to_list_ext((List **)&list, (List *)l, cmp_time);
@@ -826,6 +812,7 @@ NickList *BX_sorted_nicklist(ChannelList *chan, int sort)
list = l;
break;
default:
case NICKSORT_NICK:
case NICKSORT_NORMAL:
add_to_list((List **)&list, (List *)l);
break;