// Interp.C -*- C++ -*-
// Copyright (c) 1998 Etienne BERNARD
-// Copyright (C) 2002 Clinton Ebadi
+// Copyright (C) 2002,2005 Clinton Ebadi
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+// 02110-1301, USA.
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "Commands.H"
#include "Interp.H"
#include "BotInterp.H"
+#include "ShitEntry.H"
#include <libguile.h>
typedef SCM (*SCMFunc)();
SCM
-scm_apply_wrapper(void *data)
+Interp::ScmApplyWrapper (void *data)
{
#ifdef MULTITHREAD
// pthread_mutex_lock (&Interp::mutex);
return SCM_BOOL_T;
}
-static SCM
-lazy_handler(void *data, SCM tag, SCM throw_args)
+SCM
+Interp::LazyHandler (void *data, SCM tag, SCM throw_args)
{
SCM log_port = Interp::bot->botInterp->ScriptLog();
SCM eport = scm_set_current_error_port(log_port);
}
SCM
-empty_handler(void *data, SCM tag, SCM args)
+Interp::EmptyHandler(void *data, SCM tag, SCM args)
{
return SCM_UNSPECIFIED;
}
SCM
-lazy_apply_wrapper(void *data)
+Interp::LazyApplyWrapper(void *data)
{
return scm_internal_lazy_catch(SCM_BOOL_T,
- (scm_t_catch_body) scm_apply_wrapper, data,
- (scm_t_catch_handler) lazy_handler, 0);
+ (scm_t_catch_body) Interp::ScmApplyWrapper,
+ data,
+ (scm_t_catch_handler) Interp::LazyHandler,
+ 0);
}
lazy_eval_file(char *filename)
{
return scm_internal_lazy_catch(SCM_BOOL_T,
- (scm_t_catch_body) scm_c_primitive_load, filename,
- (scm_t_catch_handler) lazy_handler, 0);
+ (scm_t_catch_body) scm_c_primitive_load,
+ filename,
+ (scm_t_catch_handler) Interp::LazyHandler, 0);
}
static SCM
{
return scm_internal_lazy_catch(SCM_BOOL_T,
(scm_t_catch_body) scm_c_eval_string, str,
- (scm_t_catch_handler) lazy_handler, 0);
+ (scm_t_catch_handler) Interp::LazyHandler, 0);
}
// auto-op
scm_c_define ("bot:aop/yes", scm_long2num (true));
scm_c_define ("bot:aop/no", scm_long2num (false));
+
+ // shit-list
+ scm_c_define ("bot:shit/none", scm_long2num (ShitEntry::SHIT_NOSHIT));
+ scm_c_define ("bot:shit/no-op", scm_long2num (ShitEntry::SHIT_NOOP));
+ scm_c_define ("bot:shit/no-join", scm_long2num (ShitEntry::SHIT_NOJOIN));
+ scm_c_define ("bot:shit/no-deban",
+ scm_long2num (ShitEntry::SHIT_NODEBAN));
// sys-dir
scm_c_define ("bot:sys-scripts-dir",
scm_c_define ("hooks/invite", scm_long2num(Hook::INVITE));
scm_c_define ("hooks/join", scm_long2num(Hook::JOIN));
scm_c_define ("hooks/kick", scm_long2num(Hook::KICK));
- scm_c_define ("hooks/leave", scm_long2num(Hook::LEAVE));
- scm_c_define ("hooks/part", scm_long2num(Hook::LEAVE));
scm_c_define ("hooks/mode", scm_long2num(Hook::MODE));
scm_c_define ("hooks/message", scm_long2num(Hook::MESSAGE));
scm_c_define ("hooks/notice", scm_long2num(Hook::NOTICE));
+ scm_c_define ("hooks/part", scm_long2num(Hook::PART));
scm_c_define ("hooks/public", scm_long2num(Hook::PUBLIC));
scm_c_define ("hooks/public-notice", scm_long2num(Hook::PUBLIC_NOTICE));
scm_c_define ("hooks/raw", scm_long2num(Hook::RAW));
scm_c_define ("hooks/send/message", scm_long2num (Hook::SEND_MESSAGE));
scm_c_define ("hooks/send/action", scm_long2num (Hook::SEND_ACTION));
scm_c_define ("hooks/send/ctcp", scm_long2num (Hook::SEND_CTCP));
+ scm_c_define ("hooks/send/who", scm_long2num (Hook::SEND_WHO));
+ scm_c_define ("hooks/send/whois", scm_long2num (Hook::SEND_WHOIS));
// dcc hooks
scm_c_define ("hooks/dcc/chat-begin",
scm_long2num (Hook::DCC_CHAT_BEGIN));
+ scm_c_define ("hooks/dcc/chat-end",
+ scm_long2num (Hook::DCC_CHAT_END));
scm_c_define ("hooks/dcc/chat-message",
scm_long2num (Hook::DCC_CHAT_MESSAGE));
bot_new_procedure ("bot:change-command-level",
(SCMFunc)ScriptCommands::ChangeCommandLevel,
2, 0, 0);
+ scm_c_define_gsubr ("bot:ctcp", 3, 0, 0,
+ (SCMFunc)ScriptCommands::CTCP);
+ scm_c_define_gsubr ("bot:ctcp-reply", 3, 0, 0,
+ (SCMFunc)ScriptCommands::CTCPReply);
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,
bot_new_procedure ("bot:nick", (SCMFunc)ScriptCommands::Nick, 1, 0, 0);
scm_c_define_gsubr ("bot:notice", 2, 0, 0,
- (SCMFunc)ScriptCommands::sendNotice);
+ (SCMFunc)ScriptCommands::Notice);
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:tkban", (SCMFunc)ScriptCommands::TKBan, 3, 1, 0);
bot_new_procedure ("bot:topic", (SCMFunc)ScriptCommands::Topic, 2, 0, 0);
bot_new_procedure ("bot:unlock", (SCMFunc)ScriptCommands::Unlock, 1, 0, 0);
+ scm_c_define_gsubr ("bot:who", 1, 0, 0, (SCMFunc)ScriptCommands::Who);
+ scm_c_define_gsubr ("bot:whois", 1, 0, 0, (SCMFunc)ScriptCommands::Whois);
bot_new_procedure ("bot:getnickname", (SCMFunc)ScriptCommands::getNickname,
0, 0, 0);
scm_c_define_gsubr ("bot:dcc-chat-send", 2, 0, 0,
(SCMFunc)ScriptCommands::sendDCCChatMessage);
-
- // "Low Level" Message functuions
- scm_c_define_gsubr ("bot:send-ctcp", 3, 0, 0,
- (SCMFunc)ScriptCommands::sendCTCP);
- scm_c_define_gsubr ("bot:send-ctcp-reply", 3, 0, 0,
- (SCMFunc)ScriptCommands::sendCTCPReply);
}
#undef bot_new_procedure
bot = b;
scm_internal_catch(SCM_BOOL_T,
(scm_t_catch_body) lazy_eval_string, (void *) static_cast<const char *> (command),
- (scm_t_catch_handler) empty_handler, 0);
+ (scm_t_catch_handler) Interp::EmptyHandler, 0);
#ifdef MULTITHREAD
// We release the lock
#endif
bot = b;
scm_internal_catch(SCM_BOOL_T,
- (scm_t_catch_body) lazy_eval_file, (void *)static_cast<const char * >(filename),
- (scm_t_catch_handler) empty_handler, 0);
+ (scm_t_catch_body) lazy_eval_file,
+ (void *)static_cast<const char * >(filename),
+ (scm_t_catch_handler) Interp::EmptyHandler, 0);
#ifdef MULTITHREAD
// We release the lock
pthread_mutex_unlock(&mutex);