1 // BotInterp.H -*- C++ -*-
2 // Copyright (c) 1998 Etienne BERNARD
3 // Copyright (C) 2002 Clinton Ebadi
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
44 Hook(int t, String rs, SCM r, SCM f, int p, bool ft, String n="DEFAULT")
45 : type(t), priority (p), fallthru (ft), regex_str(rs),
46 name (n), regex(r), function(f) { }
48 bool operator< (const Hook &h) const
50 if (priority < h.priority)
54 else if (priority > h.priority)
58 else if (fallthru && h.fallthru)
62 else if (fallthru && !h.fallthru)
66 else if (!fallthru && h.fallthru)
72 // NOTE: This should never be reached
78 ACTION, NICKNAME, SIGNOFF, CTCP, CTCP_REPLY,
79 DISCONNECT, FLOOD, INVITE, JOIN, KICK, MODE,
80 MESSAGE, NAMES, NOTICE, PART, PUBLIC,
81 PUBLIC_NOTICE, RAW, TIMER, TOPIC,
83 SEND_ACTION, SEND_CTCP, SEND_PUBLIC, SEND_MESSAGE,
85 DCC_CHAT_BEGIN, DCC_CHAT_MESSAGE
94 Timer(int c, std::time_t t, SCM f)
95 : count(c), when(t), function(f) { }
101 std::map<int, std::list<Hook *>, std::less<int> > hooksMap;
102 std::list<Timer *> timersList;
106 BotInterp(Bot *, String);
110 void Execute(String);
111 void LoadScript(String);
113 bool AddHook(int, SCM, SCM, int, bool, String);
114 bool RunHooks(int, String, SCM);
116 SCM AddTimer(int, SCM);
121 friend class ScriptCommands;