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 |
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 |
|
|
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 |
|
|