modules/greeting.php
author Dan
Tue, 20 Jan 2009 22:08:07 -0500
changeset 51 508400fc5282
parent 48 d793361a27ec
permissions -rw-r--r--
Major change to permissions backend - performs whois check (only supported blitzed and freenode right now) and advanced permissions supported.

<?php

eb_hook('event_raw_message', 'greeting_event($chan, $message);');

function greeting_event(&$chan, &$message)
{
  static $part_list = array();
  
  switch($message['action'])
  {
    case 'JOIN':
      if ( $message['nick'] === $GLOBALS['nick'] )
        break;
      
      $wb = false;
      if ( isset($part_list[$message['nick']]) )
      {
        if ( $part_list[$message['nick']] + 1800 >= time() )
        {
          $chan->msg("Welcome back.");
          $wb = true;
        }
      }
      if ( !$wb )
      {
        $append = '';
        eval(eb_fetch_hook('event_greeting'));
        $chan->msg(eb_censor_words("Hi, {$message['nick']}.$append"));
      }
      break;
    case 'PART':
      $part_list[$message['nick']] = time();
      break;
  }
}