Started Moving IRCD specific functions to their own files

This commit is contained in:
fishwaldo 2002-03-05 06:59:06 +00:00
parent 8f7ab0068c
commit b8d69718f1
10 changed files with 168 additions and 76 deletions

2
.gitattributes vendored
View file

@ -5,7 +5,9 @@
/Makefile.in -text
/README -text
/TODO -text
/Ultimate.c -text
/Ultimate.h -text
/Unreal.c -text
/Unreal.h -text
/chans.c -text
/chkstats -text

View file

@ -1,18 +1,17 @@
# Makefile for GeoStats
# GeoStats CVS Identification
# $Id: Makefile.in,v 1.7 2002/02/27 16:36:40 fishwaldo Exp $
# $Id: Makefile.in,v 1.8 2002/03/05 06:59:06 fishwaldo Exp $
# makefile originally created by Andy Church.
CC=@CC@
CFLAGS=@CFLAGS@
LDFLAGS= -rdynamic -ldl
TEST = @IRCD_FILES@
OBJS = dotconf.o services.o main.o sock.o conf.o ircd.o timer.o users.o \
ns_help.o dl.o list.o hash.o server.o
ns_help.o dl.o list.o hash.o server.o @IRCD_FILES_OBJS@
SRCS = dotconf.c services.c main.c sock.c conf.c ircd.c timer.c users.c \
ns_help.c dl.c list.c hash.c server.c
ns_help.c dl.c list.c hash.c server.c @IRCD_FILES_SRC@
.c.o:
$(CC) $(CFLAGS) -c $<
@ -45,3 +44,5 @@ dl.o: dl.c stats.h config.h dl.h
list.o: list.c list.h
hash.o: hash.c hash.h
server.o: server.c stats.h hash.h hash.c config.h
Ultimate.o: Ultimate.c stats.h Ultimate.h
Unreal.o: Unreal.c stats.h Unreal.h

63
Ultimate.c Normal file
View file

@ -0,0 +1,63 @@
/* NeoStats - IRC Statistical Services Copyright (c) 1999-2001 NeoStats Group Inc.
** Adam Rutter, Justin Hammond & 'Niggles' http://www.neostats.net
*
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NeoStats Identification:
** ID: Ultimate.c,
** Version: 1.5
** Date: 17/11/2001
*/
#include "stats.h"
#include "Ultimate.h"
void sts(char *fmt,...)
{
va_list ap;
char buf[512];
int sent;
va_start (ap, fmt);
vsnprintf (buf, 512, fmt, ap);
#ifdef DEBUG
log("SENT: %s", buf);
#endif
strcat (buf, "\n");
sent = write (servsock, buf, strlen (buf));
if (sent == -1) {
log("Write error.");
exit(0);
}
me.SendM++;
me.SendBytes = me.SendBytes + sent;
va_end (ap);
}
void notice(char *who, char *buf,...)
{
va_list ap;
char tmp[512];
char out[512];
int sent;
va_start (ap, buf);
vsnprintf (tmp, 512, buf, ap);
if (me.onchan) {
sprintf(out,":%s PRIVMSG %s :%s",who, me.chan, tmp);
#ifdef DEBUG
log("SENT: %s", out);
#endif
strcat (out, "\n");
sent = write(servsock, out, strlen (out));
if (sent == -1) {
me.onchan = 0;
log("Write error.");
exit(0);
}
me.SendM++;
me.SendBytes = me.SendBytes + sent;
}
va_end (ap);
}

63
Unreal.c Normal file
View file

@ -0,0 +1,63 @@
/* NeoStats - IRC Statistical Services Copyright (c) 1999-2001 NeoStats Group Inc.
** Adam Rutter, Justin Hammond & 'Niggles' http://www.neostats.net
*
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NeoStats Identification:
** ID: Unreal.c,
** Version: 1.5
** Date: 17/11/2001
*/
#include "stats.h"
#include "Unreal.h"
void sts(char *fmt,...)
{
va_list ap;
char buf[512];
int sent;
va_start (ap, fmt);
vsnprintf (buf, 512, fmt, ap);
#ifdef DEBUG
log("SENT: %s", buf);
#endif
strcat (buf, "\n");
sent = write (servsock, buf, strlen (buf));
if (sent == -1) {
log("Write error.");
exit(0);
}
me.SendM++;
me.SendBytes = me.SendBytes + sent;
va_end (ap);
}
void notice(char *who, char *buf,...)
{
va_list ap;
char tmp[512];
char out[512];
int sent;
va_start (ap, buf);
vsnprintf (tmp, 512, buf, ap);
if (me.onchan) {
sprintf(out,":%s PRIVMSG %s :%s",who, me.chan, tmp);
#ifdef DEBUG
log("SENT: %s", out);
#endif
strcat (out, "\n");
sent = write(servsock, out, strlen (out));
if (sent == -1) {
me.onchan = 0;
log("Write error.");
exit(0);
}
me.SendM++;
me.SendBytes = me.SendBytes + sent;
}
va_end (ap);
}

View file

@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id: Unreal.h,v 1.4 2002/02/27 11:15:16 fishwaldo Exp $
* $Id: Unreal.h,v 1.5 2002/03/05 06:59:06 fishwaldo Exp $
*/
@ -29,9 +29,6 @@
/* Shamelessly Stolen from Unreal2.1.7 for Token Support! - Fish*/
/*
* The tokens are in the ascii character range of 33-127, and we start
* from 33 and just move up. It would be nice to match then up so they
@ -353,6 +350,12 @@ struct Oper_Modes {
};
/* function declarations */
extern void sts(char *, ...);
extern void notice(char *,char *, ...);

34
configure vendored
View file

@ -1578,7 +1578,8 @@ if test "${enable_unreal+set}" = set; then
#define UNREAL 1
EOF
IRCD_FILES="Unreal.c"
IRCD_FILES_SRC="Unreal.c"
IRCD_FILES_OBJS="Unreal.o"
echo "$ac_t""yes" 1>&6
;;
*)
@ -1591,7 +1592,7 @@ fi
echo $ac_n "checking Whether to Enable Ultimate IRCD Support...""... $ac_c" 1>&6
echo "configure:1595: checking Whether to Enable Ultimate IRCD Support..." >&5
echo "configure:1596: checking Whether to Enable Ultimate IRCD Support..." >&5
# Check whether --enable-ultimate or --disable-ultimate was given.
if test "${enable_ultimate+set}" = set; then
enableval="$enable_ultimate"
@ -1601,7 +1602,8 @@ if test "${enable_ultimate+set}" = set; then
#define ULTIMATE 1
EOF
IRCD_FILES="Ultimate.c"
IRCD_FILES_SRC="Ultimate.c"
IRCD_FILES_OBJS="Ultimate.o"
echo "$ac_t""yes" 1>&6
;;
*)
@ -1614,7 +1616,7 @@ else
fi
echo $ac_n "checking What type of Authentication to use...""... $ac_c" 1>&6
echo "configure:1618: checking What type of Authentication to use..." >&5
echo "configure:1620: checking What type of Authentication to use..." >&5
# Check whether --enable-auth or --disable-auth was given.
if test "${enable_auth+set}" = set; then
enableval="$enable_auth"
@ -1658,7 +1660,7 @@ fi
echo $ac_n "checking Whether to Enable StatServ Module?""... $ac_c" 1>&6
echo "configure:1662: checking Whether to Enable StatServ Module?" >&5
echo "configure:1664: checking Whether to Enable StatServ Module?" >&5
# Check whether --enable-statserv or --disable-statserv was given.
if test "${enable_statserv+set}" = set; then
enableval="$enable_statserv"
@ -1679,7 +1681,7 @@ fi
echo $ac_n "checking Whether to Enable Spam Module?""... $ac_c" 1>&6
echo "configure:1683: checking Whether to Enable Spam Module?" >&5
echo "configure:1685: checking Whether to Enable Spam Module?" >&5
# Check whether --enable-spam or --disable-spam was given.
if test "${enable_spam+set}" = set; then
enableval="$enable_spam"
@ -1700,7 +1702,7 @@ fi
echo $ac_n "checking Whether to Enable Icq Module?""... $ac_c" 1>&6
echo "configure:1704: checking Whether to Enable Icq Module?" >&5
echo "configure:1706: checking Whether to Enable Icq Module?" >&5
# Check whether --enable-icq or --disable-icq was given.
if test "${enable_icq+set}" = set; then
enableval="$enable_icq"
@ -1720,7 +1722,7 @@ fi
echo $ac_n "checking Whether to Enable Version Module?""... $ac_c" 1>&6
echo "configure:1724: checking Whether to Enable Version Module?" >&5
echo "configure:1726: checking Whether to Enable Version Module?" >&5
# Check whether --enable-version or --disable-version was given.
if test "${enable_version+set}" = set; then
enableval="$enable_version"
@ -1740,7 +1742,7 @@ fi
echo $ac_n "checking Whether to Enable Netinfo Module?""... $ac_c" 1>&6
echo "configure:1744: checking Whether to Enable Netinfo Module?" >&5
echo "configure:1746: checking Whether to Enable Netinfo Module?" >&5
# Check whether --enable-netinfo or --disable-netinfo was given.
if test "${enable_netinfo+set}" = set; then
enableval="$enable_netinfo"
@ -1760,7 +1762,7 @@ fi
echo $ac_n "checking Whether to Enable Services Module?""... $ac_c" 1>&6
echo "configure:1764: checking Whether to Enable Services Module?" >&5
echo "configure:1766: checking Whether to Enable Services Module?" >&5
# Check whether --enable-services or --disable-services was given.
if test "${enable_services+set}" = set; then
enableval="$enable_services"
@ -1780,7 +1782,7 @@ fi
echo $ac_n "checking Whether to Enable LoveServ Module?""... $ac_c" 1>&6
echo "configure:1784: checking Whether to Enable LoveServ Module?" >&5
echo "configure:1786: checking Whether to Enable LoveServ Module?" >&5
# Check whether --enable-loveserv or --disable-loveserv was given.
if test "${enable_loveserv+set}" = set; then
enableval="$enable_loveserv"
@ -1799,7 +1801,7 @@ else
fi
echo $ac_n "checking Any other modules to compile?""... $ac_c" 1>&6
echo "configure:1803: checking Any other modules to compile?" >&5
echo "configure:1805: checking Any other modules to compile?" >&5
# Check whether --enable-modules or --disable-modules was given.
if test "${enable_modules+set}" = set; then
enableval="$enable_modules"
@ -1813,15 +1815,16 @@ fi
echo $ac_n "checking Your Current Bank Balance""... $ac_c" 1>&6
echo "configure:1817: checking Your Current Bank Balance" >&5
echo "configure:1819: checking Your Current Bank Balance" >&5
echo "$ac_t""Thats Impressive!!!" 1>&6
echo $ac_n "checking The Modules that will be compiled""... $ac_c" 1>&6
echo "configure:1820: checking The Modules that will be compiled" >&5
echo "configure:1822: checking The Modules that will be compiled" >&5
echo "$ac_t""$MODULES" 1>&6
trap '' 1 2 15
cat > confcache <<\EOF
# This file is a shell script that caches the results of configure
@ -1956,7 +1959,8 @@ s%@infodir@%$infodir%g
s%@mandir@%$mandir%g
s%@CC@%$CC%g
s%@CPP@%$CPP%g
s%@IRCD_FILES@%$IRCD_FILES%g
s%@IRCD_FILES_SRC@%$IRCD_FILES_SRC%g
s%@IRCD_FILES_OBJS@%$IRCD_FILES_OBJS%g
s%@MODULES@%$MODULES%g
CEOF

View file

@ -55,7 +55,8 @@ AC_ARG_ENABLE(unreal, [ --enable-unreal - enable Unreal IRCD Support],
[ case "$enableval" in
yes)
AC_DEFINE(UNREAL)
IRCD_FILES="Unreal.c"
IRCD_FILES_SRC="Unreal.c"
IRCD_FILES_OBJS="Unreal.o"
AC_MSG_RESULT(yes)
;;
*)
@ -70,7 +71,8 @@ AC_ARG_ENABLE(ultimate, [ --enable-ultimate - enable Ultimate IRCD Support],
[ case "$enableval" in
yes)
AC_DEFINE(ULTIMATE)
IRCD_FILES="Ultimate.c"
IRCD_FILES_SRC="Ultimate.c"
IRCD_FILES_OBJS="Ultimate.o"
AC_MSG_RESULT(yes)
;;
*)
@ -225,7 +227,8 @@ AC_MSG_CHECKING(The Modules that will be compiled)
AC_MSG_RESULT($MODULES)
AC_SUBST(IRCD_FILES)
AC_SUBST(IRCD_FILES_SRC)
AC_SUBST(IRCD_FILES_OBJS)
AC_SUBST(MODULES)
AC_OUTPUT(dl/statserv/Makefile dl/services/Makefile dl/icq/Makefile dl/version/Makefile dl/Makefile dl/spam/Makefile dl/netinfo/Makefile Makefile dl/services/Makefile dl/loveserv/Makefile)
echo "(*----------------------------------------------------------*)"

1
ircd.c
View file

@ -823,3 +823,4 @@ static void Showcredits(char *nick)
sts(":%s 351 %s :- HeadBang for BetaTesting, and Ideas, And Hassling us for Beta Copies",me.name,nick);
sts(":%s 351 %s :- sre and Jacob for development systems and access",me.name, nick);
}

50
sock.c
View file

@ -5,7 +5,7 @@
** Based from GeoStats 1.1.0 by Johnathan George net@lite.net
*
** NetStats CVS Identification
** $Id: sock.c,v 1.11 2002/02/28 10:33:10 fishwaldo Exp $
** $Id: sock.c,v 1.12 2002/03/05 06:59:06 fishwaldo Exp $
*/
#include "stats.h"
@ -100,55 +100,7 @@ void read_loop()
}
log("hu, how did we get here");
}
void notice(char *who, char *buf,...)
{
va_list ap;
char tmp[512];
char out[512];
int sent;
va_start (ap, buf);
vsnprintf (tmp, 512, buf, ap);
if (me.onchan) {
sprintf(out,":%s PRIVMSG %s :%s",who, me.chan, tmp);
#ifdef DEBUG
log("SENT: %s", out);
#endif
strcat (out, "\n");
sent = write(servsock, out, strlen (out));
if (sent == -1) {
me.onchan = 0;
log("Write error.");
exit(0);
}
me.SendM++;
me.SendBytes = me.SendBytes + sent;
}
va_end (ap);
}
void sts(char *fmt,...)
{
va_list ap;
char buf[512];
int sent;
va_start (ap, fmt);
vsnprintf (buf, 512, fmt, ap);
#ifdef DEBUG
log("SENT: %s", buf);
#endif
strcat (buf, "\n");
sent = write (servsock, buf, strlen (buf));
if (sent == -1) {
log("Write error.");
exit(0);
}
me.SendM++;
me.SendBytes = me.SendBytes + sent;
va_end (ap);
}
void log(char *fmt, ...)
{

View file

@ -184,7 +184,7 @@ extern void log(char *, ...);
extern void ResetLogs();
extern char *sctime(time_t);
extern char *sftime(time_t);
extern void notice(char *,char *, ...);
/* conf.c */