ekg2  GIT master
irc.h
Idź do dokumentacji tego pliku.
1 /*
2  * (C) Copyright 2004-2005 Michal 'GiM' Spadlinski <gim at skrzynka dot pl>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License Version 2 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program; if not, write to the Free Software
15  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16  */
17 
18 #ifndef __EKG_PLUGINS_IRC_IRC_H
19 #define __EKG_PLUGINS_IRC_IRC_H
20 
21 #define EKG_IRC_DEFAULT_USERMODE "+iw"
22 
23 /* irc_private->sopt */
26 
27 /* irc_private_t->casemapping values */
29 
30 typedef struct _irc_private_t {
31  int autoreconnecting; /* are we in reconnecting mode now? */
32  gboolean disconnecting;
33 
34  GCancellable *connect_cancellable;
35  GDataOutputStream *send_stream;
36 
37  char *nick; /* guess again ? ;> */
38  char *host_ident; /* ident+host */
39 
40  list_t people; /* list of people_t */
41  list_t channels; /* list of people_chan_t */
43 
44  char *sopt[SERVOPTS]; /* just a few options from
45  * www.irc.org/tech_docs/005.html
46  * server's response */
47  char *nick_modes; /* should be freed */
48  char *nick_signs;
50 
52 
53  gchar **auto_guess_encoding; /* encoding names */
55 
56  gchar *conv;
58 
59 /* data for private->out_recodes */
60 typedef struct {
61  char *name; /* encoding name */
62  void *conv_in;
63  void *conv_out;
65 
66 /* data for private->recoded_channels */
67 typedef struct {
68  char *name; /* channel or nick */
71 
72 typedef struct _irc_awaylog_t {
73  char *channame; /* channel name, (null if priv) */
74  char *uid; /* nickname who wrote to us */
75  char *msg; /* msg */
76  time_t t; /* time_t when we recv message */
78 
79 #define SOP(x) (j->sopt[x])
80 
81 /* data for private->people */
82 typedef struct {
83  char *nick;
84  char *realname;
85  char *host, *ident;
87 } people_t;
88 
89 /* data for private->channels */
90 typedef struct {
91  char *name;
92  int syncmode;
93  GTimeVal syncstart;
94  int mode;
95  char *topic, *topicby, *mode_str;
98  char *nickpad_str;
99  int nickpad_len, nickpad_pos;
102  /* needed ?
103  list_t exclist;
104  list_t invlist; */
106 } channel_t;
107 
108 /* data for private->people->channels */
109 typedef struct {
110  int mode; /* bitfield */
111  char sign[2];
113 } people_chan_t;
114 
115 #define irc_private(s) ((irc_private_t*) session_private_get(s))
116 
117 /* DO NOT TOUCH THIS! */
118 #define IRC4 "irc:"
119 #define irc_uid(target) protocol_uid("irc", target)
120 
121 extern plugin_t irc_plugin;
122 
123 void irc_handle_disconnect(session_t *s, const char *reason, int type);
124 
125 /* checks if name is in format irc:something
126  * checkcon is one of:
127  * name is channel | nick
128  * IRC_GC_CHAN - channame | NULL
129  * IRC_GC_NOT_CHAN - NULL | nickname
130  * IRC_GC_ANY - name if it's in proper format [irc:something]
131  */
133 
134 #define irc_write(s, args...) ekg_connection_write(irc_private(s)->send_stream, args)
135 
136 int irc_parse_line(session_t *s, const char *l, int fd); /* misc.c */
137 
140 
142 char *nickpad_string_apply(channel_t *chan, const char *str);
144 
145 char *clean_channel_names(session_t *session, char *channels);
146 
147 #endif /* __EKG_PLUGINS_IRC_IRC_H */
148 
149 /*
150  * Local Variables:
151  * mode: c
152  * c-file-style: "k&r"
153  * c-basic-offset: 8
154  * indent-tabs-mode: t
155  * End:
156  */
list_t hilights
Definition: irc.h:42
Definition: chanview.c:59
GCancellable * connect_cancellable
Definition: irc.h:34
out_recodes_t * recode
Definition: irc.h:69
Definition: sessions.h:127
char * realname
Definition: irc.h:84
int syncmode
Definition: irc.h:92
gchar * conv
Definition: irc.h:56
int longest_nick
Definition: irc.h:100
char * nickpad_string_restore(channel_t *chan)
Definition: irc.c:1877
Definition: irc.h:25
int mode
Definition: irc.h:94
int irc_parse_line(session_t *s, const char *l, int fd)
Definition: misc.c:322
window_t * window
Definition: irc.h:96
char * nick_signs
Definition: irc.h:48
int nickpad_pos
Definition: irc.h:99
int irc_config_clean_channel_name
Definition: irc.c:128
Definition: irc.h:24
Definition: irc.h:24
Definition: irc.h:60
Definition: irc.h:28
Definition: irc.h:67
GTimeVal syncstart
Definition: irc.h:93
char * uid
Definition: irc.h:74
struct _irc_private_t irc_private_t
Definition: irc.h:25
Definition: irc.h:25
Definition: irc.h:25
gchar ** auto_guess_encoding
Definition: irc.h:53
char * name
Definition: irc.h:91
Definition: plugins.h:76
char * name
Definition: irc.h:68
Definition: irc.h:132
char * sopt[SERVOPTS]
Definition: irc.h:44
char * ident
Definition: irc.h:85
Definition: irc.h:109
GData * recoded_channels
Definition: irc.h:54
char * nick
Definition: irc.h:37
void * conv_out
Definition: irc.h:63
plugin_t irc_plugin
Definition: irc.c:133
struct _irc_awaylog_t irc_awaylog_t
char * topicby
Definition: irc.h:95
void * conv_in
Definition: irc.h:62
Definition: irc.h:28
channel_t * chanp
Definition: irc.h:112
int casemapping
Definition: irc.h:49
list_t acclist
Definition: irc.h:105
char * nick_modes
Definition: irc.h:47
Definition: irc.h:24
Definition: irc.h:25
Definition: irc.h:28
Definition: irc.h:82
int irc_config_allow_fake_contacts
Definition: irc.c:127
char * channame
Definition: irc.h:73
list_t channels
Definition: irc.h:41
Definition: irc.h:25
Definition: irc.h:24
Definition: irc.h:132
Definition: irc.h:90
list_t onchan
Definition: irc.h:97
Definition: irc.h:72
char * nickpad_str
Definition: irc.h:98
Definition: irc.h:132
void irc_handle_disconnect(session_t *s, const char *reason, int type)
Definition: irc.c:467
char * nickpad_string_create(channel_t *chan)
Definition: irc.c:1850
list_t awaylog
Definition: irc.h:51
Definition: ekg_hash_benchmark.c:14
Definition: windows.h:67
list_t banlist
Definition: irc.h:101
char * msg
Definition: irc.h:75
time_t t
Definition: irc.h:76
char * clean_channel_names(session_t *session, char *channels)
Definition: misc.c:707
int mode
Definition: irc.h:110
char * host_ident
Definition: irc.h:38
list_t channels
Definition: irc.h:86
#define s
char * nickpad_string_apply(channel_t *chan, const char *str)
Definition: irc.c:1865
char * nick
Definition: irc.h:83
int autoreconnecting
Definition: irc.h:31
Definition: irc.h:28
char * name
Definition: irc.h:61
Definition: irc.h:30
list_t people
Definition: irc.h:40
GDataOutputStream * send_stream
Definition: irc.h:35
gboolean disconnecting
Definition: irc.h:32