Mercurial > pidgin.yaz
annotate src/core.h @ 4615:34878f660804
[gaim-migrate @ 4904]
Fixed aim_conn_completeconnect. There was no need to select on the connection fd, since proxy_connect does that. On windows, we would sometimes enter an infinite loop when select was returning 0 as a result.
committer: Tailor Script <tailor@pidgin.im>
author | Herman Bloggs <hermanator12002@yahoo.com> |
---|---|
date | Tue, 25 Feb 2003 18:17:33 +0000 |
parents | 7521e29658bc |
children | d19872836812 |
rev | line source |
---|---|
2417 | 1 /* |
2 * gaim | |
3 * | |
4 * Copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * | |
6 * This program is free software; you can redistribute it and/or modify | |
7 * it under the terms of the GNU General Public License as published by | |
8 * the Free Software Foundation; either version 2 of the License, or | |
9 * (at your option) any later version. | |
10 * | |
11 * This program is distributed in the hope that it will be useful, | |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 * GNU General Public License for more details. | |
15 * | |
16 * You should have received a copy of the GNU General Public License | |
17 * along with this program; if not, write to the Free Software | |
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
19 * | |
20 */ | |
21 | |
22 #ifndef _CORE_H_ | |
23 #define _CORE_H_ | |
24 | |
25 #ifdef HAVE_CONFIG_H | |
26 #include <config.h> | |
27 #endif | |
28 | |
3517 | 29 #include <sys/types.h> |
3370 | 30 #ifdef HAVE_ICONV |
3367 | 31 #include <iconv.h> |
3370 | 32 #endif |
33 | |
34 #ifdef HAVE_LANGINFO_CODESET | |
3367 | 35 #include <langinfo.h> |
3370 | 36 #endif |
37 | |
2417 | 38 #include <stdio.h> |
39 #include <time.h> | |
40 #include <glib.h> | |
41 #ifdef GAIM_PLUGINS | |
42 #include <gmodule.h> | |
43 #endif | |
44 | |
4491 | 45 struct gaim_account; |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
46 struct group; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
47 struct buddy; |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
48 |
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
49 |
2417 | 50 #include "multi.h" |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
51 #include "conversation.h" |
4514
7521e29658bc
[gaim-migrate @ 4792]
Christian Hammond <chipx86@chipx86.com>
parents:
4491
diff
changeset
|
52 #include "ft.h" |
2417 | 53 |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2447
diff
changeset
|
54 /* Really user states are controlled by the PRPLs now. We just use this for event_away */ |
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2447
diff
changeset
|
55 #define UC_UNAVAILABLE 1 |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
56 |
3205 | 57 /* This is far too long to be practical, but MSN users are probably used to long aliases */ |
58 #define SELF_ALIAS_LEN 400 | |
59 | |
4491 | 60 struct gaim_account { |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
61 char username[64]; |
3205 | 62 char alias[SELF_ALIAS_LEN]; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
63 char password[32]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
64 char user_info[2048]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
65 int options; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
66 int protocol; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
67 /* prpls can use this to save information about the user, |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
68 * like which server to connect to, etc */ |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
69 char proto_opt[7][256]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
70 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
71 /* buddy icon file */ |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
72 char iconfile[256]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
73 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
74 struct gaim_connection *gc; |
3510 | 75 gboolean connecting; |
4349 | 76 |
77 GSList *permit; | |
78 GSList *deny; | |
79 int permdeny; | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
80 }; |
4349 | 81 |
2417 | 82 enum gaim_event { |
83 event_signon = 0, | |
84 event_signoff, | |
85 event_away, | |
86 event_back, | |
87 event_im_recv, | |
88 event_im_send, | |
89 event_buddy_signon, | |
90 event_buddy_signoff, | |
91 event_buddy_away, | |
92 event_buddy_back, | |
93 event_buddy_idle, | |
94 event_buddy_unidle, | |
95 event_blist_update, | |
96 event_chat_invited, | |
97 event_chat_join, | |
98 event_chat_leave, | |
99 event_chat_buddy_join, | |
100 event_chat_buddy_leave, | |
101 event_chat_recv, | |
102 event_chat_send, | |
103 event_warned, | |
104 event_error, | |
105 event_quit, | |
106 event_new_conversation, | |
107 event_set_info, | |
108 event_draw_menu, | |
109 event_im_displayed_sent, | |
110 event_im_displayed_rcvd, | |
111 event_chat_send_invite, | |
2993 | 112 event_got_typing, |
3461 | 113 event_del_conversation, |
3510 | 114 event_connecting, |
2417 | 115 /* any others? it's easy to add... */ |
116 }; | |
117 | |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
118 struct UI { |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
119 GIOChannel *channel; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
120 guint inpa; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
121 }; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
122 |
3551 | 123 #define USE_PLUGINS GAIM_PLUGINS || USE_PERL |
124 #define PLUGIN_API_VERSION 1 | |
125 enum gaim_plugin_type { | |
126 perl_script, | |
127 plugin | |
128 }; | |
129 | |
130 struct gaim_plugin_description { | |
131 int api_version; | |
132 gchar *name; | |
133 gchar *version; | |
134 gchar *description; | |
135 gchar *authors; | |
136 gchar *url; | |
137 gchar *iconfile; | |
138 }; | |
2417 | 139 |
140 struct gaim_plugin { | |
3551 | 141 enum gaim_plugin_type type; |
142 void *handle; | |
143 gchar path[128]; | |
144 struct gaim_plugin_description desc; | |
3563 | 145 gchar error[128]; |
3565 | 146 void *iter; |
2417 | 147 }; |
148 | |
3551 | 149 #ifdef GAIM_PLUGINS |
2417 | 150 struct gaim_callback { |
151 GModule *handle; | |
152 enum gaim_event event; | |
153 void *function; | |
154 void *data; | |
155 }; | |
156 #endif | |
157 | |
3136 | 158 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ |
159 | |
2417 | 160 struct buddy { |
2438
5cbe86a444d9
[gaim-migrate @ 2451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2435
diff
changeset
|
161 int edittype; /* XXX CUI: this is really a GUI function and we need to put this in ui.h */ |
2417 | 162 char name[80]; |
4227 | 163 char alias[BUDDY_ALIAS_MAXLEN]; |
164 char server_alias[BUDDY_ALIAS_MAXLEN]; | |
165 int present; | |
2417 | 166 int evil; |
167 time_t signon; | |
168 time_t idle; | |
169 int uc; | |
2920 | 170 guint caps; /* woohoo! */ |
2417 | 171 void *proto_data; /* what a hack */ |
4491 | 172 struct gaim_account *account; /* the connection it belongs to */ |
4349 | 173 GHashTable *settings; |
2417 | 174 }; |
175 | |
176 struct group { | |
2438
5cbe86a444d9
[gaim-migrate @ 2451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2435
diff
changeset
|
177 int edittype; /* XXX CUI: this is really a GUI function and we need to put this in ui.h */ |
2417 | 178 char name[80]; |
179 GSList *members; | |
180 }; | |
181 | |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
182 /* Globals in core.c */ |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
183 extern GSList *uis; |
4349 | 184 extern GSList *groups; |
3484 | 185 extern int gaim_session; |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
186 |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
187 /* Globals in plugins.c */ |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
188 extern GList *plugins; |
3551 | 189 extern GList *probed_plugins; |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
190 extern GList *callbacks; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
191 |
2417 | 192 /* Functions in buddy.c */ |
4491 | 193 extern struct buddy *find_buddy(struct gaim_account *, const char *); |
4349 | 194 extern struct group *find_group(const char *); |
195 extern struct group *find_group_by_buddy(struct buddy *); | |
4491 | 196 extern struct buddy *add_buddy(struct gaim_account *, const char *, const char *, const char *); |
4349 | 197 extern void remove_buddy(struct buddy *); |
198 extern struct group *add_group(const char *); | |
199 extern void remove_group(struct group *); | |
4491 | 200 extern void toc_build_config(struct gaim_account *, char *, int len, gboolean); |
201 extern void parse_toc_buddy_list(struct gaim_account *, char *); | |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2526
diff
changeset
|
202 extern void signoff_blocked(struct gaim_connection *); |
4227 | 203 extern char* get_buddy_alias_only(struct buddy *); |
204 extern char* get_buddy_alias(struct buddy *); | |
4349 | 205 extern GSList *gaim_group_get_accounts(struct group *); |
4491 | 206 extern gboolean gaim_group_on_account(struct group *, struct gaim_account *); |
207 extern void do_import(struct gaim_account *, const char *); | |
4349 | 208 extern void gaim_blist_load(); |
209 extern void gaim_blist_save(); | |
4491 | 210 extern gboolean gaim_privacy_permit_add(struct gaim_account *, const char *); |
211 extern gboolean gaim_privacy_permit_remove(struct gaim_account *, const char *); | |
212 extern gboolean gaim_privacy_deny_add(struct gaim_account *, const char *); | |
213 extern gboolean gaim_privacy_deny_remove(struct gaim_account *, const char *); | |
4349 | 214 extern void gaim_buddy_set_setting(struct buddy *, const char *, const char *); |
215 extern char *gaim_buddy_get_setting(struct buddy *, const char *); | |
216 | |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
217 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
218 /* Functions in core.c */ |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
219 extern gint UI_write(struct UI *, guchar *, int); |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2443
diff
changeset
|
220 extern void UI_build_write(struct UI *, guchar, guchar, ...); |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
221 extern void UI_broadcast(guchar *data, int); |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2443
diff
changeset
|
222 extern void UI_build_broadcast(guchar, guchar, ...); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
223 /* Don't ever use these; when gaim-core is done these will be |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
224 * merged into the core's main() and won't be called directly */ |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
225 extern int core_main(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
226 extern void core_quit(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
227 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
228 /* Functions in gaimrc.c */ |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
229 extern void load_prefs(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
230 extern void save_prefs(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
231 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
232 /* Functions in perl.c */ |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
233 #ifdef USE_PERL |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
234 extern void perl_end(); |
3517 | 235 extern int perl_event(enum gaim_event, void *, void *, void *, void *, void *); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
236 extern int perl_load_file(char *); |
3551 | 237 extern void perl_unload_file(struct gaim_plugin *); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
238 extern void unload_perl_scripts(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
239 extern void list_perl_scripts(); |
4298 | 240 extern struct gaim_plugin *probe_perl(char *); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
241 #endif |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
242 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
243 /* Functions in plugins.c */ |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
244 #ifdef GAIM_PLUGINS |
3466 | 245 extern struct gaim_plugin *load_plugin(const char *); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
246 extern void unload_plugin(struct gaim_plugin *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
247 extern struct gaim_plugin *reload_plugin(struct gaim_plugin *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
248 extern void gaim_signal_connect(GModule *, enum gaim_event, void *, void *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
249 extern void gaim_signal_disconnect(GModule *, enum gaim_event, void *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
250 extern void gaim_plugin_unload(GModule *); |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
251 extern void remove_all_plugins(); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
252 #endif |
3551 | 253 extern void gaim_probe_plugins(); |
3517 | 254 extern int plugin_event(enum gaim_event, ...); |
2511
a83b4a5ffcd6
[gaim-migrate @ 2524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
255 extern char *event_name(enum gaim_event); |
2417 | 256 |
257 /* Functions in server.c */ | |
2920 | 258 extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int, guint); |
2856
b1e300a85678
[gaim-migrate @ 2869]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2753
diff
changeset
|
259 extern void serv_got_im(struct gaim_connection *, char *, char *, guint32, time_t, gint); |
3768 | 260 extern void serv_got_typing(struct gaim_connection *, char *, int, int); |
2993 | 261 extern void serv_got_typing_stopped(struct gaim_connection *, char *); |
2417 | 262 extern void serv_got_eviled(struct gaim_connection *, char *, int); |
263 extern void serv_got_chat_invite(struct gaim_connection *, char *, char *, char *, GList *); | |
4359
5fb47ec9bfe4
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4349
diff
changeset
|
264 extern struct gaim_conversation *serv_got_joined_chat(struct gaim_connection *, int, char *); |
2417 | 265 extern void serv_got_chat_left(struct gaim_connection *, int); |
266 extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *, time_t); | |
4227 | 267 extern void serv_got_alias(struct gaim_connection *, char *, char *); |
2417 | 268 extern void serv_finish_login(); |
269 | |
270 #endif /* _CORE_H_ */ |