modules/ctcp.php
author Dan
Tue, 20 Jan 2009 22:08:17 -0500
changeset 52 a8f0e99883d1
parent 51 508400fc5282
permissions -rw-r--r--
Web interface can now update with AJAX
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;
51
508400fc5282 Major change to permissions backend - performs whois check (only supported blitzed and freenode right now) and advanced permissions supported.
Dan
parents: 40
diff changeset
     8
  global $permissions;
40
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');
51
508400fc5282 Major change to permissions backend - performs whois check (only supported blitzed and freenode right now) and advanced permissions supported.
Dan
parents: 40
diff changeset
    23
  foreach ( $permissions as $alertme => $perms )
40
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    24
  {
51
508400fc5282 Major change to permissions backend - performs whois check (only supported blitzed and freenode right now) and advanced permissions supported.
Dan
parents: 40
diff changeset
    25
    if ( check_permissions($alertme, array('context' => 'alert')) )
508400fc5282 Major change to permissions backend - performs whois check (only supported blitzed and freenode right now) and advanced permissions supported.
Dan
parents: 40
diff changeset
    26
      $irc->privmsg($alertme, "Received CTCP \"$ctcp\" from {$message['nick']}, " . $now);
40
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    27
  }
1855846cbdab Added CTCP support and an associated module
Dan
parents:
diff changeset
    28
}