[project @ 2005-06-23 22:59:18 by unknown_lamer]
[clinton/bobotpp.git] / source / Interp.C
index 401d7d5..c5c2fee 100644 (file)
@@ -32,6 +32,7 @@
 // static class member initial definitions
 Bot * Interp::bot = 0;
 SCM Interp::bot_module = 0;
+
 #ifdef MULTITHREAD
 pthread_mutex_t Interp::mutex = PTHREAD_MUTEX_INITIALIZER;
 #endif
@@ -73,6 +74,17 @@ interp_init_helper (void* unused)
   scm_c_define ("bot:user-trusted", scm_long2num (User::TRUSTED_USER));
   scm_c_define ("bot:user-friend", scm_long2num (User::FRIEND));
   scm_c_define ("bot:user-master", scm_long2num (User::MASTER));
+
+  // protection
+  scm_c_define ("bot:protection/none", scm_long2num (User::NO_PROT));
+  scm_c_define ("bot:protection/no-ban", scm_long2num (User::NO_BAN));
+  scm_c_define ("bot:protection/no-kick", scm_long2num (User::NO_KICK));
+  scm_c_define ("bot:protection/no-deop", scm_long2num (User::NO_DEOP));
+
+  // auto-op
+  scm_c_define ("bot:aop/yes", scm_long2num (true));
+  scm_c_define ("bot:aop/no", scm_long2num (false));
+  
   // sys-dir
   scm_c_define ("bot:sys-scripts-dir", 
                scm_makfrom0str (String(PREFIX) + 
@@ -118,6 +130,9 @@ interp_init_helper (void* unused)
   scm_c_define_gsubr ("bot:addshit", 3, 2, 0, 
                      (SCMFunc)ScriptCommands::AddShit);
   bot_new_procedure ("bot:ban", (SCMFunc)ScriptCommands::Action, 2, 0, 0);
+  bot_new_procedure ("bot:change-command-level", 
+                    (SCMFunc)ScriptCommands::ChangeCommandLevel,
+                    2, 0, 0);
   bot_new_procedure ("bot:cycle", (SCMFunc)ScriptCommands::Action, 1, 0, 0);
   bot_new_procedure ("bot:deban", (SCMFunc)ScriptCommands::Deban, 2, 0, 0);
   bot_new_procedure ("bot:delserver", (SCMFunc)ScriptCommands::DelServer, 
@@ -139,6 +154,10 @@ interp_init_helper (void* unused)
   bot_new_procedure ("bot:nextserver", (SCMFunc)ScriptCommands::NextServer, 
                     0, 0, 0);
   bot_new_procedure ("bot:nick", (SCMFunc)ScriptCommands::Nick, 1, 0, 0);
+
+  scm_c_define_gsubr ("bot:notice", 2, 0, 0, 
+                     (SCMFunc)ScriptCommands::sendNotice);
+
   bot_new_procedure ("bot:op", (SCMFunc)ScriptCommands::Op, 2, 0, 0);
   bot_new_procedure ("bot:part", (SCMFunc)ScriptCommands::Part, 1, 0, 0);
   bot_new_procedure ("bot:reconnect", (SCMFunc)ScriptCommands::Reconnect, 
@@ -196,6 +215,7 @@ interp_post_startup_helper (void *bot_module)
   SCM module = static_cast<SCM> (bot_module);
   scm_c_define ("the-bot-module", module);
   scm_c_export ("the-bot-module", 0);
+
   // load bobot-utils
   scm_primitive_load 
     (scm_makfrom0str (String(PREFIX) + 
@@ -207,7 +227,8 @@ void
 Interp::Startup()
 {
   bot_module = scm_c_define_module ("the-bot-module", 
-                                           interp_init_helper, 0);
+                                   interp_init_helper, 0);
+
   scm_c_call_with_current_module (bot_module,
                                  interp_post_startup_helper,
                                  bot_module);
@@ -226,8 +247,10 @@ Interp::Execute(Bot *b, String command)
   // We get the lock
   pthread_mutex_lock(&mutex);
 #endif
+  
   bot = b;
-  gh_eval_str_with_catch(command, ErrorHandler);
+  gh_eval_str_with_catch (command, ErrorHandler);
+  
 #ifdef MULTITHREAD
   // We release the lock
   pthread_mutex_unlock(&mutex);