1
0
mirror of https://github.com/unrealircd/unrealircd.git synced 2026-07-03 14:33:13 +02:00

Multiple changes...

- Changed some useless stuff.
- Enabled EXTCMODE by default, I presume it's stable but can't promise anything.
- Module coders: changed 'allowed' callback function for umodes&snomasks,
  from 'aClient *sptr' to 'aClient *sptr, int what'.
  'what' will be MODE_ADD if trying to add and MODE_DEL if trying to remove.
This commit is contained in:
Bram Matthys
2003-10-25 16:39:23 +00:00
parent 2a469b1942
commit d64fb8dbab
8 changed files with 30 additions and 25 deletions
+5
View File
@@ -2494,3 +2494,8 @@ seen. gmtime warning still there
- Fix for +L without +l desynch on serverlinking.
- Fixed a problem regarding module hooks, if a hook was called within a hook it could cause
problems (like pre connect hook -> exit_client -> quit hook).
- Changed some useless stuff.
- Enabled EXTCMODE by default, I presume it's stable but can't promise anything.
- Module coders: changed 'allowed' callback function for umodes&snomasks,
from 'aClient *sptr' to 'aClient *sptr, int what'.
'what' will be MODE_ADD if trying to add and MODE_DEL if trying to remove.
+1 -2
View File
@@ -496,9 +496,8 @@
/*
* Extended channel modes. This extends the channel modes with yet another
* 32 possible modes which can also be used in modules.
* This is currently considered experimental however.
*/
#undef EXTCMODE
#define EXTCMODE
/*
* New channelmode +f system which allows flood control for:
+3 -3
View File
@@ -342,13 +342,13 @@ extern int m_umode(aClient *, aClient *, int, char **);
extern int m_names(aClient *, aClient *, int, char **);
extern int m_server_estab(aClient *);
extern void umode_init(void);
extern long umode_get(char, int, int (*)(aClient *));
extern long umode_get(char, int, int (*)(aClient *, int));
#define UMODE_GLOBAL 1
#define UMODE_LOCAL 0
#define umode_lget(x) umode_get(x, 0, 0);
#define umode_gget(x) umode_get(x, 1, 0);
extern int umode_allow_all(aClient *sptr);
extern int umode_allow_opers(aClient *sptr);
extern int umode_allow_all(aClient *sptr, int what);
extern int umode_allow_opers(aClient *sptr, int what);
extern int umode_delete(char ch, long val);
extern void send_umode(aClient *, aClient *, long, long, char *);
extern void send_umode_out(aClient *, aClient *, long);
+2 -2
View File
@@ -101,7 +101,7 @@ typedef struct {
typedef struct {
long mode;
char flag;
int (*allowed)(aClient *sptr);
int (*allowed)(aClient *sptr, int what);
char unloaded;
Module *owner;
} Umode;
@@ -109,7 +109,7 @@ typedef struct {
typedef struct {
long mode;
char flag;
int (*allowed)(aClient *sptr);
int (*allowed)(aClient *sptr, int what);
char unloaded;
Module *owner;
} Snomask;
+2 -2
View File
@@ -759,10 +759,10 @@ extern Cmode *Channelmode_Table;
extern unsigned short Channelmode_highest;
#endif
extern Umode *UmodeAdd(Module *module, char ch, int options, int (*allowed)(aClient *sptr), long *mode);
extern Umode *UmodeAdd(Module *module, char ch, int options, int (*allowed)(aClient *sptr, int what), long *mode);
extern void UmodeDel(Umode *umode);
extern Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr), long *mode);
extern Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr, int what), long *mode);
extern void SnomaskDel(Snomask *sno);
#ifdef EXTCMODE
-1
View File
@@ -79,7 +79,6 @@ int i;
if (!Channelmode_Table[i].paracount && Channelmode_Table[i].flag)
*p++ = Channelmode_Table[i].flag;
*p = '\0';
printf("dect: %s/%s/%s/%s\n", extchmstr[0], extchmstr[1], extchmstr[2], extchmstr[3]);
}
+12 -10
View File
@@ -802,7 +802,9 @@ extern int register_user(aClient *cptr, aClient *sptr, char *nick, char *usernam
cptr->last = TStime();
parv[0] = sptr->name;
parv[1] = parv[2] = NULL;
nick = sptr->name; /* <- The data is always the same, but the pointer is sometimes not,
* I need this for one of my modules, so do not remove! ;) -- Syzop */
if (MyConnect(sptr))
{
if ((i = check_client(sptr))) {
@@ -1788,6 +1790,7 @@ CMD_FUNC(m_nick)
if (register_user(cptr, sptr, nick,
sptr->user->username, NULL, NULL) == FLUSH_BUFFER)
return FLUSH_BUFFER;
strcpy(nick, sptr->name); /* don't ask, but I need this. do not remove! -- Syzop */
update_watch = 0;
newusr = 1;
}
@@ -2193,7 +2196,7 @@ CMD_FUNC(m_ison)
}
void set_snomask(aClient *sptr, char *snomask) {
int what = MODE_ADD;
int what = MODE_ADD; /* keep this an int. -- Syzop */
char *p;
int i;
if (snomask == NULL) {
@@ -2216,7 +2219,7 @@ void set_snomask(aClient *sptr, char *snomask) {
continue;
if (*p == Snomask_Table[i].flag)
{
if (Snomask_Table[i].allowed && !Snomask_Table[i].allowed(sptr))
if (Snomask_Table[i].allowed && !Snomask_Table[i].allowed(sptr,what))
continue;
if (what == MODE_ADD)
sptr->user->snomask |= Snomask_Table[i].mode;
@@ -2229,7 +2232,7 @@ void set_snomask(aClient *sptr, char *snomask) {
}
void create_snomask(aClient *sptr, anUser *user, char *snomask) {
int what = MODE_ADD;
int what = MODE_ADD; /* keep this an int. -- Syzop */
char *p;
int i;
if (snomask == NULL) {
@@ -2252,7 +2255,7 @@ void create_snomask(aClient *sptr, anUser *user, char *snomask) {
continue;
if (*p == Snomask_Table[i].flag)
{
if (Snomask_Table[i].allowed && !Snomask_Table[i].allowed(sptr))
if (Snomask_Table[i].allowed && !Snomask_Table[i].allowed(sptr,what))
continue;
if (what == MODE_ADD)
user->snomask |= Snomask_Table[i].mode;
@@ -2276,6 +2279,7 @@ CMD_FUNC(m_umode)
char **p, *m;
aClient *acptr;
int what, setflags, setsnomask = 0;
/* (small note: keep 'what' as an int. -- Syzop). */
short rpterror = 0, umode_restrict_err = 0, chk_restrict = 0, modex_err = 0;
what = MODE_ADD;
@@ -2416,13 +2420,11 @@ CMD_FUNC(m_umode)
{
if (*m == Usermode_Table[i].flag)
{
if (Usermode_Table[i].allowed)
if (!Usermode_Table[i].allowed(sptr,what))
break;
if (what == MODE_ADD)
{
if (Usermode_Table[i].allowed)
if (!Usermode_Table[i].allowed(sptr))
break;
sptr->umodes |= Usermode_Table[i].mode;
}
else
sptr->umodes &= ~Usermode_Table[i].mode;
break;
+5 -5
View File
@@ -175,7 +175,7 @@ void make_umodestr(void)
* Add a usermode with character 'ch', if global is set to 1 the usermode is global
* (sent to other servers) otherwise it's a local usermode
*/
Umode *UmodeAdd(Module *module, char ch, int global, int (*allowed)(aClient *sptr), long *mode)
Umode *UmodeAdd(Module *module, char ch, int global, int (*allowed)(aClient *sptr, int what), long *mode)
{
short i = 0;
short j = 0;
@@ -275,7 +275,7 @@ void UmodeDel(Umode *umode)
return;
}
Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr), long *mode)
Snomask *SnomaskAdd(Module *module, char ch, int (*allowed)(aClient *sptr, int what), long *mode)
{
short i = 0;
short j = 0;
@@ -368,12 +368,12 @@ void SnomaskDel(Snomask *sno)
return;
}
int umode_allow_all(aClient *sptr)
int umode_allow_all(aClient *sptr, int what)
{
return 1;
}
int umode_allow_opers(aClient *sptr)
int umode_allow_opers(aClient *sptr, int what)
{
return IsAnOper(sptr) ? 1 : 0;
}
@@ -444,7 +444,7 @@ void unload_all_unused_snomasks()
}
}
long umode_get(char ch, int options, int (*allowed)(aClient *sptr))
long umode_get(char ch, int options, int (*allowed)(aClient *sptr, int what))
{
long flag;
if (UmodeAdd(NULL, ch, options, allowed, &flag))