#ifdef USESCRIPTS
#include <ctime>
-#include <map>
-#include <list>
#include <functional>
+#include <list>
+#include <map>
+#include <string>
#include <libguile.h>
int priority;
bool fallthru;
- String regex_str;
- String name;
+ std::string regex_str;
+ std::string name;
SCM regex;
SCM function;
- Hook(int t, String rs, SCM r, SCM f, int p, bool ft, String n="DEFAULT")
+ Hook(int t, std::string rs, SCM r, SCM f, int p, bool ft, std::string n="DEFAULT")
: type(t), priority (p), fallthru (ft), regex_str(rs),
name (n), regex(r), function(f) { }
class BotInterp {
typedef std::list<Timer *> TimerList;
+ typedef std::list<Hook *> HookList;
+ typedef std::map<int, HookList, std::less<int> > HookMap;
Bot * bot;
SCM logPort;
- std::map<int, std::list<Hook *>, std::less<int> > hooksMap;
+ int counter;
+
+ HookMap hooks;
TimerList timers;
+
Utils::IndirectPred<Timer, std::less<Timer> > timer_sort_p;
- int counter;
+ Utils::IndirectPred<Hook, std::less<Hook> > hook_sort_p;
+
BotMutex hook_mutex;
BotMutex timer_mutex; // NOTE: recursive lock
void Execute(String);
void LoadScript(String);
- bool AddHook(int, SCM, SCM, int, bool, String);
- bool RunHooks(int, String, SCM);
+ bool AddHook(int, SCM, SCM, int, bool, std::string);
+ bool RunHooks(int, std::string, SCM);
SCM AddTimer(int, SCM);
bool DelTimer(SCM);