From cbed45a2da103831b6b073a9eb7e27e3b164fa7d Mon Sep 17 00:00:00 2001 From: Valery V Yatsko Date: Tue, 24 Jun 2008 22:00:41 +0400 Subject: [PATCH] New orphaned cflags implementation, now using chm_orphaned instead of storing orphaned flags in a variable --- src/chmode.c | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/src/chmode.c b/src/chmode.c index 9a48f581..f8878bc9 100644 --- a/src/chmode.c +++ b/src/chmode.c @@ -65,8 +65,6 @@ static int mode_limit; static int mode_limit_simple; static int mask_pos; -static int orphaned_cflags = 0; - int chmode_flags[256]; void find_orphaned_cflags(void) @@ -80,12 +78,11 @@ find_orphaned_cflags(void) { if (chmode_flags[i] == 0) { - orphaned_cflags |= prev_chmode_flags[i]; + chmode_table[i].set_func = chm_orphaned; sendto_realops_snomask(SNO_DEBUG, L_ALL, "Cmode +%c is now orphaned", i); } else { - orphaned_cflags &= ~prev_chmode_flags[i]; sendto_realops_snomask(SNO_DEBUG, L_ALL, "Orphaned cmode +%c is picked up by module", i); } chmode_flags[i] = prev_chmode_flags[i]; @@ -504,6 +501,40 @@ chm_simple(struct Client *source_p, struct Channel *chptr, } } +void +chm_orphaned(struct Client *source_p, struct Channel *chptr, + int alevel, int parc, int *parn, + const char **parv, int *errors, int dir, char c, long mode_type) +{ + if(MyClient(source_p)) + return; + + if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type)) + { + chptr->mode.mode |= mode_type; + + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_ADD; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count++].arg = NULL; + } + else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type)) + { + chptr->mode.mode &= ~mode_type; + + mode_changes[mode_count].letter = c; + mode_changes[mode_count].dir = MODE_DEL; + mode_changes[mode_count].caps = 0; + mode_changes[mode_count].nocaps = 0; + mode_changes[mode_count].mems = ALL_MEMBERS; + mode_changes[mode_count].id = NULL; + mode_changes[mode_count++].arg = NULL; + } +} + void chm_staff(struct Client *source_p, struct Channel *chptr, int alevel, int parc, int *parn,