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

Comparing:
ircd-hybrid/src/channel.c (file contents), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.2/src/channel.c (file contents), Revision 567 by michael, Thu Apr 27 08:27:30 2006 UTC

# Line 31 | Line 31
31   #include "client.h"
32   #include "common.h"
33   #include "hash.h"
34 + #include "hostmask.h"
35   #include "irc_string.h"
36   #include "sprintf_irc.h"
37   #include "ircd.h"
# Line 190 | Line 191 | send_members(struct Client *client_p, st
191      if (ms->flags & CHFL_CHANOP)
192        tlen++;
193   #ifdef HALFOPS
194 <    if (ms->flags & CHFL_HALFOP)
194 >    else if (ms->flags & CHFL_HALFOP)
195        tlen++;
196   #endif
197      if (ms->flags & CHFL_VOICE)
# Line 206 | Line 207 | send_members(struct Client *client_p, st
207        t = start;
208      }
209  
210 <    strcpy(t, get_member_status(ms, YES));
211 <    t += strlen(t);
210 >    if ((ms->flags & (CHFL_CHANOP | CHFL_HALFOP)))
211 >      *t++ = (!(ms->flags & CHFL_CHANOP) && IsCapable(client_p, CAP_HOPS)) ?
212 >        '%' : '@';
213 >    if ((ms->flags & CHFL_VOICE))
214 >      *t++ = '+';
215  
216      if (IsCapable(client_p, CAP_TS6))
217        strcpy(t, ID(ms->client_p));
# Line 472 | Line 476 | channel_member_names(struct Client *sour
476    char *t = NULL, *start = NULL;
477    int tlen = 0;
478    int is_member = IsMember(source_p, chptr);
479 +  int multi_prefix = (source_p->localClient->cap_active & CAP_MULTI_PREFIX) != 0;
480  
481    if (PubChannel(chptr) || is_member)
482    {
# Line 491 | Line 496 | channel_member_names(struct Client *sour
496  
497        tlen = strlen(target_p->name) + 1;  /* nick + space */
498  
499 <      if (ms->flags & (CHFL_CHANOP | CHFL_HALFOP | CHFL_VOICE))
500 <        ++tlen;
499 >      if (!multi_prefix)
500 >      {
501 >        if (ms->flags & (CHFL_CHANOP | CHFL_HALFOP | CHFL_VOICE))
502 >          ++tlen;
503 >      }
504 >      else
505 >      {
506 >        if (ms->flags & CHFL_CHANOP)
507 >          ++tlen;
508 >        if (ms->flags & CHFL_HALFOP)
509 >          ++tlen;
510 >        if (ms->flags & CHFL_VOICE)
511 >          ++tlen;
512 >      }
513 >
514        if (t + tlen - lbuf > IRCD_BUFSIZE)
515        {
516          *(t - 1) = '\0';
# Line 500 | Line 518 | channel_member_names(struct Client *sour
518          t = start;
519        }
520  
521 <      t += ircsprintf(t, "%s%s ", get_member_status(ms, NO),
521 >      t += ircsprintf(t, "%s%s ", get_member_status(ms, multi_prefix),
522                        target_p->name);
523      }
524  
# Line 528 | Line 546 | add_invite(struct Channel *chptr, struct
546    /*
547     * delete last link in chain if the list is max length
548     */
549 <  if (dlink_list_length(&who->invited) >=
549 >  if (dlink_list_length(&who->localClient->invited) >=
550        ConfigChannel.max_chans_per_user)
551 <    del_invite(who->invited.tail->data, who);
551 >    del_invite(who->localClient->invited.tail->data, who);
552  
553    /* add client to channel invite list */
554    dlinkAdd(who, make_dlink_node(), &chptr->invites);
555  
556    /* add channel to the end of the client invite list */
557 <  dlinkAdd(chptr, make_dlink_node(), &who->invited);
557 >  dlinkAdd(chptr, make_dlink_node(), &who->localClient->invited);
558   }
559  
560   /*! \brief Delete Invite block from channel invite list
# Line 549 | Line 567 | del_invite(struct Channel *chptr, struct
567   {
568    dlink_node *ptr = NULL;
569  
570 <  if ((ptr = dlinkFindDelete(&who->invited, chptr)))
570 >  if ((ptr = dlinkFindDelete(&who->localClient->invited, chptr)))
571      free_dlink_node(ptr);
572  
573    if ((ptr = dlinkFindDelete(&chptr->invites, who)))
# Line 613 | Line 631 | find_bmask(const struct Client *who, con
631  
632    DLINK_FOREACH(ptr, list->head)
633    {
634 <    const struct Ban *bp = ptr->data;
634 >    struct Ban *bp = ptr->data;
635  
636 <    if (match(bp->name, who->name) &&
637 <        match(bp->username, who->username) &&
638 <        (match(bp->host, who->host) ||
639 <         match(bp->host, who->sockhost) ||
640 <         match_cidr(bp->host, who->sockhost)))
641 <      return 1;
636 >    if (match(bp->name, who->name) && match(bp->username, who->username))
637 >    {
638 >      switch (bp->type)
639 >      {
640 >        case HM_HOST:
641 >          if (match(bp->host, who->host) || match(bp->host, who->sockhost))
642 >            return 1;
643 >          break;
644 >        case HM_IPV4:
645 >          if (who->localClient->aftype == AF_INET)
646 >            if (match_ipv4(&who->localClient->ip, &bp->addr, bp->bits))
647 >              return 1;
648 >          break;
649 > #ifdef IPV6
650 >        case HM_IPV6:
651 >          if (who->localClient->aftype == AF_INET6)
652 >            if (match_ipv6(&who->localClient->ip, &bp->addr, bp->bits))
653 >              return 1;
654 >          break;
655 > #endif
656 >        default:
657 >          assert(0);
658 >      }
659 >    }
660    }
661  
662    return 0;
# Line 655 | Line 691 | can_join(struct Client *source_p, struct
691        return ERR_BANNEDFROMCHAN;
692  
693    if (chptr->mode.mode & MODE_INVITEONLY)
694 <    if (!dlinkFind(&source_p->invited, chptr))
694 >    if (!dlinkFind(&source_p->localClient->invited, chptr))
695        if (!ConfigChannel.use_invex || !find_bmask(source_p, &chptr->invexlist))
696          return ERR_INVITEONLYCHAN;
697  
# Line 695 | Line 731 | find_channel_link(struct Client *client_
731   /*!
732   * \param chptr    pointer to Channel struct
733   * \param source_p pointer to Client struct
734 + * \param ms       pointer to Membership struct (can be NULL)
735   * \return CAN_SEND_OPV if op or voiced on channel\n
736   *         CAN_SEND_NONOP if can send to channel but is not an op\n
737   *         CAN_SEND_NO if they cannot send to channel\n
738   */
739   int
740 < can_send(struct Channel *chptr, struct Client *source_p)
740 > can_send(struct Channel *chptr, struct Client *source_p, struct Membership *ms)
741   {
705  struct Membership *ms = NULL;
706
742    if (IsServer(source_p))
743      return CAN_SEND_OPV;
744  
745 <  if (MyClient(source_p) && !IsExemptResv(source_p) &&
746 <      !(IsOper(source_p) && ConfigFileEntry.oper_pass_resv) &&
747 <      (!hash_find_resv(chptr->chname) == ConfigChannel.restrict_channels))
748 <    return CAN_SEND_NO;
745 >  if (MyClient(source_p) && !IsExemptResv(source_p))
746 >    if (!(IsOper(source_p) && ConfigFileEntry.oper_pass_resv))
747 >      if (!hash_find_resv(chptr->chname) == ConfigChannel.restrict_channels)
748 >        return CAN_SEND_NO;
749  
750 <  if ((ms = find_channel_link(source_p, chptr)) == NULL)
716 <  {
717 <    if (chptr->mode.mode & MODE_NOPRIVMSGS)
718 <      return CAN_SEND_NO;
719 <  }
720 <  else
750 >  if (ms != NULL || (ms = find_channel_link(source_p, chptr)))
751    {
752      if (ms->flags & (CHFL_CHANOP|CHFL_HALFOP|CHFL_VOICE))
753        return CAN_SEND_OPV;
# Line 740 | Line 770 | can_send(struct Channel *chptr, struct C
770        }
771      }
772    }
773 <
744 <  if (chptr->mode.mode & MODE_MODERATED)
773 >  else if (chptr->mode.mode & MODE_NOPRIVMSGS)
774      return CAN_SEND_NO;
775  
747  return CAN_SEND_NONOP;
748 }
749
750 /*! \brief Checks to see if given client can send a part message
751 * \param member     pointer to channel membership
752 * \param chptr      pointer to channel struct
753 * \param source_p   pointer to struct Client to check
754 */
755 int
756 can_send_part(struct Membership *member, struct Channel *chptr,
757              struct Client *source_p)
758 {
759  if (has_member_flags(member, CHFL_CHANOP|CHFL_HALFOP))
760    return CAN_SEND_OPV;
761
776    if (chptr->mode.mode & MODE_MODERATED)
777      return CAN_SEND_NO;
778  
765  if (ConfigChannel.quiet_on_ban && MyClient(source_p) &&
766      is_banned(chptr, source_p))
767    return CAN_SEND_NO;
768
779    return CAN_SEND_NONOP;
780   }
781  
# Line 926 | Line 936 | set_channel_topic(struct Channel *chptr,
936    }
937    else
938    {
939 +    /*
940 +     * Do not reset chptr->topic_time here, it's required for
941 +     * bursting topics properly.
942 +     */
943      if (chptr->topic != NULL)
944        free_topic(chptr);
931
932    chptr->topic_time = 0;
945    }
946   }
935

Comparing:
ircd-hybrid/src/channel.c (property svn:keywords), Revision 32 by knight, Sun Oct 2 20:41:23 2005 UTC vs.
ircd-hybrid-7.2/src/channel.c (property svn:keywords), Revision 567 by michael, Thu Apr 27 08:27:30 2006 UTC

# Line 1 | Line 1
1 < Revision
1 > Id Revision

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)