#endif
#include <libguile.h>
+extern "C" {
+#include <libguile/hooks.h>
+}
#include "Bot.H"
#include "BotInterp.H"
pthread_mutex_t Interp::mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
-typedef SCM (*SCMFunc)();
+typedef scm_t_subr SCMFunc;
SCM
Interp::ScmApplyWrapper (void *data)
SCM
Interp::LazyApplyWrapper(void *data)
{
- return scm_internal_lazy_catch(SCM_BOOL_T,
+ return scm_internal_catch(SCM_BOOL_T,
(scm_t_catch_body) Interp::ScmApplyWrapper,
data,
(scm_t_catch_handler) Interp::LazyHandler,
static SCM
lazy_eval_file(char *filename)
{
- return scm_internal_lazy_catch(SCM_BOOL_T,
- (scm_t_catch_body) scm_c_primitive_load,
+ return scm_internal_catch(SCM_BOOL_T,
+ (scm_t_catch_body) scm_c_primitive_load_path,
filename,
(scm_t_catch_handler) Interp::LazyHandler, 0);
}
static SCM
lazy_eval_string(char *str)
{
- return scm_internal_lazy_catch(SCM_BOOL_T,
+ return scm_internal_catch(SCM_BOOL_T,
(scm_t_catch_body) scm_c_eval_string, str,
(scm_t_catch_handler) Interp::LazyHandler, 0);
}
scm_c_define ("bot:user-friend", scm_from_int (User::FRIEND));
scm_c_define ("bot:user-master", scm_from_int (User::MASTER));
+ // user channel modes
+ scm_c_define ("bot:mode/op", scm_from_int (User::OP_MODE));
+ scm_c_define ("bot:mode/voice", scm_from_int (User::VOICE_MODE));
+ scm_c_define ("bot:mode/away", scm_from_int (User::AWAY_MODE));
+ scm_c_define ("bot:mode/ircop", scm_from_int (User::IRCOP_MODE));
+
// protection
scm_c_define ("bot:protection/none", scm_from_int (User::NO_PROT));
scm_c_define ("bot:protection/no-ban", scm_from_int (User::NO_BAN));
// sys-dir
scm_c_define ("bot:sys-scripts-dir",
- scm_from_locale_string (String(PREFIX) +
- "/share/bobotpp/scripts/"));
+ scm_from_locale_string ((String(PREFIX) +
+ "/share/bobotpp/scripts/").c_str ()));
// Hooks
scm_c_define ("hooks/action", scm_from_int(Hook::ACTION));
scm_c_define ("hooks/nickname", scm_from_int(Hook::NICKNAME));
bot_new_procedure ("bot:change-command-level",
(SCMFunc)ScriptCommands::ChangeCommandLevel,
2, 0, 0);
+ scm_c_define_gsubr ("bot:channel-users", 1, 0, 0,
+ (SCMFunc)ScriptCommands::ChannelUsers);
scm_c_define_gsubr ("bot:ctcp", 3, 0, 0,
(SCMFunc)ScriptCommands::CTCP);
scm_c_define_gsubr ("bot:ctcp-reply", 3, 0, 0,
scm_c_export ("the-bot-module", 0);
// load bobot-utils
- scm_primitive_load
- (scm_from_locale_string (String(PREFIX) +
- "/share/bobotpp/scripts/bobot-utils.scm"));
- return SCM_UNSPECIFIED;
+ return scm_primitive_load_path
+ (scm_from_locale_string ((String(PREFIX) +
+ "/share/bobotpp/scripts/bobot-utils.scm").c_str ()));
}
void
bot = b;
scm_internal_catch(SCM_BOOL_T,
- (scm_t_catch_body) lazy_eval_string, (void *) static_cast<const char *> (command),
+ (scm_t_catch_body) lazy_eval_string, (void *) static_cast<const char *> (command.c_str ()),
(scm_t_catch_handler) Interp::EmptyHandler, 0);
#ifdef MULTITHREAD
bot = b;
scm_internal_catch(SCM_BOOL_T,
(scm_t_catch_body) lazy_eval_file,
- (void *)static_cast<const char * >(filename),
+ (void *)static_cast<const char * >(filename.c_str ()),
(scm_t_catch_handler) Interp::EmptyHandler, 0);
#ifdef MULTITHREAD
// We release the lock