more portable userfiles

This commit is contained in:
joonicks 2025-11-13 15:14:01 +01:00
parent 90c0cc7ec1
commit 2f97530cb8
4 changed files with 29 additions and 43 deletions

View File

@ -282,6 +282,7 @@ void aucheck(User *user)
if (au_channel) if (au_channel)
{ {
/* does the user record have channel access? */
for(ump=user->chan;ump;ump=ump->next) for(ump=user->chan;ump;ump=ump->next)
{ {
if (*ump->p == '*' || !stringcasecmp(au_channel,ump->p)) if (*ump->p == '*' || !stringcasecmp(au_channel,ump->p))

View File

@ -391,24 +391,20 @@ void make_usercombo(void)
to_file(fd,"/""* This file is automatically generated from gencmd.c *""/\n"); to_file(fd,"/""* This file is automatically generated from gencmd.c *""/\n");
#ifdef BOTNET /* dont gatekeep these flags with ifdefs,
make userfiles compatible between different compiles */
combo.comboflags = 0; combo.x.noshare = 1; combo.comboflags = 0; combo.x.noshare = 1;
to_file(fd,"#define COMBO_NOSHARE\t0x%x\n",combo.comboflags); to_file(fd,"#define COMBO_NOSHARE\t0x%x\n",combo.comboflags);
combo.comboflags = 0; combo.x.readonly = 1; combo.comboflags = 0; combo.x.readonly = 1;
to_file(fd,"#define COMBO_READONLY\t0x%x\n",combo.comboflags); to_file(fd,"#define COMBO_READONLY\t0x%x\n",combo.comboflags);
#endif /* BOTNET */
#ifdef GREET
combo.comboflags = 0; combo.x.greetfile = 1; combo.comboflags = 0; combo.x.greetfile = 1;
to_file(fd,"#define COMBO_GREETFILE\t0x%x\n",combo.comboflags); to_file(fd,"#define COMBO_GREETFILE\t0x%x\n",combo.comboflags);
combo.comboflags = 0; combo.x.randline = 1; combo.comboflags = 0; combo.x.randline = 1;
to_file(fd,"#define COMBO_RANDLINE\t0x%x\n",combo.comboflags); to_file(fd,"#define COMBO_RANDLINE\t0x%x\n",combo.comboflags);
#endif /* GREET */
#ifdef BOUNCE
combo.comboflags = 0; combo.x.bounce = 1; combo.comboflags = 0; combo.x.bounce = 1;
to_file(fd,"#define COMBO_BOUNCE\t0x%x\n",combo.comboflags); to_file(fd,"#define COMBO_BOUNCE\t0x%x\n",combo.comboflags);
#endif /* BOUNCE */
combo.comboflags = 0; combo.x.echo = 1; combo.comboflags = 0; combo.x.echo = 1;
to_file(fd,"#define COMBO_ECHO\t0x%x\n",combo.comboflags); to_file(fd,"#define COMBO_ECHO\t0x%x\n",combo.comboflags);

View File

@ -50,31 +50,6 @@ typedef struct Mix64
} Mix64; } Mix64;
typedef union usercombo
{
struct
{
uint32_t access:8, /* access level (0-200) [0-255] */
prot:3, /* protlevel (0-4) [0-7] */
#ifdef BOTNET
noshare:1, /* dont share this user over botnet */
readonly:1, /* botnet cannot alter this user */
#endif /* BOTNET */
#ifdef GREET
greetfile:1, /* greeting is filename */
randline:1, /* grab random line from filename */
#endif /* GREET */
#ifdef BOUNCE
bounce:1, /* user has access to bouncer */
#endif /* BOUNCE */
echo:1, /* partyline echo of own messages */
aop:1, /* auto-opping */
avoice:1; /* auto-voicing */
} x;
uint32_t comboflags;
} usercombo;
typedef struct OnMsg typedef struct OnMsg
{ {
const char *name; const char *name;
@ -101,8 +76,6 @@ typedef struct OnMsg
typedef unsigned char OnMsg_access; typedef unsigned char OnMsg_access;
#ifndef GENCMD_C
typedef struct ircLink typedef struct ircLink
{ {
struct ircLink *next; struct ircLink *next;
@ -273,6 +246,28 @@ typedef struct Shit
} Shit; } Shit;
typedef union usercombo
{
struct
{
/* dont gatekeep these flags with ifdefs,
make userfiles compatible between different compiles */
uint32_t access:8, /* access level (0-200) [0-255] */
prot:3, /* protlevel (0-4) [0-7] */
noshare:1, /* dont share this user over botnet */
readonly:1, /* botnet cannot alter this user */
greetfile:1, /* greeting is filename */
randline:1, /* grab random line from filename */
bounce:1, /* user has access to bouncer */
echo:1, /* partyline echo of own messages */
aop:1, /* auto-opping */
avoice:1; /* auto-voicing */
} x;
uint32_t comboflags;
} usercombo;
#ifndef GENCMD_C
/* /*
* this struct is put to use in global.h * this struct is put to use in global.h
@ -595,18 +590,16 @@ typedef struct Mech
#endif /* NOTIFY */ #endif /* NOTIFY */
time_t lastreset; /* last time bot was reset */ time_t lastreset; /* last time bot was reset */
time_t ontime; /* how long the bot has been connected */
time_t lastantiidle; /* avoid showing large idle times */ time_t lastantiidle; /* avoid showing large idle times */
time_t activity; /* Away timer (AAWAY) */
time_t lastrejoin; /* last time channels were reset */ time_t lastrejoin; /* last time channels were reset */
#ifdef CHANBAN #ifdef CHANBAN
time_t lastchanban; /* last time a chanban check was run */ time_t lastchanban; /* last time a chanban check was run */
#endif /* CHANBAN */ #endif /* CHANBAN */
time_t conntry; /* when connect try started */ time_t conntry; /* when connect try started */
/* re-used for server activity once connected */ /* re-used for server activity once connected */
int heartbeat; /* handle server timeout stuff */ int heartbeat; /* handle server timeout stuff */
time_t activity; /* Away timer (AAWAY) */
time_t ontime; /* how long the bot has been connected */
#ifdef IRCD_EXTENSIONS #ifdef IRCD_EXTENSIONS
int ircx_flags; int ircx_flags;

View File

@ -83,20 +83,16 @@ LS struct
int modeflag; int modeflag;
} cfg_opt_flags[] = } cfg_opt_flags[] =
/* dont gatekeep these flags with ifdefs,
make userfiles compatible between different compiles */
{ {
{ 'a', COMBO_AOP }, { 'a', COMBO_AOP },
#ifdef BOUNCE
{ 'b', COMBO_BOUNCE }, { 'b', COMBO_BOUNCE },
#endif /* BOUNCE */
{ 'e', COMBO_ECHO }, { 'e', COMBO_ECHO },
#ifdef BOTNET
{ 'L', COMBO_NOSHARE }, { 'L', COMBO_NOSHARE },
{ 'R', COMBO_READONLY }, { 'R', COMBO_READONLY },
#endif /* BOTNET */
#ifdef GREET
{ 'g', COMBO_GREETFILE }, { 'g', COMBO_GREETFILE },
{ 'r', COMBO_RANDLINE }, { 'r', COMBO_RANDLINE },
#endif /* GREET */
{ 'v', COMBO_AVOICE }, { 'v', COMBO_AVOICE },
{ 0, 0, }}; { 0, 0, }};