modules/ctcp.php
changeset 40 1855846cbdab
child 51 508400fc5282
equal deleted inserted replaced
39:4027a5b47db5 40:1855846cbdab
       
     1 <?php
       
     2 
       
     3 eb_hook('event_ctcp', 'handle_ctcp($ctcp, $params, $message);');
       
     4 
       
     5 function handle_ctcp($ctcp, $params, $message)
       
     6 {
       
     7   global $irc;
       
     8   global $alert_list;
       
     9   switch($ctcp)
       
    10   {
       
    11     case 'PING':
       
    12       $irc->notice($message['nick'], "\x01PING $params\x01");
       
    13       break;
       
    14     case 'VERSION':
       
    15       global $nick, $enanobot_version;
       
    16       $irc->notice($message['nick'], "\x01VERSION $nick-$enanobot_version on PHP/" . PHP_VERSION . " (" . PHP_OS . ")\x01");
       
    17       break;
       
    18     default:
       
    19       eval(eb_fetch_hook('event_custom_ctcp'));
       
    20       break;
       
    21   }
       
    22   $now = date('r');
       
    23   foreach ( $alert_list as $alertme )
       
    24   {
       
    25     $irc->privmsg($alertme, "Received CTCP \"$ctcp\" from {$message['nick']}, " . $now);
       
    26   }
       
    27 }