Idź do dokumentacji tego pliku.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef __EKG_PLUGINS_IRC_IRC_H
00019 #define __EKG_PLUGINS_IRC_IRC_H
00020
00021 #define DOT(a,x,y,z,error) \
00022 print_info("__status", z, a, session_name(z), x, y->hostname, y->address, \
00023 itoa(y->port < 0 ? \
00024 session_int_get(z, "port") < 0 ? DEFPORT : session_int_get(z, "port") : y->port), \
00025 itoa(y->family), error ? strerror(error) : "")
00026
00027 #include <ekg/dynstuff.h>
00028 #include <ekg/plugins.h>
00029 #include <ekg/protocol.h>
00030 #include <ekg/sessions.h>
00031 #include <ekg/windows.h>
00032
00033 #include "irc-ssl.h"
00034
00035
00036 enum { USERMODES=0, CHANMODES, _005_PREFIX, _005_CHANTYPES,
00037 _005_CHANMODES, _005_MODES, _005_CHANLIMIT, _005_NICKLEN, _005_IDCHAN, SERVOPTS };
00038
00039
00040 enum { IRC_CASEMAPPING_ASCII, IRC_CASEMAPPING_RFC1459, IRC_CASEMAPPING_RFC1459_STRICT, IRC_CASEMAPPING_COUNT };
00041
00042 typedef struct _irc_private_t {
00043 int fd;
00044 int autoreconnecting;
00045 int resolving;
00046 list_t bindlist, bindtmplist;
00047 list_t connlist, conntmplist;
00048
00049 watch_t *recv_watch;
00050 watch_t *send_watch;
00051
00052 char *nick;
00053 char *host_ident;
00054
00055 #ifdef IRC_HAVE_SSL
00056 unsigned char using_ssl : 2;
00057 SSL_SESSION ssl_session;
00058 string_t ssl_buf;
00059 #endif
00060
00061 list_t people;
00062 list_t channels;
00063 list_t hilights;
00064
00065 char *sopt[SERVOPTS];
00066
00067
00068 int casemapping;
00069
00070 list_t awaylog;
00071
00072 list_t auto_guess_encoding;
00073 list_t out_recodes;
00074 list_t recoded_channels;
00075
00076 void *conv_in;
00077 void *conv_out;
00078 } irc_private_t;
00079
00080
00081 typedef struct {
00082 void *conv_in;
00083 void *conv_out;
00084 } conv_in_out_t;
00085
00086
00087 typedef struct {
00088 char *name;
00089 void *conv_in;
00090 void *conv_out;
00091 } out_recodes_t;
00092
00093
00094 typedef struct {
00095 char *name;
00096 out_recodes_t *recode;
00097 } recoded_channels_t;
00098
00099 typedef struct _irc_awaylog_t {
00100 char *channame;
00101 char *uid;
00102 char *msg;
00103 time_t t;
00104 } irc_awaylog_t;
00105
00106 #define SOP(x) (j->sopt[x])
00107
00108
00109 typedef struct {
00110 char *nick;
00111 char *realname;
00112 char *host, *ident;
00113 list_t channels;
00114 } people_t;
00115
00116
00117 typedef struct {
00118 char *name;
00119 int syncmode;
00120 struct timeval syncstart;
00121 int mode;
00122 char *topic, *topicby, *mode_str;
00123 window_t *window;
00124 list_t onchan;
00125 char *nickpad_str;
00126 int nickpad_len, nickpad_pos;
00127 int longest_nick;
00128 list_t banlist;
00129
00130
00131
00132 list_t acclist;
00133 } channel_t;
00134
00135
00136 typedef struct {
00137 int mode;
00138 char sign[2];
00139 channel_t *chanp;
00140 } people_chan_t;
00141
00142
00143 typedef struct {
00144 session_t *session;
00145 char *hostname;
00146 char *address;
00147 int port;
00148 int family;
00149 } connector_t;
00150
00151 typedef struct {
00152 char *session;
00153 list_t *plist;
00154 int isbind;
00155 } irc_resolver_t;
00156
00157 #define irc_private(s) ((irc_private_t*) session_private_get(s))
00158
00159
00160 #define IRC4 "irc:"
00161 #define irc_uid(target) protocol_uid("irc", target)
00162
00163 extern plugin_t irc_plugin;
00164
00165 void irc_handle_disconnect(session_t *s, const char *reason, int type);
00166
00167
00168
00169
00170
00171
00172
00173
00174 enum { IRC_GC_CHAN=0, IRC_GC_NOT_CHAN, IRC_GC_ANY };
00175
00176 #define irc_write(s, args...) watch_write((s && s->priv) ? irc_private(s)->send_watch : NULL, args);
00177
00178 int irc_parse_line(session_t *s, char *buf, int fd);
00179
00180 extern int irc_config_experimental_chan_name_clean;
00181
00182 char *nickpad_string_create(channel_t *chan);
00183 char *nickpad_string_apply(channel_t *chan, const char *str);
00184 char *nickpad_string_restore(channel_t *chan);
00185
00186 char *clean_channel_names(session_t *session, char *channels);
00187
00188 #endif
00189
00190
00191
00192
00193
00194
00195
00196
00197