[gaim-migrate @ 3159]
[pidgin-git.git] / src / core.h
blob1a460f1bafd9ae953f523140c5bae2d0e9d28da1
1 /*
2 * gaim
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.
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.
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
22 #ifndef _CORE_H_
23 #define _CORE_H_
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
29 #include <stdio.h>
30 #include <time.h>
31 #include <glib.h>
32 #ifdef GAIM_PLUGINS
33 #include <gmodule.h>
34 #endif
36 #include "multi.h"
38 /* Really user states are controlled by the PRPLs now. We just use this for event_away */
39 #define UC_UNAVAILABLE 1
41 struct aim_user {
42 char username[64];
43 char password[32];
44 char user_info[2048];
45 int options;
46 int protocol;
47 /* prpls can use this to save information about the user,
48 * like which server to connect to, etc */
49 char proto_opt[7][256];
51 /* buddy icon file */
52 char iconfile[256];
54 struct gaim_connection *gc;
57 enum gaim_event {
58 event_signon = 0,
59 event_signoff,
60 event_away,
61 event_back,
62 event_im_recv,
63 event_im_send,
64 event_buddy_signon,
65 event_buddy_signoff,
66 event_buddy_away,
67 event_buddy_back,
68 event_buddy_idle,
69 event_buddy_unidle,
70 event_blist_update,
71 event_chat_invited,
72 event_chat_join,
73 event_chat_leave,
74 event_chat_buddy_join,
75 event_chat_buddy_leave,
76 event_chat_recv,
77 event_chat_send,
78 event_warned,
79 event_error,
80 event_quit,
81 event_new_conversation,
82 event_set_info,
83 event_draw_menu,
84 event_im_displayed_sent,
85 event_im_displayed_rcvd,
86 event_chat_send_invite,
87 event_got_typing,
88 /* any others? it's easy to add... */
91 struct UI {
92 GIOChannel *channel;
93 guint inpa;
96 #ifdef GAIM_PLUGINS
98 struct gaim_plugin {
99 GModule *handle;
100 char *name;
101 char *description;
104 struct gaim_callback {
105 GModule *handle;
106 enum gaim_event event;
107 void *function;
108 void *data;
111 #endif
113 #define BUDDY_ALIAS_MAXLEN 388 /* because MSN names can be 387 characters */
115 struct buddy {
116 int edittype; /* XXX CUI: this is really a GUI function and we need to put this in ui.h */
117 char name[80];
118 char show[BUDDY_ALIAS_MAXLEN];
119 int present;
120 int evil;
121 time_t signon;
122 time_t idle;
123 int uc;
124 guint caps; /* woohoo! */
125 void *proto_data; /* what a hack */
126 struct gaim_connection *gc; /* the connection it belongs to */
129 struct group {
130 int edittype; /* XXX CUI: this is really a GUI function and we need to put this in ui.h */
131 char name[80];
132 GSList *members;
133 struct gaim_connection *gc; /* the connection it belongs to */
136 /* Globals in core.c */
137 extern GSList *uis;
139 /* Globals in plugins.c */
140 extern GList *plugins;
141 extern GList *callbacks;
143 /* Functions in buddy.c */
144 extern struct buddy *find_buddy(struct gaim_connection *, char *);
145 extern struct group *find_group(struct gaim_connection *, char *);
146 extern struct group *find_group_by_buddy(struct gaim_connection *, char *);
147 extern struct buddy *add_buddy(struct gaim_connection *, char *, char *, char *);
148 extern void remove_buddy(struct gaim_connection *, struct group *, struct buddy *);
149 extern struct group *add_group(struct gaim_connection *, char *);
150 extern void remove_group(struct gaim_connection *, struct group *);
151 extern void do_export(struct gaim_connection *);
152 extern void do_import(struct gaim_connection *, char *);
153 extern int bud_list_cache_exists(struct gaim_connection *);
154 extern void toc_build_config(struct gaim_connection *, char *, int len, gboolean);
155 extern void parse_toc_buddy_list(struct gaim_connection *, char *);
156 extern void signoff_blocked(struct gaim_connection *);
158 /* Functions in core.c */
159 extern gint UI_write(struct UI *, guchar *, int);
160 extern void UI_build_write(struct UI *, guchar, guchar, ...);
161 extern void UI_broadcast(guchar *data, int);
162 extern void UI_build_broadcast(guchar, guchar, ...);
163 /* Don't ever use these; when gaim-core is done these will be
164 * merged into the core's main() and won't be called directly */
165 extern int core_main();
166 extern void core_quit();
168 /* Functions in gaimrc.c */
169 extern void load_prefs();
170 extern void save_prefs();
172 /* Functions in perl.c */
173 #ifdef USE_PERL
174 extern void perl_autoload();
175 extern void perl_end();
176 extern int perl_event(enum gaim_event, void *, void *, void *, void *);
177 extern int perl_load_file(char *);
178 extern void unload_perl_scripts();
179 extern void list_perl_scripts();
180 #endif
182 /* Functions in plugins.c */
183 #ifdef GAIM_PLUGINS
184 extern struct gaim_plugin *load_plugin(char *);
185 extern void unload_plugin(struct gaim_plugin *);
186 extern struct gaim_plugin *reload_plugin(struct gaim_plugin *);
187 extern void gaim_signal_connect(GModule *, enum gaim_event, void *, void *);
188 extern void gaim_signal_disconnect(GModule *, enum gaim_event, void *);
189 extern void gaim_plugin_unload(GModule *);
190 extern void remove_all_plugins();
191 #endif
192 extern int plugin_event(enum gaim_event, void *, void *, void *, void *);
193 extern char *event_name(enum gaim_event);
195 /* Functions in server.c */
196 extern void serv_got_update(struct gaim_connection *, char *, int, int, time_t, time_t, int, guint);
197 extern void serv_got_im(struct gaim_connection *, char *, char *, guint32, time_t, gint);
198 extern void serv_got_typing(struct gaim_connection *, char *, int);
199 extern void serv_got_typing_stopped(struct gaim_connection *, char *);
200 extern void serv_got_eviled(struct gaim_connection *, char *, int);
201 extern void serv_got_chat_invite(struct gaim_connection *, char *, char *, char *, GList *);
202 extern struct conversation *serv_got_joined_chat(struct gaim_connection *, int, char *);
203 extern void serv_got_chat_left(struct gaim_connection *, int);
204 extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *, time_t);
205 extern void serv_finish_login();
207 #endif /* _CORE_H_ */