modules/greeting.php
author Dan
Sat, 15 Nov 2008 15:33:51 -0500
changeset 27 4a9469bada05
parent 8 0acb8d9a3194
child 48 d793361a27ec
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_raw_message', 'greeting_event($chan, $message);');
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     4
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     5
function greeting_event(&$chan, &$message)
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     6
{
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     7
  static $part_list = array();
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     8
  
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
     9
  switch($message['action'])
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    10
  {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    11
    case 'JOIN':
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    12
      $wb = false;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    13
      if ( isset($part_list[$message['nick']]) )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    14
      {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    15
        if ( $part_list[$message['nick']] + 1800 >= time() )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    16
        {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    17
          $chan->msg("Welcome back.");
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    18
          $wb = true;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    19
        }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    20
      }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    21
      if ( !$wb )
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    22
      {
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    23
        $append = '';
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    24
        eval(eb_fetch_hook('event_greeting'));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    25
        $chan->msg(eb_censor_words("Hi, {$message['nick']}.$append"));
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    26
      }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    27
      break;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    28
    case 'PART':
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    29
      $part_list[$message['nick']] = time();
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    30
      break;
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    31
  }
0acb8d9a3194 Welcome, modularization and stats.
Dan
parents:
diff changeset
    32
}