00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef ircH
00038 #define ircH
00039
00040
00041 #include <time.h>
00042 #include <string>
00043 #include <map>
00044
00045 using namespace std;
00046
00047
00048
00049
00050
00051 #define CRITICAL_PRIORITY 1
00052
00053
00054
00055
00056 #define HIGH_PRIORITY 2
00057
00058
00059
00060
00061 #define LOW_PRIORITY 3
00062
00063
00064
00065
00066
00067
00068
00069 struct s_msg_to_server {
00070 char* msg;
00071 bool wait_for_response;
00072
00073 bool flood_protection;
00074
00075 char response[1024];
00076
00077 time_t timestamp;
00078
00079 s_msg_to_server()
00080 {
00081 msg=NULL;
00082 wait_for_response=false;
00083 memset(response,0,sizeof(response));
00084 flood_protection=true;
00085 timestamp=time(NULL);
00086 }
00087 };
00088
00089
00090
00091
00092
00093
00094
00095 struct s_005 {
00096 map<string,string> raw;
00097 string chanmodes_a;
00098 string chanmodes_b;
00099 string chanmodes_c;
00100 string chanmodes_d;
00101 map<char,char> prefix;
00102
00103 int max_modes;
00104
00105 void clear() {
00106 raw.clear();
00107 chanmodes_a="";
00108 chanmodes_b="";
00109 chanmodes_c="";
00110 chanmodes_d="";
00111 prefix.clear();
00112 max_modes=3;
00113 }
00114
00115
00116
00117
00118
00119
00120 char get_prefix1(char x) {
00121 map<char,char>::iterator i1;
00122 for(i1=prefix.begin(); i1!=prefix.end(); i1++)
00123 if((*i1).first==x)
00124 return (*i1).second;
00125 return '0';
00126 }
00127
00128
00129
00130
00131
00132
00133 char get_prefix2(char x) {
00134 map<char,char>::iterator i1;
00135 for(i1=prefix.begin(); i1!=prefix.end(); i1++)
00136 if((*i1).second==x)
00137 return (*i1).first;
00138 return '0';
00139 }
00140 };
00141
00142 int irc_disconnect();
00143 int irc_connect(const char* bind_ip, const char* host_, unsigned short port);
00144 bool irc_loop_putserv();
00145 int irc_loop_process_input();
00146 bool irc_op(const char* channel, const char* nick, int priority);
00147 bool irc_deop(const char* channel, const char* nick, int priority);
00148 bool irc_voice(const char* channel, const char* nick, int priority);
00149 bool irc_devoice(const char* channel, const char* nick, int priority);
00150 bool irc_kick(const char* channel, const char* nick, const char* reason);
00151 bool irc_join(const char* channel, const char* key);
00152 bool irc_part(const char* channel, const char* reason);
00153 bool irc_privmsg(const char* target, const char* msg, int priority);
00154 bool irc_notice(const char* target, const char* msg, int priority);
00155 bool irc_unban(const char* channel, const char* mask);
00156 bool irc_ban(const char* channel, const char* mask);
00157 bool irc_chan_mode(const char* channel, const char* mode,int priority);
00158
00159 void irc_set_redir(bool follow_redirs);
00160
00161
00162 string irc_get_nick(string user);
00163
00164 string irc_is_online(string user);
00165
00166 string irc_get_ident(string nick);
00167 string irc_get_host(string nick);
00168 bool irc_is_ircop(string nick);
00169 string irc_get_mode(string channel, string nick);
00170 string irc_get_fullname(string nick);
00171 bool irc_got_op(string channel);
00172
00173 void irc_put(string data, int priority);
00174
00175 int cmp_strings_case_insensitive(string s1, string s2);
00176
00177 void irc_quit(const char* reason);
00178
00179 void irc_await_dcc_chat(string nick, string user_name_as_in_logic, int dcc_group);
00180
00181 bool irc_putserv(const char* msg, bool wait_for_response, int priority);
00182
00183 void irc_rehashed();
00184
00185 string irc_get_chan_mode(string channel, string& topic);
00186
00187 void irc_get_005(map<string,string>& raw, map<char,char>& prefix, string& chm_a, string& chm_b, string& chm_c, string& chm_d);
00188 void irc_parse_modes(string modes, map<char,string>& with_param, string& plain);
00189
00190 string irc_get_modes_for_log(string channel, string nick);
00191
00192 #endif
00193
00194