modules/echo.php
changeset 51 508400fc5282
parent 42 c24a2311f232
equal deleted inserted replaced
50:45164bc2567a 51:508400fc5282
     5 
     5 
     6 function echo_event_channel_msg(&$chan, &$message)
     6 function echo_event_channel_msg(&$chan, &$message)
     7 {
     7 {
     8   global $privileged_list;
     8   global $privileged_list;
     9   
     9   
    10   if ( preg_match('/^\!echo /', $message['message']) && in_array($message['nick'], $privileged_list) )
    10   if ( preg_match('/^\!echo /', $message['message']) && check_permissions($message['nick'], array('context' => 'echo')) )
    11   {
    11   {
    12     $chan->msg(eb_censor_words(preg_replace('/^\!echo /', '', $message['message'])), true);
    12     $chan->msg(eb_censor_words(preg_replace('/^\!echo /', '', $message['message'])), true);
    13   }
    13   }
    14 }
    14 }
    15 
    15 
    16 function echo_event_privmsg($message)
    16 function echo_event_privmsg($message)
    17 {
    17 {
    18   global $privileged_list;
    18   global $privileged_list;
    19   
    19   
    20   if ( in_array($message['nick'], $privileged_list) && preg_match("/^(?:\!echo-|\/msg )([^\007, \r\n\a\t]+) (.+)/", $message['message'], $match) )
    20   if ( preg_match("/^(?:\!echo-|\/msg )([#&][^\007, \r\n\a\t]+) (.+)/", $message['message'], $match) && check_permissions($message['nick'], array('context' => 'echo')) )
    21   {
    21   {
    22     global $libirc_channels;
    22     global $libirc_channels;
    23     $channel_name =& $match[1];
    23     $channel_name =& $match[1];
    24     if ( isset($libirc_channels[$channel_name]) && is_object($libirc_channels[$channel_name]) )
    24     if ( isset($libirc_channels[$channel_name]) && is_object($libirc_channels[$channel_name]) )
    25     {
    25     {
    26       $libirc_channels[$channel_name]->msg(eb_censor_words($match[2]), true);
    26       $libirc_channels[$channel_name]->msg(eb_censor_words($match[2]), true);
    27     }
    27     }
    28   }
    28   }
    29   else if ( in_array($message['nick'], $privileged_list) && preg_match("/^(?:\!pm|\/msg) ([^\007, \r\n\a\t]+) (.+)/", $message['message'], $match) )
    29   else if ( preg_match("/^(?:\!pm|\/msg) ([^\007, \r\n\a\t]+) (.+)/", $message['message'], $match) && check_permissions($message['nick'], array('context' => 'pm'), false) )
    30   {
    30   {
    31     global $irc;
    31     global $irc;
    32     $irc->privmsg($match[1], eb_censor_words($match[2]));
    32     $irc->privmsg($match[1], eb_censor_words($match[2]));
    33   }
    33   }
    34 }
    34 }