ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/src/channel.c
(Generate patch)

Comparing ircd-hybrid/branches/8.2.x/src/channel.c (file contents):
Revision 8621 by michael, Sat Nov 3 17:46:51 2018 UTC vs.
Revision 8655 by michael, Sun Nov 11 20:18:54 2018 UTC

# Line 416 | Line 416 | channel_pub_or_secret(const struct Chann
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,
# Line 439 | Line 439 | channel_member_names(struct Client *clie
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;
# Line 470 | Line 470 | channel_member_names(struct Client *clie
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);
# Line 486 | Line 486 | channel_member_names(struct Client *clie
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  
# Line 580 | Line 580 | clear_invite_list(dlink_list *list)
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    }
# Line 1048 | Line 1048 | channel_do_join(struct Client *client_p,
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    }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines