modules/echo.php
changeset 8 0acb8d9a3194
child 39 4027a5b47db5
equal deleted inserted replaced
7:1d6e762433fe 8:0acb8d9a3194
       
     1 <?php
       
     2 
       
     3 eb_hook('event_channel_msg', 'echo_event_channel_msg($chan, $message);');
       
     4 eb_hook('event_privmsg', 'echo_event_privmsg($message);');
       
     5 
       
     6 function echo_event_channel_msg(&$chan, &$message)
       
     7 {
       
     8   global $privileged_list;
       
     9   
       
    10   if ( preg_match('/^\!echo /', $message['message']) && in_array($message['nick'], $privileged_list) )
       
    11   {
       
    12     $chan->msg(eb_censor_words(preg_replace('/^\!echo /', '', $message['message'])), true);
       
    13   }
       
    14 }
       
    15 
       
    16 function echo_event_privmsg($message)
       
    17 {
       
    18   global $privileged_list;
       
    19   
       
    20   if ( in_array($message['nick'], $privileged_list) && preg_match("/^\!echo-([^\007, \r\n\a\t]+) /", $message['message'], $match) )
       
    21   {
       
    22     global $libirc_channels;
       
    23     $channel_name =& $match[1];
       
    24     if ( isset($libirc_channels[$channel_name]) && is_object($libirc_channels[$channel_name]) )
       
    25     {
       
    26       $libirc_channels[$channel_name]->msg(eb_censor_words(preg_replace("/^\!echo-([^\007, \r\n\a\t]+) /", '', $message['message'])), true);
       
    27     }
       
    28   }
       
    29 }