modules/echo.php
author Dan
Sat, 15 Nov 2008 15:33:51 -0500
changeset 27 4a9469bada05
parent 8 0acb8d9a3194
child 39 4027a5b47db5
permissions -rw-r--r--
Oops! Forgot to add the DBAL.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     1
<?php
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     2
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     3
eb_hook('event_channel_msg', 'echo_event_channel_msg($chan, $message);');
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     4
eb_hook('event_privmsg', 'echo_event_privmsg($message);');
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     5
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     6
function echo_event_channel_msg(&$chan, &$message)
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     7
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     8
  global $privileged_list;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     9
  
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    10
  if ( preg_match('/^\!echo /', $message['message']) && in_array($message['nick'], $privileged_list) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    11
  {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    12
    $chan->msg(eb_censor_words(preg_replace('/^\!echo /', '', $message['message'])), true);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    13
  }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    14
}
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    15
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    16
function echo_event_privmsg($message)
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    17
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    18
  global $privileged_list;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    19
  
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    20
  if ( in_array($message['nick'], $privileged_list) && preg_match("/^\!echo-([^\007, \r\n\a\t]+) /", $message['message'], $match) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    21
  {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    22
    global $libirc_channels;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    23
    $channel_name =& $match[1];
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    24
    if ( isset($libirc_channels[$channel_name]) && is_object($libirc_channels[$channel_name]) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    25
    {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    26
      $libirc_channels[$channel_name]->msg(eb_censor_words(preg_replace("/^\!echo-([^\007, \r\n\a\t]+) /", '', $message['message'])), true);
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    27
    }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    28
  }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    29
}