ekg2  GIT master
 All Struktury Danych Pliki Funkcje Zmienne Definicje typów Wyliczenia Wartości wyliczeń Definicje Grupay Strony
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  */