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 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid-7.2/src/channel.c (file contents), Revision 454 by michael, Sun Feb 12 19:01:25 2006 UTC

# Line 21 | Line 21
21  
22   /*! \file channel.c
23   * \brief Responsible for managing channels, members, bans and topics
24 < * \version $Id: channel.c,v 7.459 2005/09/27 20:15:54 adx Exp $
24 > * \version $Id$
25   */
26  
27   #include "stdinc.h"
# 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 528 | Line 532 | add_invite(struct Channel *chptr, struct
532    /*
533     * delete last link in chain if the list is max length
534     */
535 <  if (dlink_list_length(&who->invited) >=
535 >  if (dlink_list_length(&who->localClient->invited) >=
536        ConfigChannel.max_chans_per_user)
537 <    del_invite(who->invited.tail->data, who);
537 >    del_invite(who->localClient->invited.tail->data, who);
538  
539    /* add client to channel invite list */
540    dlinkAdd(who, make_dlink_node(), &chptr->invites);
541  
542    /* add channel to the end of the client invite list */
543 <  dlinkAdd(chptr, make_dlink_node(), &who->invited);
543 >  dlinkAdd(chptr, make_dlink_node(), &who->localClient->invited);
544   }
545  
546   /*! \brief Delete Invite block from channel invite list
# Line 549 | Line 553 | del_invite(struct Channel *chptr, struct
553   {
554    dlink_node *ptr = NULL;
555  
556 <  if ((ptr = dlinkFindDelete(&who->invited, chptr)))
556 >  if ((ptr = dlinkFindDelete(&who->localClient->invited, chptr)))
557      free_dlink_node(ptr);
558  
559    if ((ptr = dlinkFindDelete(&chptr->invites, who)))
# Line 613 | Line 617 | find_bmask(const struct Client *who, con
617  
618    DLINK_FOREACH(ptr, list->head)
619    {
620 <    const struct Ban *bp = ptr->data;
620 >    struct Ban *bp = ptr->data;
621  
622 <    if (match(bp->name, who->name) &&
623 <        match(bp->username, who->username) &&
624 <        (match(bp->host, who->host) ||
625 <         match(bp->host, who->sockhost) ||
626 <         match_cidr(bp->host, who->sockhost)))
627 <      return 1;
622 >    if (match(bp->name, who->name) && match(bp->username, who->username))
623 >    {
624 >      switch (bp->type)
625 >      {
626 >        case HM_HOST:
627 >          if (match(bp->host, who->host) || match(bp->host, who->sockhost))
628 >            return 1;
629 >          break;
630 >        case HM_IPV4:
631 >          if (who->localClient->aftype == AF_INET)
632 >            if (match_ipv4(&who->localClient->ip, &bp->addr, bp->bits))
633 >              return 1;
634 >          break;
635 > #ifdef IPV6
636 >        case HM_IPV6:
637 >          if (who->localClient->aftype == AF_INET6)
638 >            if (match_ipv6(&who->localClient->ip, &bp->addr, bp->bits))
639 >              return 1;
640 >          break;
641 > #endif
642 >        default:
643 >          assert(0);
644 >      }
645 >    }
646    }
647  
648    return 0;
# Line 655 | Line 677 | can_join(struct Client *source_p, struct
677        return ERR_BANNEDFROMCHAN;
678  
679    if (chptr->mode.mode & MODE_INVITEONLY)
680 <    if (!dlinkFind(&source_p->invited, chptr))
680 >    if (!dlinkFind(&source_p->localClient->invited, chptr))
681        if (!ConfigChannel.use_invex || !find_bmask(source_p, &chptr->invexlist))
682          return ERR_INVITEONLYCHAN;
683  
# Line 695 | Line 717 | find_channel_link(struct Client *client_
717   /*!
718   * \param chptr    pointer to Channel struct
719   * \param source_p pointer to Client struct
720 + * \param ms       pointer to Membership struct (can be NULL)
721   * \return CAN_SEND_OPV if op or voiced on channel\n
722   *         CAN_SEND_NONOP if can send to channel but is not an op\n
723   *         CAN_SEND_NO if they cannot send to channel\n
724   */
725   int
726 < can_send(struct Channel *chptr, struct Client *source_p)
726 > can_send(struct Channel *chptr, struct Client *source_p, struct Membership *ms)
727   {
705  struct Membership *ms = NULL;
706
728    if (IsServer(source_p))
729      return CAN_SEND_OPV;
730  
# Line 712 | Line 733 | can_send(struct Channel *chptr, struct C
733        (!hash_find_resv(chptr->chname) == ConfigChannel.restrict_channels))
734      return CAN_SEND_NO;
735  
736 <  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
736 >  if (ms != NULL || (ms = find_channel_link(source_p, chptr)))
737    {
738      if (ms->flags & (CHFL_CHANOP|CHFL_HALFOP|CHFL_VOICE))
739        return CAN_SEND_OPV;
# Line 741 | Line 757 | can_send(struct Channel *chptr, struct C
757      }
758    }
759  
760 <  if (chptr->mode.mode & MODE_MODERATED)
745 <    return CAN_SEND_NO;
746 <
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 <
762 <  if (chptr->mode.mode & MODE_MODERATED)
763 <    return CAN_SEND_NO;
764 <
765 <  if (ConfigChannel.quiet_on_ban && MyClient(source_p) &&
766 <      is_banned(chptr, source_p))
760 >  if (chptr->mode.mode & (MODE_MODERATED|MODE_NOPRIVMSGS))
761      return CAN_SEND_NO;
762  
763    return CAN_SEND_NONOP;
# Line 926 | Line 920 | set_channel_topic(struct Channel *chptr,
920    }
921    else
922    {
923 +    /*
924 +     * Do not reset chptr->topic_time here, it's required for
925 +     * bursting topics properly.
926 +     */
927      if (chptr->topic != NULL)
928        free_topic(chptr);
931
932    chptr->topic_time = 0;
929    }
930   }
935

Comparing:
ircd-hybrid/src/channel.c (property svn:keywords), Revision 30 by adx, Sun Oct 2 20:03:27 2005 UTC vs.
ircd-hybrid-7.2/src/channel.c (property svn:keywords), Revision 454 by michael, Sun Feb 12 19:01:25 2006 UTC

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

Diff Legend

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