modules/greeting.php
changeset 8 0acb8d9a3194
child 48 d793361a27ec
equal deleted inserted replaced
7:1d6e762433fe 8:0acb8d9a3194
       
     1 <?php
       
     2 
       
     3 eb_hook('event_raw_message', 'greeting_event($chan, $message);');
       
     4 
       
     5 function greeting_event(&$chan, &$message)
       
     6 {
       
     7   static $part_list = array();
       
     8   
       
     9   switch($message['action'])
       
    10   {
       
    11     case 'JOIN':
       
    12       $wb = false;
       
    13       if ( isset($part_list[$message['nick']]) )
       
    14       {
       
    15         if ( $part_list[$message['nick']] + 1800 >= time() )
       
    16         {
       
    17           $chan->msg("Welcome back.");
       
    18           $wb = true;
       
    19         }
       
    20       }
       
    21       if ( !$wb )
       
    22       {
       
    23         $append = '';
       
    24         eval(eb_fetch_hook('event_greeting'));
       
    25         $chan->msg(eb_censor_words("Hi, {$message['nick']}.$append"));
       
    26       }
       
    27       break;
       
    28     case 'PART':
       
    29       $part_list[$message['nick']] = time();
       
    30       break;
       
    31   }
       
    32 }