226 |
|
else if (keep_our_modes) |
227 |
|
{ |
228 |
|
mode.mode |= oldmode->mode; |
229 |
+ |
|
230 |
|
if (oldmode->limit > mode.limit) |
231 |
|
mode.limit = oldmode->limit; |
232 |
|
if (strcmp(mode.key, oldmode->key) < 0) |
233 |
|
strcpy(mode.key, oldmode->key); |
234 |
|
} |
235 |
+ |
|
236 |
|
set_final_mode(&mode, oldmode); |
237 |
|
chptr->mode = mode; |
238 |
|
|
264 |
|
servername, chptr->chname, modebuf, parabuf); |
265 |
|
} |
266 |
|
|
267 |
< |
if (parv[3][0] != '0' && keep_new_modes) |
267 |
> |
if (*parv[3] != '0' && keep_new_modes) |
268 |
|
channel_modes(chptr, source_p, modebuf, parabuf); |
269 |
|
else |
270 |
|
{ |
297 |
|
s = parv[args + 4]; |
298 |
|
while (*s == ' ') |
299 |
|
s++; |
300 |
< |
if ((p = strchr(s, ' ')) != NULL) |
300 |
> |
|
301 |
> |
if ((p = strchr(s, ' '))) |
302 |
|
{ |
303 |
|
*p++ = '\0'; |
304 |
|
while (*p == ' ') |
423 |
|
sptr = sendbuf; |
424 |
|
*mbuf = '\0'; |
425 |
|
|
426 |
< |
for(lcount = 0; lcount < MAXMODEPARAMS; lcount++) |
426 |
> |
for (lcount = 0; lcount < MAXMODEPARAMS; ++lcount) |
427 |
|
{ |
428 |
|
slen = sprintf(sptr, " %s", para[lcount]); /* see? */ |
429 |
|
sptr += slen; /* ready for next */ |
430 |
|
} |
431 |
+ |
|
432 |
|
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s", |
433 |
|
servername, chptr->chname, modebuf, sendbuf); |
434 |
|
mbuf = modebuf; |
448 |
|
{ |
449 |
|
sptr = sendbuf; |
450 |
|
*mbuf = '\0'; |
451 |
< |
for(lcount = 0; lcount < MAXMODEPARAMS; lcount++) |
451 |
> |
|
452 |
> |
for (lcount = 0; lcount < MAXMODEPARAMS; ++lcount) |
453 |
|
{ |
454 |
|
slen = sprintf(sptr, " %s", para[lcount]); |
455 |
|
sptr += slen; |
456 |
|
} |
457 |
+ |
|
458 |
|
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s", |
459 |
|
servername, chptr->chname, modebuf, sendbuf); |
460 |
|
|
475 |
|
{ |
476 |
|
sptr = sendbuf; |
477 |
|
*mbuf = '\0'; |
478 |
< |
for (lcount = 0; lcount < MAXMODEPARAMS; lcount++) |
478 |
> |
|
479 |
> |
for (lcount = 0; lcount < MAXMODEPARAMS; ++lcount) |
480 |
|
{ |
481 |
|
slen = sprintf(sptr, " %s", para[lcount]); |
482 |
|
sptr += slen; |
483 |
|
} |
484 |
+ |
|
485 |
|
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s", |
486 |
|
servername, chptr->chname, modebuf, sendbuf); |
487 |
|
|
496 |
|
nextnick: |
497 |
|
if ((s = p) == NULL) |
498 |
|
break; |
499 |
+ |
|
500 |
|
while (*s == ' ') |
501 |
< |
s++; |
502 |
< |
if ((p = strchr(s, ' ')) != NULL) |
501 |
> |
++s; |
502 |
> |
|
503 |
> |
if ((p = strchr(s, ' '))) |
504 |
|
{ |
505 |
< |
*p++ = 0; |
505 |
> |
*p++ = '\0'; |
506 |
> |
|
507 |
|
while (*p == ' ') |
508 |
< |
p++; |
508 |
> |
++p; |
509 |
|
} |
510 |
|
} |
511 |
|
|
520 |
|
* - Dianora |
521 |
|
*/ |
522 |
|
|
523 |
< |
if (pargs != 0) |
523 |
> |
if (pargs) |
524 |
|
{ |
525 |
|
sptr = sendbuf; |
526 |
|
|
527 |
< |
for (lcount = 0; lcount < pargs; lcount++) |
527 |
> |
for (lcount = 0; lcount < pargs; ++lcount) |
528 |
|
{ |
529 |
|
slen = sprintf(sptr, " %s", para[lcount]); |
530 |
|
sptr += slen; |
531 |
|
} |
532 |
|
|
533 |
|
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s", |
534 |
< |
servername, chptr->chname, modebuf, sendbuf); |
534 |
> |
servername, chptr->chname, modebuf, sendbuf); |
535 |
|
} |
536 |
|
|
537 |
|
/* If this happens, its the result of a malformed SJOIN |
541 |
|
* - Dianora |
542 |
|
*/ |
543 |
|
|
544 |
< |
if ((dlink_list_length(&chptr->members) == 0) && isnew) |
544 |
> |
if (!dlink_list_length(&chptr->members) && isnew) |
545 |
|
{ |
546 |
|
destroy_channel(chptr); |
547 |
|
return 0; |
548 |
|
} |
549 |
|
|
550 |
< |
if (parv[4 + args][0] == '\0') |
550 |
> |
if (*parv[4 + args] == '\0') |
551 |
|
return 0; |
552 |
|
|
553 |
|
sendto_server(source_p, NOCAPS, NOCAPS, "%s", uid_buf); |
554 |
|
|
555 |
|
if (!keep_our_modes) |
556 |
|
{ |
557 |
< |
if (dlink_list_length(&chptr->banlist) > 0) |
557 |
> |
if (dlink_list_length(&chptr->banlist)) |
558 |
|
remove_ban_list(chptr, source_p, &chptr->banlist, 'b'); |
559 |
|
|
560 |
< |
if (dlink_list_length(&chptr->exceptlist) > 0) |
560 |
> |
if (dlink_list_length(&chptr->exceptlist)) |
561 |
|
remove_ban_list(chptr, source_p, &chptr->exceptlist, 'e'); |
562 |
|
|
563 |
< |
if (dlink_list_length(&chptr->invexlist) > 0) |
563 |
> |
if (dlink_list_length(&chptr->invexlist)) |
564 |
|
remove_ban_list(chptr, source_p, &chptr->invexlist, 'I'); |
565 |
|
clear_ban_cache(chptr); |
566 |
|
} |
588 |
|
*mbuf++ = '-'; |
589 |
|
|
590 |
|
for (tab = chan_modes; tab->letter; ++tab) |
580 |
– |
{ |
591 |
|
if ((tab->mode & oldmode->mode) && |
592 |
|
!(tab->mode & mode->mode)) |
593 |
|
*mbuf++ = tab->letter; |
584 |
– |
} |
594 |
|
|
595 |
< |
if (oldmode->limit != 0 && mode->limit == 0) |
595 |
> |
if (oldmode->limit && mode->limit == 0) |
596 |
|
*mbuf++ = 'l'; |
597 |
|
|
598 |
|
if (oldmode->key[0] && !mode->key[0]) |
603 |
|
pargs++; |
604 |
|
} |
605 |
|
|
606 |
< |
if (*(mbuf-1) == '-') |
607 |
< |
*(mbuf-1) = '+'; |
606 |
> |
if (*(mbuf - 1) == '-') |
607 |
> |
*(mbuf - 1) = '+'; |
608 |
|
else |
609 |
|
*mbuf++ = '+'; |
610 |
|
|
611 |
|
for (tab = chan_modes; tab->letter; ++tab) |
603 |
– |
{ |
612 |
|
if ((tab->mode & mode->mode) && |
613 |
|
!(tab->mode & oldmode->mode)) |
614 |
|
*mbuf++ = tab->letter; |
607 |
– |
} |
615 |
|
|
616 |
< |
if (mode->limit != 0 && oldmode->limit != mode->limit) |
616 |
> |
if (mode->limit && oldmode->limit != mode->limit) |
617 |
|
{ |
618 |
|
*mbuf++ = 'l'; |
619 |
|
len = sprintf(pbuf, "%d ", mode->limit); |
628 |
|
pbuf += len; |
629 |
|
pargs++; |
630 |
|
} |
631 |
< |
if (*(mbuf-1) == '+') |
632 |
< |
*(mbuf-1) = '\0'; |
631 |
> |
|
632 |
> |
if (*(mbuf - 1) == '+') |
633 |
> |
*(mbuf - 1) = '\0'; |
634 |
|
else |
635 |
|
*mbuf = '\0'; |
636 |
|
} |
666 |
|
remove_a_mode(struct Channel *chptr, struct Client *source_p, |
667 |
|
int mask, char flag) |
668 |
|
{ |
669 |
< |
dlink_node *ptr; |
662 |
< |
struct Membership *ms; |
669 |
> |
dlink_node *ptr = NULL; |
670 |
|
char lmodebuf[MODEBUFLEN]; |
671 |
< |
char *sp=sendbuf; |
671 |
> |
char *sp = sendbuf; |
672 |
|
const char *lpara[MAXMODEPARAMS]; |
673 |
|
int count = 0; |
674 |
|
int i; |
680 |
|
|
681 |
|
DLINK_FOREACH(ptr, chptr->members.head) |
682 |
|
{ |
683 |
< |
ms = ptr->data; |
683 |
> |
struct Membership *ms = ptr->data; |
684 |
|
|
685 |
|
if ((ms->flags & mask) == 0) |
686 |
|
continue; |
693 |
|
|
694 |
|
if (count >= MAXMODEPARAMS) |
695 |
|
{ |
696 |
< |
for(i = 0; i < MAXMODEPARAMS; i++) |
696 |
> |
for (i = 0; i < MAXMODEPARAMS; ++i) |
697 |
|
{ |
698 |
|
l = sprintf(sp, " %s", lpara[i]); |
699 |
|
sp += l; |
712 |
|
} |
713 |
|
} |
714 |
|
|
715 |
< |
if (count != 0) |
715 |
> |
if (count) |
716 |
|
{ |
717 |
|
*mbuf = '\0'; |
718 |
< |
for(i = 0; i < count; i++) |
718 |
> |
|
719 |
> |
for (i = 0; i < count; ++i) |
720 |
|
{ |
721 |
|
l = sprintf(sp, " %s", lpara[i]); |
722 |
|
sp += l; |
723 |
|
} |
724 |
+ |
|
725 |
|
sendto_channel_local(ALL_MEMBERS, 0, chptr, ":%s MODE %s %s%s", |
726 |
|
(IsHidden(source_p) || ConfigServerHide.hide_servers) ? |
727 |
|
me.name : source_p->name, |
758 |
|
banptr = ptr->data; |
759 |
|
|
760 |
|
plen = banptr->len + 4; /* another +b and "!@ " */ |
761 |
+ |
|
762 |
|
if (count >= MAXMODEPARAMS || |
763 |
|
(cur_len + 1 /* space between */ + (plen - 1)) > IRCD_BUFSIZE - 2) |
764 |
|
{ |