416 |
|
* (don't want it with /names with no params) |
417 |
|
*/ |
418 |
|
void |
419 |
< |
channel_member_names(struct Client *client_p, struct Channel *chptr, int show_eon) |
419 |
> |
channel_member_names(struct Client *client_p, struct Channel *chptr, bool show_eon) |
420 |
|
{ |
421 |
|
dlink_node *node; |
422 |
|
char buf[IRCD_BUFSIZE + 1] = ""; |
423 |
|
char *t = NULL, *start = NULL; |
424 |
|
int tlen = 0; |
425 |
< |
const int is_member = IsMember(client_p, chptr); |
426 |
< |
const int multi_prefix = HasCap(client_p, CAP_MULTI_PREFIX) != 0; |
427 |
< |
const int uhnames = HasCap(client_p, CAP_UHNAMES) != 0; |
425 |
> |
bool is_member = IsMember(client_p, chptr); |
426 |
> |
bool multi_prefix = HasCap(client_p, CAP_MULTI_PREFIX) != 0; |
427 |
> |
bool uhnames = HasCap(client_p, CAP_UHNAMES) != 0; |
428 |
|
|
429 |
|
assert(IsClient(client_p)); |
430 |
|
|
431 |
< |
if (PubChannel(chptr) || is_member) |
431 |
> |
if (PubChannel(chptr) || is_member == true) |
432 |
|
{ |
433 |
|
t = buf + snprintf(buf, sizeof(buf), numeric_form(RPL_NAMREPLY), |
434 |
|
me.name, client_p->name, |
439 |
|
{ |
440 |
|
const struct Membership *member = node->data; |
441 |
|
|
442 |
< |
if (HasUMode(member->client_p, UMODE_INVISIBLE) && !is_member) |
442 |
> |
if (HasUMode(member->client_p, UMODE_INVISIBLE) && is_member == false) |
443 |
|
continue; |
444 |
|
|
445 |
< |
if (uhnames) |
445 |
> |
if (uhnames == true) |
446 |
|
tlen = strlen(member->client_p->name) + strlen(member->client_p->username) + |
447 |
|
strlen(member->client_p->host) + 3; /* +3 for ! + @ + space */ |
448 |
|
else |
449 |
|
tlen = strlen(member->client_p->name) + 1; /* +1 for space */ |
450 |
|
|
451 |
< |
if (multi_prefix) |
451 |
> |
if (multi_prefix == true) |
452 |
|
{ |
453 |
|
if (member->flags & CHFL_CHANOP) |
454 |
|
++tlen; |
470 |
|
t = start; |
471 |
|
} |
472 |
|
|
473 |
< |
if (uhnames) |
473 |
> |
if (uhnames == true) |
474 |
|
t += sprintf(t, "%s%s!%s@%s ", get_member_status(member, multi_prefix), |
475 |
|
member->client_p->name, member->client_p->username, |
476 |
|
member->client_p->host); |
486 |
|
} |
487 |
|
} |
488 |
|
|
489 |
< |
if (show_eon) |
489 |
> |
if (show_eon == true) |
490 |
|
sendto_one_numeric(client_p, &me, RPL_ENDOFNAMES, chptr->name); |
491 |
|
} |
492 |
|
|
580 |
|
* (like in client_get_name) |
581 |
|
*/ |
582 |
|
const char * |
583 |
< |
get_member_status(const struct Membership *member, const int combine) |
583 |
> |
get_member_status(const struct Membership *member, bool combine) |
584 |
|
{ |
585 |
|
static char buffer[CMEMBER_STATUS_FLAGS_LEN + 1]; /* +1 for \0 */ |
586 |
|
char *p = buffer; |
587 |
|
|
588 |
|
if (member->flags & CHFL_CHANOP) |
589 |
|
{ |
590 |
< |
if (!combine) |
590 |
> |
if (combine == false) |
591 |
|
return "@"; |
592 |
|
*p++ = '@'; |
593 |
|
} |
594 |
|
|
595 |
|
if (member->flags & CHFL_HALFOP) |
596 |
|
{ |
597 |
< |
if (!combine) |
597 |
> |
if (combine == false) |
598 |
|
return "%"; |
599 |
|
*p++ = '%'; |
600 |
|
} |
1048 |
|
chptr->topic_info, chptr->topic_time); |
1049 |
|
} |
1050 |
|
|
1051 |
< |
channel_member_names(client_p, chptr, 1); |
1051 |
> |
channel_member_names(client_p, chptr, true); |
1052 |
|
|
1053 |
|
client_p->connection->last_join_time = CurrentTime; |
1054 |
|
} |