modules/ctcp.php
author Dan
Sun, 04 Jan 2009 12:19:27 -0500
changeset 42 c24a2311f232
parent 40 1855846cbdab
child 51 508400fc5282
permissions -rw-r--r--
Removed a stray debug message
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
40
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     1
<?php
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     2
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     3
eb_hook('event_ctcp', 'handle_ctcp($ctcp, $params, $message);');
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     4
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     5
function handle_ctcp($ctcp, $params, $message)
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     6
{
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     7
  global $irc;
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     8
  global $alert_list;
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
     9
  switch($ctcp)
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    10
  {
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    11
    case 'PING':
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    12
      $irc->notice($message['nick'], "\x01PING $params\x01");
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    13
      break;
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    14
    case 'VERSION':
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    15
      global $nick, $enanobot_version;
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    16
      $irc->notice($message['nick'], "\x01VERSION $nick-$enanobot_version on PHP/" . PHP_VERSION . " (" . PHP_OS . ")\x01");
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    17
      break;
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    18
    default:
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    19
      eval(eb_fetch_hook('event_custom_ctcp'));
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    20
      break;
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    21
  }
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    22
  $now = date('r');
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    23
  foreach ( $alert_list as $alertme )
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    24
  {
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    25
    $irc->privmsg($alertme, "Received CTCP \"$ctcp\" from {$message['nick']}, " . $now);
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    26
  }
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    27
}