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
00034 enum { USERMODES=0, CHANMODES, _005_PREFIX, _005_CHANTYPES,
00035 _005_CHANMODES, _005_MODES, _005_CHANLIMIT, _005_NICKLEN, _005_IDCHAN, SERVOPTS };
00036
00037
00038 enum { IRC_CASEMAPPING_ASCII, IRC_CASEMAPPING_RFC1459, IRC_CASEMAPPING_RFC1459_STRICT, IRC_CASEMAPPING_COUNT };
00039
00040 typedef struct _irc_private_t {
00041 int fd;
00042 int autoreconnecting;
00043 int resolving;
00044 list_t bindlist, bindtmplist;
00045 list_t connlist, conntmplist;
00046
00047 watch_t *recv_watch;
00048 watch_t *send_watch;
00049
00050 char *nick;
00051 char *host_ident;
00052
00053 list_t people;
00054 list_t channels;
00055 list_t hilights;
00056
00057 char *sopt[SERVOPTS];
00058
00059
00060 int casemapping;
00061
00062 list_t awaylog;
00063
00064 list_t auto_guess_encoding;
00065 list_t out_recodes;
00066 list_t recoded_channels;
00067
00068 void *conv_in;
00069 void *conv_out;
00070 } irc_private_t;
00071
00072
00073 typedef struct {
00074 void *conv_in;
00075 void *conv_out;
00076 } conv_in_out_t;
00077
00078
00079 typedef struct {
00080 char *name;
00081 void *conv_in;
00082 void *conv_out;
00083 } out_recodes_t;
00084
00085
00086 typedef struct {
00087 char *name;
00088 out_recodes_t *recode;
00089 } recoded_channels_t;
00090
00091 typedef struct _irc_awaylog_t {
00092 char *channame;
00093 char *uid;
00094 char *msg;
00095 time_t t;
00096 } irc_awaylog_t;
00097
00098 #define SOP(x) (j->sopt[x])
00099
00100
00101 typedef struct {
00102 char *nick;
00103 char *realname;
00104 char *host, *ident;
00105 list_t channels;
00106 } people_t;
00107
00108
00109 typedef struct {
00110 char *name;
00111 int syncmode;
00112 struct timeval syncstart;
00113 int mode;
00114 char *topic, *topicby, *mode_str;
00115 window_t *window;
00116 list_t onchan;
00117 char *nickpad_str;
00118 int nickpad_len, nickpad_pos;
00119 int longest_nick;
00120 list_t banlist;
00121
00122
00123
00124 list_t acclist;
00125 } channel_t;
00126
00127
00128 typedef struct {
00129 int mode;
00130 char sign[2];
00131 channel_t *chanp;
00132 } people_chan_t;
00133
00134
00135 typedef struct {
00136 session_t *session;
00137 char *hostname;
00138 char *address;
00139 int port;
00140 int family;
00141 } connector_t;
00142
00143 typedef struct {
00144 char *session;
00145 list_t *plist;
00146 int isbind;
00147 } irc_resolver_t;
00148
00149 #define irc_private(s) ((irc_private_t*) session_private_get(s))
00150
00151
00152 #define IRC4 "irc:"
00153 #define irc_uid(target) protocol_uid("irc", target)
00154
00155 extern plugin_t irc_plugin;
00156
00157 void irc_handle_disconnect(session_t *s, const char *reason, int type);
00158
00159
00160
00161
00162
00163
00164
00165
00166 enum { IRC_GC_CHAN=0, IRC_GC_NOT_CHAN, IRC_GC_ANY };
00167
00168 #define irc_write(s, args...) watch_write((s && s->priv) ? irc_private(s)->send_watch : NULL, args);
00169
00170 int irc_parse_line(session_t *s, char *buf, int fd);
00171
00172 extern int irc_config_experimental_chan_name_clean;
00173
00174 char *nickpad_string_create(channel_t *chan);
00175 char *nickpad_string_apply(channel_t *chan, char *str);
00176 char *nickpad_string_restore(channel_t *chan);
00177
00178 #endif
00179
00180
00181
00182
00183
00184
00185
00186
00187