From d80b180c0987c2afe9261b8414835175aacdb13d Mon Sep 17 00:00:00 2001 From: fishwaldo <> Date: Wed, 23 Jul 2003 10:35:47 +0000 Subject: [PATCH] lots of updates. Bahamut implemented. BugFixes --- Bahamut.c | 41 +++++++++++++++++-------- Bahamut.h | 3 +- ChangeLog | 2 ++ QuantumIRCd.h | 7 +++-- Ultimate.h | 8 +++-- Unreal.h | 5 +++- chans.c | 68 ++++++++++++++++++++++++++++++++++++++---- dl/cs/cs.h | 17 ++++++++++- dl/hostserv/hostserv.c | 6 ++-- hybrid7.h | 3 +- mystic.h | 6 ++-- neoircd.h | 5 +++- stats.h | 6 ++-- 13 files changed, 143 insertions(+), 34 deletions(-) diff --git a/Bahamut.c b/Bahamut.c index 484db285..20cad1a0 100644 --- a/Bahamut.c +++ b/Bahamut.c @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: Bahamut.c,v 1.2 2003/07/22 15:01:49 fishwaldo Exp $ +** $Id: Bahamut.c,v 1.3 2003/07/23 10:35:47 fishwaldo Exp $ */ #include "stats.h" @@ -222,6 +222,9 @@ Oper_Modes usr_mds[] = { , {UMODE_SERVADMIN, 'A', 100} , + /* this is needed for bot support */ + {UMODE_SERVICES, 'S', 200} + , {0, 0, 0} }; @@ -242,7 +245,7 @@ int slogin_cmd(const char *name, const int numeric, const char *infoline, const char *pass) { sts("%s %s :TS", (me.token ? TOK_PASS : MSG_PASS), pass); - sts("CAPAB TS5 BURST NICKIP CLIENT"); + sts("CAPAB TS5 SSJOIN BURST NICKIP CLIENT"); sts("%s %s %d :%s", (me.token ? TOK_SERVER : MSG_SERVER), name, numeric, infoline); return 1; @@ -279,11 +282,20 @@ int sjoin_cmd(const char *who, const char *chan, unsigned long chflag) char mode[2]; char **av; int ac; + time_t tstime; char tmp[512]; + Chans *c; + + c = findchan((char *)chan); + if (!c) { + tstime = time(NULL); + } else { + tstime = c->tstime; + } switch (chflag) { case MODE_CHANOP: flag = '@'; - strcpy(mode, "0"); + strcpy(mode, "o"); break; case MODE_VOICE: flag = '+'; @@ -293,7 +305,7 @@ int sjoin_cmd(const char *who, const char *chan, unsigned long chflag) flag = ' '; strcpy(mode, ""); } - sts(":%s %s 0 %s + :%c%s", me.name, MSG_SJOIN, chan, flag, who); + sts(":%s %s %d %s + :%c%s", me.name, MSG_SJOIN, tstime, chan, flag, who); join_chan(finduser(who), (char *) chan); snprintf(tmp, 512, "%s +%s %s", chan, mode, who); ac = split_buf(tmp, &av, 0); @@ -661,23 +673,22 @@ void Srv_Sjoin(char *origin, char **argv, int argc) long mode = 0; long mode1 = 0; char *modes; - int ok = 1, i, j = 4; + int ok = 1, i, j = 3; ModesParm *m; Chans *c; lnode_t *mn = NULL; list_t *tl; - if (argc <= 2) { + if (argc > 4) { modes = argv[2]; } else { - modes = argv[3]; + modes = argv[1]; } -#if 0 printf("%s %s\n", argv[2], argv[1]); if (*modes == '#') { join_chan(finduser(origin), modes); return; } -#endif +printf("%s\n", modes); tl = list_create(10); if (*modes != '+') { goto nomodes; @@ -732,13 +743,15 @@ printf("%s %s\n", argv[2], argv[1]); } } } - join_chan(finduser(nick), argv[2]); - ChangeChanUserMode(findchan(argv[2]), finduser(nick), 1, + join_chan(finduser(nick), argv[1]); + ChangeChanUserMode(findchan(argv[1]), finduser(nick), 1, mode); j++; ok = 1; } - c = findchan(argv[2]); + c = findchan(argv[1]); + /* update the TS time */ + Change_Chan_Ts(c, atoi(argv[0])); c->modes |= mode1; if (!list_isempty(tl)) { if (!list_isfull(c->modeparms)) { @@ -1005,7 +1018,9 @@ int SignOn_NewBot(const char *nick, const char *user, snewnick_cmd(nick, user, host, rname, Umode); if ((me.allbots > 0) || (Umode & UMODE_SERVICES)) { sjoin_cmd(nick, me.chan, MODE_CHANOP); - schmode_cmd(nick, me.chan, "+a", nick); +#if 0 + schmode_cmd(nick, me.chan, "+o", nick); +#endif /* all bots join */ } return 1; diff --git a/Bahamut.h b/Bahamut.h index 4b82ab5f..a8826abc 100644 --- a/Bahamut.h +++ b/Bahamut.h @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: Bahamut.h,v 1.2 2003/07/22 15:01:49 fishwaldo Exp $ +** $Id: Bahamut.h,v 1.3 2003/07/23 10:35:47 fishwaldo Exp $ */ #ifndef BAHAMUT_H #define BAHAMUT_H @@ -372,6 +372,7 @@ #define is_hidden_chan(x) ((x) && (x->modes & (MODE_PRIVATE|MODE_SECRET|MODE_OPERONLY))) #define is_oper(x) ((x) && ((x->Umode & UMODE_OPER) || (x->Umode & UMODE_LOCOP))) +#define is_pub_chan(x) ((x) && (CheckChanMode(x, MODE_PRIVATE) || CheckChanMode(x, MODE_SECRET) || CheckChanMode(x, MODE_RGSTRONLY) || CheckChanMode(x, MODE_OPERONLY) || CheckChanMode(x, MODE_INVITEONLY) || CheckChanMode(x, MODE_KEY))) struct ircd_srv_ { diff --git a/ChangeLog b/ChangeLog index fbfe47c2..1d4075f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,8 @@ NeoStats ChangeLog - Anything we add/remove/fix/change is in here (even our rants) * NeoStats * Fish * Version 2.5.4 - Fixed a core with using strcasecmp instead of strcmp in the parse function. + - Moved is_pub_chan from SecureServ to NeoStats + - Implemented Bahamut support and necessary functions * NeoStats * Fish * Version 2.5.4 Pre2 - Fixed a problem with statserv and the HTML settings diff --git a/QuantumIRCd.h b/QuantumIRCd.h index e996efe3..63d3cd27 100644 --- a/QuantumIRCd.h +++ b/QuantumIRCd.h @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: QuantumIRCd.h,v 1.2 2003/07/15 11:21:45 fishwaldo Exp $ +** $Id: QuantumIRCd.h,v 1.3 2003/07/23 10:35:47 fishwaldo Exp $ */ #ifndef QUANTUM_H #define QUANTUM_H @@ -28,6 +28,9 @@ /* we support tokens */ #define HAVE_TOKEN_SUP +/* we have vhost support */ +#define GOTSVSVHOST + #define MSG_PRIVATE "PRIVMSG" /* PRIV */ #define TOK_PRIVATE "!" /* 33 */ @@ -392,7 +395,7 @@ #define is_hidden_chan(x) ((x) && (x->modes & (MODE_PRIVATE|MODE_SECRET|MODE_ADMONLY|MODE_OPERONLY))) #define is_oper(x) ((x) && ((x->Umode & UMODE_OPER) || (x->Umode & UMODE_LOCOP))) - +#define is_pub_chan(x) ((x) && (CheckChanMode(x, MODE_PRIVATE) || CheckChanMode(x, MODE_SECRET) || CheckChanMode(x, MODE_ADMONLY) || CheckChanMode(x, MODE_OPERONLY) || CheckChanMode(x, MODE_KEY))) struct ircd_srv_ { int uprot; diff --git a/Ultimate.h b/Ultimate.h index 6353ddbe..7e5cb3bc 100644 --- a/Ultimate.h +++ b/Ultimate.h @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: Ultimate.h,v 1.23 2003/06/30 14:56:25 fishwaldo Exp $ +** $Id: Ultimate.h,v 1.24 2003/07/23 10:35:47 fishwaldo Exp $ */ #ifndef ULTIMATE_H #define ULTIMATE_H @@ -28,6 +28,10 @@ /* we support tokens */ #define HAVE_TOKEN_SUP +/* we have vhost support */ +#define GOTSVSVHOST + + #define MSG_PRIVATE "PRIVMSG" /* PRIV */ #define TOK_PRIVATE "!" /* 33 */ @@ -404,7 +408,7 @@ #define is_hidden_chan(x) ((x) && (x->modes & (MODE_PRIVATE|MODE_SECRET|MODE_ADMONLY|MODE_OPERONLY))) #define is_oper(x) ((x) && ((x->Umode & UMODE_OPER) || (x->Umode & UMODE_LOCOP))) - +#define is_pub_chan(x) ((x) && (CheckChanMode(x, MODE_PRIVATE) || CheckChanMode(x, MODE_SECRET) || CheckChanMode(x, MODE_KEY) || CheckChanMode(x, MODE_RGSTRONLY) || CheckChanMode(x, MODE_INVITEONLY) || CheckChanMode(x, MODE_ADMONLY) || CheckChanMode(x, MODE_OPERONLY) )) struct ircd_srv_ { int uprot; diff --git a/Unreal.h b/Unreal.h index 15f752db..4f33ecfc 100644 --- a/Unreal.h +++ b/Unreal.h @@ -44,7 +44,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.31 2003/06/30 14:56:25 fishwaldo Exp $ + * $Id: Unreal.h,v 1.32 2003/07/23 10:35:47 fishwaldo Exp $ */ @@ -57,6 +57,8 @@ /* we have token support */ #define HAVE_TOKEN_SUP 1 +/* we have vhost support */ +#define GOTSVSVHOST /* @@ -414,6 +416,7 @@ #define is_hidden_chan(x) ((x) && (x->modes & (MODE_PRIVATE|MODE_SECRET|MODE_ADMONLY|MODE_OPERONLY))) #define is_oper(x) ((x) && ((x->Umode & UMODE_OPER) || (x->Umode & UMODE_LOCOP))) +#define is_pub_chan(x) ((x) && (CheckChanMode(x, MODE_PRIVATE) || CheckChanMode(x, MODE_SECRET) || CheckChanMode(x, MODE_ADMONLY) || CheckChanMode(x, MODE_OPERONLY) || CheckChanMode(x, MODE_KEY) || CheckChanMode(x, MODE_INVITEONLY) || CheckChanMode(x, MODE_RGSTRONLY))) struct ircd_srv_ { diff --git a/chans.c b/chans.c index 3e7123ec..2d608d81 100644 --- a/chans.c +++ b/chans.c @@ -19,7 +19,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: chans.c,v 1.46 2003/07/08 05:35:37 fishwaldo Exp $ +** $Id: chans.c,v 1.47 2003/07/23 10:35:47 fishwaldo Exp $ */ #include @@ -42,6 +42,25 @@ void init_chan_hash() ch = hash_create(C_TABLE_SIZE, 0, 0); } +/** @brief Process the Channel TS Time + * + * Addes the channel TS time to the channel struct + * + * @param c Channel Struct of channel who's ts is being changed + * @param tstime ts time of the channel + * + * @returns Nothing + * + */ +void Change_Chan_Ts(Chans *c, time_t tstime) { + if (!c) { + nlog(LOG_WARNING, LOG_CORE, "Warning, Called Change_Change_Ts with null channel"); + return; + } + c->tstime = tstime; +} + + /** @brief Process a Topic Change * @@ -71,6 +90,41 @@ extern void Change_Topic(char *owner, Chans * c, time_t time, char *topic) // FreeList(av, ac); } +/** @brief Check if a mode is set on a Channel + * + * used to check if a mode is set on a channel + * + * @param c channel to check + * @param mode is the mode to check, as a LONG + * + * @returns 1 on match, 0 on no match, -1 on error + * +*/ +extern int CheckChanMode(Chans *c, long mode) { + ModesParm *m; + lnode_t *mn; + if (!c) { + nlog(LOG_WARNING, LOG_CORE, "Warning, CheckChanMode Called with empty channel"); + return -1; + } + if (c->modes & mode) { + /* its a match */ + return 1; + } + /* if we get here, we have to check the modeparm list first */ + mn = list_first(c->modeparms); + while (mn) { + m = lnode_get(mn); + if (m->mode & mode) { + /* its a match */ + return 1; + } + mn = list_next(c->modeparms, mn); + } + return 0; +} + + /** @brief Compare channel modes from the channel hash * * used in ChanMode to compare modes (list_find argument) @@ -239,6 +293,7 @@ int ChanMode(char *origin, char **av, int ac) lnode_destroy (mn); free(m); + if (!(cFlagTab[i].mode == MODE_LIMIT || cFlagTab[i].mode == MODE_KEY)) j++; } @@ -656,6 +711,7 @@ void join_chan(User * u, char *chan) c->cur_users = 0; c->topictime = 0; c->modes = 0; + c->tstime = 0; AddStringToList(&av, c->name, &ac); Module_Event("NEWCHAN", av, ac); free(av); @@ -755,12 +811,13 @@ void chandump(char *chan) } } sendcoders - ("Channel: %s Members: %d (List %d) Flags %s", + ("Channel: %s Members: %d (List %d) Flags %s tstime %d", c->name, c->cur_users, - list_count(c->chanmembers), mode); + list_count(c->chanmembers), mode, c->tstime); sendcoders (" Topic Owner %s, TopicTime: %d, Topic %s", c->topicowner, c->topictime, c->topic); + sendcoders("PubChan?: %d", is_pub_chan(c)); cmn = list_first(c->modeparms); while (cmn) { m = lnode_get(cmn); @@ -815,12 +872,13 @@ void chandump(char *chan) } } sendcoders - ("Channel: %s Members: %d (List %d) Flags %s", + ("Channel: %s Members: %d (List %d) Flags %s tstime %d", c->name, c->cur_users, - list_count(c->chanmembers), mode); + list_count(c->chanmembers), mode, c->tstime); sendcoders (" Topic Owner %s, TopicTime: %d Topic %s", c->topicowner, c->topictime, c->topic); + sendcoders("PubChan?: %d", is_pub_chan(c)); cmn = list_first(c->modeparms); while (cmn) { m = lnode_get(cmn); diff --git a/dl/cs/cs.h b/dl/cs/cs.h index c35dec21..842add90 100644 --- a/dl/cs/cs.h +++ b/dl/cs/cs.h @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: cs.h,v 1.9 2003/05/26 09:18:29 fishwaldo Exp $ +** $Id: cs.h,v 1.10 2003/07/23 10:35:47 fishwaldo Exp $ */ @@ -103,3 +103,18 @@ #define INVISIBLE_MODE '3' #define BOT_MODE '2' #endif + +#ifdef BAHAMUT + #define LOCOP_MODE 'O' + #define OPER_MODE 'o' + #define GUESTADMIN_MODE '1' /* Set to a number we dont use */ + #define COSERVERADMIN_MODE '2' + #define SERVERADMIN_MODE 'a' + #define CONETADMIN_MODE '3' /* Set to a number we dont use */ + #define NETADMIN_MODE '4' + #define TECHADMIN_MODE '5' + #define SERVICESADMIN_MODE '6' + #define NETSERVICE_MODE '7' + #define INVISIBLE_MODE '8' + #define BOT_MODE '9' +#endif \ No newline at end of file diff --git a/dl/hostserv/hostserv.c b/dl/hostserv/hostserv.c index 7ea510ee..de568640 100644 --- a/dl/hostserv/hostserv.c +++ b/dl/hostserv/hostserv.c @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: hostserv.c,v 1.46 2003/07/01 14:06:01 fishwaldo Exp $ +** $Id: hostserv.c,v 1.47 2003/07/23 10:35:47 fishwaldo Exp $ */ #include @@ -35,8 +35,8 @@ /* hostserv doesn't work on Hybrid, Echo a error and exit the compile */ -#ifdef HYBRID7 -#error "Error: Hybrid7 doesn't support changing a users host. This module will not compile" +#ifndef GOTSVSVHOST +#error "Error: This IRCd doesn't support changing a users host. This module will not compile" #endif diff --git a/hybrid7.h b/hybrid7.h index 9f43c9c4..f2f7bc8b 100644 --- a/hybrid7.h +++ b/hybrid7.h @@ -18,7 +18,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: hybrid7.h,v 1.11 2003/06/30 14:56:25 fishwaldo Exp $ +** $Id: hybrid7.h,v 1.12 2003/07/23 10:35:47 fishwaldo Exp $ */ @@ -219,6 +219,7 @@ #define is_hidden_chan(x) ((x) && (x->modes & MODE_SECRET)) #define is_oper(x) ((x) && (x->Umode & UMODE_OPER)) +#define is_pub_chan(x) ((x) && (CheckChanMode(x, MODE_PRIVATE) || CheckChanMode(x, MODE_SECRET) || CheckChanMode(x, MODE_KEY) || CheckChanMode(x, MODE_INVITEONLY))) struct ircd_srv_ { diff --git a/mystic.h b/mystic.h index b84be073..6b842a12 100644 --- a/mystic.h +++ b/mystic.h @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: mystic.h,v 1.3 2003/07/02 09:48:55 fishwaldo Exp $ +** $Id: mystic.h,v 1.4 2003/07/23 10:35:47 fishwaldo Exp $ */ #ifndef MYSTIC_H #define MYSTIC_H @@ -28,6 +28,8 @@ /* we support tokens */ #define HAVE_TOKEN_SUP +/* we have vhost support */ +#define GOTSVSVHOST #define MSG_PRIVATE "PRIVMSG" /* PRIV */ #define TOK_PRIVATE "!" /* 33 */ @@ -378,7 +380,7 @@ #define is_hidden_chan(x) ((x) && (x->modes & (MODE_PRIVATE|MODE_SECRET|MODE_ADMONLY|MODE_OPERONLY))) #define is_oper(x) ((x) && ((x->Umode & UMODE_OPER) || (x->Umode & UMODE_LOCOP))) - +#define is_pub_chan(x) ((x) && (CheckChanMode(x, MODE_PRIVATE) || CheckChanMode(x, MODE_SECRET) || CheckChanMode(x, MODE_ADMONLY) || CheckChanMode(x, MODE_OPERONLY) || CheckChanMode(x, MODE_KEY) || CheckChanMode(x, MODE_RGSTRONLY) || CheckChanMode(x, MODE_INVITEONLY))) struct ircd_srv_ { int uprot; diff --git a/neoircd.h b/neoircd.h index d872defa..77b1e27e 100644 --- a/neoircd.h +++ b/neoircd.h @@ -18,13 +18,15 @@ ** USA ** ** NeoStats CVS Identification -** $Id: neoircd.h,v 1.8 2003/06/30 14:56:26 fishwaldo Exp $ +** $Id: neoircd.h,v 1.9 2003/07/23 10:35:47 fishwaldo Exp $ */ #ifndef HYBRID7_H #define HYBRID7_H +/* we have vhost support */ +#define GOTSVSVHOST @@ -223,6 +225,7 @@ #define is_hidden_chan(x) ((x) && (x->modes & MODE_SECRET)) #define is_oper(x) ((x) && (x->Umode & UMODE_OPER)) +#define is_pub_chan(x) ((x) && (CheckChanMode(x, MODE_PRIVATE) || CheckChanMode(x, MODE_SECRET) || CheckChanMode(x, MODE_KEY) || CheckChanMode(x, MODE_INVITEONLY) || CheckChanMode(x, MODE_OPERSONLY))) struct ircd_srv_ { diff --git a/stats.h b/stats.h index 396eecd5..76586c48 100644 --- a/stats.h +++ b/stats.h @@ -20,7 +20,7 @@ ** USA ** ** NeoStats CVS Identification -** $Id: stats.h,v 1.87 2003/07/15 11:21:45 fishwaldo Exp $ +** $Id: stats.h,v 1.88 2003/07/23 10:35:47 fishwaldo Exp $ */ #ifndef STATS_H @@ -231,6 +231,7 @@ struct chans_ { char topicowner[MAXHOST]; /* becuase a "server" can be a topic owner */ time_t topictime; void *moddata[NUM_MODULES]; + time_t tstime; } chans_; struct chanmem_ { @@ -375,7 +376,8 @@ extern int ChanMode(char *origin, char **av, int ac); extern void Change_Topic(char *, Chans *, time_t t, char *); extern void ChangeChanUserMode(Chans * c, User * u, int add, long mode); void kick_chan(User *, char *, User *); - +void Change_Chan_Ts(Chans *c, time_t tstime); +extern int CheckChanMode(Chans *c, long mode); /* dns.c */ extern int dns_lookup(char *str, adns_rrtype type,