X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/f0356d2a6f6447caa632667a04d4f5f0020a90d0..8b7110d6ba07591bdad87a4cccdcad47d5c80147:/ircd/s_serv.c diff --git a/ircd/s_serv.c b/ircd/s_serv.c index 83511349..7ce1daf2 100644 --- a/ircd/s_serv.c +++ b/ircd/s_serv.c @@ -474,13 +474,8 @@ burst_ban(struct Client *client_p) { rb_dlink_node *ptr; struct ConfItem *aconf; - const char *type, *oper; - /* +5 for !,@,{,} and null */ - char operbuf[NICKLEN + USERLEN + HOSTLEN + HOSTLEN + 5]; - char *p; - size_t melen; + const char *type; - melen = strlen(me.name); RB_DLINK_FOREACH(ptr, prop_bans.head) { aconf = ptr->data; @@ -498,24 +493,6 @@ burst_ban(struct Client *client_p) default: continue; } - oper = aconf->info.oper; - if(aconf->flags & CONF_FLAGS_MYOPER) - { - /* Our operator{} names may not be meaningful - * to other servers, so rewrite to our server - * name. - */ - rb_strlcpy(operbuf, aconf->info.oper, sizeof operbuf); - p = strrchr(operbuf, '{'); - if (p != NULL && - operbuf + sizeof operbuf - p > (ptrdiff_t)(melen + 2)) - { - memcpy(p + 1, me.name, melen); - p[melen + 1] = '}'; - p[melen + 2] = '\0'; - oper = operbuf; - } - } sendto_one(client_p, ":%s BAN %s %s %s %lu %d %d %s :%s%s%s", me.id, type, @@ -523,7 +500,7 @@ burst_ban(struct Client *client_p) (unsigned long)aconf->created, (int)(aconf->hold - aconf->created), (int)(aconf->lifetime - aconf->created), - oper, + aconf->info.oper, aconf->passwd, aconf->spasswd ? "|" : "", aconf->spasswd ? aconf->spasswd : ""); @@ -542,51 +519,26 @@ burst_modes_TS6(struct Client *client_p, struct Channel *chptr, { rb_dlink_node *ptr; struct Ban *banptr; - char *t; - int tlen; - int mlen; - int cur_len; - cur_len = mlen = sprintf(buf, ":%s BMASK %ld %s %c :", - me.id, (long) chptr->channelts, chptr->chname, flag); - t = buf + mlen; + send_multiline_init(client_p, " ", ":%s BMASK %ld %s %c :", + me.id, + (long)chptr->channelts, + chptr->chname, + flag); RB_DLINK_FOREACH_PREV(ptr, list->tail) { banptr = ptr->data; - tlen = strlen(banptr->banstr) + (banptr->forward ? strlen(banptr->forward) + 1 : 0) + 1; - - /* uh oh */ - if(cur_len + tlen > BUFSIZE - 3) - { - /* the one we're trying to send doesnt fit at all! */ - if(cur_len == mlen) - { - s_assert(0); - continue; - } - - /* chop off trailing space and send.. */ - *(t-1) = '\0'; - sendto_one(client_p, "%s", buf); - cur_len = mlen; - t = buf + mlen; - } - if (banptr->forward) - sprintf(t, "%s$%s ", banptr->banstr, banptr->forward); + send_multiline_item(client_p, "%s$%s", + banptr->banstr, + banptr->forward); else - sprintf(t, "%s ", banptr->banstr); - t += tlen; - cur_len += tlen; + send_multiline_item(client_p, "%s", banptr->banstr); } - /* cant ever exit the loop above without having modified buf, - * chop off trailing space and send. - */ - *(t-1) = '\0'; - sendto_one(client_p, "%s", buf); + send_multiline_fini(client_p, NULL); } /* @@ -670,11 +622,18 @@ burst_TS6(struct Client *client_p) use_id(target_p), target_p->user->away); - if(IsOper(target_p) && target_p->user && target_p->user->opername && target_p->user->privset) - sendto_one(client_p, ":%s OPER %s %s", - use_id(target_p), - target_p->user->opername, - target_p->user->privset->name); + if (IsOper(target_p) && target_p->user && target_p->user->opername) + { + if (target_p->user->privset) + sendto_one(client_p, ":%s OPER %s %s", + use_id(target_p), + target_p->user->opername, + target_p->user->privset->name); + else + sendto_one(client_p, ":%s OPER %s", + use_id(target_p), + target_p->user->opername); + } hclientinfo.target = target_p; call_hook(h_burst_client, &hclientinfo);