logic.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           logic.h  -  description
00003                              -------------------
00004     begin                : Thu Dec 9 2004
00005     copyright            : (C) 2004 by VooDooMan
00006     email                : vdmfun@hotmail.com
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010 
00011 VooDoo cIRCle - an IRC (ro)bot
00012 Copyright (C) 2004 by Marian VooDooMan Meravy (vdmfun@hotmail.com)
00013 
00014 This program is free software; you can redistribute it and/or
00015 modify it under the terms of the GNU General Public License
00016 as published by the Free Software Foundation; either version 2
00017 of the License, or (at your option) any later version.
00018 
00019 This program is distributed in the hope that it will be useful,
00020 but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License
00025 along with this program; if not, write to the Free Software
00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 
00028 ****************************************************************************/
00029 
00030 /*!
00031     \file
00032     \brief Implements core logic stored in "logic.txt" file
00033 */
00034 
00035 //---------------------------------------------------------------------------
00036 
00037 #ifndef logicH
00038 #define logicH
00039 
00040 //---------------------------------------------------------------------------
00041 
00042 bool logic_load_conf(const char* filename, int& error_on_line, const char* &error_reason);
00043 
00044 /*!
00045     \def LOGIC_PROC_NOT_FOUND
00046     \brief Procedure not found
00047 */
00048 #define LOGIC_PROC_NOT_FOUND    -1
00049 /*!
00050     \def LOGIC_PROC_BAD_TEXT
00051     \brief Bad text
00052 */
00053 #define LOGIC_PROC_BAD_TEXT     -2
00054 /*!
00055     \def LOGIC_PROC_BAD_NUM
00056     \brief Bad number
00057 */
00058 #define LOGIC_PROC_BAD_NUM      -3
00059 /*!
00060     \def LOGIC_PROC_BAD_SYNTAX
00061     \brief Bad syntax
00062 */
00063 #define LOGIC_PROC_BAD_SYNTAX   -4
00064 /*!
00065     \def LOGIC_SOCKET_ERROR
00066     \brief Socket I/O error
00067 */
00068 #define LOGIC_SOCKET_ERROR      -5
00069 /*!
00070     \def LOGIC_RESTART
00071     \brief Bot wants to be restarted ("restart" command)
00072 */
00073 #define LOGIC_RESTART           -6
00074 /*!
00075     \def LOGIC_NO_SERVER
00076     \brief No irc server in the list
00077 */
00078 #define LOGIC_NO_SERVER         -7
00079 /*!
00080     \def LOGIC_OK
00081     \brief Ok, no error
00082 */
00083 #define LOGIC_OK                0
00084 int logic_call_proc(const char* call_string);
00085 
00086 #include <vector>
00087 #include <map>
00088 #include <list>
00089 #include <string>
00090 
00091 #include "shared.h"
00092 #include "win_sock.h"
00093 
00094 using namespace std;
00095 
00096 string logic_find_user(string nick, string ident, string host, string fullname, bool irc_op);
00097 bool logic_access_to_partyline(string nick, string ident, string host, string fullname, bool irc_op, string& user_name_as_in_logic);
00098 string logic_get_dcc_host(int dcc_group, string user_name_as_in_logic);
00099 bool logic_access_to_partyline(string user_name_as_in_logic);
00100 bool logic_is_replication_partner(string user_name_as_in_logic);
00101 
00102 void logic_validate(string channel, string source_user, string target_user, string source_nick, string target_nick, char prefix, char action);
00103 void logic_validate_by_mask(string channel, string source_user, string source_nick, string mask, char prefix, char action);
00104 void logic_on_join(string nick, string ident, string host, string fullname, string channel, bool irc_op);
00105 void logic_on_nick_change(string nick, string ident, string host, string fullname, string channel, bool irc_op, string old_nick);
00106 void logic_on_nick_validate(string nick, string ident, string host, string fullname, string channel, bool irc_op, bool passive=false);
00107 void logic_on_banned(string channel, string ban_mask, vector<string> excepts, vector<string> invites, vector<string>& bans);
00108 void logic_validate_kick(string channel, string source_user, string target_user, string source_nick, string target_nick);
00109 void logic_loop();
00110 int logic_call_proc_ex2(const char* call_string, map<string,string>& vrs, list<string>& params, bool from_work=false);
00111 int logic_call_proc_ex(const char* call_string, map<string,string> vars);
00112 
00113 void logic_loop_identd();
00114 
00115 int logic_partyline_whois(string lang, string param1, list<string>& lines);
00116 bool logic_partyline_user_exists(string name);
00117 void logic_partyline_get_channels(vector<string>& channels);
00118 void logic_partyline_backup(string who);
00119 void logic_partyline_remove_user(string username);
00120 
00121 void logic_list_proc(string proc_name, list<string>& commands, string& declaration, vector<string>& groups);
00122 
00123 string logic_find_proc_by_name(string name);
00124 
00125 void logic_parse_proc(const char* &error_reason, int& error_line, list<string> commands, bool copy_to_r_procedures, string declaration, vector<string> groups);
00126 
00127 string logic_eval(string str, map<string,string>& vars);
00128 
00129 void logic_on_flood(string channel, string user, string nick, int type, int stat_num, time_t stat_sec, time_t stat_sec_of); // (username=="") == unknown user
00130 
00131 void logic_on_privmsg(string channel, string username, string nick, string msg);
00132 void logic_on_privmsg_query(string user, string nick, string msg);
00133 void logic_on_notice(string channel, string user, string nick, string msg);
00134 
00135 void logic_botnet_backup(string who);
00136 void logic_botnet_remove_user(string username);
00137 
00138 int logic_exec_from_work();
00139 
00140 void logic_set_dynamic(string username, string from_user, char prefix, char mode);
00141 
00142 void logic_validate_chan_mode(string channel, string source_user, string source_nick, char prefix, char mode);
00143 void logic_validate_chan_key(string channel, string source_user, string source_nick, char prefix, string key);
00144 void logic_validate_chan_limit(string channel, string source_user, string source_nick, char prefix, string limit);
00145 void logic_validate_topic(string channel, string source_user, string source_nick, string topic);
00146 
00147 void logic_on_not_invited(string channel, string mask, string user_name);
00148 void logic_on_not_in_reop(string channel, string mask, string user_name);
00149 
00150 bool logic_access_to_filesystem(string user);
00151 
00152 void logic_botnet_rehash(string who);
00153 string logic_partyline_rehash(string lang, string eol,string who);
00154 
00155 void logic_on_ircop(string channel, string nick, bool on);
00156 void logic_on_part(string channel, string nick, string msg, int type);
00157 
00158 void logic_partyline_get_user(string user_name, s_user& user, vector<s_channel>& channels);
00159 void logic_partyline_get_user_template(string user_name, s_user& user, vector<s_channel>& channels);
00160 
00161 bool logic_check_mask(string mask1, string mask2, string fnm1, string fnm2);
00162 
00163 unsigned long logic_resolve(string host);
00164 in_addr6_ logic_resolve6(string host);
00165 
00166 string logic_script_esc(string script_type, string str);
00167 
00168 void logic_execute(string call_string, map<string,string>& vars);
00169 
00170 void logic_filesys_got_new(string user_name, string nick, string ident, string host, string internal_name);
00171 void logic_fnc(string old_nick, string new_nick);
00172 void logic_on_broadcast(string username, string nick, string ident, string host,
00173                         string bcast_mask, int type, string msg,
00174                         string server, unsigned short port);
00175 void logic_on_server_msg(string channel, string source, int type, string msg, string server, unsigned short port);
00176 void logic_on_internal_event(string type, string flags1, string flags2, string flags3, string flags4, int severity_numeric, string msg1, string msg2);
00177 
00178 #endif

Generated on Sun Jul 10 03:23:00 2005 for VooDoo cIRCle by doxygen 1.4.3

Hosted by SourceForge.net Logo