X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/2b2e97af7fdb9b456ab168f25a23208b428e4131..c735f9302395b5383733b7c706081e71dd26538a:/src/channel.c diff --git a/src/channel.c b/src/channel.c index d192f26..702038e 100644 --- a/src/channel.c +++ b/src/channel.c @@ -30,8 +30,7 @@ #include "common.h" #include "hash.h" #include "hook.h" -#include "irc_string.h" -#include "sprintf_irc.h" +#include "match.h" #include "ircd.h" #include "numeric.h" #include "s_serv.h" /* captab */ @@ -40,15 +39,7 @@ #include "whowas.h" #include "s_conf.h" /* ConfigFileEntry, ConfigChannel */ #include "s_newconf.h" -#include "s_log.h" - -extern rb_dlink_list global_channel_list; - -extern struct config_channel_entry ConfigChannel; -extern rb_bh *channel_heap; -extern rb_bh *ban_heap; -extern rb_bh *topic_heap; -extern rb_bh *member_heap; +#include "logger.h" static int channel_capabs[] = { CAP_EX, CAP_IE, CAP_SERVICE, @@ -73,10 +64,10 @@ static int h_can_join; void init_channels(void) { - channel_heap = rb_bh_create(sizeof(struct Channel), CHANNEL_HEAP_SIZE); - ban_heap = rb_bh_create(sizeof(struct Ban), BAN_HEAP_SIZE); - topic_heap = rb_bh_create(TOPICLEN + 1 + USERHOST_REPLYLEN, TOPIC_HEAP_SIZE); - member_heap = rb_bh_create(sizeof(struct membership), MEMBER_HEAP_SIZE); + channel_heap = rb_bh_create(sizeof(struct Channel), CHANNEL_HEAP_SIZE, "channel_heap"); + ban_heap = rb_bh_create(sizeof(struct Ban), BAN_HEAP_SIZE, "ban_heap"); + topic_heap = rb_bh_create(TOPICLEN + 1 + USERHOST_REPLYLEN, TOPIC_HEAP_SIZE, "topic_heap"); + member_heap = rb_bh_create(sizeof(struct membership), MEMBER_HEAP_SIZE, "member_heap"); h_can_join = register_hook("can_join"); } @@ -989,7 +980,7 @@ check_splitmode(void *unused) splitmode = 1; sendto_realops_snomask(SNO_GENERAL, L_ALL, "Network split, activating splitmode"); - eventAddIsh("check_splitmode", check_splitmode, NULL, 2); + check_splitmode_ev = rb_event_addish("check_splitmode", check_splitmode, NULL, 2); } } /* in splitmode, check whether its finished */ @@ -1000,7 +991,7 @@ check_splitmode(void *unused) sendto_realops_snomask(SNO_GENERAL, L_ALL, "Network rejoined, deactivating splitmode"); - eventDelete(check_splitmode, NULL); + rb_event_delete(check_splitmode_ev); } } } @@ -1068,8 +1059,8 @@ set_channel_topic(struct Channel *chptr, const char *topic, const char *topic_in { if(chptr->topic == NULL) allocate_topic(chptr); - strlcpy(chptr->topic, topic, TOPICLEN + 1); - strlcpy(chptr->topic_info, topic_info, USERHOST_REPLYLEN); + rb_strlcpy(chptr->topic, topic, TOPICLEN + 1); + rb_strlcpy(chptr->topic_info, topic_info, USERHOST_REPLYLEN); chptr->topic_time = topicts; } else @@ -1080,25 +1071,6 @@ set_channel_topic(struct Channel *chptr, const char *topic, const char *topic_in } } -const struct mode_letter chmode_flags[] = -{ - {MODE_INVITEONLY, 'i'}, - {MODE_MODERATED, 'm'}, - {MODE_NOPRIVMSGS, 'n'}, - {MODE_PRIVATE, 'p'}, - {MODE_SECRET, 's'}, - {MODE_TOPICLIMIT, 't'}, - {MODE_NOCOLOR, 'c'}, - {MODE_FREEINVITE, 'g'}, - {MODE_OPMODERATE, 'z'}, - {MODE_EXLIMIT, 'L'}, - {MODE_PERMANENT, 'P'}, - {MODE_FREETARGET, 'F'}, - {MODE_DISFORWARD, 'Q'}, - {MODE_REGONLY, 'r'}, - {0, '\0'} -}; - /* channel_modes() * * inputs - pointer to channel @@ -1121,9 +1093,9 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf++ = '+'; *pbuf = '\0'; - for (i = 0; chmode_flags[i].mode; ++i) - if(chptr->mode.mode & chmode_flags[i].mode) - *mbuf++ = chmode_flags[i].letter; + for (i = 0; i < 256; i++) + if(chptr->mode.mode & chmode_flags[i]) + *mbuf++ = i; if(chptr->mode.limit) { @@ -1160,8 +1132,8 @@ channel_modes(struct Channel *chptr, struct Client *client_p) *mbuf = '\0'; - strlcpy(final, buf1, sizeof final); - strlcat(final, buf2, sizeof final); + rb_strlcpy(final, buf1, sizeof final); + rb_strlcat(final, buf2, sizeof final); return final; } @@ -1304,13 +1276,9 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, cap = chcap_combos[j].cap_yes; nocap = chcap_combos[j].cap_no; - if(cap & CAP_TS6) - mbl = preflen = rb_sprintf(modebuf, ":%s TMODE %ld %s ", - use_id(source_p), (long) chptr->channelts, - chptr->chname); - else - mbl = preflen = rb_sprintf(modebuf, ":%s MODE %s ", - source_p->name, chptr->chname); + mbl = preflen = rb_sprintf(modebuf, ":%s TMODE %ld %s ", + use_id(source_p), (long) chptr->channelts, + chptr->chname); /* loop the list of - modes we have */ for (i = 0; i < mode_count; i++) @@ -1324,7 +1292,7 @@ send_cap_mode_changes(struct Client *client_p, struct Client *source_p, || ((nocap & mode_changes[i].nocaps) != mode_changes[i].nocaps)) continue; - if((cap & CAP_TS6) && !EmptyString(mode_changes[i].id)) + if(!EmptyString(mode_changes[i].id)) arg = mode_changes[i].id; else arg = mode_changes[i].arg;