164 |
|
{ |
165 |
|
const struct Membership *ms = ptr->data; |
166 |
|
|
167 |
< |
tlen = strlen(IsCapable(client_p, CAP_TS6) ? |
168 |
< |
ID(ms->client_p) : ms->client_p->name) + 1; /* nick + space */ |
167 |
> |
tlen = strlen(ID(ms->client_p)) + 1; /* nick + space */ |
168 |
|
|
169 |
|
if (ms->flags & CHFL_CHANOP) |
170 |
|
tlen++; |
171 |
|
#ifdef HALFOPS |
172 |
< |
else if (ms->flags & CHFL_HALFOP) |
172 |
> |
if (ms->flags & CHFL_HALFOP) |
173 |
|
tlen++; |
174 |
|
#endif |
175 |
|
if (ms->flags & CHFL_VOICE) |
185 |
|
t = start; |
186 |
|
} |
187 |
|
|
188 |
< |
if ((ms->flags & (CHFL_CHANOP | CHFL_HALFOP))) |
189 |
< |
*t++ = (!(ms->flags & CHFL_CHANOP) && IsCapable(client_p, CAP_HOPS)) ? |
190 |
< |
'%' : '@'; |
191 |
< |
if ((ms->flags & CHFL_VOICE)) |
188 |
> |
if (ms->flags & CHFL_CHANOP) |
189 |
> |
*t++ = '@'; |
190 |
> |
if (ms->flags & CHFL_HALFOP) |
191 |
> |
*t++ = '%'; |
192 |
> |
if (ms->flags & CHFL_VOICE) |
193 |
|
*t++ = '+'; |
194 |
|
|
195 |
< |
if (IsCapable(client_p, CAP_TS6)) |
196 |
< |
strcpy(t, ID(ms->client_p)); |
197 |
< |
else |
198 |
< |
strcpy(t, ms->client_p->name); |
195 |
> |
strcpy(t, ID(ms->client_p)); |
196 |
> |
|
197 |
|
t += strlen(t); |
198 |
|
*t++ = ' '; |
199 |
|
} |
215 |
|
send_mode_list(struct Client *client_p, struct Channel *chptr, |
216 |
|
const dlink_list *top, char flag) |
217 |
|
{ |
220 |
– |
int ts5 = !IsCapable(client_p, CAP_TS6); |
218 |
|
const dlink_node *lp = NULL; |
219 |
|
char pbuf[IRCD_BUFSIZE]; |
220 |
|
int tlen, mlen, cur_len, count = 0; |
221 |
< |
char *mp = NULL, *pp = pbuf; |
221 |
> |
char *pp = pbuf; |
222 |
|
|
223 |
|
if (top == NULL || top->length == 0) |
224 |
|
return; |
225 |
|
|
226 |
< |
if (ts5) |
227 |
< |
mlen = snprintf(buf, sizeof(buf), ":%s MODE %s +", me.name, chptr->chname); |
228 |
< |
else |
232 |
< |
mlen = snprintf(buf, sizeof(buf), ":%s BMASK %lu %s %c :", me.id, |
233 |
< |
(unsigned long)chptr->channelts, chptr->chname, flag); |
234 |
< |
|
235 |
< |
/* MODE needs additional one byte for space between buf and pbuf */ |
236 |
< |
cur_len = mlen + ts5; |
237 |
< |
mp = buf + mlen; |
226 |
> |
mlen = snprintf(buf, sizeof(buf), ":%s BMASK %lu %s %c :", me.id, |
227 |
> |
(unsigned long)chptr->channelts, chptr->chname, flag); |
228 |
> |
cur_len = mlen; |
229 |
|
|
230 |
|
DLINK_FOREACH(lp, top->head) |
231 |
|
{ |
232 |
|
const struct Ban *banptr = lp->data; |
233 |
|
|
234 |
< |
/* must add another b/e/I letter if we use MODE */ |
244 |
< |
tlen = banptr->len + 3 + ts5; |
234 |
> |
tlen = banptr->len + 3; |
235 |
|
|
236 |
|
/* |
237 |
|
* send buffer and start over if we cannot fit another ban, |
238 |
|
* or if the target is non-ts6 and we have too many modes in |
239 |
|
* in this line. |
240 |
|
*/ |
241 |
< |
if (cur_len + (tlen - 1) > IRCD_BUFSIZE - 2 || |
252 |
< |
(!IsCapable(client_p, CAP_TS6) && |
253 |
< |
(count >= MAXMODEPARAMS || pp - pbuf >= MODEBUFLEN))) |
241 |
> |
if (cur_len + (tlen - 1) > IRCD_BUFSIZE - 2) |
242 |
|
{ |
243 |
|
*(pp - 1) = '\0'; /* get rid of trailing space on buffer */ |
244 |
< |
sendto_one(client_p, "%s%s%s", buf, ts5 ? " " : "", pbuf); |
244 |
> |
sendto_one(client_p, "%s%s", buf, pbuf); |
245 |
|
|
246 |
< |
cur_len = mlen + ts5; |
259 |
< |
mp = buf + mlen; |
246 |
> |
cur_len = mlen; |
247 |
|
pp = pbuf; |
248 |
|
count = 0; |
249 |
|
} |
250 |
|
|
251 |
|
count++; |
265 |
– |
if (ts5) |
266 |
– |
{ |
267 |
– |
*mp++ = flag; |
268 |
– |
*mp = '\0'; |
269 |
– |
} |
270 |
– |
|
252 |
|
pp += sprintf(pp, "%s!%s@%s ", banptr->name, banptr->user, |
253 |
|
banptr->host); |
254 |
|
cur_len += tlen; |
255 |
|
} |
256 |
|
|
257 |
|
*(pp - 1) = '\0'; /* get rid of trailing space on buffer */ |
258 |
< |
sendto_one(client_p, "%s%s%s", buf, ts5 ? " " : "", pbuf); |
258 |
> |
sendto_one(client_p, "%s%s", buf, pbuf); |
259 |
|
} |
260 |
|
|
261 |
|
/*! \brief send "client_p" a full list of the modes for channel chptr |
419 |
|
|
420 |
|
if (PubChannel(chptr) || is_member) |
421 |
|
{ |
422 |
< |
t = lbuf + snprintf(lbuf, sizeof(lbuf), form_str(RPL_NAMREPLY), |
422 |
> |
t = lbuf + snprintf(lbuf, sizeof(lbuf), numeric_form(RPL_NAMREPLY), |
423 |
|
me.name, source_p->name, |
424 |
|
channel_pub_or_secret(chptr), chptr->chname); |
425 |
|
start = t; |
476 |
|
} |
477 |
|
|
478 |
|
if (show_eon) |
479 |
< |
sendto_one(source_p, form_str(RPL_ENDOFNAMES), me.name, |
499 |
< |
source_p->name, chptr->chname); |
479 |
> |
sendto_one_numeric(source_p, &me, RPL_ENDOFNAMES, chptr->chname); |
480 |
|
} |
481 |
|
|
482 |
|
/*! \brief adds client to invite list |