Initial import of the ircii-pana-1.1-final source tree.
git-svn-id: svn://svn.code.sf.net/p/bitchx/code/tags/ircii-pana-1.1-final@1 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
30
dll/hint/BitchX.hints
Normal file
30
dll/hint/BitchX.hints
Normal file
@@ -0,0 +1,30 @@
|
||||
%Ghint%n: If you want to AutoOp users, don't forget to %W/cset %RAOP %WON
|
||||
%Ghint%n: Did you know that %WPageUp%n & %WPageDown%n will scroll screen up/dn?
|
||||
%Ghint%n: If you don't like your current auto response use %W/set %RRESPONSE%Y <new>%n
|
||||
%Ghint%n: Kick the guy who uses CTCP VERSION with %W/set %RAUTOKICK_ON_VERSION %WON
|
||||
%Ghint%n: Set %RAUTO_AWAY%n & %RAUTO_AWAY_TIME%n to set /away when idling...
|
||||
%Ghint%n: Set %RAUTO_NSLOOKUP%n to find the user's host on every join.
|
||||
%Ghint%n: Set number of beeps if someone /MSGs you by %RBEEP_WHEN_AWAY%n
|
||||
%Ghint%n: Set %RBOT_LOG%n to log your BOT commands. (like autoop)
|
||||
%Ghint%n: Set %RBITCH%n if you don't want un-authorized person to have ops.
|
||||
%Ghint%n: If you don't like that '/' is for your command, set %RCMDCHARS%n for new
|
||||
%Ghint%n: Set %RDCC_AUTOGET%n to specify wether you wan't to AUTOGET the packages.
|
||||
%Ghint%n: Set %RCTCP_FLOOD_PROTECTION%n to change CTCP protection ON/OFF
|
||||
%Ghint%n: Set %RDEFAULT_REASON%n to specify reason when you ban|kick someone.
|
||||
%Ghint%n: Set %RFLOOD_AFTER%n to specify the amount of messages sent before ignoring.
|
||||
%Ghint%n: All %RFLOOD_%n commands are useless if you don't set %RFLOOD_PROTECTION%n %WON%n
|
||||
%Ghint%n: Specify msg when returned from AWAY w/ %RFORMAT_BACK%n (time: %W$$1%n=m, %W$$2%n=h)
|
||||
%Ghint%n: If you want to see signon-ed nickname w/ host set %RHARD_UH_NOTIFY%n
|
||||
%Ghint%n: How long do you want to ignore the sucker? Set it with %RIGNORE_TIME%n
|
||||
%Ghint%n: If you don't want to harm OPS, set %RKICK_OPS%n to %WOFF%n
|
||||
%Ghint%n: Activate LinkLooker (net splits) with %RLOOK%n & %RLLOOK_DELAY%n
|
||||
%Ghint%n: When scrolling up/dn, specify %RSCROLL_LINES%n to specify the step.
|
||||
%Ghint%n: To send message when away set %RSEND_AWAY_MSG%n (not good idea)
|
||||
%Ghint%n: To send message when ignoring someone set %RSEND_IGNORE_MSG%n
|
||||
%Ghint%n: To use SHITLIST %RSHITLIST%n must be %WON%n
|
||||
%Ghint%n: Specify default SHITLIST reason with %RSHITLIST_REASON%n
|
||||
%Ghint%n: Set %RSUPPRESS_SERVER_MOTD%n to %WOFF%n if you want to read Server's MOTD.
|
||||
%Ghint%n: To use TAB key %RTAB%n must be %WON%n
|
||||
%Ghint%n: To use USERLIST (autoop, invite...) set %RUSERLIST%n to %WON%n
|
||||
%Ghint%n: Specify default user mode when connected to server with %RUSERMODE%n
|
||||
%Ghint%n: Remember: Special channel setup can be accessed via /CSET
|
||||
181
dll/hint/Makefile.in
Normal file
181
dll/hint/Makefile.in
Normal file
@@ -0,0 +1,181 @@
|
||||
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 = hint
|
||||
|
||||
all: Makefile hint$(SHLIB_SUFFIX)
|
||||
|
||||
Makefile: Makefile.in
|
||||
cd $(topdir) \
|
||||
&& ./config.status
|
||||
|
||||
hint.o: $(srcdir)/hint.c
|
||||
$(CC) $(DEFS) $(CFLAGS) -c $(srcdir)/hint.c
|
||||
|
||||
hint$(SHLIB_SUFFIX): hint.o ../dllinit.o
|
||||
$(SHLIB_LD) hint.o ../dllinit.o $(SHLIB_CFLAGS) -o hint$(SHLIB_SUFFIX)
|
||||
|
||||
clean:
|
||||
$(RM) *~ *.o *.a *.dll hint$(SHLIB_SUFFIX) *.def .#*
|
||||
|
||||
distclean: clean
|
||||
$(RM) Makefile
|
||||
|
||||
install:
|
||||
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(PLUGINDIR)
|
||||
$(INSTALL) $(srcdir)/BitchX.hints $(PLUGINDIR)/@HINT_FILE@
|
||||
206
dll/hint/hint.c
Normal file
206
dll/hint/hint.c
Normal file
@@ -0,0 +1,206 @@
|
||||
/*
|
||||
* hint.c - HINT shared library for BitchX (by panasync)
|
||||
*
|
||||
* Written by |MaRe|
|
||||
*
|
||||
*/
|
||||
|
||||
#define HINT_VERSION "0.01"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include "irc.h"
|
||||
#include "struct.h"
|
||||
#include "ircaux.h"
|
||||
#include "status.h"
|
||||
#include "screen.h"
|
||||
#include "vars.h"
|
||||
#include "misc.h"
|
||||
#include "output.h"
|
||||
#include "module.h"
|
||||
#define INIT_MODULE
|
||||
#include "modval.h"
|
||||
|
||||
#define HINT_LOADED "*** %W<%GHINT shared libarary loaded%W>"
|
||||
#define getrandom(min, max) ((rand() % (int)(((max)+1) - (min))) + (min))
|
||||
#define HINT_MAX_LEN 1000
|
||||
|
||||
int max_hints = 0;
|
||||
|
||||
char hint_buf[HINT_MAX_LEN+1]; /* max length of one hint */
|
||||
|
||||
#if !defined(WINNT) || !defined(__EMX__)
|
||||
#define HINT_FILENAME "BitchX.hints"
|
||||
#else
|
||||
#define HINT_FILENAME "BitchX.hnt"
|
||||
#endif
|
||||
|
||||
char *cp(char *fmt) { return (convert_output_format(fmt, NULL, NULL)); }
|
||||
|
||||
char *Hint_Version(IrcCommandDll **intp)
|
||||
{
|
||||
return HINT_VERSION;
|
||||
}
|
||||
|
||||
char *show_hint(int num)
|
||||
{
|
||||
FILE *fp;
|
||||
char *f = NULL;
|
||||
int i;
|
||||
char *converted = NULL;
|
||||
malloc_strcpy(&f, HINT_FILENAME);
|
||||
if ((fp = uzfopen(&f, get_string_var(LOAD_PATH_VAR), 0)))
|
||||
{
|
||||
for (i=0;i<=num;i++)
|
||||
fgets(hint_buf, HINT_MAX_LEN, fp);
|
||||
hint_buf[strlen(hint_buf)-1]='\0';
|
||||
converted = cp(hint_buf);
|
||||
fclose(fp);
|
||||
}
|
||||
new_free(&f);
|
||||
return converted;
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(shint)
|
||||
{
|
||||
int number;
|
||||
if (max_hints <= 0)
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n No hints avaible."));
|
||||
return;
|
||||
}
|
||||
|
||||
number = atoi(args);
|
||||
|
||||
if (word_count(args)==0) number=-1; /* hehe, this is malicious..:=) */
|
||||
if (number >= 0 && number <= max_hints)
|
||||
put_it("%s", show_hint(number));
|
||||
else
|
||||
{
|
||||
put_it("%s Specify number from 0-%d", cp("*** %W<%Ghint%W>%n"), max_hints);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(hint)
|
||||
{
|
||||
int hint_no;
|
||||
|
||||
if (max_hints <= 0)
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n No hints avaible."));
|
||||
return;
|
||||
}
|
||||
|
||||
hint_no = getrandom(0, max_hints);
|
||||
put_it("%s", show_hint(hint_no));
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(hintsay)
|
||||
{
|
||||
int hint_no;
|
||||
char *tmp;
|
||||
if (max_hints <= 0)
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n No hints avaible."));
|
||||
return;
|
||||
}
|
||||
|
||||
hint_no = getrandom(0, max_hints);
|
||||
if (!(tmp = next_arg(args, &args)))
|
||||
if (!(tmp = get_current_channel_by_refnum(0)))
|
||||
return;
|
||||
tmp = make_channel(tmp);
|
||||
send_to_server("PRIVMSG %s :%s", tmp, show_hint(hint_no));
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(rehint)
|
||||
{
|
||||
FILE *fp;
|
||||
char *f = NULL;
|
||||
max_hints=0;
|
||||
malloc_strcpy(&f, HINT_FILENAME);
|
||||
if ((fp = uzfopen(&f, get_string_var(LOAD_PATH_VAR), 0)))
|
||||
{
|
||||
while (fgets(hint_buf, HINT_MAX_LEN, fp)!=NULL) max_hints++;
|
||||
fclose(fp);
|
||||
put_it("%s (using %d hints)", cp("*** %W<%Ghint%W> Reloaded%n"), max_hints);
|
||||
max_hints--;
|
||||
} else
|
||||
put_it("%s (%s)", cp("*** %W<%Ghint%W>%n: Hint file not found"), f);
|
||||
new_free(&f);
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(hhelp)
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W> %GHINT%n (version %W0.1b%n by %Y|MaRe|%n) %GHELP%n"));
|
||||
if (word_count(args)==0)
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n Commands avaible:"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n HINT SHINT HINTSAY"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n REHINT HELP"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n More help with %W/HHELP %Y<command>%n"));
|
||||
} else
|
||||
{
|
||||
if (!strcmp(upper(args), "HINT"))
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n Usage: %W/HINT%n"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n %YHINT%n: this will print you randomly"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n %YHINT%n: chosen hint from the hint database."));
|
||||
}
|
||||
|
||||
if (!strcmp(upper(args), "SHINT"))
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n Usage: %W/SHINT%n %Y<number>%n"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n %YSHINT%n: this will print the Xth"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n %YSHINT%n: hint from the hint database."));
|
||||
}
|
||||
|
||||
if (!strcmp(upper(args), "REHINT"))
|
||||
{
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n Usage: %W/REHINT%n"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n %YREHINT%n: this will reload the"));
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n %YREHINT%n: hint database."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Hint_Init(IrcCommandDll **intp, Function_ptr *global_table)
|
||||
{
|
||||
FILE *fp;
|
||||
char *f = NULL;
|
||||
initialize_module("hint");
|
||||
/* add /HINT */
|
||||
add_module_proc(COMMAND_PROC, "hint", "hint", NULL, 0, 0, hint, NULL);
|
||||
|
||||
/* add /SHINT */
|
||||
add_module_proc(COMMAND_PROC, "hint", "shint", NULL, 0, 0, shint, NULL);
|
||||
|
||||
/* add /REHINT */
|
||||
add_module_proc(COMMAND_PROC, "hint", "rehint", NULL, 0, 0, rehint, NULL);
|
||||
|
||||
/* add /HINTSAY */
|
||||
add_module_proc(COMMAND_PROC, "hint", "hintsay", NULL, 0, 0, hintsay, NULL);
|
||||
|
||||
/* add /HHELP */
|
||||
add_module_proc(COMMAND_PROC, "hint", "hhelp", NULL, 0, 0, hhelp, NULL);
|
||||
|
||||
srand(time(NULL));
|
||||
put_it("%s", cp(HINT_LOADED));
|
||||
|
||||
max_hints=0;
|
||||
malloc_strcpy(&f, HINT_FILENAME);
|
||||
if ((fp = uzfopen(&f, get_string_var(LOAD_PATH_VAR), 0)))
|
||||
{
|
||||
while (fgets(hint_buf, HINT_MAX_LEN, fp)!=NULL)
|
||||
max_hints++;
|
||||
fclose(fp);
|
||||
put_it("%s (using %d hints)", cp("*** %W<%Ghint%W>%n"), max_hints);
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n try %W/HHELP%n."));
|
||||
max_hints--;
|
||||
} else
|
||||
put_it("%s", cp("*** %W<%Ghint%W>%n Hint file not found"));
|
||||
new_free(&f);
|
||||
return 0;
|
||||
}
|
||||
32
dll/hint/hint.sh
Normal file
32
dll/hint/hint.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/sh
|
||||
# Make .def file:
|
||||
export LIBPATH=/usr/local/cygwin-new/i586-pc-cygwin/lib
|
||||
export LD=/usr/local/cygwin-new/bin/i586-pc-cygwin-ld
|
||||
export NM=/usr/local/cygwin-new/bin/i586-pc-cygwin-nm
|
||||
export DLLTOOL=/usr/local/cygwin-new/bin/i586-pc-cygwin-dlltool
|
||||
export AS=/usr/local/cygwin-new/bin/i586-pc-cygwin-as
|
||||
export GCC=/usr/local/cygwin-new/bin/i586-pc-cygwin-gcc
|
||||
CP=cp
|
||||
RM=rm
|
||||
|
||||
$GCC -I../../include -c hint.c
|
||||
|
||||
echo EXPORTS > hint.def
|
||||
$NM hint.o ../init.o ../fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> hint.def
|
||||
|
||||
# Link DLL.
|
||||
$LD --base-file hint.base --dll -o hint.dll hint.o ../init.o ../fixup.o\
|
||||
$LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
|
||||
$DLLTOOL --as=$AS --dllname hint.dll --def hint.def --base-file\
|
||||
hint.base --output-exp hint.exp
|
||||
$LD --base-file hint.base hint.exp --dll -o hint.dll hint.o\
|
||||
../init.o ../fixup.o $LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
|
||||
$DLLTOOL --as=$AS --dllname hint.dll --def hint.def --base-file\
|
||||
hint.base --output-exp hint.exp
|
||||
$LD hint.exp --dll -o hint.dll hint.o ../init.o ../fixup.o\
|
||||
$LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
|
||||
|
||||
# Build the hintB.a lib to link to:
|
||||
$DLLTOOL --as=$AS --dllname hint.dll --def hint.def --output-lib hint.a
|
||||
$RM *.base *.exp *.def
|
||||
$CP *.dll ..
|
||||
Reference in New Issue
Block a user