And more type changes to make things consistent and more readable.

This commit is contained in:
Bram Matthys 2019-09-11 11:04:31 +02:00
parent 2a5ea10453
commit e8d53ffe8e
No known key found for this signature in database
GPG key ID: BF8116B163EAAE98
43 changed files with 372 additions and 388 deletions

View file

@ -595,7 +595,7 @@ extern void add_user_to_channel(Channel *chptr, Client *who, int flags);
extern int add_banid(Client *, Channel *, char *);
extern int add_exbanid(Client *cptr, Channel *chptr, char *banid);
extern int sub1_from_channel(Channel *);
extern MODVAR aCtab cFlagTab[];
extern MODVAR CoreChannelModeTable corechannelmodetable[];
extern char *unreal_encodespace(char *s);
extern char *unreal_decodespace(char *s);
extern MODVAR Link *helpign;
@ -751,7 +751,7 @@ extern Client *find_non_pending_net_duplicates(Client *cptr);
extern PendingNet *find_pending_net_by_sid_butone(char *sid, Client *exempt);
extern Client *find_pending_net_duplicates(Client *cptr, Client **srv, char **sid);
extern MODVAR char serveropts[];
extern MODVAR char *IsupportStrings[];
extern MODVAR char *ISupportStrings[];
extern void finish_auth(Client *acptr);
extern void read_packet(int fd, int revents, void *data);
extern int process_packet(Client *cptr, char *readbuf, int length, int killsafely);

View file

@ -519,12 +519,13 @@ struct Hooktype {
ModuleChild *parents;
};
typedef struct ISupport {
struct ISupport *prev, *next;
typedef struct ISupport ISupport;
struct ISupport {
ISupport *prev, *next;
char *token;
char *value;
Module *owner;
} Isupport;
};
typedef struct ModuleObject {
struct ModuleObject *prev, *next;
@ -541,7 +542,7 @@ typedef struct ModuleObject {
Extban *extban;
Callback *callback;
Efunction *efunction;
Isupport *isupport;
ISupport *isupport;
Cmode *cmode;
ModDataInfo *moddata;
OperClassValidator *validator;
@ -661,13 +662,13 @@ extern const char *our_dlerror(void);
extern Versionflag *VersionflagAdd(Module *module, char flag);
extern void VersionflagDel(Versionflag *vflag, Module *module);
extern Isupport *IsupportAdd(Module *module, const char *token, const char *value);
extern void IsupportSetValue(Isupport *isupport, const char *value);
extern void IsupportDel(Isupport *isupport);
extern Isupport *IsupportFind(const char *token);
extern void IsupportSet(Module *module, const char *name, const char *value);
extern void IsupportSetFmt(Module *module, const char *name, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,3,4)));
extern void IsupportDelByName(const char *name);
extern ISupport *ISupportAdd(Module *module, const char *token, const char *value);
extern void ISupportSetValue(ISupport *isupport, const char *value);
extern void ISupportDel(ISupport *isupport);
extern ISupport *ISupportFind(const char *token);
extern void ISupportSet(Module *module, const char *name, const char *value);
extern void ISupportSetFmt(Module *module, const char *name, FORMAT_STRING(const char *pattern), ...) __attribute__((format(printf,3,4)));
extern void ISupportDelByName(const char *name);
extern ClientCapability *ClientCapabilityFind(const char *token, Client *sptr);
extern ClientCapability *ClientCapabilityFindReal(const char *token);

View file

@ -514,8 +514,8 @@ typedef OperPermission (*OperClassEntryEvalCallback)(OperClassACLEntryVar* varia
#define ID(sptr) (*sptr->id ? sptr->id : sptr->name)
/** Union for moddata objects */
typedef union _moddata ModData;
union _moddata
typedef union ModData ModData;
union ModData
{
int i;
long l;
@ -840,7 +840,8 @@ struct SpamExcept {
};
/** IRC Statistics, used for /LUSERS */
typedef struct ircstatsx {
typedef struct IRCStatistics IRCStatistics;
struct IRCStatistics {
int clients; /* total */
int invisible; /* invisible */
unsigned short servers; /* servers */
@ -851,10 +852,10 @@ typedef struct ircstatsx {
unsigned short me_servers; /* my servers */
int me_max; /* local max */
int global_max; /* global max */
} ircstats;
};
/** The /LUSERS stats information */
extern MODVAR ircstats IRCstats;
extern MODVAR IRCStatistics ircstats;
typedef int (*CmdFunc)(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[]);
typedef int (*AliasCmdFunc)(Client *cptr, Client *sptr, MessageTag *mtags, int parc, char *parv[], char *cmd);
@ -1551,7 +1552,6 @@ struct Link {
Channel *chptr;
ListStruct *aconf;
Watch *wptr;
aName *whowas;
char *cp;
struct {
char *banstr;
@ -1872,12 +1872,13 @@ struct ThrottlingBucket
char count;
};
typedef struct {
long mode;
char flag;
unsigned halfop : 1; /* 1 = yes 0 = no */
unsigned parameters : 1;
} aCtab;
typedef struct CoreChannelModeTable CoreChannelModeTable;
struct CoreChannelModeTable {
long mode; /**< Mode value (which bit will be set) */
char flag; /**< Mode letter (eg: 't') */
unsigned halfop : 1; /**< May halfop set this mode? 1/0 */
unsigned parameters : 1; /**< Mode requires a parameter? 1/0 */
};
/** Parse channel mode */
typedef struct ParseMode ParseMode;
@ -1917,7 +1918,7 @@ struct MaxTarget {
};
#define MAXTARGETS_MAX 1000000 /* used for 'max' */
#define VERIFY_OPERCOUNT(clnt,tag) { if (IRCstats.operators < 0) verify_opercount(clnt,tag); } while(0)
#define VERIFY_OPERCOUNT(clnt,tag) { if (ircstats.operators < 0) verify_opercount(clnt,tag); } while(0)
#define MARK_AS_OFFICIAL_MODULE(modinf) do { if (modinf && modinf->handle) ModuleSetOptions(modinfo->handle, MOD_OPT_OFFICIAL, 1); } while(0)

View file

@ -35,19 +35,6 @@
#ifndef __whowas_include__
#define __whowas_include__
/*
** WHOWAS structure moved here from whowas.c
*/
typedef struct aname {
ClientUser *ww_user;
Client *ww_online;
time_t ww_logout;
long ww_umodes;
char ww_nick[NICKLEN + 1];
char ww_info[REALLEN + 1];
} aName;
/*
** add_history
** Add the currently defined name of the client to history.

View file

@ -19,8 +19,6 @@
#include "unrealircd.h"
extern ircstats IRCstats;
/* Function to return a group of tokens -- codemastr */
void strrangetok(char *in, char *out, char tok, short first, short last) {
int i = 0, tokcount = 0, j = 0;

View file

@ -73,7 +73,7 @@ static char previous_chanmodes[256];
void extcmodes_check_for_changes(void)
{
char chanmodes[256];
Isupport *isup;
ISupport *isup;
make_cmodestr();
make_extcmodestr();
@ -93,14 +93,14 @@ void extcmodes_check_for_changes(void)
me.serv->features.chanmodes[2],
me.serv->features.chanmodes[3]);
isup = IsupportFind("CHANMODES");
isup = ISupportFind("CHANMODES");
if (!isup)
{
strlcpy(previous_chanmodes, chanmodes, sizeof(previous_chanmodes));
return; /* not booted yet. then we are done here. */
}
IsupportSetValue(isup, chanmodes);
ISupportSetValue(isup, chanmodes);
if (*previous_chanmodes && strcmp(chanmodes, previous_chanmodes))
{

View file

@ -37,7 +37,7 @@ void set_isupport_extban(void)
*m++ = ExtBan_Table[i].flag;
}
*m = 0;
IsupportSetFmt(NULL, "EXTBAN", "~,%s", extbanstr);
ISupportSetFmt(NULL, "EXTBAN", "~,%s", extbanstr);
}
Extban *findmod_by_bantype(char c)

View file

@ -22,12 +22,12 @@
#include "unrealircd.h"
Isupport *Isupports; /* List of ISUPPORT (005) tokens */
ISupport *ISupports; /* List of ISUPPORT (005) tokens */
#define MAXISUPPORTLINES 10
MODVAR char *IsupportStrings[MAXISUPPORTLINES+1];
MODVAR char *ISupportStrings[MAXISUPPORTLINES+1];
void isupport_add_sorted(Isupport *is);
void isupport_add_sorted(ISupport *is);
void make_isupportstrings(void);
/** Easier way to set a 005 name or name=value.
@ -37,12 +37,12 @@ void make_isupportstrings(void);
* The 'value' may be NULL, in which case if there was a value
* it will be unset.
*/
void IsupportSet(Module *module, const char *name, const char *value)
void ISupportSet(Module *module, const char *name, const char *value)
{
Isupport *is = IsupportFind(name);
ISupport *is = ISupportFind(name);
if (!is)
is = IsupportAdd(module, name, value);
IsupportSetValue(is, value);
is = ISupportAdd(module, name, value);
ISupportSetValue(is, value);
}
/** Easy way to set a 005 name=value with printf style formatting.
@ -53,7 +53,7 @@ void IsupportSet(Module *module, const char *name, const char *value)
* The 'pattern' may be NULL, in which case if there was a value
* it will be unset.
*/
void IsupportSetFmt(Module *module, const char *name, const char *pattern, ...)
void ISupportSetFmt(Module *module, const char *name, const char *pattern, ...)
{
const char *value = NULL;
char buf[256];
@ -66,14 +66,14 @@ void IsupportSetFmt(Module *module, const char *name, const char *pattern, ...)
va_end(vl);
value = buf;
}
IsupportSet(module, name, value);
ISupportSet(module, name, value);
}
void IsupportDelByName(const char *name)
void ISupportDelByName(const char *name)
{
Isupport *is = IsupportFind(name);
ISupport *is = ISupportFind(name);
if (is)
IsupportDel(is);
ISupportDel(is);
}
extern void set_isupport_extban(void);
@ -84,48 +84,48 @@ extern void set_isupport_targmax(void);
*/
void isupport_init(void)
{
IsupportSet(NULL, "INVEX", NULL);
IsupportSet(NULL, "EXCEPTS", NULL);
ISupportSet(NULL, "INVEX", NULL);
ISupportSet(NULL, "EXCEPTS", NULL);
#ifdef PREFIX_AQ
IsupportSet(NULL, "STATUSMSG", "~&@%+");
ISupportSet(NULL, "STATUSMSG", "~&@%+");
#else
IsupportSet(NULL, "STATUSMSG", "@%+");
ISupportSet(NULL, "STATUSMSG", "@%+");
#endif
IsupportSet(NULL, "ELIST", "MNUCT");
IsupportSet(NULL, "CASEMAPPING", "ascii");
IsupportSet(NULL, "NETWORK", ircnet005);
IsupportSetFmt(NULL, "CHANMODES",
ISupportSet(NULL, "ELIST", "MNUCT");
ISupportSet(NULL, "CASEMAPPING", "ascii");
ISupportSet(NULL, "NETWORK", ircnet005);
ISupportSetFmt(NULL, "CHANMODES",
CHPAR1 "%s," CHPAR2 "%s," CHPAR3 "%s," CHPAR4 "%s",
EXPAR1, EXPAR2, EXPAR3, EXPAR4);
IsupportSet(NULL, "PREFIX", CHPFIX);
IsupportSet(NULL, "CHANTYPES", "#");
IsupportSetFmt(NULL, "MODES", "%d", MAXMODEPARAMS);
IsupportSetFmt(NULL, "SILENCE", "%d", SILENCE_LIMIT);
ISupportSet(NULL, "PREFIX", CHPFIX);
ISupportSet(NULL, "CHANTYPES", "#");
ISupportSetFmt(NULL, "MODES", "%d", MAXMODEPARAMS);
ISupportSetFmt(NULL, "SILENCE", "%d", SILENCE_LIMIT);
if (WATCH_AWAY_NOTIFICATION)
IsupportSet(NULL, "WATCHOPTS", "A");
ISupportSet(NULL, "WATCHOPTS", "A");
else
IsupportDelByName("WATCHOPTS");
IsupportSetFmt(NULL, "WATCH", "%d", MAXWATCH);
IsupportSet(NULL, "WALLCHOPS", NULL);
IsupportSetFmt(NULL, "AWAYLEN", "%d", iConf.away_length);
IsupportSetFmt(NULL, "KICKLEN", "%d", iConf.kick_length);
IsupportSetFmt(NULL, "TOPICLEN", "%d", iConf.topic_length);
IsupportSetFmt(NULL, "QUITLEN", "%d", iConf.quit_length);
IsupportSetFmt(NULL, "CHANNELLEN", "%d", CHANNELLEN);
IsupportSetFmt(NULL, "MINNICKLEN", "%d", iConf.min_nick_length);
IsupportSetFmt(NULL, "NICKLEN", "%d", iConf.nick_length);
IsupportSetFmt(NULL, "MAXNICKLEN", "%d", NICKLEN);
IsupportSetFmt(NULL, "MAXLIST", "b:%d,e:%d,I:%d", MAXBANS, MAXBANS, MAXBANS);
IsupportSetFmt(NULL, "CHANLIMIT", "#:%d", MAXCHANNELSPERUSER);
IsupportSetFmt(NULL, "MAXCHANNELS", "%d", MAXCHANNELSPERUSER);
IsupportSet(NULL, "HCN", NULL);
IsupportSet(NULL, "SAFELIST", NULL);
IsupportSet(NULL, "NAMESX", NULL);
ISupportDelByName("WATCHOPTS");
ISupportSetFmt(NULL, "WATCH", "%d", MAXWATCH);
ISupportSet(NULL, "WALLCHOPS", NULL);
ISupportSetFmt(NULL, "AWAYLEN", "%d", iConf.away_length);
ISupportSetFmt(NULL, "KICKLEN", "%d", iConf.kick_length);
ISupportSetFmt(NULL, "TOPICLEN", "%d", iConf.topic_length);
ISupportSetFmt(NULL, "QUITLEN", "%d", iConf.quit_length);
ISupportSetFmt(NULL, "CHANNELLEN", "%d", CHANNELLEN);
ISupportSetFmt(NULL, "MINNICKLEN", "%d", iConf.min_nick_length);
ISupportSetFmt(NULL, "NICKLEN", "%d", iConf.nick_length);
ISupportSetFmt(NULL, "MAXNICKLEN", "%d", NICKLEN);
ISupportSetFmt(NULL, "MAXLIST", "b:%d,e:%d,I:%d", MAXBANS, MAXBANS, MAXBANS);
ISupportSetFmt(NULL, "CHANLIMIT", "#:%d", MAXCHANNELSPERUSER);
ISupportSetFmt(NULL, "MAXCHANNELS", "%d", MAXCHANNELSPERUSER);
ISupportSet(NULL, "HCN", NULL);
ISupportSet(NULL, "SAFELIST", NULL);
ISupportSet(NULL, "NAMESX", NULL);
if (UHNAMES_ENABLED)
IsupportSet(NULL, "UHNAMES", NULL);
ISupportSet(NULL, "UHNAMES", NULL);
else
IsupportDelByName("UHNAMES");
IsupportSet(NULL, "DEAF", "d");
ISupportDelByName("UHNAMES");
ISupportSet(NULL, "DEAF", "d");
set_isupport_extban(); /* EXTBAN=xyz */
set_isupport_targmax(); /* TARGMAX=... */
}
@ -136,7 +136,7 @@ void isupport_init(void)
* @param isupport The pointer to the isupport handle.
* @param value The new value of the token (NULL indicates no value).
*/
void IsupportSetValue(Isupport *isupport, const char *value)
void ISupportSetValue(ISupport *isupport, const char *value)
{
if (isupport->value)
free(isupport->value);
@ -155,11 +155,11 @@ void IsupportSetValue(Isupport *isupport, const char *value)
* @return Returns the handle to the isupport token if it was found,
* otherwise NULL is returned.
*/
Isupport *IsupportFind(const char *token)
ISupport *ISupportFind(const char *token)
{
Isupport *isupport;
ISupport *isupport;
for (isupport = Isupports; isupport; isupport = isupport->next)
for (isupport = ISupports; isupport; isupport = isupport->next)
{
if (!strcasecmp(token, isupport->token))
return isupport;
@ -177,12 +177,12 @@ Isupport *IsupportFind(const char *token)
* The module's error code contains specific information about the
* error.
*/
Isupport *IsupportAdd(Module *module, const char *token, const char *value)
ISupport *ISupportAdd(Module *module, const char *token, const char *value)
{
Isupport *isupport;
ISupport *isupport;
const char *c;
if (IsupportFind(token))
if (ISupportFind(token))
{
if (module)
module->errorcode = MODERR_EXISTS;
@ -217,7 +217,7 @@ Isupport *IsupportAdd(Module *module, const char *token, const char *value)
}
}
isupport = MyMallocEx(sizeof(Isupport));
isupport = MyMallocEx(sizeof(ISupport));
isupport->owner = module;
isupport->token = strdup(token);
if (value)
@ -240,9 +240,9 @@ Isupport *IsupportAdd(Module *module, const char *token, const char *value)
*
* @param isupport The token to remove.
*/
void IsupportDel(Isupport *isupport)
void ISupportDel(ISupport *isupport)
{
DelListItem(isupport, Isupports);
DelListItem(isupport, ISupports);
free(isupport->token);
if (isupport->value)
free(isupport->value);
@ -260,17 +260,17 @@ void make_isupportstrings(void)
#define ISUPPORTLEN BUFSIZE-HOSTLEN-NICKLEN-39
int bufsize = ISUPPORTLEN;
int tokcnt = 0, len = 0;
Isupport *isupport;
ISupport *isupport;
char tmp[ISUPPORTLEN];
/* Free any previous strings */
for (i = 0; IsupportStrings[i]; i++)
safefree(IsupportStrings[i]);
for (i = 0; ISupportStrings[i]; i++)
safefree(ISupportStrings[i]);
i = 0;
IsupportStrings[i] = MyMallocEx(bufsize+1);
ISupportStrings[i] = MyMallocEx(bufsize+1);
for (isupport = Isupports; isupport; isupport = isupport->next)
for (isupport = ISupports; isupport; isupport = isupport->next)
{
if (isupport->value)
snprintf(tmp, sizeof(tmp), "%s=%s", isupport->token, isupport->value);
@ -278,32 +278,32 @@ void make_isupportstrings(void)
strlcpy(tmp, isupport->token, sizeof(tmp));
tokcnt++;
if ((strlen(IsupportStrings[i]) + strlen(tmp) + 1 >= ISUPPORTLEN) || (tokcnt == 13))
if ((strlen(ISupportStrings[i]) + strlen(tmp) + 1 >= ISUPPORTLEN) || (tokcnt == 13))
{
/* No room or max tokens reached: start a new buffer */
IsupportStrings[++i] = MyMallocEx(bufsize+1);
ISupportStrings[++i] = MyMallocEx(bufsize+1);
tokcnt = 1;
if (i == MAXISUPPORTLINES)
abort(); /* should never happen anyway */
}
if (*IsupportStrings[i])
strlcat(IsupportStrings[i], " ", ISUPPORTLEN);
strlcat(IsupportStrings[i], tmp, ISUPPORTLEN);
if (*ISupportStrings[i])
strlcat(ISupportStrings[i], " ", ISUPPORTLEN);
strlcat(ISupportStrings[i], tmp, ISUPPORTLEN);
}
}
void isupport_add_sorted(Isupport *n)
void isupport_add_sorted(ISupport *n)
{
Isupport *e;
ISupport *e;
if (!Isupports)
if (!ISupports)
{
Isupports = n;
ISupports = n;
return;
}
for (e = Isupports; e; e = e->next)
for (e = ISupports; e; e = e->next)
{
if (strcmp(n->token, e->token) < 0)
{
@ -311,7 +311,7 @@ void isupport_add_sorted(Isupport *n)
if (e->prev)
e->prev->next = n;
else
Isupports = n; /* new head */
ISupports = n; /* new head */
n->prev = e->prev;
n->next = e;

View file

@ -62,7 +62,6 @@ void close_listener(ConfigItem_listen *listener);
static char readbuf[BUFSIZE];
char zlinebuf[BUFSIZE];
extern char *version;
extern ircstats IRCstats;
MODVAR time_t last_allinuse = 0;
#ifdef USE_LIBCURL
@ -962,7 +961,7 @@ refuse_client:
acptr->local->listener->clients++;
add_client_to_list(acptr);
IRCstats.unknown++;
ircstats.unknown++;
acptr->status = STAT_UNKNOWN;
list_add(&acptr->lclient_node, &unknown_list);
@ -1416,7 +1415,7 @@ int connect_server(ConfigItem_link *aconf, Client *by, struct hostent *hp)
cptr->serv->up = me.name;
SetConnecting(cptr);
SetOutgoing(cptr);
IRCstats.unknown++;
ircstats.unknown++;
list_add(&cptr->lclient_node, &unknown_list);
set_sockhost(cptr, aconf->outgoing.hostname);
add_client_to_list(cptr);

View file

@ -28,7 +28,10 @@ Channel *channel = NULL;
static char nickbuf[BUFSIZE], buf[BUFSIZE];
MODVAR char modebuf[BUFSIZE], parabuf[BUFSIZE];
aCtab cFlagTab[] = {
/** This describes the letters, modes and options for core channel modes.
* These are +ntmispklr and also the list modes +vhoaq and +beI.
*/
CoreChannelModeTable corechannelmodetable[] = {
{MODE_LIMIT, 'l', 1, 1},
{MODE_VOICE, 'v', 1, 1},
{MODE_HALFOP, 'h', 0, 1},
@ -72,7 +75,7 @@ inline int op_can_override(char* acl, Client *sptr,Channel *channel,void* extra)
void make_cmodestr(void)
{
char *p = &cmodestring[0];
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
int i;
while (tab->mode != 0x0)
{
@ -88,7 +91,7 @@ void make_cmodestr(void)
int Halfop_mode(long mode)
{
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
while (tab->mode != 0x0)
{
@ -616,7 +619,7 @@ long get_access(Client *cptr, Channel *chptr)
/** Returns 1 if channel has this channel mode set and 0 if not */
int has_channel_mode(Channel *chptr, char mode)
{
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
int i;
/* Extended channel modes */
@ -658,7 +661,7 @@ Cmode_t get_extmode_bitbychar(char m)
long get_mode_bitbychar(char m)
{
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
while(tab->mode != 0x0)
{
@ -676,7 +679,7 @@ long get_mode_bitbychar(char m)
/* TODO: this function has many security issues and needs an audit, maybe even a recode */
void channel_modes(Client *cptr, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size, Channel *chptr)
{
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
char bcbuf[1024];
int ismember;
int i;
@ -974,7 +977,7 @@ Channel *get_channel(Client *cptr, char *chname, int flag)
chptr->creationtime = MyClient(cptr) ? TStime() : 0;
channel = chptr;
(void)add_to_channel_hash_table(chname, chptr);
IRCstats.channels++;
ircstats.channels++;
RunHook2(HOOKTYPE_CHANNEL_CREATE, cptr, chptr);
}
return chptr;
@ -1125,7 +1128,7 @@ int sub1_from_channel(Channel *chptr)
if (chptr->nextch)
chptr->nextch->prevch = chptr->prevch;
(void)del_from_channel_hash_table(chptr->chname, chptr);
IRCstats.channels--;
ircstats.channels--;
MyFree(chptr);
return 1;
}
@ -1242,7 +1245,7 @@ int parse_chanmode(ParseMode *pm, char *modebuf_in, char *parabuf_in)
}
else
{
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
int i;
int eatparam = 0;

View file

@ -491,7 +491,7 @@ void free_conf_channelmodes(struct ChMode *store)
/* Set configuration, used for set::modes-on-join */
void conf_channelmodes(char *modes, struct ChMode *store, int warn)
{
aCtab *tab;
CoreChannelModeTable *tab;
char *params = strchr(modes, ' ');
char *parambuf = NULL;
char *param = NULL;
@ -522,7 +522,7 @@ void conf_channelmodes(char *modes, struct ChMode *store, int warn)
modes++;
continue;
}
for (tab = &cFlagTab[0]; tab->mode; tab++)
for (tab = &corechannelmodetable[0]; tab->mode; tab++)
{
if (tab->flag == *modes)
{
@ -568,7 +568,7 @@ void conf_channelmodes(char *modes, struct ChMode *store, int warn)
void chmode_str(struct ChMode *modes, char *mbuf, char *pbuf, size_t mbuf_size, size_t pbuf_size)
{
aCtab *tab;
CoreChannelModeTable *tab;
int i;
if (!(mbuf_size && pbuf_size))
@ -577,7 +577,7 @@ void chmode_str(struct ChMode *modes, char *mbuf, char *pbuf, size_t mbuf_size,
*pbuf = 0;
*mbuf++ = '+';
if (--mbuf_size == 0) return;
for (tab = &cFlagTab[0]; tab->mode; tab++)
for (tab = &corechannelmodetable[0]; tab->mode; tab++)
{
if (modes->mode & tab->mode)
{

View file

@ -43,7 +43,7 @@ int R_do_dns, R_fin_dns, R_fin_dnsc, R_fail_dns, R_do_id, R_fin_id, R_fail_id;
char REPORT_DO_DNS[256], REPORT_FIN_DNS[256], REPORT_FIN_DNSC[256],
REPORT_FAIL_DNS[256], REPORT_DO_ID[256], REPORT_FIN_ID[256],
REPORT_FAIL_ID[256];
ircstats IRCstats;
IRCStatistics ircstats;
Client me; /* That's me */
MODVAR char *me_hash;
extern char backupbuf[8192];
@ -922,8 +922,8 @@ int InitUnrealIRCd(int argc, char *argv[])
memset(&StatsZ, 0, sizeof(StatsZ));
setup_signals();
memset(&IRCstats, '\0', sizeof(ircstats));
IRCstats.servers = 1;
memset(&ircstats, '\0', sizeof(ircstats));
ircstats.servers = 1;
mp_pool_init();
dbuf_init();
@ -1372,10 +1372,10 @@ void SocketLoop(void *dummy)
* ** second
* ** also check for expiring glines
*/
if (IRCstats.clients > IRCstats.global_max)
IRCstats.global_max = IRCstats.clients;
if (IRCstats.me_clients > IRCstats.me_max)
IRCstats.me_max = IRCstats.me_clients;
if (ircstats.clients > ircstats.global_max)
ircstats.global_max = ircstats.clients;
if (ircstats.me_clients > ircstats.me_max)
ircstats.me_max = ircstats.me_clients;
fd_select(SOCKETLOOP_MAX_DELAY);

View file

@ -22,7 +22,6 @@
void free_link(Link *);
Link *make_link();
extern ircstats IRCstats;
ID_Copyright
("(C) 1988 University of Oulu, Computing Center and Jarkko Oikarinen");
@ -301,27 +300,27 @@ void remove_client_from_list(Client *cptr)
list_del(&cptr->client_node);
if (IsServer(cptr))
{
IRCstats.servers--;
ircstats.servers--;
}
if (IsClient(cptr))
{
if (IsInvisible(cptr))
{
IRCstats.invisible--;
ircstats.invisible--;
}
if (IsOper(cptr) && !IsHideOper(cptr))
{
IRCstats.operators--;
ircstats.operators--;
VERIFY_OPERCOUNT(cptr, "rmvlist");
}
IRCstats.clients--;
ircstats.clients--;
if (cptr->srvptr && cptr->srvptr->serv)
cptr->srvptr->serv->users--;
}
if (IsUnknown(cptr) || IsConnecting(cptr) || IsHandshake(cptr)
|| IsTLSHandshake(cptr)
)
IRCstats.unknown--;
ircstats.unknown--;
if (IsPerson(cptr)) /* Only persons can have been added before */
{

View file

@ -23,7 +23,6 @@
#include "unrealircd.h"
extern ircstats IRCstats;
extern char *me_hash;
static void exit_one_client(Client *, MessageTag *mtags_i, const char *);
@ -552,7 +551,7 @@ int exit_client(Client *cptr, Client *sptr, Client *from, MessageTag *recv_mtags
}
}
if (IsClient(sptr))
IRCstats.me_clients--;
ircstats.me_clients--;
if (sptr->serv && sptr->serv->conf)
{
sptr->serv->conf->refcount--;
@ -568,7 +567,7 @@ int exit_client(Client *cptr, Client *sptr, Client *from, MessageTag *recv_mtags
}
if (IsServer(sptr))
{
IRCstats.me_servers--;
ircstats.me_servers--;
ircd_log(LOG_SERVER, "SQUIT %s (%s)", sptr->name, comment);
}
free_pending_net(sptr);
@ -694,17 +693,17 @@ char text[2048];
if (IsOper(acptr) && !IsHideOper(acptr))
counted++;
}
if (counted == IRCstats.operators)
if (counted == ircstats.operators)
return;
snprintf(text, sizeof(text), "[BUG] operator count bug! value in /lusers is '%d', we counted '%d', "
"user='%s', userserver='%s', tag=%s. Corrected. ",
IRCstats.operators, counted, orig->name,
ircstats.operators, counted, orig->name,
orig->srvptr ? orig->srvptr->name : "<null>", tag ? tag : "<null>");
#ifdef DEBUGMODE
sendto_realops("%s", text);
#endif
ircd_log(LOG_ERROR, "%s", text);
IRCstats.operators = counted;
ircstats.operators = counted;
}
/** Check if the specified hostname does not contain forbidden characters.

View file

@ -506,7 +506,7 @@ void FreeModObj(ModuleObject *obj, Module *m)
EfunctionDel(obj->object.efunction);
}
else if (obj->type == MOBJ_ISUPPORT) {
IsupportDel(obj->object.isupport);
ISupportDel(obj->object.isupport);
}
else if (obj->type == MOBJ_MODDATA) {
ModDataDel(obj->object.moddata);

View file

@ -48,8 +48,8 @@ struct DNSBL {
int *reply;
};
typedef union _blacklistbackend BlacklistBackend;
union _blacklistbackend
typedef union BlacklistBackend BlacklistBackend;
union BlacklistBackend
{
DNSBL *dns;
};

View file

@ -49,18 +49,18 @@ struct {
#define MODEF_MAX_UNSETTIME cfg.modef_max_unsettime
#define MODEF_BOOT_DELAY cfg.modef_boot_delay
typedef struct SChanFloodProt ChanFloodProt;
typedef struct SRemoveFld RemoveFld;
typedef struct ChannelFloodProtection ChannelFloodProtection;
typedef struct RemoveChannelModeTimer RemoveChannelModeTimer;
struct SRemoveFld {
struct SRemoveFld *prev, *next;
struct RemoveChannelModeTimer {
struct RemoveChannelModeTimer *prev, *next;
Channel *chptr;
char m; /* mode to be removed */
time_t when; /* scheduled at */
};
typedef struct UserFld aUserFld;
struct UserFld {
typedef struct MemberFlood MemberFlood;
struct MemberFlood {
unsigned short nmsg;
unsigned short nmsg_repeat;
time_t firstmsg;
@ -74,7 +74,7 @@ struct UserFld {
#define MAXCHMODEFACTIONS 8
/** Per-channel flood protection settings and counters */
struct SChanFloodProt {
struct ChannelFloodProtection {
unsigned short per; /**< setting: per <XX> seconds */
time_t timer[NUMFLD]; /**< runtime: timers */
unsigned short counter[NUMFLD]; /**< runtime: counters */
@ -88,7 +88,7 @@ struct SChanFloodProt {
ModDataInfo *mdflood = NULL;
Cmode_t EXTMODE_FLOODLIMIT = 0L;
static int timedban_available = 0; /**< Set to 1 if extbans/timedban module is loaded. */
RemoveFld *removefld_list = NULL;
RemoveChannelModeTimer *removechannelmodetimer_list = NULL;
char *floodprot_msghash_key = NULL;
#define IsFloodLimit(x) ((x)->mode.extmode & EXTMODE_FLOODLIMIT)
@ -101,9 +101,9 @@ int floodprot_config_run(ConfigFile *, ConfigEntry *, int);
void floodprottimer_del(Channel *chptr, char mflag);
void floodprottimer_stopchantimers(Channel *chptr);
static inline char *chmodefstrhelper(char *buf, char t, char tdef, unsigned short l, unsigned char a, unsigned char r);
static int compare_floodprot_modes(ChanFloodProt *a, ChanFloodProt *b);
static int compare_floodprot_modes(ChannelFloodProtection *a, ChannelFloodProtection *b);
static int do_floodprot(Channel *chptr, int what);
char *channel_modef_string(ChanFloodProt *x, char *str);
char *channel_modef_string(ChannelFloodProtection *x, char *str);
int check_for_chan_flood(Client *sptr, Channel *chptr, char *text);
void do_floodprot_action(Channel *chptr, int what, char *text);
void floodprottimer_add(Channel *chptr, char mflag, time_t when);
@ -124,9 +124,9 @@ int floodprot_knock(Client *sptr, Channel *chptr, MessageTag *mtags, char *comme
int floodprot_local_nickchange(Client *sptr, char *oldnick);
int floodprot_remote_nickchange(Client *cptr, Client *sptr, char *oldnick);
int floodprot_chanmode_del(Channel *chptr, int m);
void userfld_free(ModData *md);
void memberflood_free(ModData *md);
int floodprot_stats(Client *sptr, char *flag);
void floodprot_free_removefld_list(ModData *m);
void floodprot_free_removechannelmodetimer_list(ModData *m);
void floodprot_free_msghash_key(ModData *m);
MOD_TEST(floodprot)
@ -157,13 +157,13 @@ MOD_INIT(floodprot)
init_config();
LoadPersistentPointer(modinfo, removefld_list, floodprot_free_removefld_list);
LoadPersistentPointer(modinfo, removechannelmodetimer_list, floodprot_free_removechannelmodetimer_list);
LoadPersistentPointer(modinfo, floodprot_msghash_key, floodprot_free_msghash_key);
memset(&mreq, 0, sizeof(mreq));
mreq.name = "floodprot";
mreq.type = MODDATATYPE_MEMBERSHIP;
mreq.free = userfld_free;
mreq.free = memberflood_free;
mdflood = ModDataAdd(modinfo->handle, mreq);
if (!mdflood)
abort();
@ -197,7 +197,7 @@ MOD_LOAD(floodprot)
MOD_UNLOAD(floodprot)
{
SavePersistentPointer(modinfo, removefld_list);
SavePersistentPointer(modinfo, removechannelmodetimer_list);
return MOD_SUCCESS;
}
@ -312,7 +312,7 @@ int cmodef_is_ok(Client *sptr, Channel *chptr, char mode, char *param, int type,
} else
if (type == EXCHK_PARAM)
{
ChanFloodProt newf;
ChannelFloodProtection newf;
int xxi, xyi, xzi, hascolon;
char *xp;
@ -539,7 +539,7 @@ invalidsyntax:
void *cmodef_put_param(void *fld_in, char *param)
{
ChanFloodProt *fld = (ChanFloodProt *)fld_in;
ChannelFloodProtection *fld = (ChannelFloodProtection *)fld_in;
char xbuf[256], c, a, *p, *p2, *x = xbuf+1;
int v;
unsigned short warnings = 0, breakit;
@ -550,7 +550,7 @@ void *cmodef_put_param(void *fld_in, char *param)
if (!fld)
{
/* Need to create one */
fld = MyMallocEx(sizeof(ChanFloodProt));
fld = MyMallocEx(sizeof(ChannelFloodProtection));
}
/* always reset settings (l, a, r) */
@ -566,13 +566,13 @@ void *cmodef_put_param(void *fld_in, char *param)
p2 = strchr(xbuf+1, ']');
if (!p2)
{
memset(fld, 0, sizeof(ChanFloodProt));
memset(fld, 0, sizeof(ChannelFloodProtection));
return fld; /* FAIL */
}
*p2 = '\0';
if (*(p2+1) != ':')
{
memset(fld, 0, sizeof(ChanFloodProt));
memset(fld, 0, sizeof(ChannelFloodProtection));
return fld; /* FAIL */
}
breakit = 0;
@ -674,13 +674,13 @@ void *cmodef_put_param(void *fld_in, char *param)
p2++;
if (*p2 != ':')
{
memset(fld, 0, sizeof(ChanFloodProt));
memset(fld, 0, sizeof(ChannelFloodProtection));
return fld; /* FAIL */
}
p2++;
if (!*p2)
{
memset(fld, 0, sizeof(ChanFloodProt));
memset(fld, 0, sizeof(ChannelFloodProtection));
return fld; /* FAIL */
}
v = atoi(p2);
@ -704,7 +704,7 @@ void *cmodef_put_param(void *fld_in, char *param)
breakit=0;
if (breakit)
{
memset(fld, 0, sizeof(ChanFloodProt));
memset(fld, 0, sizeof(ChannelFloodProtection));
return fld; /* FAIL */
}
@ -713,7 +713,7 @@ void *cmodef_put_param(void *fld_in, char *param)
char *cmodef_get_param(void *r_in)
{
ChanFloodProt *r = (ChanFloodProt *)r_in;
ChannelFloodProtection *r = (ChannelFloodProtection *)r_in;
static char retbuf[512];
if (!r)
@ -731,7 +731,7 @@ char *cmodef_conv_param(char *param_in, Client *cptr)
static char retbuf[256];
char param[256], *p;
int num, t, fail = 0;
ChanFloodProt newf;
ChannelFloodProtection newf;
int xxi, xyi, xzi, hascolon;
char *xp;
int localclient = (!cptr || MyClient(cptr)) ? 1 : 0;
@ -953,17 +953,17 @@ void cmodef_free_param(void *r)
void *cmodef_dup_struct(void *r_in)
{
ChanFloodProt *r = (ChanFloodProt *)r_in;
ChanFloodProt *w = MyMallocEx(sizeof(ChanFloodProt));
ChannelFloodProtection *r = (ChannelFloodProtection *)r_in;
ChannelFloodProtection *w = MyMallocEx(sizeof(ChannelFloodProtection));
memcpy(w, r, sizeof(ChanFloodProt));
memcpy(w, r, sizeof(ChannelFloodProtection));
return (void *)w;
}
int cmodef_sjoin_check(Channel *chptr, void *ourx, void *theirx)
{
ChanFloodProt *our = (ChanFloodProt *)ourx;
ChanFloodProt *their = (ChanFloodProt *)theirx;
ChannelFloodProtection *our = (ChannelFloodProtection *)ourx;
ChannelFloodProtection *their = (ChannelFloodProtection *)theirx;
char *x;
int i;
@ -1043,7 +1043,7 @@ char tmpbuf[16], *p2 = tmpbuf;
/** returns the channelmode +f string (ie: '[5k,40j]:10').
* 'retbuf' is suggested to be of size 512, which is more than X times the maximum (for safety).
*/
char *channel_modef_string(ChanFloodProt *x, char *retbuf)
char *channel_modef_string(ChannelFloodProtection *x, char *retbuf)
{
char *p = retbuf;
@ -1138,12 +1138,12 @@ int floodprot_remote_nickchange(Client *cptr, Client *sptr, char *oldnick)
int floodprot_chanmode_del(Channel *chptr, int modechar)
{
ChanFloodProt *chp;
ChannelFloodProtection *chp;
if (!IsFloodLimit(chptr))
return 0;
chp = (ChanFloodProt *)GETPARASTRUCT(chptr, 'f');
chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f');
if (!chp)
return 0;
@ -1183,8 +1183,8 @@ int floodprot_chanmode_del(Channel *chptr, int modechar)
int check_for_chan_flood(Client *sptr, Channel *chptr, char *text)
{
MembershipL *lp;
ChanFloodProt *chp;
aUserFld *userfld;
ChannelFloodProtection *chp;
MemberFlood *memberflood;
uint64_t msghash;
unsigned char is_flooding_text=0, is_flooding_repeat=0;
@ -1194,7 +1194,7 @@ int check_for_chan_flood(Client *sptr, Channel *chptr, char *text)
if (!(lp = (MembershipL *)find_membership_link(sptr->user->channel, chptr)))
return 0; /* not in channel */
chp = (ChanFloodProt *)GETPARASTRUCT(chptr, 'f');
chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f');
if (!chp || !(chp->limit[FLD_TEXT] || chp->limit[FLD_REPEAT]))
return 0;
@ -1202,10 +1202,10 @@ int check_for_chan_flood(Client *sptr, Channel *chptr, char *text)
if (moddata_membership(lp, mdflood).ptr == NULL)
{
/* Alloc a new entry if it doesn't exist yet */
moddata_membership(lp, mdflood).ptr = MyMallocEx(sizeof(aUserFld));
moddata_membership(lp, mdflood).ptr = MyMallocEx(sizeof(MemberFlood));
}
userfld = (aUserFld *)moddata_membership(lp, mdflood).ptr;
memberflood = (MemberFlood *)moddata_membership(lp, mdflood).ptr;
/* Anti-repeat ('r') */
if (chp->limit[FLD_REPEAT])
@ -1213,36 +1213,36 @@ int check_for_chan_flood(Client *sptr, Channel *chptr, char *text)
/* if current - firstmsgtime >= mode.per, then reset,
* if nummsg > mode.msgs then kick/ban
*/
if ((TStime() - userfld->firstmsg) >= chp->per)
if ((TStime() - memberflood->firstmsg) >= chp->per)
{
/* reset */
userfld->firstmsg = TStime();
userfld->nmsg = 1;
userfld->nmsg_repeat = 1;
userfld->lastmsg = gen_floodprot_msghash(text);
userfld->prevmsg = 0;
memberflood->firstmsg = TStime();
memberflood->nmsg = 1;
memberflood->nmsg_repeat = 1;
memberflood->lastmsg = gen_floodprot_msghash(text);
memberflood->prevmsg = 0;
return 0; /* forget about it.. */
}
msghash = gen_floodprot_msghash(text);
if (userfld->lastmsg)
if (memberflood->lastmsg)
{
if ((userfld->lastmsg == msghash) || (userfld->prevmsg == msghash))
if ((memberflood->lastmsg == msghash) || (memberflood->prevmsg == msghash))
{
userfld->nmsg_repeat++;
if (userfld->nmsg_repeat > chp->limit[FLD_REPEAT])
memberflood->nmsg_repeat++;
if (memberflood->nmsg_repeat > chp->limit[FLD_REPEAT])
is_flooding_repeat = 1;
}
userfld->prevmsg = userfld->lastmsg;
memberflood->prevmsg = memberflood->lastmsg;
}
userfld->lastmsg = msghash;
memberflood->lastmsg = msghash;
}
if (chp->limit[FLD_TEXT])
{
/* increase msgs */
userfld->nmsg++;
if (userfld->nmsg > chp->limit[FLD_TEXT])
memberflood->nmsg++;
if (memberflood->nmsg > chp->limit[FLD_TEXT])
is_flooding_text = 1;
}
@ -1303,11 +1303,11 @@ int check_for_chan_flood(Client *sptr, Channel *chptr, char *text)
return 0;
}
RemoveFld *floodprottimer_find(Channel *chptr, char mflag)
RemoveChannelModeTimer *floodprottimer_find(Channel *chptr, char mflag)
{
RemoveFld *e;
RemoveChannelModeTimer *e;
for (e=removefld_list; e; e=e->next)
for (e=removechannelmodetimer_list; e; e=e->next)
{
if ((e->chptr == chptr) && (e->m == mflag))
return e;
@ -1337,9 +1337,9 @@ void strccat(char *s, char c)
*/
void floodprottimer_add(Channel *chptr, char mflag, time_t when)
{
RemoveFld *e = NULL;
RemoveChannelModeTimer *e = NULL;
unsigned char add=1;
ChanFloodProt *chp = (ChanFloodProt *)GETPARASTRUCT(chptr, 'f');
ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f');
if (strchr(chp->timers_running, mflag))
{
@ -1362,20 +1362,20 @@ void floodprottimer_add(Channel *chptr, char mflag, time_t when)
}
if (add)
e = MyMallocEx(sizeof(RemoveFld));
e = MyMallocEx(sizeof(RemoveChannelModeTimer));
e->chptr = chptr;
e->m = mflag;
e->when = when;
if (add)
AddListItem(e, removefld_list);
AddListItem(e, removechannelmodetimer_list);
}
void floodprottimer_del(Channel *chptr, char mflag)
{
RemoveFld *e;
ChanFloodProt *chp = (ChanFloodProt *)GETPARASTRUCT(chptr, 'f');
RemoveChannelModeTimer *e;
ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f');
if (chp && !strchr(chp->timers_running, mflag))
return; /* nothing to remove.. */
@ -1383,7 +1383,7 @@ void floodprottimer_del(Channel *chptr, char mflag)
if (!e)
return;
DelListItem(e, removefld_list);
DelListItem(e, removechannelmodetimer_list);
MyFree(e);
if (chp)
@ -1400,12 +1400,12 @@ void floodprottimer_del(Channel *chptr, char mflag)
EVENT(modef_event)
{
RemoveFld *e, *e_next;
RemoveChannelModeTimer *e, *e_next;
time_t now;
now = TStime();
for (e = removefld_list; e; e = e_next)
for (e = removechannelmodetimer_list; e; e = e_next)
{
e_next = e->next;
if (e->when <= now)
@ -1437,7 +1437,7 @@ EVENT(modef_event)
}
/* And delete... */
DelListItem(e, removefld_list);
DelListItem(e, removechannelmodetimer_list);
MyFree(e);
} else {
#ifdef NEWFLDDBG
@ -1450,14 +1450,14 @@ EVENT(modef_event)
void floodprottimer_stopchantimers(Channel *chptr)
{
RemoveFld *e, *e_next;
RemoveChannelModeTimer *e, *e_next;
for (e = removefld_list; e; e = e_next)
for (e = removechannelmodetimer_list; e; e = e_next)
{
e_next = e->next;
if (e->chptr == chptr)
{
DelListItem(e, removefld_list);
DelListItem(e, removechannelmodetimer_list);
MyFree(e);
}
}
@ -1465,7 +1465,7 @@ void floodprottimer_stopchantimers(Channel *chptr)
int do_floodprot(Channel *chptr, int what)
{
ChanFloodProt *chp = (ChanFloodProt *)GETPARASTRUCT(chptr, 'f');
ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f');
if (!chp || !chp->limit[what]) /* no +f or not restricted */
return 0;
@ -1498,7 +1498,7 @@ void do_floodprot_action(Channel *chptr, int what, char *text)
char m;
int mode = 0;
Cmode_t extmode = 0;
ChanFloodProt *chp = (ChanFloodProt *)GETPARASTRUCT(chptr, 'f');
ChannelFloodProtection *chp = (ChannelFloodProtection *)GETPARASTRUCT(chptr, 'f');
m = chp->action[what];
if (!m)
@ -1597,12 +1597,12 @@ uint64_t gen_floodprot_msghash(char *text)
// FIXME: REMARK: make sure you can only do a +f/-f once (latest in line wins).
/* Checks if 2 ChanFloodProt modes (chmode +f) are different.
/* Checks if 2 ChannelFloodProtection modes (chmode +f) are different.
* This is a bit more complicated than 1 simple memcmp(a,b,..) because
* counters are also stored in this struct so we have to do
* it manually :( -- Syzop.
*/
static int compare_floodprot_modes(ChanFloodProt *a, ChanFloodProt *b)
static int compare_floodprot_modes(ChannelFloodProtection *a, ChannelFloodProtection *b)
{
if (memcmp(a->limit, b->limit, sizeof(a->limit)) ||
memcmp(a->action, b->action, sizeof(a->action)) ||
@ -1612,9 +1612,9 @@ static int compare_floodprot_modes(ChanFloodProt *a, ChanFloodProt *b)
return 0;
}
void userfld_free(ModData *md)
void memberflood_free(ModData *md)
{
aUserFld *userfld;
MemberFlood *memberflood;
/* We don't have any struct members (anymore) that need freeing */
safefree(md->ptr);
}
@ -1627,11 +1627,11 @@ int floodprot_stats(Client *sptr, char *flag)
}
/** Admin unloading the floodprot module for good. Bad. */
void floodprot_free_removefld_list(ModData *m)
void floodprot_free_removechannelmodetimer_list(ModData *m)
{
RemoveFld *e, *e_next;
RemoveChannelModeTimer *e, *e_next;
for (e=removefld_list; e; e=e_next)
for (e=removechannelmodetimer_list; e; e=e_next)
{
e_next = e->next;
MyFree(e);

View file

@ -78,7 +78,7 @@ CMD_FUNC(m_close)
sendnumeric(sptr, RPL_CLOSEEND, closed);
sendto_realops("%s!%s@%s closed %d unknown connections", sptr->name,
sptr->user->username, GetHost(sptr), closed);
IRCstats.unknown = 0;
ircstats.unknown = 0;
return 0;
}

View file

@ -38,7 +38,7 @@ ModuleHeader MOD_HEADER(dccallow)
MOD_INIT(dccallow)
{
CommandAdd(modinfo->handle, MSG_DCCALLOW, m_dccallow, 1, M_USER);
IsupportAdd(modinfo->handle, "USERIP", NULL);
ISupportAdd(modinfo->handle, "USERIP", NULL);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}

View file

@ -45,10 +45,10 @@ struct {
unsigned short t;
} cfg;
typedef struct JFlood aJFlood;
typedef struct JoinFlood JoinFlood;
struct JFlood {
aJFlood *prev, *next;
struct JoinFlood {
JoinFlood *prev, *next;
char chname[CHANNELLEN+1];
time_t firstjoin;
unsigned short numjoins;
@ -63,7 +63,7 @@ int jointhrottle_local_join(Client *cptr, Client *sptr, Channel *chptr, MessageT
static int isjthrottled(Client *cptr, Channel *chptr);
static void jointhrottle_increase_usercounter(Client *cptr, Channel *chptr);
EVENT(jointhrottle_cleanup_structs);
aJFlood *jointhrottle_addentry(Client *cptr, Channel *chptr);
JoinFlood *jointhrottle_addentry(Client *cptr, Channel *chptr);
MOD_TEST(jointhrottle)
{
@ -153,8 +153,9 @@ int jointhrottle_config_run(ConfigFile *cf, ConfigEntry *ce, int type)
static int isjthrottled(Client *cptr, Channel *chptr)
{
aJFlood *e;
int num=cfg.num, t=cfg.t;
JoinFlood *e;
int num = cfg.num;
int t = cfg.t;
if (!MyClient(cptr))
return 0;
@ -178,8 +179,9 @@ int num=cfg.num, t=cfg.t;
static void jointhrottle_increase_usercounter(Client *cptr, Channel *chptr)
{
aJFlood *e;
int num=cfg.num, t=cfg.t;
JoinFlood *e;
int num = cfg.num;
int t = cfg.t;
if (!MyClient(cptr))
return;
@ -220,12 +222,12 @@ int jointhrottle_local_join(Client *cptr, Client *sptr, Channel *chptr, MessageT
return 0;
}
/** Adds a aJFlood entry to user & channel and returns entry.
/** Adds a JoinFlood entry to user & channel and returns entry.
* NOTE: Does not check for already-existing-entry
*/
aJFlood *jointhrottle_addentry(Client *cptr, Channel *chptr)
JoinFlood *jointhrottle_addentry(Client *cptr, Channel *chptr)
{
aJFlood *e;
JoinFlood *e;
#ifdef DEBUGMODE
if (!IsPerson(cptr))
@ -236,13 +238,13 @@ aJFlood *e;
abort(); /* already exists -- should never happen */
#endif
e = MyMallocEx(sizeof(aJFlood));
e = MyMallocEx(sizeof(JoinFlood));
strlcpy(e->chname, chptr->chname, sizeof(e->chname));
/* Insert our new entry as (new) head */
if (moddata_client(cptr, jointhrottle_md).ptr)
{
aJFlood *current_head = moddata_client(cptr, jointhrottle_md).ptr;
JoinFlood *current_head = moddata_client(cptr, jointhrottle_md).ptr;
current_head->prev = e;
e->next = current_head;
}
@ -254,10 +256,10 @@ aJFlood *e;
/** Regularly cleans up user/chan structs */
EVENT(jointhrottle_cleanup_structs)
{
Client *acptr;
Channel *chptr;
aJFlood *jf, *jf_next;
int t = cfg.t;
Client *acptr;
Channel *chptr;
JoinFlood *jf, *jf_next;
int t = cfg.t;
list_for_each_entry(acptr, &lclient_list, lclient_node)
{
@ -297,7 +299,7 @@ int t = cfg.t;
void jointhrottle_md_free(ModData *m)
{
aJFlood *j, *j_next;
JoinFlood *j, *j_next;
if (!m->ptr)
return;

View file

@ -38,7 +38,7 @@ ModuleHeader MOD_HEADER(knock)
MOD_INIT(knock)
{
CommandAdd(modinfo->handle, MSG_KNOCK, m_knock, 2, M_USER);
IsupportAdd(modinfo->handle, "KNOCK", NULL);
ISupportAdd(modinfo->handle, "KNOCK", NULL);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}

View file

@ -65,31 +65,31 @@ char flatmap;
flatmap = (FLAT_MAP && !ValidatePermissionsForPath("server:info:lusers",sptr,NULL,NULL,NULL)) ? 1 : 0;
/* Just to correct results ---Stskeeps */
if (IRCstats.clients > IRCstats.global_max)
IRCstats.global_max = IRCstats.clients;
if (IRCstats.me_clients > IRCstats.me_max)
IRCstats.me_max = IRCstats.me_clients;
if (ircstats.clients > ircstats.global_max)
ircstats.global_max = ircstats.clients;
if (ircstats.me_clients > ircstats.me_max)
ircstats.me_max = ircstats.me_clients;
sendnumeric(sptr, RPL_LUSERCLIENT,
IRCstats.clients - IRCstats.invisible, IRCstats.invisible,
IRCstats.servers);
ircstats.clients - ircstats.invisible, ircstats.invisible,
ircstats.servers);
if (IRCstats.operators)
sendnumeric(sptr, RPL_LUSEROP, IRCstats.operators);
if (IRCstats.unknown)
sendnumeric(sptr, RPL_LUSERUNKNOWN, IRCstats.unknown);
if (IRCstats.channels)
sendnumeric(sptr, RPL_LUSERCHANNELS, IRCstats.channels);
sendnumeric(sptr, RPL_LUSERME, IRCstats.me_clients, flatmap ? 0 : IRCstats.me_servers);
sendnumeric(sptr, RPL_LOCALUSERS, IRCstats.me_clients, IRCstats.me_max, IRCstats.me_clients, IRCstats.me_max);
sendnumeric(sptr, RPL_GLOBALUSERS, IRCstats.clients, IRCstats.global_max, IRCstats.clients, IRCstats.global_max);
if ((IRCstats.me_clients + IRCstats.me_servers) > max_connection_count)
if (ircstats.operators)
sendnumeric(sptr, RPL_LUSEROP, ircstats.operators);
if (ircstats.unknown)
sendnumeric(sptr, RPL_LUSERUNKNOWN, ircstats.unknown);
if (ircstats.channels)
sendnumeric(sptr, RPL_LUSERCHANNELS, ircstats.channels);
sendnumeric(sptr, RPL_LUSERME, ircstats.me_clients, flatmap ? 0 : ircstats.me_servers);
sendnumeric(sptr, RPL_LOCALUSERS, ircstats.me_clients, ircstats.me_max, ircstats.me_clients, ircstats.me_max);
sendnumeric(sptr, RPL_GLOBALUSERS, ircstats.clients, ircstats.global_max, ircstats.clients, ircstats.global_max);
if ((ircstats.me_clients + ircstats.me_servers) > max_connection_count)
{
max_connection_count =
IRCstats.me_clients + IRCstats.me_servers;
ircstats.me_clients + ircstats.me_servers;
if (max_connection_count % 10 == 0) /* only send on even tens */
sendto_ops("New record on this server: %d connections (%d clients)",
max_connection_count, IRCstats.me_clients);
max_connection_count, ircstats.me_clients);
}
return 0;
}

View file

@ -38,7 +38,7 @@ ModuleHeader MOD_HEADER(map)
MOD_INIT(map)
{
CommandAdd(modinfo->handle, MSG_MAP, m_map, MAXPARA, M_USER);
IsupportAdd(modinfo->handle, "MAP", NULL);
ISupportAdd(modinfo->handle, "MAP", NULL);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}

View file

@ -554,7 +554,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou
size_t mode_buf_size, size_t para_buf_size, char bounce)
{
char tmpbuf[MODEBUFLEN+3], *tmpstr;
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
char *x = mode_buf;
int what, cnt, z;
int i;
@ -566,7 +566,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou
*para_buf = '\0';
what = 0;
/* + param-less modes */
tab = &cFlagTab[0];
tab = &corechannelmodetable[0];
while (tab->mode != 0x0)
{
if (chptr->mode.mode & tab->mode)
@ -604,7 +604,7 @@ void make_mode_str(Channel *chptr, long oldm, Cmode_t oldem, long oldl, int pcou
*x = '\0';
/* - param-less modes */
tab = &cFlagTab[0];
tab = &corechannelmodetable[0];
while (tab->mode != 0x0)
{
if (!(chptr->mode.mode & tab->mode))
@ -737,7 +737,7 @@ int do_mode_char(Channel *chptr, long modetype, char modechar, char *param,
u_int what, Client *cptr,
u_int *pcount, char pvar[MAXMODEPARAMS][MODEBUFLEN + 3], char bounce, long my_access)
{
aCtab *tab = &cFlagTab[0];
CoreChannelModeTable *tab = &corechannelmodetable[0];
int retval = 0;
Member *member = NULL;
Membership *membership = NULL;
@ -1398,8 +1398,8 @@ void _set_mode(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcou
#ifdef DEVELOP
char *tmpo = NULL;
#endif
aCtab *tab = &cFlagTab[0];
aCtab foundat;
CoreChannelModeTable *tab = &corechannelmodetable[0];
CoreChannelModeTable foundat;
int found = 0;
int sent_mlock_warning = 0;
unsigned int htrig = 0;
@ -1441,7 +1441,7 @@ void _set_mode(Channel *chptr, Client *cptr, int parc, char *parv[], u_int *pcou
continue;
}
found = 0;
tab = &cFlagTab[0];
tab = &corechannelmodetable[0];
while ((tab->mode != 0x0) && found == 0)
{
if (tab->flag == *curchr)
@ -1858,29 +1858,29 @@ CMD_FUNC(_m_umode)
}
if (!(oldumodes & UMODE_OPER) && IsOper(sptr))
IRCstats.operators++;
ircstats.operators++;
/* deal with opercounts and stuff */
if ((oldumodes & UMODE_OPER) && !IsOper(sptr))
{
IRCstats.operators--;
ircstats.operators--;
VERIFY_OPERCOUNT(sptr, "umode1");
} else /* YES this 'else' must be here, otherwise we can decrease twice. fixes opercount bug. */
if (!(oldumodes & UMODE_HIDEOPER) && IsHideOper(sptr))
{
IRCstats.operators--;
ircstats.operators--;
VERIFY_OPERCOUNT(sptr, "umode2");
}
/* end of dealing with opercounts */
if ((oldumodes & UMODE_HIDEOPER) && !IsHideOper(sptr))
{
IRCstats.operators++;
ircstats.operators++;
}
if (!(oldumodes & UMODE_INVISIBLE) && IsInvisible(sptr))
IRCstats.invisible++;
ircstats.invisible++;
if ((oldumodes & UMODE_INVISIBLE) && !IsInvisible(sptr))
IRCstats.invisible--;
ircstats.invisible--;
if (MyConnect(sptr) && !IsOper(sptr))
remove_oper_privileges(sptr, 0);

View file

@ -89,9 +89,9 @@ CMD_FUNC(m_netinfo)
protocol = atol(parv[3]);
/* max global count != max_global_count --sts */
if (lmax > IRCstats.global_max)
if (lmax > ircstats.global_max)
{
IRCstats.global_max = lmax;
ircstats.global_max = lmax;
sendto_realops("Max Global Count is now %li (set by link %s)",
lmax, cptr->name);
}

View file

@ -1377,7 +1377,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
strlcpy(user->username, username, USERLEN+1);
}
SetClient(sptr);
IRCstats.clients++;
ircstats.clients++;
if (sptr->srvptr && sptr->srvptr->serv)
sptr->srvptr->serv->users++;
@ -1394,8 +1394,8 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
list_move(&sptr->lclient_node, &lclient_list);
IRCstats.unknown--;
IRCstats.me_clients++;
ircstats.unknown--;
ircstats.me_clients++;
if (IsSecure(sptr))
{
@ -1422,8 +1422,8 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
me.name, version, umodestring, cmodestring);
RunHook2(HOOKTYPE_WELCOME, sptr, 4);
for (i = 0; IsupportStrings[i]; i++)
sendnumeric(sptr, RPL_ISUPPORT, IsupportStrings[i]);
for (i = 0; ISupportStrings[i]; i++)
sendnumeric(sptr, RPL_ISUPPORT, ISupportStrings[i]);
RunHook2(HOOKTYPE_WELCOME, sptr, 5);
@ -1505,7 +1505,7 @@ int _register_user(Client *cptr, Client *sptr, char *nick, char *username, char
}
if (sptr->umodes & UMODE_INVISIBLE)
{
IRCstats.invisible++;
ircstats.invisible++;
}
if (virthost && umode)

View file

@ -296,9 +296,9 @@ CMD_FUNC(m_oper)
/* Update statistics */
if (IsInvisible(sptr) && !(old & UMODE_INVISIBLE))
IRCstats.invisible++;
ircstats.invisible++;
if (IsOper(sptr) && !IsHideOper(sptr))
IRCstats.operators++;
ircstats.operators++;
if (SHOWOPERMOTD == 1)
(void)do_cmd(cptr, sptr, NULL, "OPERMOTD", parc, parv);

View file

@ -84,9 +84,9 @@ struct cfgstruct {
char *database;
};
typedef struct reputationentry ReputationEntry;
typedef struct ReputationEntry ReputationEntry;
struct reputationentry {
struct ReputationEntry {
ReputationEntry *prev, *next;
unsigned short score; /**< score for the user */
long last_seen; /**< user last seen (unix timestamp) */

View file

@ -29,9 +29,9 @@ ModuleHeader MOD_HEADER(restrict-commands) = {
#define GetReputation(acptr) (moddata_client_get(acptr, "reputation") ? atoi(moddata_client_get(acptr, "reputation")) : 0)
typedef struct restrictedcmd RestrictedCmd;
struct restrictedcmd {
RestrictedCmd *prev, *next;
typedef struct RestrictedCommand RestrictedCommand;
struct RestrictedCommand {
RestrictedCommand *prev, *next;
char *cmd;
char *conftag;
long connect_delay;
@ -47,8 +47,8 @@ typedef struct {
// Forward declarations
char *find_cmd_byconftag(char *conftag);
RestrictedCmd *find_restrictions_bycmd(char *cmd);
RestrictedCmd *find_restrictions_byconftag(char *conftag);
RestrictedCommand *find_restrictions_bycmd(char *cmd);
RestrictedCommand *find_restrictions_byconftag(char *conftag);
int rcmd_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs);
int rcmd_configrun(ConfigFile *cf, ConfigEntry *ce, int type);
char *rcmd_hook_prechanmsg(Client *sptr, Channel *chptr, MessageTag *mtags, char *text, int notice);
@ -58,7 +58,7 @@ CMD_OVERRIDE_FUNC(rcmd_override);
// Globals
static ModuleInfo ModInf;
RestrictedCmd *RestrictedCmdList = NULL;
RestrictedCommand *RestrictedCommandList = NULL;
CmdMap conf_cmdmaps[] = {
// These are special cases in which we can't override the command, so they are handled through hooks instead
{ "channel-message", "PRIVMSG" },
@ -98,16 +98,16 @@ MOD_LOAD(restrict-commands)
MOD_UNLOAD(restrict-commands)
{
RestrictedCmd *rcmd, *next;
for (rcmd = RestrictedCmdList; rcmd; rcmd = next)
RestrictedCommand *rcmd, *next;
for (rcmd = RestrictedCommandList; rcmd; rcmd = next)
{
next = rcmd->next;
MyFree(rcmd->conftag);
MyFree(rcmd->cmd);
DelListItem(rcmd, RestrictedCmdList);
DelListItem(rcmd, RestrictedCommandList);
MyFree(rcmd);
}
RestrictedCmdList = NULL;
RestrictedCommandList = NULL;
return MOD_SUCCESS;
}
@ -121,9 +121,9 @@ char *find_cmd_byconftag(char *conftag) {
return NULL;
}
RestrictedCmd *find_restrictions_bycmd(char *cmd) {
RestrictedCmd *rcmd;
for (rcmd = RestrictedCmdList; rcmd; rcmd = rcmd->next)
RestrictedCommand *find_restrictions_bycmd(char *cmd) {
RestrictedCommand *rcmd;
for (rcmd = RestrictedCommandList; rcmd; rcmd = rcmd->next)
{
if (!strcasecmp(rcmd->cmd, cmd))
return rcmd;
@ -131,9 +131,9 @@ RestrictedCmd *find_restrictions_bycmd(char *cmd) {
return NULL;
}
RestrictedCmd *find_restrictions_byconftag(char *conftag) {
RestrictedCmd *rcmd;
for (rcmd = RestrictedCmdList; rcmd; rcmd = rcmd->next)
RestrictedCommand *find_restrictions_byconftag(char *conftag) {
RestrictedCommand *rcmd;
for (rcmd = RestrictedCommandList; rcmd; rcmd = rcmd->next)
{
if (rcmd->conftag && !strcmp(rcmd->conftag, conftag))
return rcmd;
@ -145,7 +145,7 @@ int rcmd_configtest(ConfigFile *cf, ConfigEntry *ce, int type, int *errs)
{
int errors = 0;
ConfigEntry *cep, *cep2;
RestrictedCmd *rcmd;
RestrictedCommand *rcmd;
long connect_delay;
int exempt_reputation_score;
int has_restriction;
@ -220,7 +220,7 @@ int rcmd_configrun(ConfigFile *cf, ConfigEntry *ce, int type)
{
ConfigEntry *cep, *cep2;
char *cmd, *conftag;
RestrictedCmd *rcmd;
RestrictedCommand *rcmd;
// We are only interested in set::restrict-commands
if (type != CONFIG_SET)
@ -256,7 +256,7 @@ int rcmd_configrun(ConfigFile *cf, ConfigEntry *ce, int type)
}
}
rcmd = MyMallocEx(sizeof(RestrictedCmd));
rcmd = MyMallocEx(sizeof(RestrictedCommand));
rcmd->cmd = strdup(cmd);
rcmd->conftag = (conftag ? strdup(conftag) : NULL);
for (cep2 = cep->ce_entries; cep2; cep2 = cep2->ce_next)
@ -288,13 +288,13 @@ int rcmd_configrun(ConfigFile *cf, ConfigEntry *ce, int type)
break; // Using break instead of continue since 'disable' takes precedence anyways
}
}
AddListItem(rcmd, RestrictedCmdList);
AddListItem(rcmd, RestrictedCommandList);
}
return 1;
}
int rcmd_canbypass(Client *sptr, RestrictedCmd *rcmd) {
int rcmd_canbypass(Client *sptr, RestrictedCommand *rcmd) {
if (!sptr || !rcmd)
return 1;
if (rcmd->exempt_identified && IsLoggedIn(sptr))
@ -321,7 +321,7 @@ char *rcmd_hook_preusermsg(Client *sptr, Client *to, char *text, int notice)
char *rcmd_hook_wrapper(Client *sptr, char *text, int notice, char *display, char *conftag)
{
RestrictedCmd *rcmd;
RestrictedCommand *rcmd;
// Let's allow non-local users, opers and U:Lines early =]
if (!MyClient(sptr) || !sptr->local || IsOper(sptr) || IsULine(sptr))
@ -348,7 +348,7 @@ char *rcmd_hook_wrapper(Client *sptr, char *text, int notice, char *display, cha
CMD_OVERRIDE_FUNC(rcmd_override)
{
RestrictedCmd *rcmd;
RestrictedCommand *rcmd;
if (!MyClient(sptr) || !sptr->local || IsOper(sptr) || IsULine(sptr))
return CallCommandOverride(ovr, cptr, sptr, recv_mtags, parc, parv);

View file

@ -730,7 +730,7 @@ CMD_FUNC(m_server_remote)
if (IsULine(sptr)
|| (Find_uline(acptr->name)))
acptr->flags |= FLAGS_ULINE;
IRCstats.servers++;
ircstats.servers++;
(void)find_or_add(acptr->name);
add_client_to_list(acptr);
(void)add_to_client_hash_table(acptr->name, acptr);
@ -919,9 +919,9 @@ int m_server_synch(Client *cptr, ConfigItem_link *aconf)
/* Set up server structure */
free_pending_net(cptr);
SetServer(cptr);
IRCstats.me_servers++;
IRCstats.servers++;
IRCstats.unknown--;
ircstats.me_servers++;
ircstats.servers++;
ircstats.unknown--;
list_move(&cptr->client_node, &global_server_list);
list_move(&cptr->lclient_node, &lclient_list);
list_add(&cptr->special_node, &server_list);
@ -1096,7 +1096,7 @@ int m_server_synch(Client *cptr, ConfigItem_link *aconf)
dcc_sync(cptr);
sendto_one(cptr, NULL, "NETINFO %i %lld %i %s 0 0 0 :%s",
IRCstats.global_max, (long long)TStime(), UnrealProtocol,
ircstats.global_max, (long long)TStime(), UnrealProtocol,
CLOAK_KEYCRC,
ircnetwork);

View file

@ -767,7 +767,7 @@ getnick:
if (merge && !nomode)
{
aCtab *acp;
CoreChannelModeTable *acp;
Mode oldmode; /**< The old mode (OUR mode) */
/* Copy current mode to oldmode (need to duplicate all extended mode params too..) */
@ -835,7 +835,7 @@ getnick:
queue_s = 1;
}
/* Add single char modes... */
for (acp = cFlagTab; acp->mode; acp++)
for (acp = corechannelmodetable; acp->mode; acp++)
{
if ((oldmode.mode & acp->mode) && !(chptr->mode.mode & acp->mode) && !acp->parameters)
{
@ -858,7 +858,7 @@ getnick:
if (queue_c)
Addsingle('c');
for (acp = cFlagTab; acp->mode; acp++)
for (acp = corechannelmodetable; acp->mode; acp++)
{
if (!(oldmode.mode & acp->mode) && (chptr->mode.mode & acp->mode) && !acp->parameters)
{

View file

@ -744,7 +744,6 @@ int stats_mem(Client *sptr, char *para)
rcm = 0, /* memory used by remote clients */
awm = 0, /* memory used by aways */
wwam = 0, /* whowas away memory used */
wwm = 0, /* whowas array memory used */
com = 0, /* memory used by conf lines */
wlhm = 0, /* watchlist memory used */
db = 0, /* memory used by dbufs */
@ -759,7 +758,6 @@ int stats_mem(Client *sptr, char *para)
count_whowas_memory(&wwu, &wwam);
count_watch_memory(&wlh, &wlhm);
wwm = sizeof(aName) * NICKNAMEHISTORYLENGTH;
list_for_each_entry(acptr, &client_list, client_node)
{
@ -855,10 +853,8 @@ int stats_mem(Client *sptr, char *para)
sendnumericfmt(sptr, RPL_STATSDEBUG, "Whowas users %d(%ld) away %d(%ld)",
wwu, (long)(wwu * sizeof(ClientUser)),
wwa, wwam);
sendnumericfmt(sptr, RPL_STATSDEBUG, "Whowas array %d(%ld)",
NICKNAMEHISTORYLENGTH, wwm);
totww = wwu * sizeof(ClientUser) + wwam + wwm;
totww = wwu * sizeof(ClientUser) + wwam;
sendnumericfmt(sptr, RPL_STATSDEBUG,
"Hash: client %d(%ld) chan %d(%ld) watch %d(%ld)",
@ -1164,7 +1160,7 @@ int stats_uptime(Client *sptr, char *para)
tmpnow / 86400, (tmpnow / 3600) % 24, (tmpnow / 60) % 60,
tmpnow % 60);
sendnumeric(sptr, RPL_STATSCONN,
max_connection_count, IRCstats.me_max);
max_connection_count, ircstats.me_max);
return 0;
}

View file

@ -70,10 +70,10 @@ CMD_FUNC(m_svslusers)
int temp;
temp = atoi(parv[2]);
if (temp >= 0)
IRCstats.global_max = temp;
ircstats.global_max = temp;
temp = atoi(parv[3]);
if (temp >= 0)
IRCstats.me_max = temp;
ircstats.me_max = temp;
}
return 0;
}

View file

@ -353,9 +353,9 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
break;
case 'i':
if ((what == MODE_ADD) && !(acptr->umodes & UMODE_INVISIBLE))
IRCstats.invisible++;
ircstats.invisible++;
if ((what == MODE_DEL) && (acptr->umodes & UMODE_INVISIBLE))
IRCstats.invisible--;
ircstats.invisible--;
goto setmodex;
case 'o':
if ((what == MODE_ADD) && !(acptr->umodes & UMODE_OPER))
@ -363,7 +363,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
if (!IsOper(acptr) && MyClient(acptr))
list_add(&acptr->special_node, &oper_list);
IRCstats.operators++;
ircstats.operators++;
}
if ((what == MODE_DEL) && (acptr->umodes & UMODE_OPER))
{
@ -372,7 +372,7 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
/* clear 'H' too, and opercount stays the same.. */
acptr->umodes &= ~UMODE_HIDEOPER;
} else {
IRCstats.operators--;
ircstats.operators--;
}
if (MyClient(acptr) && !list_empty(&acptr->special_node))
@ -396,10 +396,10 @@ int do_svsmode(Client *cptr, Client *sptr, MessageTag *recv_mtags, int parc, cha
"report at https://bugs.unrealircd.org/", sptr->name, parv[1], parv[2], acptr->umodes);
break; /* abort! */
}
IRCstats.operators--;
ircstats.operators--;
}
if (what == MODE_DEL && (acptr->umodes & UMODE_HIDEOPER))
IRCstats.operators++;
ircstats.operators++;
goto setmodex;
case 'd':
if (parv[3])

View file

@ -74,7 +74,7 @@ CMD_FUNC(m_svsnoop)
{
if (IsOper(acptr))
{
IRCstats.operators--;
ircstats.operators--;
VERIFY_OPERCOUNT(acptr, "svsnoop");
}

View file

@ -38,7 +38,7 @@ ModuleHeader MOD_HEADER(userip)
MOD_INIT(userip)
{
CommandAdd(modinfo->handle, MSG_USERIP, m_userip, 1, M_USER);
IsupportAdd(modinfo->handle, "USERIP", NULL);
ISupportAdd(modinfo->handle, "USERIP", NULL);
MARK_AS_OFFICIAL_MODULE(modinfo);
return MOD_SUCCESS;
}

View file

@ -85,7 +85,7 @@ MOD_INIT(whox)
config_warn("You cannot load both m_whox and m_who. You should ONLY load the m_whox module.");
return MOD_FAILED;
}
IsupportAdd(modinfo->handle, "WHOX", NULL);
ISupportAdd(modinfo->handle, "WHOX", NULL);
return MOD_SUCCESS;
}

View file

@ -22,10 +22,11 @@ static int hash(char *); /*
#define SCACHE_HASH_SIZE 257
typedef struct scache_entry {
typedef struct SCACHE SCACHE;
struct SCACHE {
char name[HOSTLEN + 1];
struct scache_entry *next;
} SCACHE;
SCACHE *next;
};
static SCACHE *scache_hash[SCACHE_HASH_SIZE];

View file

@ -33,7 +33,6 @@ extern void s_die();
static char buf[BUFSIZE];
MODVAR int max_connection_count = 1, max_client_count = 1;
extern ircstats IRCstats;
extern int do_garbage_collect;
/* We need all these for cached MOTDs -- codemastr */
extern char *buildid;
@ -145,9 +144,9 @@ void send_version(Client* sptr, int reply)
{
int i;
for (i = 0; IsupportStrings[i]; i++)
for (i = 0; ISupportStrings[i]; i++)
{
sendnumeric(sptr, reply, IsupportStrings[i]);
sendnumeric(sptr, reply, ISupportStrings[i]);
}
}
@ -199,7 +198,7 @@ char *num = NULL;
*/
void send_proto(Client *cptr, ConfigItem_link *aconf)
{
Isupport *prefix = IsupportFind("PREFIX");
ISupport *prefix = ISupportFind("PREFIX");
/* CAUTION: If adding a token to an existing PROTOCTL line below,
* then ensure that MAXPARA is not reached!
@ -505,7 +504,7 @@ EVENT(save_tunefile)
return;
}
fprintf(tunefile, "0\n");
fprintf(tunefile, "%d\n", IRCstats.me_max);
fprintf(tunefile, "%d\n", ircstats.me_max);
fclose(tunefile);
}
@ -525,7 +524,7 @@ void load_tunefile(void)
if (!fgets(buf, sizeof(buf), tunefile))
fprintf(stderr, "Warning: error while reading the peak user count from the tunefile%s%s\n",
errno? ": ": "", errno? strerror(errno): "");
IRCstats.me_max = atol(buf);
ircstats.me_max = atol(buf);
fclose(tunefile);
}

View file

@ -25,8 +25,8 @@ struct Upgrade
struct Upgrade upgrade;
typedef struct flagmapping FlagMapping;
struct flagmapping
typedef struct FlagMapping FlagMapping;
struct FlagMapping
{
char shortflag;
char *longflag;

View file

@ -677,7 +677,7 @@ void set_isupport_targmax(void)
strlcat(buf, ",", sizeof(buf));
strlcat(buf, tbuf, sizeof(buf));
}
IsupportSet(NULL, "TARGMAX", buf);
ISupportSet(NULL, "TARGMAX", buf);
}
/** Called between config test and config run */

View file

@ -71,7 +71,6 @@ NOTIFYICONDATA SysTray;
HTREEITEM AddItemToTree(HWND, LPSTR, int, short);
void win_map(Client *, HWND, short);
extern Link *Servers;
extern ircstats IRCstats;
unsigned char *errors = NULL;
extern VOID WINAPI ServiceMain(DWORD dwArgc, LPTSTR *lpszArgv);
void CleanUp(void)
@ -905,20 +904,20 @@ LRESULT CALLBACK StatusDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
{
hwTreeView = GetDlgItem(hDlg, IDC_TREE);
win_map(&me, hwTreeView, 0);
SetDlgItemInt(hDlg, IDC_CLIENTS, IRCstats.clients, FALSE);
SetDlgItemInt(hDlg, IDC_SERVERS, IRCstats.servers, FALSE);
SetDlgItemInt(hDlg, IDC_INVISO, IRCstats.invisible, FALSE);
SetDlgItemInt(hDlg, IDC_UNKNOWN, IRCstats.unknown, FALSE);
SetDlgItemInt(hDlg, IDC_OPERS, IRCstats.operators, FALSE);
SetDlgItemInt(hDlg, IDC_CHANNELS, IRCstats.channels, FALSE);
if (IRCstats.clients > IRCstats.global_max)
IRCstats.global_max = IRCstats.clients;
if (IRCstats.me_clients > IRCstats.me_max)
IRCstats.me_max = IRCstats.me_clients;
SetDlgItemInt(hDlg, IDC_MAXCLIENTS, IRCstats.global_max, FALSE);
SetDlgItemInt(hDlg, IDC_LCLIENTS, IRCstats.me_clients, FALSE);
SetDlgItemInt(hDlg, IDC_LSERVERS, IRCstats.me_servers, FALSE);
SetDlgItemInt(hDlg, IDC_LMAXCLIENTS, IRCstats.me_max, FALSE);
SetDlgItemInt(hDlg, IDC_CLIENTS, ircstats.clients, FALSE);
SetDlgItemInt(hDlg, IDC_SERVERS, ircstats.servers, FALSE);
SetDlgItemInt(hDlg, IDC_INVISO, ircstats.invisible, FALSE);
SetDlgItemInt(hDlg, IDC_UNKNOWN, ircstats.unknown, FALSE);
SetDlgItemInt(hDlg, IDC_OPERS, ircstats.operators, FALSE);
SetDlgItemInt(hDlg, IDC_CHANNELS, ircstats.channels, FALSE);
if (ircstats.clients > ircstats.global_max)
ircstats.global_max = ircstats.clients;
if (ircstats.me_clients > ircstats.me_max)
ircstats.me_max = ircstats.me_clients;
SetDlgItemInt(hDlg, IDC_MAXCLIENTS, ircstats.global_max, FALSE);
SetDlgItemInt(hDlg, IDC_LCLIENTS, ircstats.me_clients, FALSE);
SetDlgItemInt(hDlg, IDC_LSERVERS, ircstats.me_servers, FALSE);
SetDlgItemInt(hDlg, IDC_LMAXCLIENTS, ircstats.me_max, FALSE);
SetTimer(hDlg, 1, 5000, NULL);
return TRUE;
}
@ -928,21 +927,21 @@ LRESULT CALLBACK StatusDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
case WM_TIMER:
TreeView_DeleteAllItems(hwTreeView);
win_map(&me, hwTreeView, 1);
SetDlgItemInt(hDlg, IDC_CLIENTS, IRCstats.clients, FALSE);
SetDlgItemInt(hDlg, IDC_SERVERS, IRCstats.servers, FALSE);
SetDlgItemInt(hDlg, IDC_INVISO, IRCstats.invisible, FALSE);
SetDlgItemInt(hDlg, IDC_INVISO, IRCstats.invisible, FALSE);
SetDlgItemInt(hDlg, IDC_UNKNOWN, IRCstats.unknown, FALSE);
SetDlgItemInt(hDlg, IDC_OPERS, IRCstats.operators, FALSE);
SetDlgItemInt(hDlg, IDC_CHANNELS, IRCstats.channels, FALSE);
if (IRCstats.clients > IRCstats.global_max)
IRCstats.global_max = IRCstats.clients;
if (IRCstats.me_clients > IRCstats.me_max)
IRCstats.me_max = IRCstats.me_clients;
SetDlgItemInt(hDlg, IDC_MAXCLIENTS, IRCstats.global_max, FALSE);
SetDlgItemInt(hDlg, IDC_LCLIENTS, IRCstats.me_clients, FALSE);
SetDlgItemInt(hDlg, IDC_LSERVERS, IRCstats.me_servers, FALSE);
SetDlgItemInt(hDlg, IDC_LMAXCLIENTS, IRCstats.me_max, FALSE);
SetDlgItemInt(hDlg, IDC_CLIENTS, ircstats.clients, FALSE);
SetDlgItemInt(hDlg, IDC_SERVERS, ircstats.servers, FALSE);
SetDlgItemInt(hDlg, IDC_INVISO, ircstats.invisible, FALSE);
SetDlgItemInt(hDlg, IDC_INVISO, ircstats.invisible, FALSE);
SetDlgItemInt(hDlg, IDC_UNKNOWN, ircstats.unknown, FALSE);
SetDlgItemInt(hDlg, IDC_OPERS, ircstats.operators, FALSE);
SetDlgItemInt(hDlg, IDC_CHANNELS, ircstats.channels, FALSE);
if (ircstats.clients > ircstats.global_max)
ircstats.global_max = ircstats.clients;
if (ircstats.me_clients > ircstats.me_max)
ircstats.me_max = ircstats.me_clients;
SetDlgItemInt(hDlg, IDC_MAXCLIENTS, ircstats.global_max, FALSE);
SetDlgItemInt(hDlg, IDC_LCLIENTS, ircstats.me_clients, FALSE);
SetDlgItemInt(hDlg, IDC_LSERVERS, ircstats.me_servers, FALSE);
SetDlgItemInt(hDlg, IDC_LMAXCLIENTS, ircstats.me_max, FALSE);
SetTimer(hDlg, 1, 5000, NULL);
return TRUE;
case WM_COMMAND:

View file

@ -24,8 +24,8 @@ typedef struct {
unsigned char **buffer;
} StreamIO;
typedef struct colorlist {
struct colorlist *next;
typedef struct IRCColor {
struct IRCColor *next;
unsigned char *color;
} IRCColor;