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 1936 by michael, Sun Apr 28 11:46:40 2013 UTC vs.
Revision 1937 by michael, Sat May 4 20:54:13 2013 UTC

# Line 693 | Line 693 | find_channel_link(struct Client *client_
693    return NULL;
694   }
695  
696 + /*
697 + * Basically the same functionality as in bahamut
698 + */
699 + static int
700 + msg_has_ctrls(const char *message)
701 + {
702 +  const unsigned char *p = (const unsigned char *)message;
703 +
704 +  for (; *p; ++p)
705 +  {
706 +    if (*p > 31 || *p == 1)
707 +      continue;
708 +
709 +    if (*p == 27)
710 +    {
711 +      if (*(p + 1) == '$' ||
712 +          *(p + 1) == '(')
713 +      {
714 +        ++p;
715 +        continue;
716 +      }
717 +    }
718 +
719 +    return 1;
720 +  }
721 +
722 +  return 0;
723 + }
724 +
725   /*!
726   * \param chptr    pointer to Channel struct
727   * \param source_p pointer to Client struct
# Line 702 | Line 731 | find_channel_link(struct Client *client_
731   *         ERR_CANNOTSENDTOCHAN or ERR_NEEDREGGEDNICK if they cannot send to channel\n
732   */
733   int
734 < can_send(struct Channel *chptr, struct Client *source_p, struct Membership *ms)
734 > can_send(struct Channel *chptr, struct Client *source_p,
735 >         struct Membership *ms, const char *message)
736   {
737    struct MaskItem *conf = NULL;
738  
# Line 746 | Line 776 | can_send(struct Channel *chptr, struct C
776    if ((chptr->mode.mode & MODE_REGONLY) && !HasUMode(source_p, UMODE_REGISTERED))
777      return ERR_NEEDREGGEDNICK;
778  
779 +  if ((chptr->mode.mode & MODE_NOCTRL) && msg_has_ctrls(message))
780 +    return ERR_NOCTRLSONCHAN;
781 +
782    return CAN_SEND_NONOP;
783   }
784  

Diff Legend

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