modules/greeting.php
changeset 8 0acb8d9a3194
child 48 d793361a27ec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/modules/greeting.php	Mon Aug 25 12:34:26 2008 -0400
@@ -0,0 +1,32 @@
+<?php
+
+eb_hook('event_raw_message', 'greeting_event($chan, $message);');
+
+function greeting_event(&$chan, &$message)
+{
+  static $part_list = array();
+  
+  switch($message['action'])
+  {
+    case 'JOIN':
+      $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;
+  }
+}