author | Dan |
Thu, 01 Jan 2009 00:18:34 -0500 | |
changeset 40 | 1855846cbdab |
parent 39 | 4027a5b47db5 |
child 41 | 1d854f22ac5a |
permissions | -rw-r--r-- |
8 | 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 |
||
40 | 20 |
if ( in_array($message['nick'], $privileged_list) && preg_match("/^(?:\!echo-|\/msg )([^\007, \r\n\a\t]+) /", $message['message'], $match) ) |
8 | 21 |
{ |
22 |
global $libirc_channels; |
|
23 |
$channel_name =& $match[1]; |
|
24 |
if ( isset($libirc_channels[$channel_name]) && is_object($libirc_channels[$channel_name]) ) |
|
25 |
{ |
|
40 | 26 |
$libirc_channels[$channel_name]->msg(eb_censor_words(preg_replace("/^(?:\!echo-|\/msg )((?:#|&)[^\007, \r\n\a\t]+) /", '', $message['message'])), true); |
8 | 27 |
} |
28 |
} |
|
40 | 29 |
else if ( in_array($message['nick'], $privileged_list) && preg_match("/^(?:\!pm|\/msg) ([^\007, \r\n\a\t]+) (.+)/", $message['message'], $match) ) |
39
4027a5b47db5
echo: added ability to PM people with !pm [nick] [message]
Dan
parents:
8
diff
changeset
|
30 |
{ |
4027a5b47db5
echo: added ability to PM people with !pm [nick] [message]
Dan
parents:
8
diff
changeset
|
31 |
global $irc; |
4027a5b47db5
echo: added ability to PM people with !pm [nick] [message]
Dan
parents:
8
diff
changeset
|
32 |
$irc->privmsg($match[1], eb_censor_words($match[2])); |
4027a5b47db5
echo: added ability to PM people with !pm [nick] [message]
Dan
parents:
8
diff
changeset
|
33 |
} |
8 | 34 |
} |