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/trunk/src/channel.c (file contents):
Revision 1858 by michael, Thu Apr 25 15:00:52 2013 UTC vs.
Revision 2148 by michael, Fri May 31 17:18:20 2013 UTC

# Line 544 | Line 544 | del_invite(struct Channel *chptr, struct
544   * (like in get_client_name)
545   */
546   const char *
547 < get_member_status(const struct Membership *ms, int combine)
547 > get_member_status(const struct Membership *ms, const int combine)
548   {
549    static char buffer[4];
550 <  char *p = NULL;
551 <
552 <  if (ms == NULL)
553 <    return "";
554 <  p = buffer;
550 >  char *p = buffer;
551  
552    if (ms->flags & CHFL_CHANOP)
553    {
# Line 651 | Line 647 | can_join(struct Client *source_p, struct
647   #ifdef HAVE_LIBCRYPTO
648    if ((chptr->mode.mode & MODE_SSLONLY) && !source_p->localClient->fd.ssl)
649      return ERR_SSLONLYCHAN;
650 + #else
651 +  if ((chptr->mode.mode & MODE_SSLONLY))
652 +    return ERR_SSLONLYCHAN;
653   #endif
654  
655    if ((chptr->mode.mode & MODE_REGONLY) && !HasUMode(source_p, UMODE_REGISTERED))
# Line 697 | Line 696 | find_channel_link(struct Client *client_
696    return NULL;
697   }
698  
699 + /*
700 + * Basically the same functionality as in bahamut
701 + */
702 + static int
703 + msg_has_ctrls(const char *message)
704 + {
705 +  const unsigned char *p = (const unsigned char *)message;
706 +
707 +  for (; *p; ++p)
708 +  {
709 +    if (*p > 31 || *p == 1)
710 +      continue;
711 +
712 +    if (*p == 27)
713 +    {
714 +      if (*(p + 1) == '$' ||
715 +          *(p + 1) == '(')
716 +      {
717 +        ++p;
718 +        continue;
719 +      }
720 +    }
721 +
722 +    return 1;
723 +  }
724 +
725 +  return 0;
726 + }
727 +
728   /*!
729   * \param chptr    pointer to Channel struct
730   * \param source_p pointer to Client struct
# Line 706 | Line 734 | find_channel_link(struct Client *client_
734   *         ERR_CANNOTSENDTOCHAN or ERR_NEEDREGGEDNICK if they cannot send to channel\n
735   */
736   int
737 < can_send(struct Channel *chptr, struct Client *source_p, struct Membership *ms)
737 > can_send(struct Channel *chptr, struct Client *source_p,
738 >         struct Membership *ms, const char *message)
739   {
740    struct MaskItem *conf = NULL;
741  
# Line 718 | Line 747 | can_send(struct Channel *chptr, struct C
747        if ((conf = match_find_resv(chptr->chname)) && !resv_find_exempt(source_p, conf))
748          return ERR_CANNOTSENDTOCHAN;
749  
750 <  if (ms != NULL || (ms = find_channel_link(source_p, chptr)))
751 <  {
750 >  if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(message))
751 >    return ERR_NOCTRLSONCHAN;
752 >  if (ms || (ms = find_channel_link(source_p, chptr)))
753      if (ms->flags & (CHFL_CHANOP|CHFL_HALFOP|CHFL_VOICE))
754        return CAN_SEND_OPV;
755 +  if (chptr->mode.mode & MODE_MODERATED)
756 +    return ERR_CANNOTSENDTOCHAN;
757 +  if ((chptr->mode.mode & MODE_MODREG) && !HasUMode(source_p, UMODE_REGISTERED))
758 +    return ERR_NEEDREGGEDNICK;
759  
760 <    /* cache can send if quiet_on_ban and banned */
761 <    if (ConfigChannel.quiet_on_ban && MyClient(source_p))
760 >  /* cache can send if banned */
761 >  if (MyClient(source_p))
762 >  {
763 >    if (ms)
764      {
765        if (ms->flags & CHFL_BAN_SILENCED)
766          return ERR_CANNOTSENDTOCHAN;
# Line 740 | Line 776 | can_send(struct Channel *chptr, struct C
776          ms->flags |= CHFL_BAN_CHECKED;
777        }
778      }
779 +    else if (is_banned(chptr, source_p))
780 +      return ERR_CANNOTSENDTOCHAN;
781    }
744 –  else if (chptr->mode.mode & MODE_NOPRIVMSGS)
745 –    return ERR_CANNOTSENDTOCHAN;
746 –
747 –  if (chptr->mode.mode & MODE_MODERATED)
748 –    return ERR_CANNOTSENDTOCHAN;
782  
783    return CAN_SEND_NONOP;
784   }

Diff Legend

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