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:
180
dll/abot/Makefile.in
Normal file
180
dll/abot/Makefile.in
Normal file
@@ -0,0 +1,180 @@
|
||||
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 = autobot
|
||||
|
||||
all: Makefile autobot$(SHLIB_SUFFIX)
|
||||
|
||||
Makefile: Makefile.in
|
||||
cd $(topdir) \
|
||||
&& ./config.status
|
||||
|
||||
autobot.o: $(srcdir)/autobot.c
|
||||
$(CC) $(DEFS) $(CFLAGS) -c $(srcdir)/autobot.c
|
||||
|
||||
autobot$(SHLIB_SUFFIX): autobot.o ../dllinit.o
|
||||
$(SHLIB_LD) autobot.o ../dllinit.o $(SHLIB_CFLAGS) -o autobot$(SHLIB_SUFFIX)
|
||||
|
||||
clean:
|
||||
$(RM) *~ *.o *.so *.a *.dll *.def .#*
|
||||
|
||||
distclean: clean
|
||||
$(RM) Makefile
|
||||
|
||||
install:
|
||||
$(INSTALL) $(PLUGIN_NAME)$(SHLIB_SUFFIX) $(PLUGINDIR)
|
||||
33
dll/abot/abot.sh
Normal file
33
dll/abot/abot.sh
Normal file
@@ -0,0 +1,33 @@
|
||||
#!/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 autobot.c
|
||||
|
||||
echo EXPORTS > autobot.def
|
||||
$NM autobot.o ../init.o ../fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> autobot.def
|
||||
|
||||
# Link DLL.
|
||||
$LD --base-file autobot.base --dll -o autobot.dll autobot.o ../init.o ../fixup.o\
|
||||
$LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
|
||||
$DLLTOOL --as=$AS --dllname autobot.dll --def autobot.def --base-file\
|
||||
autobot.base --output-exp autobot.exp
|
||||
$LD --base-file autobot.base autobot.exp --dll -o autobot.dll autobot.o\
|
||||
../init.o ../fixup.o $LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
|
||||
$DLLTOOL --as=$AS --dllname autobot.dll --def autobot.def --base-file\
|
||||
autobot.base --output-exp autobot.exp
|
||||
$LD autobot.exp --dll -o autobot.dll autobot.o ../init.o ../fixup.o\
|
||||
$LIBPATH/libcygwin.a $LIBPATH/libkernel32.a -e _dll_entry@12
|
||||
|
||||
# Build the autobotB.a lib to link to:
|
||||
$DLLTOOL --as=$AS --dllname autobot.dll --def autobot.def --output-lib autobot.a
|
||||
|
||||
$RM *.base *.exp *.def
|
||||
$CP *.dll ..
|
||||
242
dll/abot/autobot.c
Normal file
242
dll/abot/autobot.c
Normal file
@@ -0,0 +1,242 @@
|
||||
#define AUTO_VERSION "1.00"
|
||||
|
||||
/*
|
||||
*
|
||||
* Written by Colten Edwards. (C) August 97, March 98
|
||||
* Based on script by suicide for evolver script.
|
||||
*/
|
||||
#include "irc.h"
|
||||
#include "struct.h"
|
||||
#include "dcc.h"
|
||||
#include "ircaux.h"
|
||||
#include "ctcp.h"
|
||||
#include "status.h"
|
||||
#include "lastlog.h"
|
||||
#include "screen.h"
|
||||
#include "vars.h"
|
||||
#include "misc.h"
|
||||
#include "output.h"
|
||||
#include "module.h"
|
||||
#include "hook.h"
|
||||
#include "hash2.h"
|
||||
#define INIT_MODULE
|
||||
#include "modval.h"
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#define cparse convert_output_format
|
||||
char auto_bot_version[] = "Auto-Bot 1.000";
|
||||
UserList *auto_bot = NULL;
|
||||
char *auto_filename = NULL;
|
||||
|
||||
BUILT_IN_DLL(add_abot);
|
||||
BUILT_IN_DLL(remove_abot);
|
||||
|
||||
void write_abot (char *, int);
|
||||
void read_abot (char *);
|
||||
int join_proc (char *, char *, char **);
|
||||
|
||||
int check_userop(UserList *u, char *channel, int server)
|
||||
{
|
||||
NickList *n;
|
||||
ChannelList *cptr;
|
||||
cptr = get_server_channels(server);
|
||||
cptr = (ChannelList *)find_in_list((List **)&cptr, channel, 0);
|
||||
if (cptr && (n = find_nicklist_in_channellist(u->nick, cptr, 0)))
|
||||
{
|
||||
if (n->host && u->host && !my_stricmp(u->host, n->host) && wild_match(u->channels, channel))
|
||||
{
|
||||
if (!nick_isop(n))
|
||||
{
|
||||
put_it("%s", cparse("$G %G$0 is not a channel op on $1", "%s %s", u->nick, channel));
|
||||
return 0;
|
||||
}
|
||||
put_it("%s", cparse("$G %GRequesting OPS from $0 on $1", "%s %s", u->nick, channel));
|
||||
switch(get_dllint_var("autobot-type"))
|
||||
{
|
||||
case 0:
|
||||
send_to_server("PRIVMSG %s :OP %s", u->nick, u->password);
|
||||
break;
|
||||
case 1:
|
||||
send_to_server("PRIVMSG %s :OP %s %s", u->nick, channel, u->password);
|
||||
break;
|
||||
case 2:
|
||||
send_to_server("PRIVMSG %s :+OP %s", u->nick, get_server_nickname(server));
|
||||
break;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int join_proc (char *which, char *str, char **unused)
|
||||
{
|
||||
char channel[BIG_BUFFER_SIZE];
|
||||
char *p;
|
||||
strncpy(channel, str, BIG_BUFFER_SIZE-10);
|
||||
if (!(p = strchr(channel, ' ')))
|
||||
return 1;
|
||||
*p = 0;
|
||||
if (!is_chanop(channel, get_server_nickname(from_server)))
|
||||
{
|
||||
UserList *u;
|
||||
for (u = auto_bot; u; u = u->next)
|
||||
check_userop(u, channel, from_server);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
BUILT_IN_DLL(remove_abot)
|
||||
{
|
||||
UserList *n;
|
||||
char *nick;
|
||||
int count = 0;
|
||||
nick = next_arg(args, &args);
|
||||
if (nick)
|
||||
{
|
||||
while ((n = (UserList *)remove_from_list((List **)&auto_bot, nick)))
|
||||
{
|
||||
put_it("%s", cparse("$G Removing Abot entry $0", "%s", n->nick));
|
||||
new_free(&n->nick);
|
||||
new_free(&n->host);
|
||||
new_free(&n->channels);
|
||||
new_free(&n->password);
|
||||
new_free((char **)&n);
|
||||
write_abot(auto_filename, 0);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (!count)
|
||||
put_it("%s", cparse("$G Couldn't find Abot entry $0", "%s", nick?nick:empty_string));
|
||||
return;
|
||||
}
|
||||
|
||||
BUILT_IN_DLL(add_abot)
|
||||
{
|
||||
ChannelList *chan;
|
||||
NickList *n = NULL;
|
||||
char *nick, *password, *channels;
|
||||
nick = next_arg(args, &args);
|
||||
password = next_arg(args, &args);
|
||||
channels = next_arg(args, &args);
|
||||
if (from_server == -1)
|
||||
return;
|
||||
if (!nick || !password)
|
||||
{
|
||||
if (auto_bot)
|
||||
{
|
||||
int count = 0;
|
||||
UserList *u;
|
||||
for (u = auto_bot; u; u = u->next, count++)
|
||||
put_it("%s", cparse("$0 $1!$2 $4", "%d %s %s %s", count, u->nick, u->host, u->channels));
|
||||
}
|
||||
userage("abot", helparg);
|
||||
return;
|
||||
}
|
||||
if (!channels || !*channels)
|
||||
channels = "*";
|
||||
chan = get_server_channels(from_server);
|
||||
for ( ; chan; chan = chan->next)
|
||||
{
|
||||
for (n = next_nicklist(chan, NULL); n; n = next_nicklist(chan, n))
|
||||
if (!my_stricmp(nick, n->nick))
|
||||
goto done;
|
||||
}
|
||||
done:
|
||||
if (n)
|
||||
{
|
||||
UserList *new;
|
||||
new = (UserList *) new_malloc(sizeof(UserList));
|
||||
new->nick = m_strdup(n->nick);
|
||||
new->host = m_strdup(n->host);
|
||||
new->password = m_strdup(password);
|
||||
new->channels = m_strdup(channels);
|
||||
add_to_list((List **)&auto_bot, (List *)new);
|
||||
write_abot(auto_filename, 1);
|
||||
}
|
||||
}
|
||||
|
||||
char *auto_Version(IrcCommandDll **intp)
|
||||
{
|
||||
return auto_bot_version;
|
||||
}
|
||||
|
||||
void write_abot(char *filename, int out)
|
||||
{
|
||||
FILE *f;
|
||||
UserList *u;
|
||||
if (filename && (f = fopen(filename, "w")))
|
||||
{
|
||||
if (out)
|
||||
put_it("%s", cparse("$G Auto-Saving $0", "%s", filename));
|
||||
for (u = auto_bot; u; u = u->next)
|
||||
fprintf(f, "%s!%s,%s,%s\n", u->nick,u->host,u->password,u->channels);
|
||||
fclose(f);
|
||||
} else if (filename)
|
||||
put_it("%s", cparse("$G Could not open $0 for write", "%s", filename));
|
||||
}
|
||||
|
||||
void read_abot(char *filename)
|
||||
{
|
||||
FILE *f;
|
||||
char buffer[BIG_BUFFER_SIZE];
|
||||
char *u, *h, *p, *c;
|
||||
UserList *new;
|
||||
|
||||
if (!(f = fopen(filename, "r")))
|
||||
{
|
||||
put_it("Could not open %s for reading", filename);
|
||||
return;
|
||||
}
|
||||
while (!feof(f))
|
||||
{
|
||||
if ((fgets(buffer, sizeof(buffer), f)))
|
||||
{
|
||||
chop(buffer, 1);
|
||||
u = buffer;
|
||||
h = strchr(u, '!');
|
||||
*h++ = 0;
|
||||
p = strchr(h, ',');
|
||||
*p++ = 0;
|
||||
if ((c = strchr(p, ',')))
|
||||
*c++ = 0;
|
||||
else
|
||||
c = "*";
|
||||
|
||||
new = (UserList *) new_malloc(sizeof(UserList));
|
||||
new->nick = m_strdup(u);
|
||||
new->host = m_strdup(h);
|
||||
new->password = m_strdup(p);
|
||||
new->channels = m_strdup(c);
|
||||
add_to_list((List **)&auto_bot, (List *)new);
|
||||
}
|
||||
}
|
||||
fclose(f);
|
||||
}
|
||||
char *Autobot_Version(IrcCommandDll **intp)
|
||||
{
|
||||
return AUTO_VERSION;
|
||||
}
|
||||
|
||||
|
||||
int Autobot_Init(IrcCommandDll **intp, Function_ptr *global_table)
|
||||
{
|
||||
char buffer[BIG_BUFFER_SIZE+1];
|
||||
initialize_module("Autobot");
|
||||
|
||||
add_module_proc(VAR_PROC, "Autobot", "autobot-type", NULL, INT_TYPE_VAR, 0, NULL, NULL);
|
||||
add_module_proc(COMMAND_PROC, "Autobot", "abot", NULL, 0, 0, add_abot, "Add bot to msg for auto-ops");
|
||||
add_module_proc(COMMAND_PROC, "Autobot", "rbot", NULL, 0, 0, remove_abot, "Remove bot from autoop list");
|
||||
add_module_proc(HOOK_PROC, "Autobot", NULL, "*", CHANNEL_SYNCH_LIST, 1, NULL, join_proc);
|
||||
|
||||
put_it("%s", convert_output_format("$G $0 v$1 by panasync. Based on suicide's Abot script.", "%s %s", auto_bot_version, AUTO_VERSION));
|
||||
sprintf(buffer, "%s/abots.sav", get_string_var(CTOOLZ_DIR_VAR));
|
||||
auto_filename = expand_twiddle(buffer);
|
||||
/* read abots.sav */
|
||||
read_abot(auto_filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user