mirror of
https://github.com/EnergyMech/energymech.git
synced 2025-12-17 15:36:50 +00:00
removed old IDWRAP code & new code for handling nicks & userhost
This commit is contained in:
parent
9ca80bc45c
commit
c9d2907a9e
4
.gitignore
vendored
4
.gitignore
vendored
@ -37,10 +37,14 @@ dev/*
|
|||||||
.use_size
|
.use_size
|
||||||
conf
|
conf
|
||||||
debug*
|
debug*
|
||||||
|
src/benchmark*
|
||||||
src/nostdlib
|
src/nostdlib
|
||||||
src/x
|
src/x
|
||||||
src/y
|
src/y
|
||||||
src/z
|
src/z
|
||||||
|
x
|
||||||
|
y
|
||||||
|
z
|
||||||
randdata
|
randdata
|
||||||
test.conf
|
test.conf
|
||||||
postfix.sh
|
postfix.sh
|
||||||
|
|||||||
36
configure
vendored
36
configure
vendored
@ -103,7 +103,6 @@ do
|
|||||||
dyncmd ) ft_dyncmd=$yesno ;;
|
dyncmd ) ft_dyncmd=$yesno ;;
|
||||||
greet ) ft_greet=$yesno ;;
|
greet ) ft_greet=$yesno ;;
|
||||||
hostinfo ) ft_hostinfo=$yesno ;;
|
hostinfo ) ft_hostinfo=$yesno ;;
|
||||||
idwrap ) ft_idwrap=$yesno ;;
|
|
||||||
ircd_ext ) ft_ircd_ext=$yesno ;;
|
ircd_ext ) ft_ircd_ext=$yesno ;;
|
||||||
libmusl ) try_libmusl=$yesno ;;
|
libmusl ) try_libmusl=$yesno ;;
|
||||||
md5 ) ft_md5=$yesno ;;
|
md5 ) ft_md5=$yesno ;;
|
||||||
@ -154,7 +153,7 @@ do
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
case "$feature" in
|
case "$feature" in
|
||||||
alias | botnet | bounce | chanban | ctcp | dccfile | debug | dynamode | dyncmd | greet | hostinfo | idwrap | ircd_ext | libmusl | md5 \
|
alias | botnet | bounce | chanban | ctcp | dccfile | debug | dynamode | dyncmd | greet | hostinfo | ircd_ext | libmusl | md5 \
|
||||||
| netcfg | newbie | note | notify | perl | profiling | python | rawdns | redirect | seen | session | sha | stats | suppress | tcl \
|
| netcfg | newbie | note | notify | perl | profiling | python | rawdns | redirect | seen | session | sha | stats | suppress | tcl \
|
||||||
| telnet | toybox | trivia | uptime | urlcapture | web | wingate )
|
| telnet | toybox | trivia | uptime | urlcapture | web | wingate )
|
||||||
case _"$optarg"_ in
|
case _"$optarg"_ in
|
||||||
@ -206,8 +205,6 @@ do
|
|||||||
greet_no ) ft_greet=no ;;
|
greet_no ) ft_greet=no ;;
|
||||||
hostinfo_yes | hostinfo_ ) ft_hostinfo=yes ;;
|
hostinfo_yes | hostinfo_ ) ft_hostinfo=yes ;;
|
||||||
hostinfo_no ) ft_hostinfo=no ;;
|
hostinfo_no ) ft_hostinfo=no ;;
|
||||||
idwrap_yes | idwrap_ ) ft_idwrap=yes ;;
|
|
||||||
idwrap_no ) ft_idwrap=no ;;
|
|
||||||
ircd_ext_yes | ircd_ext_ ) ft_ircd_ext=yes ;;
|
ircd_ext_yes | ircd_ext_ ) ft_ircd_ext=yes ;;
|
||||||
ircd_ext_no ) ft_ircd_ext=no ;;
|
ircd_ext_no ) ft_ircd_ext=no ;;
|
||||||
libmusl_yes | libmusl_ ) try_libmusl=/usr/local/musl/bin/musl-gcc ;;
|
libmusl_yes | libmusl_ ) try_libmusl=/usr/local/musl/bin/musl-gcc ;;
|
||||||
@ -273,7 +270,6 @@ do
|
|||||||
dyncmd ) ft_dyncmd=no ;;
|
dyncmd ) ft_dyncmd=no ;;
|
||||||
greet ) ft_greet=no ;;
|
greet ) ft_greet=no ;;
|
||||||
hostinfo ) ft_hostinfo=no ;;
|
hostinfo ) ft_hostinfo=no ;;
|
||||||
idwrap ) ft_idwrap=no ;;
|
|
||||||
ircd_ext ) ft_ircd_ext=no ;;
|
ircd_ext ) ft_ircd_ext=no ;;
|
||||||
libmusl ) try_libmusl=no ;;
|
libmusl ) try_libmusl=no ;;
|
||||||
md5 ) ft_md5=no ;;
|
md5 ) ft_md5=no ;;
|
||||||
@ -1074,26 +1070,6 @@ fi
|
|||||||
echo $ac_t "$has_ldscript"
|
echo $ac_t "$has_ldscript"
|
||||||
rm -f $TESTP
|
rm -f $TESTP
|
||||||
|
|
||||||
#
|
|
||||||
# idwrap
|
|
||||||
#
|
|
||||||
has_idwrap=no
|
|
||||||
def_idwrap='#undef IDWRAP'
|
|
||||||
IDWRAP_PATH='/* nothing */'
|
|
||||||
|
|
||||||
if [ -r .use_idwrap -o "$ft_idwrap" = yes ]; then
|
|
||||||
echo $ac_n "checking for idwrap path ... "$ac_c
|
|
||||||
if test -z "$idwrappath"; then
|
|
||||||
idwrappath="/tmp/.ident/"
|
|
||||||
fi
|
|
||||||
if test -d $idwrappath; then
|
|
||||||
IDWRAP_PATH='"'"$idwrappath"'"'
|
|
||||||
has_idwrap="$IDWRAP_PATH"
|
|
||||||
def_idwrap='#define IDWRAP'
|
|
||||||
fi
|
|
||||||
echo $ac_t "$has_idwrap"
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -1425,12 +1401,12 @@ test "$ft_uptime" && $out "$ft_uptime" && ans=$ft_uptime
|
|||||||
test -z "$ft_uptime" && read ans
|
test -z "$ft_uptime" && read ans
|
||||||
test -z "$ans" -o "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_uptime='#define UPTIME'
|
test -z "$ans" -o "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_uptime='#define UPTIME'
|
||||||
|
|
||||||
def_urlcapture='#undef URLCAPTURE'
|
def_urlcap='#undef URLCAPTURE'
|
||||||
unset ans
|
unset ans
|
||||||
$out $ac_n "[ BETA ] URL capture support? ....................... [Y/n] "$ac_c
|
$out $ac_n "[ BETA ] URL capture support? ....................... [Y/n] "$ac_c
|
||||||
test "$ft_urlcapture" && $out "$ft_urlcapture" && ans=$ft_urlcapture
|
test "$ft_urlcapture" && $out "$ft_urlcapture" && ans=$ft_urlcapture
|
||||||
test -z "$ft_urlcapture" && read ans
|
test -z "$ft_urlcapture" && read ans
|
||||||
test -z "$ans" -o "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_urlcapture='#define URLCAPTURE'
|
test -z "$ans" -o "$ans" = y -o "$ans" = Y -o "$ans" = yes -o "$ans" = YES -o "$ans" = Yes && def_urlcap='#define URLCAPTURE'
|
||||||
|
|
||||||
def_wingate='#undef WINGATE'
|
def_wingate='#undef WINGATE'
|
||||||
unset ans
|
unset ans
|
||||||
@ -1502,7 +1478,6 @@ sed "
|
|||||||
s|@DEF_DYNAMODE@|$def_dynamode|;
|
s|@DEF_DYNAMODE@|$def_dynamode|;
|
||||||
s|@DEF_GREET@|$def_greet|;
|
s|@DEF_GREET@|$def_greet|;
|
||||||
s|@DEF_HOSTINFO@|$def_hostinfo|;
|
s|@DEF_HOSTINFO@|$def_hostinfo|;
|
||||||
s|@DEF_IDWRAP@|$def_idwrap|;
|
|
||||||
s|@DEF_IRCD_EXT@|$def_ircd_ext|;
|
s|@DEF_IRCD_EXT@|$def_ircd_ext|;
|
||||||
s|@DEF_MD5@|$def_md5|;
|
s|@DEF_MD5@|$def_md5|;
|
||||||
s|@DEF_SHA@|$def_sha|;
|
s|@DEF_SHA@|$def_sha|;
|
||||||
@ -1523,7 +1498,7 @@ s|@DEF_SUPPRESS@|$def_suppress|;
|
|||||||
s|@DEF_TOYBOX@|$def_toybox|;
|
s|@DEF_TOYBOX@|$def_toybox|;
|
||||||
s|@DEF_TRIVIA@|$def_trivia|;
|
s|@DEF_TRIVIA@|$def_trivia|;
|
||||||
s|@DEF_UPTIME@|$def_uptime|;
|
s|@DEF_UPTIME@|$def_uptime|;
|
||||||
s|@DEF_URLCAPTURE@|$def_urlcapture|;
|
s|@DEF_URLCAP@|$def_urlcap|;
|
||||||
s|@DEF_WEB@|$def_web|;
|
s|@DEF_WEB@|$def_web|;
|
||||||
s|@DEF_WINGATE@|$def_wingate|;
|
s|@DEF_WINGATE@|$def_wingate|;
|
||||||
|
|
||||||
@ -1534,14 +1509,13 @@ s|@DEF_CRYPT_FUNCTION@|$CRYPT_FUNCTION|;
|
|||||||
s|@CRYPT_HAS_SHA@|$CRYPT_HAS_SHA|;
|
s|@CRYPT_HAS_SHA@|$CRYPT_HAS_SHA|;
|
||||||
s|@CRYPT_HAS_MD5@|$CRYPT_HAS_MD5|;
|
s|@CRYPT_HAS_MD5@|$CRYPT_HAS_MD5|;
|
||||||
s|@CRYPT_HAS_DES@|$CRYPT_HAS_DES|;
|
s|@CRYPT_HAS_DES@|$CRYPT_HAS_DES|;
|
||||||
s|@IDWRAP_PATH@|$IDWRAP_PATH|;
|
|
||||||
s|@PTSIZE_DEFINE32@|$PTSIZE_DEFINE32|;
|
s|@PTSIZE_DEFINE32@|$PTSIZE_DEFINE32|;
|
||||||
s|@PTSIZE_DEFINE64@|$PTSIZE_DEFINE64|;
|
s|@PTSIZE_DEFINE64@|$PTSIZE_DEFINE64|;
|
||||||
s|@UNALIGNED_MEM@|$UNALIGNED_MEM|;
|
s|@UNALIGNED_MEM@|$UNALIGNED_MEM|;
|
||||||
" < src/config.h.in >> src/config.h
|
" < src/config.h.in >> src/config.h
|
||||||
|
|
||||||
save_myconfig() {
|
save_myconfig() {
|
||||||
names="alias botnet bounce chanban ctcp dccfile debug dynamode dyncmd greet hostinfo idwrap ircd_ext libmusl md5
|
names="alias botnet bounce chanban ctcp dccfile debug dynamode dyncmd greet hostinfo ircd_ext libmusl md5
|
||||||
netcfg newbie note notify perl profiling python rawdns redirect seen session sha stats suppress tcl
|
netcfg newbie note notify perl profiling python rawdns redirect seen session sha stats suppress tcl
|
||||||
telnet toybox trivia uptime urlcapture web wingate"
|
telnet toybox trivia uptime urlcapture web wingate"
|
||||||
echo "./configure \\" > ./myconfig
|
echo "./configure \\" > ./myconfig
|
||||||
|
|||||||
37
src/bounce.c
37
src/bounce.c
@ -45,16 +45,8 @@
|
|||||||
#define BNC_ACTIVE 5
|
#define BNC_ACTIVE 5
|
||||||
#define BNC_DEAD 6
|
#define BNC_DEAD 6
|
||||||
|
|
||||||
#ifdef IDWRAP
|
|
||||||
|
|
||||||
#define USE_VHOST 2
|
|
||||||
|
|
||||||
#else /* not IDWRAP */
|
|
||||||
|
|
||||||
#define USE_VHOST TRUE
|
#define USE_VHOST TRUE
|
||||||
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
void bounce_parse(ircLink *irc, char *message)
|
void bounce_parse(ircLink *irc, char *message)
|
||||||
{
|
{
|
||||||
Mech fakebot;
|
Mech fakebot;
|
||||||
@ -175,10 +167,6 @@ void bounce_parse(ircLink *irc, char *message)
|
|||||||
#ifdef WINGATE
|
#ifdef WINGATE
|
||||||
current->setting[STR_WINGATE].str_var = NULL;
|
current->setting[STR_WINGATE].str_var = NULL;
|
||||||
#endif /* WINGATE */
|
#endif /* WINGATE */
|
||||||
#ifdef IDWRAP
|
|
||||||
current->identfile = NULL;
|
|
||||||
current->setting[STR_IDENT].str_var = irc->handle;
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
if (virtual)
|
if (virtual)
|
||||||
{
|
{
|
||||||
@ -189,28 +177,10 @@ void bounce_parse(ircLink *irc, char *message)
|
|||||||
{
|
{
|
||||||
irc->status = BNC_CONNECTING;
|
irc->status = BNC_CONNECTING;
|
||||||
irc->active = now + 60; /* 120 second timeout */
|
irc->active = now + 60; /* 120 second timeout */
|
||||||
#ifdef IDWRAP
|
|
||||||
irc->idfile = current->identfile;
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef IDWRAP
|
|
||||||
|
|
||||||
void bounce_cleanup(void)
|
|
||||||
{
|
|
||||||
ircLink *irc;
|
|
||||||
|
|
||||||
for(irc=bnclist;irc;irc=irc->next)
|
|
||||||
{
|
|
||||||
if (irc->idfile)
|
|
||||||
unlink(irc->idfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
void new_port_bounce(const struct Setting *no_op)
|
void new_port_bounce(const struct Setting *no_op)
|
||||||
{
|
{
|
||||||
if (bounce_sock != -1)
|
if (bounce_sock != -1)
|
||||||
@ -379,13 +349,6 @@ void process_bounce(void)
|
|||||||
Free((char**)&irc->nickLine);
|
Free((char**)&irc->nickLine);
|
||||||
Free((char**)&irc->nick);
|
Free((char**)&irc->nick);
|
||||||
Free((char**)&irc->handle);
|
Free((char**)&irc->handle);
|
||||||
#ifdef IDWRAP
|
|
||||||
if (irc->idfile)
|
|
||||||
{
|
|
||||||
unlink(irc->idfile);
|
|
||||||
Free((char**)&irc->idfile);
|
|
||||||
}
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
Free((char**)&irc);
|
Free((char**)&irc);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -427,7 +427,7 @@ void channel_massmode(const Chan *chan, char *pattern, int filtmode, char mode,
|
|||||||
/*
|
/*
|
||||||
* never deop yourself, stupid bot
|
* never deop yourself, stupid bot
|
||||||
*/
|
*/
|
||||||
if (nickcmp(pat,current->nick))
|
if (nickcmp(pat,getbotnick(current)))
|
||||||
willdo = TRUE;
|
willdo = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -890,9 +890,10 @@ void do_mode(COMMAND_ARGS)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
/* todo: is it really necessary to chop? */
|
||||||
target = chop(&rest);
|
target = chop(&rest);
|
||||||
|
|
||||||
if (!nickcmp(current->nick,target))
|
if (!nickcmp(target,getbotnick(current)))
|
||||||
{
|
{
|
||||||
to_server("MODE %s %s\n",target,rest);
|
to_server("MODE %s %s\n",target,rest);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -71,12 +71,6 @@
|
|||||||
*/
|
*/
|
||||||
@DEF_HOSTINFO@
|
@DEF_HOSTINFO@
|
||||||
|
|
||||||
/*
|
|
||||||
* IDWRAP: support for idwrap ident spoofing
|
|
||||||
*/
|
|
||||||
@DEF_IDWRAP@
|
|
||||||
#define IDWRAP_PATH @IDWRAP_PATH@
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IRCD_EXTENSIONS: support some special features of new ircds
|
* IRCD_EXTENSIONS: support some special features of new ircds
|
||||||
*/
|
*/
|
||||||
@ -195,7 +189,7 @@
|
|||||||
/*
|
/*
|
||||||
* URLCAPTURE: capture url's mentioned
|
* URLCAPTURE: capture url's mentioned
|
||||||
*/
|
*/
|
||||||
@DEF_URLCAPTURE@
|
@DEF_URLCAP@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* WEB: serving documents via HTTP
|
* WEB: serving documents via HTTP
|
||||||
|
|||||||
103
src/core.c
103
src/core.c
@ -33,22 +33,6 @@
|
|||||||
#include <sys/utsname.h>
|
#include <sys/utsname.h>
|
||||||
#endif /* HOSTINFO */
|
#endif /* HOSTINFO */
|
||||||
|
|
||||||
#ifdef IDWRAP
|
|
||||||
|
|
||||||
void unlink_identfile(void)
|
|
||||||
{
|
|
||||||
if (current->identfile)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG
|
|
||||||
debug("(unlink_identfile) unlink(%s)\n",current->identfile);
|
|
||||||
#endif /* DEBUG */
|
|
||||||
unlink(current->identfile);
|
|
||||||
Free((char**)¤t->identfile);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
int conf_callback(char *line)
|
int conf_callback(char *line)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -57,7 +41,7 @@ int conf_callback(char *line)
|
|||||||
|
|
||||||
fix_config_line(line);
|
fix_config_line(line);
|
||||||
|
|
||||||
on_msg((char*)CoreUser.name,current->nick,line);
|
on_msg((char*)CoreUser.name,getbotnick(current),line);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -108,7 +92,7 @@ void readcfgfile(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((current) && (current->chanlist == NULL))
|
if ((current) && (current->chanlist == NULL))
|
||||||
to_file(1,"%s %s will not join any channels\n",ERR_INIT,current->nick);
|
to_file(1,"init: Warning: %s will not join any channels\n",getbotnick(current));
|
||||||
|
|
||||||
oc = 0;
|
oc = 0;
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -123,8 +107,8 @@ void readcfgfile(void)
|
|||||||
to_file(1,", ...");
|
to_file(1,", ...");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
to_file(1,"%s%s",(oc > 0) ? ", " : "",bot->nick);
|
to_file(1,"%s%s",(oc > 0) ? ", " : "",getbotnick(bot));
|
||||||
oc += strlen(bot->nick);
|
oc += getbotnicklen(bot);
|
||||||
}
|
}
|
||||||
to_file(1," ]\n");
|
to_file(1," ]\n");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -243,7 +227,7 @@ int write_session(void)
|
|||||||
|
|
||||||
for(bot=botlist;bot;bot=bot->next)
|
for(bot=botlist;bot;bot=bot->next)
|
||||||
{
|
{
|
||||||
to_file(sf,"nick %i %s\n",bot->guid,bot->wantnick);
|
to_file(sf,"nick %i %s\n",bot->guid,getbotwantnick(bot));
|
||||||
/*
|
/*
|
||||||
* current->setting contains channel defaults and global vars
|
* current->setting contains channel defaults and global vars
|
||||||
*/
|
*/
|
||||||
@ -327,22 +311,6 @@ int write_session(void)
|
|||||||
* Bot nicking, adding and killing
|
* Bot nicking, adding and killing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void setbotnick(Mech *bot, char *nick)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* if its exactly the same we dont need to change it
|
|
||||||
*/
|
|
||||||
if (!stringcmp(bot->nick,nick))
|
|
||||||
return;
|
|
||||||
|
|
||||||
Free((char**)&bot->nick);
|
|
||||||
set_mallocdoer(setbotnick);
|
|
||||||
bot->nick = stringdup(nick);
|
|
||||||
#ifdef BOTNET
|
|
||||||
botnet_refreshbotinfo();
|
|
||||||
#endif /* BOTNET */
|
|
||||||
}
|
|
||||||
|
|
||||||
Mech *add_bot(int guid, char *nick)
|
Mech *add_bot(int guid, char *nick)
|
||||||
{
|
{
|
||||||
Mech *bot;
|
Mech *bot;
|
||||||
@ -352,10 +320,8 @@ Mech *add_bot(int guid, char *nick)
|
|||||||
bot->connect = CN_NOSOCK;
|
bot->connect = CN_NOSOCK;
|
||||||
bot->sock = -1;
|
bot->sock = -1;
|
||||||
bot->guid = guid;
|
bot->guid = guid;
|
||||||
set_mallocdoer(add_bot);
|
setbotnick(bot,nick);
|
||||||
bot->nick = stringdup(nick);
|
setbotwantnick(bot,nick);
|
||||||
set_mallocdoer(add_bot);
|
|
||||||
bot->wantnick = stringdup(nick);
|
|
||||||
set_binarydefault(bot->setting);
|
set_binarydefault(bot->setting);
|
||||||
bot->next = botlist;
|
bot->next = botlist;
|
||||||
botlist = bot;
|
botlist = bot;
|
||||||
@ -375,7 +341,7 @@ void signoff(char *from, char *reason)
|
|||||||
|
|
||||||
if (from)
|
if (from)
|
||||||
{
|
{
|
||||||
to_user(from,"Killing mech: %s",current->nick);
|
to_user(from,"Killing mech: %s",getbotnick(current));
|
||||||
to_user(from,"Saving the lists...");
|
to_user(from,"Saving the lists...");
|
||||||
}
|
}
|
||||||
fname = current->setting[STR_USERFILE].str_var;
|
fname = current->setting[STR_USERFILE].str_var;
|
||||||
@ -419,9 +385,6 @@ void signoff(char *from, char *reason)
|
|||||||
|
|
||||||
if (current->sock != -1)
|
if (current->sock != -1)
|
||||||
{
|
{
|
||||||
#ifdef IDWRAP
|
|
||||||
unlink_identfile();
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
if (!reason)
|
if (!reason)
|
||||||
reason = randstring(SIGNOFFSFILE);
|
reason = randstring(SIGNOFFSFILE);
|
||||||
to_server("QUIT :%s\n",(reason) ? reason : "");
|
to_server("QUIT :%s\n",(reason) ? reason : "");
|
||||||
@ -451,9 +414,6 @@ void signoff(char *from, char *reason)
|
|||||||
/*
|
/*
|
||||||
* little of this n that
|
* little of this n that
|
||||||
*/
|
*/
|
||||||
Free((char**)¤t->nick);
|
|
||||||
Free((char**)¤t->wantnick);
|
|
||||||
Free((char**)¤t->userhost);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These 2 are used by do_die() to pass reason and doer.
|
* These 2 are used by do_die() to pass reason and doer.
|
||||||
@ -481,10 +441,6 @@ void signoff(char *from, char *reason)
|
|||||||
*/
|
*/
|
||||||
if ((current = botlist) == NULL)
|
if ((current = botlist) == NULL)
|
||||||
{
|
{
|
||||||
#if defined(BOUNCE) && defined(IDWRAP)
|
|
||||||
bounce_cleanup();
|
|
||||||
#endif /* BOUNCE && IDWRAP */
|
|
||||||
|
|
||||||
#ifdef TRIVIA
|
#ifdef TRIVIA
|
||||||
write_triviascore();
|
write_triviascore();
|
||||||
#endif /* TRIVIA */
|
#endif /* TRIVIA */
|
||||||
@ -759,7 +715,7 @@ void register_with_server(void)
|
|||||||
to_server((sendpass) ? "PASS :%s\nNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n" :
|
to_server((sendpass) ? "PASS :%s\nNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n" :
|
||||||
"%sNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n",
|
"%sNICK %s\nUSER %s " MECHUSERLOGIN " 0 :%s\n",
|
||||||
(sendpass) ? sp->pass : "",
|
(sendpass) ? sp->pass : "",
|
||||||
current->wantnick,
|
getbotwantnick(current),
|
||||||
(ident) ? ident : BOTLOGIN,
|
(ident) ? ident : BOTLOGIN,
|
||||||
(ircname) ? ircname : VERSION);
|
(ircname) ? ircname : VERSION);
|
||||||
current->connect = CN_CONNECTED;
|
current->connect = CN_CONNECTED;
|
||||||
@ -1034,8 +990,8 @@ void update(SequenceTime *this)
|
|||||||
if ((now - current->lastreset) > RESETINTERVAL)
|
if ((now - current->lastreset) > RESETINTERVAL)
|
||||||
{
|
{
|
||||||
current->lastreset = now;
|
current->lastreset = now;
|
||||||
if (stringcmp(current->nick,current->wantnick))
|
if (stringcmp(getbotnick(current),getbotwantnick(current)))
|
||||||
to_server("NICK %s\n",current->wantnick);
|
to_server("NICK %s\n",getbotwantnick(current));
|
||||||
check_idlekick();
|
check_idlekick();
|
||||||
if ((x = current->setting[INT_AAWAY].int_var) && current->away == FALSE)
|
if ((x = current->setting[INT_AAWAY].int_var) && current->away == FALSE)
|
||||||
{
|
{
|
||||||
@ -1134,10 +1090,10 @@ void process_server_input(void)
|
|||||||
|
|
||||||
if (FD_ISSET(current->sock,&write_fds))
|
if (FD_ISSET(current->sock,&write_fds))
|
||||||
{
|
{
|
||||||
setbotnick(current,current->wantnick);
|
setbotnick(current,getbotwantnick(current));
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("[PSI] {%i} connection established (%s) [ASYNC]\n",
|
debug("[PSI] {%i} connection established (%s) [ASYNC]\n",
|
||||||
current->sock,current->wantnick);
|
current->sock,getbotwantnick(current));
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
#ifdef WINGATE
|
#ifdef WINGATE
|
||||||
if ((current->vhost_type & VH_WINGATE_BOTH) == VH_WINGATE)
|
if ((current->vhost_type & VH_WINGATE_BOTH) == VH_WINGATE)
|
||||||
@ -1170,10 +1126,6 @@ void process_server_input(void)
|
|||||||
* send NICK, USER and maybe PASS
|
* send NICK, USER and maybe PASS
|
||||||
*/
|
*/
|
||||||
register_with_server();
|
register_with_server();
|
||||||
#ifdef IDWRAP
|
|
||||||
if (current->sock == -1)
|
|
||||||
unlink_identfile();
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (FD_ISSET(current->sock,&read_fds))
|
if (FD_ISSET(current->sock,&read_fds))
|
||||||
@ -1244,9 +1196,6 @@ breaksock:
|
|||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
breaksock2:
|
breaksock2:
|
||||||
*current->sockdata = 0;
|
*current->sockdata = 0;
|
||||||
#ifdef IDWRAP
|
|
||||||
unlink_identfile();
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
close(current->sock);
|
close(current->sock);
|
||||||
current->sock = -1;
|
current->sock = -1;
|
||||||
current->connect = CN_NOSOCK;
|
current->connect = CN_NOSOCK;
|
||||||
@ -1287,11 +1236,11 @@ void do_core(COMMAND_ARGS)
|
|||||||
bu++;
|
bu++;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = stringcmp(current->nick,current->wantnick);
|
i = stringcmp(getbotnick(current),getbotwantnick(current));
|
||||||
if (i)
|
if (i)
|
||||||
table_buffer(TEXT_CURRNICKWANT,current->nick,current->wantnick,current->guid);
|
table_buffer(TEXT_CURRNICKWANT,getbotnick(current),getbotwantnick(current),current->guid);
|
||||||
else
|
else
|
||||||
table_buffer(TEXT_CURRNICKHAS,current->nick,current->guid);
|
table_buffer(TEXT_CURRNICKHAS,getbotnick(current),current->guid);
|
||||||
table_buffer(TEXT_USERLISTSTATS,u,su,EXTRA_CHAR(su),bu,EXTRA_CHAR(bu));
|
table_buffer(TEXT_USERLISTSTATS,u,su,EXTRA_CHAR(su),bu,EXTRA_CHAR(bu));
|
||||||
|
|
||||||
pt = tmp;
|
pt = tmp;
|
||||||
@ -1716,15 +1665,15 @@ void do_nick(COMMAND_ARGS)
|
|||||||
char *nick;
|
char *nick;
|
||||||
int guid;
|
int guid;
|
||||||
|
|
||||||
nick = chop(&rest);
|
if (!rest || !*rest)
|
||||||
if (!nick || !*nick)
|
|
||||||
{
|
{
|
||||||
usage(from); /* usage for CurrentCmd->name */
|
usage(from); /* usage for CurrentCmd->name */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
nick = chop(&rest);
|
||||||
guid = asc2int(nick);
|
guid = asc2int(nick);
|
||||||
backup = current;
|
backup = current;
|
||||||
if (!errno)
|
if (errno == 0) /* we got a number */
|
||||||
{
|
{
|
||||||
nick = chop(&rest);
|
nick = chop(&rest);
|
||||||
for(current=botlist;current;current=current->next)
|
for(current=botlist;current;current=current->next)
|
||||||
@ -1735,7 +1684,7 @@ void do_nick(COMMAND_ARGS)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!is_nick(nick))
|
if (is_nick(nick) == FALSE)
|
||||||
{
|
{
|
||||||
current = backup;
|
current = backup;
|
||||||
to_user(from,ERR_NICK,nick);
|
to_user(from,ERR_NICK,nick);
|
||||||
@ -1756,15 +1705,11 @@ void do_nick(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
if (current->guid == 0)
|
if (current->guid == 0)
|
||||||
{
|
{
|
||||||
Free((char**)¤t->nick);
|
setbotnick(current,nick);
|
||||||
set_mallocdoer(do_nick);
|
current->guid = guid; /* guid might be undefined? */
|
||||||
current->nick = stringdup(nick);
|
|
||||||
current->guid = guid;
|
|
||||||
}
|
}
|
||||||
Free((char**)¤t->wantnick);
|
setbotwantnick(current,nick);
|
||||||
set_mallocdoer(do_nick);
|
to_server("NICK %s\n",getbotwantnick(current));
|
||||||
current->wantnick = stringdup(nick);
|
|
||||||
to_server("NICK %s\n",current->wantnick);
|
|
||||||
}
|
}
|
||||||
current = backup;
|
current = backup;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,7 +82,7 @@ void delete_client(Client *client)
|
|||||||
pspy = &(*pspy)->next;
|
pspy = &(*pspy)->next;
|
||||||
}
|
}
|
||||||
send_global(SPYSTR_STATUS,"[%s] %s[%i] has disconnected",
|
send_global(SPYSTR_STATUS,"[%s] %s[%i] has disconnected",
|
||||||
current->nick,client->user->name,client->user->x.x.access);
|
getbotnick(current),client->user->name,client->user->x.x.access);
|
||||||
}
|
}
|
||||||
#ifdef DCC_FILE
|
#ifdef DCC_FILE
|
||||||
if (client->fileno >= 0)
|
if (client->fileno >= 0)
|
||||||
@ -347,11 +347,11 @@ void parse_dcc(Client *client)
|
|||||||
bp = ptr;
|
bp = ptr;
|
||||||
chop(&bp);
|
chop(&bp);
|
||||||
ptr = get_token(&bp,"\001");
|
ptr = get_token(&bp,"\001");
|
||||||
on_action(CurrentUser->name,current->nick,ptr);
|
on_action(CurrentUser->name,getbotnick(current),ptr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
on_msg(CurrentUser->name,current->nick,ptr);
|
on_msg(CurrentUser->name,getbotnick(current),ptr);
|
||||||
}
|
}
|
||||||
CurrentDCC = NULL;
|
CurrentDCC = NULL;
|
||||||
/*
|
/*
|
||||||
|
|||||||
11
src/debug.c
11
src/debug.c
@ -168,7 +168,7 @@ LS struct
|
|||||||
{ send_kick, "send_kick" },
|
{ send_kick, "send_kick" },
|
||||||
{ send_mode, "send_mode" },
|
{ send_mode, "send_mode" },
|
||||||
{ set_str_varc, "set_str_varc" CFG1_SE },
|
{ set_str_varc, "set_str_varc" CFG1_SE },
|
||||||
{ setbotnick, "setbotnick" },
|
{ set_mix16, "set_mix16" CORE_SE },
|
||||||
{ sig_hup, "sig_hup" RARE_SE },
|
{ sig_hup, "sig_hup" RARE_SE },
|
||||||
{ table_buffer, "table_buffer" },
|
{ table_buffer, "table_buffer" },
|
||||||
#ifdef ALIAS
|
#ifdef ALIAS
|
||||||
@ -661,7 +661,6 @@ void debug_memory(void)
|
|||||||
{
|
{
|
||||||
memtouch(bot->lastcmds[i]);
|
memtouch(bot->lastcmds[i]);
|
||||||
}
|
}
|
||||||
memtouch(bot->userhost);
|
|
||||||
}
|
}
|
||||||
debug("> Memory allocations\n");
|
debug("> Memory allocations\n");
|
||||||
for(mea=mrrec;(mea);mea=mea->next)
|
for(mea=mrrec;(mea);mea=mea->next)
|
||||||
@ -851,7 +850,7 @@ void debug_core(void)
|
|||||||
}
|
}
|
||||||
debug(" ; ---\n");
|
debug(" ; ---\n");
|
||||||
if (current)
|
if (current)
|
||||||
debug("; current\t\t"mx_pfmt" \"%s\"\n",(mx_ptr)current,nullstr(current->nick));
|
debug("; current\t\t"mx_pfmt" \"%s\"\n",(mx_ptr)current,nullstr(getbotnick(current)));
|
||||||
else
|
else
|
||||||
debug("; current\t\t"mx_pfmt"\n",(mx_ptr)current);
|
debug("; current\t\t"mx_pfmt"\n",(mx_ptr)current);
|
||||||
debug("; executable\t\t\"%s\"\n",executable);
|
debug("; executable\t\t\"%s\"\n",executable);
|
||||||
@ -887,8 +886,6 @@ void debug_core(void)
|
|||||||
for(bot=botlist;bot;bot=bot->next)
|
for(bot=botlist;bot;bot=bot->next)
|
||||||
{
|
{
|
||||||
memtouch(bot);
|
memtouch(bot);
|
||||||
memtouch(bot->nick);
|
|
||||||
memtouch(bot->wantnick);
|
|
||||||
debug(" ; Mech*\t\t"mx_pfmt"\n",(mx_ptr)bot);
|
debug(" ; Mech*\t\t"mx_pfmt"\n",(mx_ptr)bot);
|
||||||
debug(" ; next\t\t"mx_pfmt"\n",(mx_ptr)bot->next);
|
debug(" ; next\t\t"mx_pfmt"\n",(mx_ptr)bot->next);
|
||||||
debug(" ; connect\t\t%s (%i)\n",strdef(CNdefs,bot->connect),bot->connect);
|
debug(" ; connect\t\t%s (%i)\n",strdef(CNdefs,bot->connect),bot->connect);
|
||||||
@ -906,8 +903,8 @@ void debug_core(void)
|
|||||||
{
|
{
|
||||||
debug_server(sp," ");
|
debug_server(sp," ");
|
||||||
}
|
}
|
||||||
debug(" ; nick\t\t\"%s\"\n",nullstr(bot->nick));
|
debug(" ; nick\t\t\"%s\"\n",nullstr(getbotnick(bot)));
|
||||||
debug(" ; wantnick\t\t\"%s\"\n",nullstr(bot->wantnick));
|
debug(" ; wantnick\t\t\"%s\"\n",nullstr(getbotwantnick(bot)));
|
||||||
|
|
||||||
debug_settings(bot->setting,DSET_GLOBAL);
|
debug_settings(bot->setting,DSET_GLOBAL);
|
||||||
|
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
EnergyMech, IRC bot software
|
||||||
Parts Copyright (c) 1997-2020 proton
|
Parts Copyright (c) 1997-2025 proton
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -167,6 +167,50 @@ void Free(char **mem)
|
|||||||
|
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
|
void set_mix16(Mix16 *mix, const char *str)
|
||||||
|
{
|
||||||
|
int sz;
|
||||||
|
|
||||||
|
if (mix->opt >= 16)
|
||||||
|
{
|
||||||
|
Free(&mix->x.ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
sz = strlen(str);
|
||||||
|
if (sz < 16)
|
||||||
|
{
|
||||||
|
stringcpy(mix->x.string,str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_mallocdoer(set_mix16);
|
||||||
|
mix->x.ptr = stringdup(str);
|
||||||
|
}
|
||||||
|
mix->opt = sz;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_mix64(Mix64 *mix, const char *str)
|
||||||
|
{
|
||||||
|
int sz;
|
||||||
|
|
||||||
|
if (mix->opt >= 64)
|
||||||
|
{
|
||||||
|
Free(&mix->x.ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
sz = strlen(str);
|
||||||
|
if (sz < 64)
|
||||||
|
{
|
||||||
|
stringcpy(mix->x.string,str);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_mallocdoer(set_mix64);
|
||||||
|
mix->x.ptr = stringdup(str);
|
||||||
|
}
|
||||||
|
mix->opt = sz;
|
||||||
|
}
|
||||||
|
|
||||||
Strp *make_strp(Strp **pp, const char *string)
|
Strp *make_strp(Strp **pp, const char *string)
|
||||||
{
|
{
|
||||||
set_mallocdoer(make_strp);
|
set_mallocdoer(make_strp);
|
||||||
|
|||||||
@ -55,7 +55,6 @@ BEG const char NULLSTR[] MDEF("<NULL>");
|
|||||||
|
|
||||||
BEG const char ERR_CHAN[] MDEF("I'm not on %s");
|
BEG const char ERR_CHAN[] MDEF("I'm not on %s");
|
||||||
BEG const char ERR_FILEOPEN[] MDEF("Couldn't open the file %s");
|
BEG const char ERR_FILEOPEN[] MDEF("Couldn't open the file %s");
|
||||||
BEG const char ERR_INIT[] MDEF("init: Warning:");
|
|
||||||
BEG const char ERR_NICK[] MDEF("Invalid nickname: %s");
|
BEG const char ERR_NICK[] MDEF("Invalid nickname: %s");
|
||||||
BEG const char ERR_NOCHANNELS[] MDEF("I'm not active on any channels");
|
BEG const char ERR_NOCHANNELS[] MDEF("I'm not active on any channels");
|
||||||
BEG const char ERR_NOTOPPED[] MDEF("I'm not opped on %s");
|
BEG const char ERR_NOTOPPED[] MDEF("I'm not opped on %s");
|
||||||
|
|||||||
16
src/h.h
16
src/h.h
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
EnergyMech, IRC bot software
|
||||||
Copyright (c) 1997-2024 proton
|
Copyright (c) 1997-2025 proton
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -183,11 +183,21 @@ LS void do_idle(COMMAND_ARGS) __page(CMD1_SEG);
|
|||||||
|
|
||||||
/* core.c */
|
/* core.c */
|
||||||
|
|
||||||
void unlink_identfile(void);
|
#define getbotnicklen(z) (z->nick.opt)
|
||||||
|
#define getbotnick(z) ((z->nick.opt < 16) ? z->nick.x.string : z->nick.x.ptr)
|
||||||
|
#define getbotwantnick(z) ((z->wantnick.opt < 16) ? z->wantnick.x.string : z->wantnick.x.ptr)
|
||||||
|
#define getbotuserhost(z) ((z->userhost.opt == 0) ? UNKNOWNATUNKNOWN : ((z->userhost.opt < 64) ? z->userhost.x.string : z->userhost.x.ptr))
|
||||||
|
|
||||||
|
#define setbotnick(z,y) set_mix16(&z->nick,y)
|
||||||
|
#define setbotwantnick(z,y) set_mix16(&z->wantnick,y)
|
||||||
|
#define setbotuserhost(z,y) set_mix64(&z->userhost,y)
|
||||||
|
|
||||||
|
void set_mix16(Mix16 *, const char *) __page(CORE_SEG);
|
||||||
|
void set_mix64(Mix64 *, const char *) __page(CORE_SEG);
|
||||||
|
|
||||||
int conf_callback(char *line) __page(CFG1_SEG);
|
int conf_callback(char *line) __page(CFG1_SEG);
|
||||||
void readcfgfile(void) __page(CFG1_SEG);
|
void readcfgfile(void) __page(CFG1_SEG);
|
||||||
int write_session(void) __page(CORE_SEG);
|
int write_session(void) __page(CORE_SEG);
|
||||||
void setbotnick(Mech *bot, char *nick) __page(CFG1_SEG);
|
|
||||||
Mech *add_bot(int guid, char *nick) __page(CFG1_SEG);
|
Mech *add_bot(int guid, char *nick) __page(CFG1_SEG);
|
||||||
void signoff(char *from, char *reason) __page(RARE_SEG);
|
void signoff(char *from, char *reason) __page(RARE_SEG);
|
||||||
void kill_all_bots(char *reason) __attr(RARE_SEG, __noreturn__);;
|
void kill_all_bots(char *reason) __attr(RARE_SEG, __noreturn__);;
|
||||||
|
|||||||
51
src/io.c
51
src/io.c
@ -115,10 +115,6 @@ int SockConnect(char *host, int port, int use_vhost)
|
|||||||
{
|
{
|
||||||
struct sockaddr_in sai;
|
struct sockaddr_in sai;
|
||||||
int s;
|
int s;
|
||||||
#ifdef IDWRAP
|
|
||||||
char *id,identfile[64];
|
|
||||||
int t = FALSE;
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(SockConnect) %s %i%s\n",nullstr(host),port,(use_vhost) ? " [VHOST]" : "");
|
debug("(SockConnect) %s %i%s\n",nullstr(host),port,(use_vhost) ? " [VHOST]" : "");
|
||||||
@ -130,16 +126,7 @@ int SockConnect(char *host, int port, int use_vhost)
|
|||||||
memset((char*)&sai,0,sizeof(sai));
|
memset((char*)&sai,0,sizeof(sai));
|
||||||
sai.sin_family = AF_INET;
|
sai.sin_family = AF_INET;
|
||||||
|
|
||||||
/*
|
if (use_vhost && ((current->vhost_type & VH_IPALIAS_FAIL) == 0)
|
||||||
* special case, BOUNCE feature may call SockConnect()
|
|
||||||
* to create the IDWRAP symlink, using special use_vhost value == 2
|
|
||||||
*/
|
|
||||||
#if defined(BOUNCE) && defined(IDWRAP)
|
|
||||||
if ((use_vhost == TRUE)
|
|
||||||
#else /* not ... */
|
|
||||||
if (use_vhost
|
|
||||||
#endif /* ... */
|
|
||||||
&& ((current->vhost_type & VH_IPALIAS_FAIL) == 0)
|
|
||||||
&& current->setting[STR_VIRTUAL].str_var)
|
&& current->setting[STR_VIRTUAL].str_var)
|
||||||
{
|
{
|
||||||
current->vhost_type |= VH_IPALIAS_BOTH;
|
current->vhost_type |= VH_IPALIAS_BOTH;
|
||||||
@ -151,25 +138,12 @@ int SockConnect(char *host, int port, int use_vhost)
|
|||||||
#ifdef WINGATE
|
#ifdef WINGATE
|
||||||
use_vhost++;
|
use_vhost++;
|
||||||
#endif /* WINGATE */
|
#endif /* WINGATE */
|
||||||
#ifdef IDWRAP
|
|
||||||
t = TRUE;
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(SockConnect) IP Alias virtual host bound OK\n");
|
debug("(SockConnect) IP Alias virtual host bound OK\n");
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef IDWRAP
|
|
||||||
/*
|
|
||||||
* do a blank bind to get a port number
|
|
||||||
*/
|
|
||||||
if (!t)
|
|
||||||
{
|
|
||||||
sai.sin_addr.s_addr = INADDR_ANY;
|
|
||||||
bind(s,(struct sockaddr *)&sai,sizeof(sai));
|
|
||||||
}
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
memset((char*)&sai,0,sizeof(sai));
|
memset((char*)&sai,0,sizeof(sai));
|
||||||
sai.sin_family = AF_INET;
|
sai.sin_family = AF_INET;
|
||||||
@ -204,29 +178,6 @@ int SockConnect(char *host, int port, int use_vhost)
|
|||||||
/*
|
/*
|
||||||
* Normal connect, no bounces...
|
* Normal connect, no bounces...
|
||||||
*/
|
*/
|
||||||
#ifdef IDWRAP
|
|
||||||
if (use_vhost)
|
|
||||||
{
|
|
||||||
t = sizeof(sai);
|
|
||||||
if (getsockname(s,(struct sockaddr*)&sai,&t) == 0)
|
|
||||||
{
|
|
||||||
if (current->identfile)
|
|
||||||
Free((char**)¤t->identfile);
|
|
||||||
sprintf(identfile,IDWRAP_PATH "%i.%i",ntohs(sai.sin_port),port);
|
|
||||||
id = current->setting[STR_IDENT].str_var;
|
|
||||||
if (symlink((id) ? id : BOTLOGIN,identfile) == 0)
|
|
||||||
{
|
|
||||||
set_mallocdoer(SockConnect);
|
|
||||||
current->identfile = Strdup(identfile);
|
|
||||||
#ifdef DEBUG
|
|
||||||
debug("(SockConnect) symlink: %s -> %s\n",identfile,(id) ? id : BOTLOGIN);
|
|
||||||
#endif /* DEBUG */
|
|
||||||
}
|
|
||||||
}
|
|
||||||
memset((char*)&sai,0,sizeof(sai));
|
|
||||||
sai.sin_family = AF_INET;
|
|
||||||
}
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
sai.sin_port = htons(port);
|
sai.sin_port = htons(port);
|
||||||
if ((sai.sin_addr.s_addr = get_ip(host)) == -1)
|
if ((sai.sin_addr.s_addr = get_ip(host)) == -1)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -209,7 +209,7 @@ LS struct
|
|||||||
|
|
||||||
int sig_hup_callback(char *line)
|
int sig_hup_callback(char *line)
|
||||||
{
|
{
|
||||||
on_msg((char*)CoreUser.name,current->nick,line);
|
on_msg((char*)CoreUser.name,getbotnick(current),line);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -295,9 +295,6 @@ void do_sigusr1(void)
|
|||||||
{
|
{
|
||||||
if (current->sock != -1)
|
if (current->sock != -1)
|
||||||
{
|
{
|
||||||
#ifdef IDWRAP
|
|
||||||
unlink_identfile();
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
close(current->sock);
|
close(current->sock);
|
||||||
}
|
}
|
||||||
current->sock = -1;
|
current->sock = -1;
|
||||||
@ -686,9 +683,6 @@ doit_jumptonext:
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(doit) {%i} Connection timed out\n",current->sock);
|
debug("(doit) {%i} Connection timed out\n",current->sock);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
#ifdef IDWRAP
|
|
||||||
unlink_identfile();
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
close(current->sock);
|
close(current->sock);
|
||||||
current->sock = -1;
|
current->sock = -1;
|
||||||
goto restart_dcc;
|
goto restart_dcc;
|
||||||
|
|||||||
10
src/net.c
10
src/net.c
@ -206,8 +206,8 @@ void botnet_refreshbotinfo(void)
|
|||||||
Server *sv;
|
Server *sv;
|
||||||
|
|
||||||
sv = find_server(current->server);
|
sv = find_server(current->server);
|
||||||
botnet_relay(NULL,"BL%i 0 %s!%s %s:%i %s %s\n", current->guid,current->nick,
|
botnet_relay(NULL,"BL%i 0 %s!%s %s:%i %s %s\n", current->guid,getbotnick(current),
|
||||||
(current->userhost) ? current->userhost : UNKNOWNATUNKNOWN,
|
getbotuserhost(current),
|
||||||
(sv) ? ((*sv->realname) ? sv->realname : sv->name) : UNKNOWN,
|
(sv) ? ((*sv->realname) ? sv->realname : sv->name) : UNKNOWN,
|
||||||
(sv) ? sv->port : 0,BOTCLASS,VERSION);
|
(sv) ? sv->port : 0,BOTCLASS,VERSION);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -248,8 +248,8 @@ void botnet_dumplinklist(BotNet *bn)
|
|||||||
*/
|
*/
|
||||||
sv = find_server(bot->server);
|
sv = find_server(bot->server);
|
||||||
to_file(bn->sock,"BL%i %c %s!%s %s:%i %s %s\n",bot->guid,
|
to_file(bn->sock,"BL%i %c %s!%s %s:%i %s %s\n",bot->guid,
|
||||||
(bot == bn->controller) ? '0' : '1',bot->nick,
|
(bot == bn->controller) ? '0' : '1',getbotnick(bot),
|
||||||
(bot->userhost) ? bot->userhost : UNKNOWNATUNKNOWN,
|
getbotuserhost(bot),
|
||||||
(sv) ? ((*sv->realname) ? sv->realname : sv->name) : UNKNOWN,
|
(sv) ? ((*sv->realname) ? sv->realname : sv->name) : UNKNOWN,
|
||||||
(sv) ? sv->port : 0,BOTCLASS,VERSION);
|
(sv) ? sv->port : 0,BOTCLASS,VERSION);
|
||||||
}
|
}
|
||||||
@ -987,7 +987,7 @@ int commandlocal(int dg, int sg, char *from, char *command)
|
|||||||
*p2 = current->setting[CHR_CMDCHAR].char_var;
|
*p2 = current->setting[CHR_CMDCHAR].char_var;
|
||||||
stringcpy((*p2 == *command) ? p2 : p2+1,command);
|
stringcpy((*p2 == *command) ? p2 : p2+1,command);
|
||||||
|
|
||||||
on_msg(p1,current->nick,p2);
|
on_msg(p1,getbotnick(current),p2);
|
||||||
CurrentDCC = NULL;
|
CurrentDCC = NULL;
|
||||||
}
|
}
|
||||||
if (dg == -1)
|
if (dg == -1)
|
||||||
|
|||||||
21
src/ons.c
21
src/ons.c
@ -82,7 +82,7 @@ void on_kick(char *from, char *rest)
|
|||||||
if (current->spy & SPYF_CHANNEL)
|
if (current->spy & SPYF_CHANNEL)
|
||||||
send_spy(chan->name,"*** %s was kicked by %s (%s)",nick,CurrentNick,rest);
|
send_spy(chan->name,"*** %s was kicked by %s (%s)",nick,CurrentNick,rest);
|
||||||
|
|
||||||
if (!nickcmp(current->nick,nick))
|
if (!nickcmp(getbotnick(current),nick))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(on_kick) I was kicked from %s\n",chan->name);
|
debug("(on_kick) I was kicked from %s\n",chan->name);
|
||||||
@ -290,8 +290,8 @@ void on_nick(char *from, char *newnick)
|
|||||||
* grab the nick *RIGHT NOW*
|
* grab the nick *RIGHT NOW*
|
||||||
* this is a setting because this is risky, you might get collided as a result
|
* this is a setting because this is risky, you might get collided as a result
|
||||||
*/
|
*/
|
||||||
if (!nickcmp(CurrentNick,current->wantnick))
|
if (!nickcmp(CurrentNick,getbotwantnick(current)))
|
||||||
to_server("NICK %s\n",current->wantnick);
|
to_server("NICK %s\n",getbotwantnick(current));
|
||||||
#endif /* FASTNICK */
|
#endif /* FASTNICK */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -311,9 +311,12 @@ void on_nick(char *from, char *newnick)
|
|||||||
|
|
||||||
change_authnick(from,newnuh);
|
change_authnick(from,newnuh);
|
||||||
|
|
||||||
if ((isbot = !nickcmp(current->nick,CurrentNick)))
|
if ((isbot = !nickcmp(getbotnick(current),CurrentNick)))
|
||||||
{
|
{
|
||||||
setbotnick(current,newnick);
|
setbotnick(current,newnick);
|
||||||
|
#ifdef BOTNET
|
||||||
|
botnet_refreshbotinfo();
|
||||||
|
#endif /* BOTNET */
|
||||||
}
|
}
|
||||||
|
|
||||||
for(chan=current->chanlist;chan;chan=chan->next)
|
for(chan=current->chanlist;chan;chan=chan->next)
|
||||||
@ -450,7 +453,7 @@ void on_msg(char *from, char *to, char *rest)
|
|||||||
if ((p2 = (uchar*)(command = chop(&rest))) == NULL)
|
if ((p2 = (uchar*)(command = chop(&rest))) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p1 = (uchar*)current->nick;
|
p1 = (uchar*)getbotnick(current);
|
||||||
while(!(i = tolowertab[*(p1++)] - tolowertab[*p2]) && *(p2++))
|
while(!(i = tolowertab[*(p1++)] - tolowertab[*p2]) && *(p2++))
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -726,7 +729,7 @@ public_msg:
|
|||||||
{
|
{
|
||||||
partyline_broadcast(CurrentDCC,"<%s> %s\n",origstart);
|
partyline_broadcast(CurrentDCC,"<%s> %s\n",origstart);
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
botnet_relay(NULL,"PM* * %s@%s %s\n",CurrentNick,current->nick,origstart);
|
botnet_relay(NULL,"PM* * %s@%s %s\n",CurrentNick,getbotnick(current),origstart);
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -800,7 +803,7 @@ modeloop:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!nickcmp(current->nick,nick))
|
if (!nickcmp(getbotnick(current),nick))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* wooohoooo! they gave me ops!!!
|
* wooohoooo! they gave me ops!!!
|
||||||
@ -824,7 +827,7 @@ modeloop:
|
|||||||
victim->flags &= ~(CU_CHANOP|CU_DEOPPED);
|
victim->flags &= ~(CU_CHANOP|CU_DEOPPED);
|
||||||
if (i == BOTLEVEL)
|
if (i == BOTLEVEL)
|
||||||
{
|
{
|
||||||
if (!nickcmp(current->nick,nick))
|
if (!nickcmp(getbotnick(current),nick))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* they dont love me!!! :~(
|
* they dont love me!!! :~(
|
||||||
@ -1105,7 +1108,7 @@ void on_action(char *from, char *to, char *rest)
|
|||||||
{
|
{
|
||||||
partyline_broadcast(CurrentDCC,"* %s %s\n",rest);
|
partyline_broadcast(CurrentDCC,"* %s %s\n",rest);
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
botnet_relay(NULL,"PM* * %s@%s \001%s\n",CurrentNick,current->nick,rest);
|
botnet_relay(NULL,"PM* * %s@%s \001%s\n",CurrentNick,getbotnick(current),rest);
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
36
src/parse.c
36
src/parse.c
@ -84,7 +84,7 @@ void parse_join(char *from, char *rest)
|
|||||||
if ((CurrentChan = chan = find_channel_ny(rest)) == NULL)
|
if ((CurrentChan = chan = find_channel_ny(rest)) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!nickcmp(current->nick,from))
|
if (!nickcmp(getbotnick(current),from))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_join) Im joining %s\n",chan->name);
|
debug("(parse_join) Im joining %s\n",chan->name);
|
||||||
@ -202,7 +202,7 @@ void parse_mode(char *from, char *rest)
|
|||||||
on_mode(from,to,rest);
|
on_mode(from,to,rest);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!stringcasecmp(current->nick,to))
|
if (!stringcasecmp(getbotnick(current),to)) /* todo: nickcmp? */
|
||||||
{
|
{
|
||||||
char *dst;
|
char *dst;
|
||||||
char sign;
|
char sign;
|
||||||
@ -311,7 +311,7 @@ void parse_part(char *from, char *rest)
|
|||||||
if (current->spy & SPYF_CHANNEL)
|
if (current->spy & SPYF_CHANNEL)
|
||||||
send_spy(channel,"*** Parts: %s (%s)",nick,from);
|
send_spy(channel,"*** Parts: %s (%s)",nick,from);
|
||||||
|
|
||||||
if (!nickcmp(current->nick,nick))
|
if (!nickcmp(getbotnick(current),nick))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_part) Im parting %s\n",chan->name);
|
debug("(parse_part) Im parting %s\n",chan->name);
|
||||||
@ -547,6 +547,9 @@ void parse_251(char *from, char *rest)
|
|||||||
{
|
{
|
||||||
nick = chop(&rest);
|
nick = chop(&rest);
|
||||||
setbotnick(current,nick);
|
setbotnick(current,nick);
|
||||||
|
#ifdef BOTNET
|
||||||
|
botnet_refreshbotinfo();
|
||||||
|
#endif /* BOTNET */
|
||||||
for(sp=serverlist;sp;sp=sp->next)
|
for(sp=serverlist;sp;sp=sp->next)
|
||||||
{
|
{
|
||||||
if (!stringcasecmp(sp->name,from) || !stringcasecmp(sp->realname,from))
|
if (!stringcasecmp(sp->name,from) || !stringcasecmp(sp->realname,from))
|
||||||
@ -702,11 +705,9 @@ void parse_311(char *from, char *rest)
|
|||||||
if (host)
|
if (host)
|
||||||
host[-1] = '@';
|
host[-1] = '@';
|
||||||
|
|
||||||
if (!nickcmp(nick,current->nick))
|
if (!nickcmp(getbotnick(current),nick))
|
||||||
{
|
{
|
||||||
Free((char**)¤t->userhost);
|
setbotuserhost(current,user);
|
||||||
set_mallocdoer(parse_311);
|
|
||||||
current->userhost = stringdup(user);
|
|
||||||
#ifdef BOTNET
|
#ifdef BOTNET
|
||||||
botnet_refreshbotinfo();
|
botnet_refreshbotinfo();
|
||||||
#endif /* BOTNET */
|
#endif /* BOTNET */
|
||||||
@ -855,7 +856,7 @@ void parse_319(char *from, char *rest)
|
|||||||
send_pa(PA_WHOIS,nick,"Channels: %s",rest);
|
send_pa(PA_WHOIS,nick,"Channels: %s",rest);
|
||||||
|
|
||||||
/* if nick is myself (the bot), check for reset recovery */
|
/* if nick is myself (the bot), check for reset recovery */
|
||||||
if (!nickcmp(nick,current->nick))
|
if (!nickcmp(getbotnick(current),nick))
|
||||||
{
|
{
|
||||||
if (current->reset)
|
if (current->reset)
|
||||||
{
|
{
|
||||||
@ -871,7 +872,7 @@ loop:
|
|||||||
*/
|
*/
|
||||||
while(*channel && *channel != '#') /* this is a recipe for disaster with other valid channels than '#' */
|
while(*channel && *channel != '#') /* this is a recipe for disaster with other valid channels than '#' */
|
||||||
channel++;
|
channel++;
|
||||||
sprintf(nuh,"%s!%s",current->nick,current->userhost);
|
sprintf(nuh,"%s!%s",getbotnick(current),getbotuserhost(current));
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_319) :%s JOIN :%s\n",nuh,channel);
|
debug("(parse_319) :%s JOIN :%s\n",nuh,channel);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
@ -996,7 +997,7 @@ void parse_352(char *from, char *rest)
|
|||||||
if (*rest == '@')
|
if (*rest == '@')
|
||||||
{
|
{
|
||||||
chan->users->flags = CU_CHANOP;
|
chan->users->flags = CU_CHANOP;
|
||||||
if (!nickcmp(current->nick,nick))
|
if (!nickcmp(getbotnick(current),nick))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_352) According to wholist I have ops\n");
|
debug("(parse_352) According to wholist I have ops\n");
|
||||||
@ -1066,13 +1067,10 @@ void parse_376(char *from, char *rest)
|
|||||||
{
|
{
|
||||||
current->connect = CN_ONLINE;
|
current->connect = CN_ONLINE;
|
||||||
current->ontime = now;
|
current->ontime = now;
|
||||||
to_server("WHOIS %s\n",current->nick);
|
to_server("WHOIS %s\n",getbotnick(current));
|
||||||
if ((mode = current->setting[STR_UMODES].str_var))
|
if ((mode = current->setting[STR_UMODES].str_var))
|
||||||
to_server("MODE %s %s\n",current->nick,mode);
|
to_server("MODE %s %s\n",getbotnick(current),mode);
|
||||||
}
|
}
|
||||||
#ifdef IDWRAP
|
|
||||||
unlink_identfile();
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1113,7 +1111,7 @@ void parse_433(char *from, char *rest)
|
|||||||
do
|
do
|
||||||
{
|
{
|
||||||
s2 = chop(&s);
|
s2 = chop(&s);
|
||||||
if (current->connect == CN_ONLINE && !stringcasecmp(current->nick,s2))
|
if (current->connect == CN_ONLINE && !stringcasecmp(getbotnick(current),s2)) /* todo: nickcmp? */
|
||||||
{
|
{
|
||||||
/* nicks listed first are more worth, dont try nicks after */
|
/* nicks listed first are more worth, dont try nicks after */
|
||||||
break;
|
break;
|
||||||
@ -1134,14 +1132,12 @@ void parse_433(char *from, char *rest)
|
|||||||
if (nick)
|
if (nick)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(parse_433) Nick: %s, Altnick: %s\n",current->nick,nick);
|
debug("(parse_433) Nick: %s, Altnick: %s\n",getbotnick(current),nick);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
to_server("NICK %s\n",nick);
|
to_server("NICK %s\n",nick);
|
||||||
if (current->connect != CN_ONLINE)
|
if (current->connect != CN_ONLINE)
|
||||||
{
|
{
|
||||||
Free((char**)¤t->nick);
|
setbotnick(current,nick);
|
||||||
set_mallocdoer(parse_433);
|
|
||||||
current->nick = stringdup(nick);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,7 +122,7 @@ void partyline_banner(Client *client)
|
|||||||
client->lasttime = now;
|
client->lasttime = now;
|
||||||
|
|
||||||
sprintf(tmp,"[%s] %s[%i] has connected",
|
sprintf(tmp,"[%s] %s[%i] has connected",
|
||||||
current->nick,client->user->name,(int)client->user->x.x.access);
|
getbotnick(current),client->user->name,(int)client->user->x.x.access);
|
||||||
|
|
||||||
if ((to_file(client->sock,"[%s] %s\n",time2medium(now),tmp)) < 0)
|
if ((to_file(client->sock,"[%s] %s\n",time2medium(now),tmp)) < 0)
|
||||||
{
|
{
|
||||||
@ -134,7 +134,7 @@ void partyline_banner(Client *client)
|
|||||||
{
|
{
|
||||||
CurrentDCC = client;
|
CurrentDCC = client;
|
||||||
stringcpy(tmp,SPYSTR_STATUS);
|
stringcpy(tmp,SPYSTR_STATUS);
|
||||||
do_spy(client->user->name,current->nick,tmp,0);
|
do_spy(client->user->name,getbotnick(current),tmp,0);
|
||||||
CurrentDCC = NULL;
|
CurrentDCC = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,7 +240,7 @@ void do_whom(COMMAND_ARGS)
|
|||||||
{
|
{
|
||||||
stringcpy(stt,TEXT_NOTCONNECTED);
|
stringcpy(stt,TEXT_NOTCONNECTED);
|
||||||
}
|
}
|
||||||
table_buffer(TEXT_WHOMSELFLINE,bot->nick,(bot == current) ? "(me)" : "b200",stt);
|
table_buffer(TEXT_WHOMSELFLINE,getbotnick(bot),(bot == current) ? "(me)" : "b200",stt);
|
||||||
for(client=bot->clientlist;client;client=client->next)
|
for(client=bot->clientlist;client;client=client->next)
|
||||||
{
|
{
|
||||||
m = (now - client->lasttime) / 60;
|
m = (now - client->lasttime) / 60;
|
||||||
|
|||||||
@ -97,7 +97,7 @@ char *recover_client(char *env)
|
|||||||
|
|
||||||
found_user:
|
found_user:
|
||||||
if (to_file(fd,"[%s] [%s] %s[%i] has connected (reset recover)\n",
|
if (to_file(fd,"[%s] [%s] %s[%i] has connected (reset recover)\n",
|
||||||
time2medium(now),current->wantnick,handle,user->x.x.access) < 0)
|
time2medium(now),getbotwantnick(current),handle,user->x.x.access) < 0)
|
||||||
{
|
{
|
||||||
close(fd);
|
close(fd);
|
||||||
return(p);
|
return(p);
|
||||||
@ -121,7 +121,7 @@ found_user:
|
|||||||
{
|
{
|
||||||
CurrentDCC = client;
|
CurrentDCC = client;
|
||||||
stringcpy(client->sockdata,"status");
|
stringcpy(client->sockdata,"status");
|
||||||
do_spy(user->name,current->wantnick,client->sockdata,0);
|
do_spy(user->name,getbotwantnick(current),client->sockdata,0);
|
||||||
*client->sockdata = 0;
|
*client->sockdata = 0;
|
||||||
CurrentDCC = NULL;
|
CurrentDCC = NULL;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -201,7 +201,7 @@ Shit *get_shituser(char *userhost, char *channel)
|
|||||||
*/
|
*/
|
||||||
if (!current->shitlist)
|
if (!current->shitlist)
|
||||||
return(NULL);
|
return(NULL);
|
||||||
if (!nickcmp(current->nick,userhost))
|
if (!nickcmp(getbotnick(current),userhost))
|
||||||
return(NULL);
|
return(NULL);
|
||||||
for(chan=current->chanlist;chan;chan=chan->next)
|
for(chan=current->chanlist;chan;chan=chan->next)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -104,7 +104,7 @@ void send_spy(const char *src, const char *format, ...)
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (src != SPYSTR_RAWIRC) /* too much debug spam */
|
if (src != SPYSTR_RAWIRC) /* too much debug spam */
|
||||||
debug("(send_spy) src <%s> format = '%s', current = '%s' (%i)\n",src,format,
|
debug("(send_spy) src <%s> format = '%s', current = '%s' (%i)\n",src,format,
|
||||||
(current == NULL) ? "<NULL>" : nullstr(current->nick),(current == NULL) ? -1 : current->guid);
|
(current == NULL) ? "<NULL>" : getbotnick(current),(current == NULL) ? -1 : current->guid);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
for(spy=current->spylist;spy;spy=spy->next)
|
for(spy=current->spylist;spy;spy=spy->next)
|
||||||
@ -428,7 +428,7 @@ void send_redirect(char *message)
|
|||||||
Mech *backup;
|
Mech *backup;
|
||||||
|
|
||||||
/* PM<targetguid> <targetuserhost> <source> <message> */
|
/* PM<targetguid> <targetuserhost> <source> <message> */
|
||||||
sprintf(tempdata,"%i %s %s %s",redirect.guid,redirect.to,current->nick,message);
|
sprintf(tempdata,"%i %s %s %s",redirect.guid,redirect.to,getbotnick(current),message);
|
||||||
backup = current;
|
backup = current;
|
||||||
partyMessage(NULL,tempdata);
|
partyMessage(NULL,tempdata);
|
||||||
current = backup;
|
current = backup;
|
||||||
@ -770,7 +770,7 @@ spy_dest_ok:
|
|||||||
debug("(do_spy) src = `%s'; t_src = %i (%s); dest = `%s'; t_dest = %i (%s), CurrentDCC "mx_pfmt"\n",
|
debug("(do_spy) src = `%s'; t_src = %i (%s); dest = `%s'; t_dest = %i (%s), CurrentDCC "mx_pfmt"\n",
|
||||||
src,t_src,SPY_DEFS[t_src-1],nullstr(dest),t_dest,SPY_DEFS[t_dest-1],CurrentDCC);
|
src,t_src,SPY_DEFS[t_src-1],nullstr(dest),t_dest,SPY_DEFS[t_dest-1],CurrentDCC);
|
||||||
if (guid >= 0)
|
if (guid >= 0)
|
||||||
debug("(do_spy) spying from remote bot guid %i (%s), channel %s\n",guid,(destbot) ? destbot->nick : "unknown",src);
|
debug("(do_spy) spying from remote bot guid %i (%s), channel %s\n",guid,(destbot) ? getbotnick(destbot) : "unknown",src);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
if (t_dest == SPY_DCC)
|
if (t_dest == SPY_DCC)
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
|
|
||||||
EnergyMech, IRC bot software
|
EnergyMech, IRC bot software
|
||||||
Parts Copyright (c) 1997-2020 proton
|
Parts Copyright (c) 1997-2025 proton
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -21,6 +21,35 @@
|
|||||||
#ifndef STRUCTS_H
|
#ifndef STRUCTS_H
|
||||||
#define STRUCTS_H 1
|
#define STRUCTS_H 1
|
||||||
|
|
||||||
|
typedef struct Strp
|
||||||
|
{
|
||||||
|
struct Strp *next;
|
||||||
|
char p[1];
|
||||||
|
|
||||||
|
} Strp;
|
||||||
|
|
||||||
|
typedef struct Mix16
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
char string[16];
|
||||||
|
char *ptr;
|
||||||
|
} x;
|
||||||
|
int8_t opt;
|
||||||
|
|
||||||
|
} Mix16;
|
||||||
|
|
||||||
|
typedef struct Mix64
|
||||||
|
{
|
||||||
|
union
|
||||||
|
{
|
||||||
|
char string[64];
|
||||||
|
char *ptr;
|
||||||
|
} x;
|
||||||
|
int8_t opt;
|
||||||
|
|
||||||
|
} Mix64;
|
||||||
|
|
||||||
typedef union usercombo
|
typedef union usercombo
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
@ -88,10 +117,6 @@ typedef struct ircLink
|
|||||||
char *nick; /* which nick to speak to */
|
char *nick; /* which nick to speak to */
|
||||||
char *handle;
|
char *handle;
|
||||||
|
|
||||||
#ifdef IDWRAP
|
|
||||||
char *idfile;
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
char servmem[MSGLEN];
|
char servmem[MSGLEN];
|
||||||
char usermem[MSGLEN];
|
char usermem[MSGLEN];
|
||||||
|
|
||||||
@ -212,13 +237,6 @@ typedef struct Setting
|
|||||||
|
|
||||||
} Setting;
|
} Setting;
|
||||||
|
|
||||||
typedef struct Strp
|
|
||||||
{
|
|
||||||
struct Strp *next;
|
|
||||||
char p[1];
|
|
||||||
|
|
||||||
} Strp;
|
|
||||||
|
|
||||||
typedef struct KickSay
|
typedef struct KickSay
|
||||||
{
|
{
|
||||||
struct KickSay *next;
|
struct KickSay *next;
|
||||||
@ -553,9 +571,10 @@ typedef struct Mech
|
|||||||
/*
|
/*
|
||||||
* Basic bot information
|
* Basic bot information
|
||||||
*/
|
*/
|
||||||
char *nick; /* current nickname */
|
Mix16 nick;
|
||||||
char *wantnick; /* wanted nickname */
|
Mix16 wantnick;
|
||||||
char *userhost;
|
Mix64 userhost;
|
||||||
|
|
||||||
int vhost_type;
|
int vhost_type;
|
||||||
|
|
||||||
uint32_t reset:1,
|
uint32_t reset:1,
|
||||||
@ -605,10 +624,6 @@ typedef struct Mech
|
|||||||
char *signoff;
|
char *signoff;
|
||||||
char *from;
|
char *from;
|
||||||
|
|
||||||
#ifdef IDWRAP
|
|
||||||
char *identfile;
|
|
||||||
#endif /* IDWRAP */
|
|
||||||
|
|
||||||
/* big buffers at the end */
|
/* big buffers at the end */
|
||||||
UniVar setting[SIZE_VARS]; /* global vars + channel defaults */
|
UniVar setting[SIZE_VARS]; /* global vars + channel defaults */
|
||||||
char modes[32];
|
char modes[32];
|
||||||
|
|||||||
@ -168,7 +168,7 @@ void send_uptime(int type)
|
|||||||
*/
|
*/
|
||||||
if (botlist)
|
if (botlist)
|
||||||
{
|
{
|
||||||
nick = botlist->nick;
|
nick = getbotnick(botlist);
|
||||||
upPack.ontime = htonl(botlist->ontime);
|
upPack.ontime = htonl(botlist->ontime);
|
||||||
if ((sp = find_server(botlist->server)))
|
if ((sp = find_server(botlist->server)))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -593,7 +593,7 @@ void mirror_user(User *user)
|
|||||||
}
|
}
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(mirror_user) mirroring user %s[%i] to local bot %s(%i)\n",
|
debug("(mirror_user) mirroring user %s[%i] to local bot %s(%i)\n",
|
||||||
user->name,user->x.x.access,nullstr(anybot->nick),anybot->guid);
|
user->name,user->x.x.access,getbotnick(anybot),anybot->guid);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
current = anybot;
|
current = anybot;
|
||||||
@ -646,7 +646,7 @@ void mirror_userlist(void)
|
|||||||
User *user;
|
User *user;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
debug("(mirror_userlist) mirroring userlist of %s(%i)\n",nullstr(current->nick),current->guid);
|
debug("(mirror_userlist) mirroring userlist of %s(%i)\n",getbotnick(current),current->guid);
|
||||||
#endif /* DEBUG */
|
#endif /* DEBUG */
|
||||||
|
|
||||||
for(user=current->userlist;user;user=user->next)
|
for(user=current->userlist;user;user=user->next)
|
||||||
@ -903,7 +903,7 @@ int is_bot(const char *userhost)
|
|||||||
|
|
||||||
for(bot=botlist;bot;bot=bot->next)
|
for(bot=botlist;bot;bot=bot->next)
|
||||||
{
|
{
|
||||||
if (!nickcmp(userhost,bot->nick))
|
if (!nickcmp(userhost,getbotnick(bot)))
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user