Mercurial > pidgin.yaz
annotate src/core.h @ 4349:0c68d402f59f
[gaim-migrate @ 4614]
XML Blist
Gaim stores all the buddy lists in one big happy file now. You can order
the buddies however you want, and they'll stay ordered that way.
We can also store some per-buddy information now, which will be cool.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Sun, 19 Jan 2003 22:16:52 +0000 |
parents | cddb50734169 |
children | 5fb47ec9bfe4 |
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 | |
45 #include "multi.h" | |
46 | |
2501
227cc42ffa6e
[gaim-migrate @ 2514]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2447
diff
changeset
|
47 /* 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
|
48 #define UC_UNAVAILABLE 1 |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
49 |
3205 | 50 /* This is far too long to be practical, but MSN users are probably used to long aliases */ |
51 #define SELF_ALIAS_LEN 400 | |
52 | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
53 struct aim_user { |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
54 char username[64]; |
3205 | 55 char alias[SELF_ALIAS_LEN]; |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
56 char password[32]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
57 char user_info[2048]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
58 int options; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
59 int protocol; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
60 /* prpls can use this to save information about the user, |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
61 * like which server to connect to, etc */ |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
62 char proto_opt[7][256]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
63 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
64 /* buddy icon file */ |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
65 char iconfile[256]; |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
66 |
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
67 struct gaim_connection *gc; |
3510 | 68 gboolean connecting; |
4349 | 69 |
70 GSList *permit; | |
71 GSList *deny; | |
72 int permdeny; | |
2442
895e2469cb3a
[gaim-migrate @ 2455]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2440
diff
changeset
|
73 }; |
4349 | 74 |
2417 | 75 enum gaim_event { |
76 event_signon = 0, | |
77 event_signoff, | |
78 event_away, | |
79 event_back, | |
80 event_im_recv, | |
81 event_im_send, | |
82 event_buddy_signon, | |
83 event_buddy_signoff, | |
84 event_buddy_away, | |
85 event_buddy_back, | |
86 event_buddy_idle, | |
87 event_buddy_unidle, | |
88 event_blist_update, | |
89 event_chat_invited, | |
90 event_chat_join, | |
91 event_chat_leave, | |
92 event_chat_buddy_join, | |
93 event_chat_buddy_leave, | |
94 event_chat_recv, | |
95 event_chat_send, | |
96 event_warned, | |
97 event_error, | |
98 event_quit, | |
99 event_new_conversation, | |
100 event_set_info, | |
101 event_draw_menu, | |
102 event_im_displayed_sent, | |
103 event_im_displayed_rcvd, | |
104 event_chat_send_invite, | |
2993 | 105 event_got_typing, |
3461 | 106 event_del_conversation, |
3510 | 107 event_connecting, |
2417 | 108 /* any others? it's easy to add... */ |
109 }; | |
110 | |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
111 struct UI { |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
112 GIOChannel *channel; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
113 guint inpa; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
114 }; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
115 |
3551 | 116 #define USE_PLUGINS GAIM_PLUGINS || USE_PERL |
117 #define PLUGIN_API_VERSION 1 | |
118 enum gaim_plugin_type { | |
119 perl_script, | |
120 plugin | |
121 }; | |
122 | |
123 struct gaim_plugin_description { | |
124 int api_version; | |
125 gchar *name; | |
126 gchar *version; | |
127 gchar *description; | |
128 gchar *authors; | |
129 gchar *url; | |
130 gchar *iconfile; | |
131 }; | |
2417 | 132 |
133 struct gaim_plugin { | |
3551 | 134 enum gaim_plugin_type type; |
135 void *handle; | |
136 gchar path[128]; | |
137 struct gaim_plugin_description desc; | |
3563 | 138 gchar error[128]; |
3565 | 139 void *iter; |
2417 | 140 }; |
141 | |
3551 | 142 #ifdef GAIM_PLUGINS |
2417 | 143 struct gaim_callback { |
144 GModule *handle; | |
145 enum gaim_event event; | |
146 void *function; | |
147 void *data; | |
148 }; | |
149 #endif | |
150 | |
3136 | 151 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */ |
152 | |
2417 | 153 struct buddy { |
2438
5cbe86a444d9
[gaim-migrate @ 2451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2435
diff
changeset
|
154 int edittype; /* XXX CUI: this is really a GUI function and we need to put this in ui.h */ |
2417 | 155 char name[80]; |
4227 | 156 char alias[BUDDY_ALIAS_MAXLEN]; |
157 char server_alias[BUDDY_ALIAS_MAXLEN]; | |
158 int present; | |
2417 | 159 int evil; |
160 time_t signon; | |
161 time_t idle; | |
162 int uc; | |
2920 | 163 guint caps; /* woohoo! */ |
2417 | 164 void *proto_data; /* what a hack */ |
4349 | 165 struct aim_user *user; /* the connection it belongs to */ |
166 GHashTable *settings; | |
2417 | 167 }; |
168 | |
169 struct group { | |
2438
5cbe86a444d9
[gaim-migrate @ 2451]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2435
diff
changeset
|
170 int edittype; /* XXX CUI: this is really a GUI function and we need to put this in ui.h */ |
2417 | 171 char name[80]; |
172 GSList *members; | |
173 }; | |
174 | |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
175 /* Globals in core.c */ |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
176 extern GSList *uis; |
4349 | 177 extern GSList *groups; |
3484 | 178 extern int gaim_session; |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
179 |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
180 /* Globals in plugins.c */ |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
181 extern GList *plugins; |
3551 | 182 extern GList *probed_plugins; |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
183 extern GList *callbacks; |
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
184 |
2417 | 185 /* Functions in buddy.c */ |
4349 | 186 extern struct buddy *find_buddy(struct aim_user *, const char *); |
187 extern struct group *find_group(const char *); | |
188 extern struct group *find_group_by_buddy(struct buddy *); | |
189 extern struct buddy *add_buddy(struct aim_user *, const char *, const char *, const char *); | |
190 extern void remove_buddy(struct buddy *); | |
191 extern struct group *add_group(const char *); | |
192 extern void remove_group(struct group *); | |
193 extern void toc_build_config(struct aim_user *, char *, int len, gboolean); | |
194 extern void parse_toc_buddy_list(struct aim_user *, char *); | |
2597
2ced57c58653
[gaim-migrate @ 2610]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2526
diff
changeset
|
195 extern void signoff_blocked(struct gaim_connection *); |
4227 | 196 extern char* get_buddy_alias_only(struct buddy *); |
197 extern char* get_buddy_alias(struct buddy *); | |
4349 | 198 extern GSList *gaim_group_get_accounts(struct group *); |
199 extern gboolean gaim_group_on_account(struct group *, struct aim_user *); | |
200 extern void do_import(struct aim_user *, const char *); | |
201 extern void gaim_blist_load(); | |
202 extern void gaim_blist_save(); | |
203 extern gboolean gaim_privacy_permit_add(struct aim_user *, const char *); | |
204 extern gboolean gaim_privacy_permit_remove(struct aim_user *, const char *); | |
205 extern gboolean gaim_privacy_deny_add(struct aim_user *, const char *); | |
206 extern gboolean gaim_privacy_deny_remove(struct aim_user *, const char *); | |
207 extern void gaim_buddy_set_setting(struct buddy *, const char *, const char *); | |
208 extern char *gaim_buddy_get_setting(struct buddy *, const char *); | |
209 | |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
210 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
211 /* Functions in core.c */ |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
212 extern gint UI_write(struct UI *, guchar *, int); |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2443
diff
changeset
|
213 extern void UI_build_write(struct UI *, guchar, guchar, ...); |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
214 extern void UI_broadcast(guchar *data, int); |
2447
6bdeb91abe4e
[gaim-migrate @ 2460]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2443
diff
changeset
|
215 extern void UI_build_broadcast(guchar, guchar, ...); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
216 /* 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
|
217 * 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
|
218 extern int core_main(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
219 extern void core_quit(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
220 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
221 /* Functions in gaimrc.c */ |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
222 extern void load_prefs(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
223 extern void save_prefs(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
224 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
225 /* Functions in perl.c */ |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
226 #ifdef USE_PERL |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
227 extern void perl_end(); |
3517 | 228 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
|
229 extern int perl_load_file(char *); |
3551 | 230 extern void perl_unload_file(struct gaim_plugin *); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
231 extern void unload_perl_scripts(); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
232 extern void list_perl_scripts(); |
4298 | 233 extern struct gaim_plugin *probe_perl(char *); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
234 #endif |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
235 |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
236 /* Functions in plugins.c */ |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
237 #ifdef GAIM_PLUGINS |
3466 | 238 extern struct gaim_plugin *load_plugin(const char *); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
239 extern void unload_plugin(struct gaim_plugin *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
240 extern struct gaim_plugin *reload_plugin(struct gaim_plugin *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
241 extern void gaim_signal_connect(GModule *, enum gaim_event, void *, void *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
242 extern void gaim_signal_disconnect(GModule *, enum gaim_event, void *); |
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
243 extern void gaim_plugin_unload(GModule *); |
2440
8306c042bac7
[gaim-migrate @ 2453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2438
diff
changeset
|
244 extern void remove_all_plugins(); |
2435
b4f2a53c0ee5
[gaim-migrate @ 2448]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2417
diff
changeset
|
245 #endif |
3551 | 246 extern void gaim_probe_plugins(); |
3517 | 247 extern int plugin_event(enum gaim_event, ...); |
2511
a83b4a5ffcd6
[gaim-migrate @ 2524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2501
diff
changeset
|
248 extern char *event_name(enum gaim_event); |
2417 | 249 |
250 /* Functions in server.c */ | |
2920 | 251 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
|
252 extern void serv_got_im(struct gaim_connection *, char *, char *, guint32, time_t, gint); |
3768 | 253 extern void serv_got_typing(struct gaim_connection *, char *, int, int); |
2993 | 254 extern void serv_got_typing_stopped(struct gaim_connection *, char *); |
2417 | 255 extern void serv_got_eviled(struct gaim_connection *, char *, int); |
256 extern void serv_got_chat_invite(struct gaim_connection *, char *, char *, char *, GList *); | |
257 extern struct conversation *serv_got_joined_chat(struct gaim_connection *, int, char *); | |
258 extern void serv_got_chat_left(struct gaim_connection *, int); | |
259 extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *, time_t); | |
4227 | 260 extern void serv_got_alias(struct gaim_connection *, char *, char *); |
2417 | 261 extern void serv_finish_login(); |
262 | |
263 #endif /* _CORE_H_ */ |