lots of updates. Bahamut implemented. BugFixes

This commit is contained in:
fishwaldo 2003-07-23 10:35:47 +00:00
parent 639de9b543
commit d80b180c09
13 changed files with 143 additions and 34 deletions

View file

@ -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;

View file

@ -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_ {

View file

@ -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

View file

@ -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;

View file

@ -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;

View file

@ -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_ {

68
chans.c
View file

@ -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 <fnmatch.h>
@ -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);

View file

@ -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

View file

@ -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 <stdio.h>
@ -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

View file

@ -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_ {

View file

@ -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;

View file

@ -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_ {

View file

@ -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,