X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/1117fbd3d5bc574638910807b50dfac84d69c846..90a3c35b295b07ebe3793bf5d3b882c3c1a5dc7c:/modules/core/m_sjoin.c diff --git a/modules/core/m_sjoin.c b/modules/core/m_sjoin.c index ccde55b..b8eda6a 100644 --- a/modules/core/m_sjoin.c +++ b/modules/core/m_sjoin.c @@ -25,7 +25,6 @@ */ #include "stdinc.h" -#include "tools.h" #include "channel.h" #include "client.h" #include "hash.h" @@ -75,7 +74,7 @@ static int pargs; static void set_final_mode(struct Mode *mode, struct Mode *oldmode); static void remove_our_modes(struct Channel *chptr, struct Client *source_p); static void remove_ban_list(struct Channel *chptr, struct Client *source_p, - dlink_list * list, char c, int cap, int mems); + rb_dlink_list * list, char c, int cap, int mems); static int ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) @@ -105,7 +104,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char char *p; int i, joinc = 0, timeslice = 0; static char empty[] = ""; - dlink_node *ptr, *next_ptr; + rb_dlink_node *ptr, *next_ptr; if(!IsChannelName(parv[2]) || !check_channel_name(parv[2])) return 0; @@ -263,13 +262,13 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char { struct membership *msptr; struct Client *who; - int l = dlink_list_length(&chptr->members); - int b = dlink_list_length(&chptr->banlist) + - dlink_list_length(&chptr->exceptlist) + - dlink_list_length(&chptr->invexlist) + - dlink_list_length(&chptr->quietlist); + int l = rb_dlink_list_length(&chptr->members); + int b = rb_dlink_list_length(&chptr->banlist) + + rb_dlink_list_length(&chptr->exceptlist) + + rb_dlink_list_length(&chptr->invexlist) + + rb_dlink_list_length(&chptr->quietlist); - DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->locmembers.head) { msptr = ptr->data; who = msptr->client_p; @@ -343,7 +342,7 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char if(!keep_our_modes) { remove_our_modes(chptr, fakesource_p); - DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head) + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, chptr->invites.head) { del_invite(chptr, ptr->data); } @@ -367,14 +366,14 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char else modes = empty_modes; - mlen_nick = ircsprintf(buf_nick, ":%s SJOIN %ld %s %s :", + mlen_nick = rb_sprintf(buf_nick, ":%s SJOIN %ld %s %s :", source_p->name, (long) chptr->channelts, parv[2], modes); ptr_nick = buf_nick + mlen_nick; /* working on the presumption eventually itll be more efficient to * build a TS6 buffer without checking its needed.. */ - mlen_uid = ircsprintf(buf_uid, ":%s SJOIN %ld %s %s :", + mlen_uid = rb_sprintf(buf_uid, ":%s SJOIN %ld %s %s :", use_id(source_p), (long) chptr->channelts, parv[2], modes); ptr_uid = buf_uid + mlen_uid; @@ -455,20 +454,15 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char } /* copy the nick to the two buffers */ - len = ircsprintf(ptr_nick, "%s ", target_p->name); + len = rb_sprintf(ptr_nick, "%s ", target_p->name); ptr_nick += len; len_nick += len; - len = ircsprintf(ptr_uid, "%s ", use_id(target_p)); + len = rb_sprintf(ptr_uid, "%s ", use_id(target_p)); ptr_uid += len; len_uid += len; if(!keep_new_modes) - { - if(fl & CHFL_CHANOP) - fl = CHFL_DEOPPED; - else - fl = 0; - } + fl = 0; if(!IsMember(target_p, chptr)) { @@ -582,18 +576,18 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char */ if(!keep_our_modes && source_p->id[0] != '\0') { - if(dlink_list_length(&chptr->banlist) > 0) + if(rb_dlink_list_length(&chptr->banlist) > 0) remove_ban_list(chptr, fakesource_p, &chptr->banlist, 'b', NOCAPS, ALL_MEMBERS); - if(dlink_list_length(&chptr->exceptlist) > 0) + if(rb_dlink_list_length(&chptr->exceptlist) > 0) remove_ban_list(chptr, fakesource_p, &chptr->exceptlist, 'e', CAP_EX, ONLY_CHANOPS); - if(dlink_list_length(&chptr->invexlist) > 0) + if(rb_dlink_list_length(&chptr->invexlist) > 0) remove_ban_list(chptr, fakesource_p, &chptr->invexlist, 'I', CAP_IE, ONLY_CHANOPS); - if(dlink_list_length(&chptr->quietlist) > 0) + if(rb_dlink_list_length(&chptr->quietlist) > 0) remove_ban_list(chptr, fakesource_p, &chptr->quietlist, 'q', NOCAPS, ALL_MEMBERS); @@ -603,30 +597,6 @@ ms_sjoin(struct Client *client_p, struct Client *source_p, int parc, const char return 0; } -struct mode_letter -{ - int mode; - char letter; -}; - -static struct mode_letter flags[] = { - {MODE_NOPRIVMSGS, 'n'}, - {MODE_TOPICLIMIT, 't'}, - {MODE_SECRET, 's'}, - {MODE_MODERATED, 'm'}, - {MODE_INVITEONLY, 'i'}, - {MODE_PRIVATE, 'p'}, - {MODE_REGONLY, 'r'}, - {MODE_EXLIMIT, 'L'}, - {MODE_PERMANENT, 'P'}, - {MODE_NOCOLOR, 'c'}, - {MODE_FREEINVITE, 'g'}, - {MODE_OPMODERATE, 'z'}, - {MODE_FREETARGET, 'F'}, - {MODE_DISFORWARD, 'Q'}, - {0, 0} -}; - static void set_final_mode(struct Mode *mode, struct Mode *oldmode) { @@ -636,30 +606,30 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) int i; /* ok, first get a list of modes we need to add */ - for (i = 0; flags[i].letter; i++) + for (i = 0; chmode_flags[i].letter; i++) { - if((mode->mode & flags[i].mode) && !(oldmode->mode & flags[i].mode)) + if((mode->mode & chmode_flags[i].mode) && !(oldmode->mode & chmode_flags[i].mode)) { if(dir != MODE_ADD) { *mbuf++ = '+'; dir = MODE_ADD; } - *mbuf++ = flags[i].letter; + *mbuf++ = chmode_flags[i].letter; } } /* now the ones we need to remove. */ - for (i = 0; flags[i].letter; i++) + for (i = 0; chmode_flags[i].letter; i++) { - if((oldmode->mode & flags[i].mode) && !(mode->mode & flags[i].mode)) + if((oldmode->mode & chmode_flags[i].mode) && !(mode->mode & chmode_flags[i].mode)) { if(dir != MODE_DEL) { *mbuf++ = '-'; dir = MODE_DEL; } - *mbuf++ = flags[i].letter; + *mbuf++ = chmode_flags[i].letter; } } @@ -680,7 +650,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_DEL; } *mbuf++ = 'k'; - len = ircsprintf(pbuf, "%s ", oldmode->key); + len = rb_sprintf(pbuf, "%s ", oldmode->key); pbuf += len; pargs++; } @@ -710,7 +680,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'l'; - len = ircsprintf(pbuf, "%d ", mode->limit); + len = rb_sprintf(pbuf, "%d ", mode->limit); pbuf += len; pargs++; } @@ -722,7 +692,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'k'; - len = ircsprintf(pbuf, "%s ", mode->key); + len = rb_sprintf(pbuf, "%s ", mode->key); pbuf += len; pargs++; } @@ -734,7 +704,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'j'; - len = ircsprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time); + len = rb_sprintf(pbuf, "%d:%d ", mode->join_num, mode->join_time); pbuf += len; pargs++; } @@ -746,7 +716,7 @@ set_final_mode(struct Mode *mode, struct Mode *oldmode) dir = MODE_ADD; } *mbuf++ = 'f'; - len = ircsprintf(pbuf, "%s ", mode->forward); + len = rb_sprintf(pbuf, "%s ", mode->forward); pbuf += len; pargs++; } @@ -764,7 +734,7 @@ static void remove_our_modes(struct Channel *chptr, struct Client *source_p) { struct membership *msptr; - dlink_node *ptr; + rb_dlink_node *ptr; char lmodebuf[MODEBUFLEN]; char *lpara[MAXMODEPARAMS]; int count = 0; @@ -776,7 +746,7 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p) for (i = 0; i < MAXMODEPARAMS; i++) lpara[i] = NULL; - DLINK_FOREACH(ptr, chptr->members.head) + RB_DLINK_FOREACH(ptr, chptr->members.head) { msptr = ptr->data; @@ -860,23 +830,23 @@ remove_our_modes(struct Channel *chptr, struct Client *source_p) */ static void remove_ban_list(struct Channel *chptr, struct Client *source_p, - dlink_list * list, char c, int cap, int mems) + rb_dlink_list * list, char c, int cap, int mems) { static char lmodebuf[BUFSIZE]; static char lparabuf[BUFSIZE]; struct Ban *banptr; - dlink_node *ptr; - dlink_node *next_ptr; + rb_dlink_node *ptr; + rb_dlink_node *next_ptr; char *pbuf; int count = 0; int cur_len, mlen, plen; pbuf = lparabuf; - cur_len = mlen = ircsprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname); + cur_len = mlen = rb_sprintf(lmodebuf, ":%s MODE %s -", source_p->name, chptr->chname); mbuf = lmodebuf + mlen; - DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) + RB_DLINK_FOREACH_SAFE(ptr, next_ptr, list->head) { banptr = ptr->data; @@ -904,7 +874,7 @@ remove_ban_list(struct Channel *chptr, struct Client *source_p, *mbuf++ = c; cur_len += plen; - pbuf += ircsprintf(pbuf, "%s ", banptr->banstr); + pbuf += rb_sprintf(pbuf, "%s ", banptr->banstr); count++; free_ban(banptr);