[gaim-migrate @ 3063]
[pidgin-git.git] / src / gaim.h
blob568b2754c37df112934c2f2705e171422fbb4896
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 _GAIM_H_
23 #define _GAIM_H_
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
29 #include "core.h"
30 #include "ui.h"
31 /* XXX CUI: when this is done being split, the only things below should be things
32 * both the core and the uis depend on e.g. the protocol definitions, etc, and
33 * it won't include core.h or ui.h (i.e. it'll mostly be #define's) */
35 /* this is the basis of the CUI protocol. */
36 #define CUI_TYPE_META 1
37 #define CUI_TYPE_PLUGIN 2
38 #define CUI_TYPE_USER 3
39 #define CUI_TYPE_CONN 4
40 #define CUI_TYPE_BUDDY 5 /* BUDDY_LIST, i.e., both groups and buddies */
41 #define CUI_TYPE_MESSAGE 6
42 #define CUI_TYPE_CHAT 7
44 #define CUI_META_LIST 1 /* 1 is always list; this is ignored by the core.
45 If we move to TCP this can be a keepalive */
46 #define CUI_META_QUIT 2
47 #define CUI_META_DETACH 3 /* you don't need to send this, you can just close
48 the socket. the core will understand. */
50 #define CUI_PLUGIN_LIST 1
51 #define CUI_PLUGIN_LOAD 2
52 #define CUI_PLUGIN_UNLOAD 3
53 #define CUI_PLUGIN_RELOAD 4 /* this is redundant and may be removed */
55 #define CUI_USER_LIST 1
56 #define CUI_USER_ADD 2
57 #define CUI_USER_REMOVE 3
58 #define CUI_USER_MODIFY 4 /* this handles moving them in the list too */
59 #define CUI_USER_SIGNON 5
61 #define CUI_CONN_LIST 1
62 #define CUI_CONN_PROGRESS 2
63 #define CUI_CONN_ONLINE 3
64 #define CUI_CONN_OFFLINE 4 /* this may send a "reason" for why it was killed */
66 #define CUI_BUDDY_LIST 1
67 #define CUI_BUDDY_STATE 2 /* notifies the UI of state changes; UI can use it to
68 request the current status from the core */
69 #define CUI_BUDDY_ADD 3
70 #define CUI_BUDDY_REMOVE 4
71 #define CUI_BUDDY_MODIFY 5
73 #define CUI_MESSAGE_LIST 1 /* no idea */
74 #define CUI_MESSAGE_SEND 2
75 #define CUI_MESSAGE_RECV 3
77 #define CUI_CHAT_LIST 1
78 #define CUI_CHAT_HISTORY 2 /* is this necessary? should we have one for IMs? */
79 #define CUI_CHAT_JOIN 3 /* handles other people joining/parting too */
80 #define CUI_CHAT_PART 4
81 #define CUI_CHAT_SEND 5
82 #define CUI_CHAT_RECV 6
85 #define BROWSER_NETSCAPE 0
86 #define BROWSER_KFM 1
87 #define BROWSER_MANUAL 2
88 /*#define BROWSER_INTERNAL 3*/
89 #define BROWSER_GNOME 4
91 #define IM_FLAG_AWAY 0x01
92 #define IM_FLAG_CHECKBOX 0x02
93 #define IM_FLAG_GAIMUSER 0x04
95 #define IDLE_NONE 0
96 #define IDLE_GAIM 1
97 #define IDLE_SCREENSAVER 2
99 #define PERMIT_ALL 1
100 #define PERMIT_NONE 2
101 #define PERMIT_SOME 3
102 #define DENY_SOME 4
104 #define WFLAG_SEND 0x01
105 #define WFLAG_RECV 0x02
106 #define WFLAG_AUTO 0x04
107 #define WFLAG_WHISPER 0x08
108 #define WFLAG_FILERECV 0x10
109 #define WFLAG_SYSTEM 0x20
110 #define WFLAG_NICK 0x40
111 #define WFLAG_NOLOG 0x80
113 #define AUTO_RESPONSE "&lt;AUTO-REPLY&gt; : "
115 #define WEBSITE "http://gaim.sourceforge.net/"
117 #ifndef USE_GNOME
118 #ifdef ENABLE_NLS
119 # include <libintl.h>
120 # define _(x) gettext(x)
121 # ifdef gettext_noop
122 # define N_(String) gettext_noop (String)
123 # else
124 # define N_(String) (String)
125 # endif
126 #else
127 # define N_(String) (String)
128 # define _(x) (x)
129 #endif
130 #endif
132 #define OPT_USR_AUTO 0x00000001
133 /*#define OPT_USR_KEEPALV 0x00000002 this shouldn't be optional */
134 #define OPT_USR_REM_PASS 0x00000004
135 #define OPT_USR_MAIL_CHECK 0x00000008
137 #define DEFAULT_INFO "Visit the Gaim website at <A HREF=\"http://gaim.sourceforge.net/\">http://gaim.sourceforge.net/</A>."
139 enum log_event {
140 log_signon = 0,
141 log_signoff,
142 log_away,
143 log_back,
144 log_idle,
145 log_unidle,
146 log_quit
149 #define OPT_POUNCE_POPUP 0x001
150 #define OPT_POUNCE_SEND_IM 0x002
151 #define OPT_POUNCE_COMMAND 0x004
152 #define OPT_POUNCE_SOUND 0x008
154 #define OPT_POUNCE_SIGNON 0x010
155 #define OPT_POUNCE_UNAWAY 0x020
156 #define OPT_POUNCE_UNIDLE 0x040
157 #define OPT_POUNCE_TYPING 0x080
158 #define OPT_POUNCE_SAVE 0x100
160 #define OPT_POUNCE_NOTIFY 0x200
162 #define CONVERSATION_TITLE "%s - Gaim"
163 #define LOG_CONVERSATION_TITLE "%s - Gaim (logged)"
165 /* These should all be runtime selectable */
167 #define MSG_LEN 2048
168 /* The above should normally be the same as BUF_LEN,
169 * but just so we're explictly asking for the max message
170 * length. */
171 #define BUF_LEN MSG_LEN
172 #define BUF_LONG BUF_LEN * 2
174 /* Globals in aim.c */
175 extern GList *buddy_pounces;
176 extern GList *conversations;
177 extern int opt_away;
178 extern char *opt_away_arg;
179 extern char *opt_rcfile_arg;
180 extern int opt_debug;
182 extern guint misc_options;
183 #define OPT_MISC_DEBUG 0x00000001
184 #define OPT_MISC_BROWSER_POPUP 0x00000002
185 #define OPT_MISC_BUDDY_TICKER 0x00000004
186 #define OPT_MISC_COOL_LOOK 0x00000008
187 #define OPT_MISC_STEALTH_TYPING 0x00000010
189 extern guint logging_options;
190 #define OPT_LOG_ALL 0x00000001
191 #define OPT_LOG_STRIP_HTML 0x00000002
192 #define OPT_LOG_BUDDY_SIGNON 0x00000004
193 #define OPT_LOG_BUDDY_IDLE 0x00000008
194 #define OPT_LOG_BUDDY_AWAY 0x00000010
195 #define OPT_LOG_MY_SIGNON 0x00000020
196 #define OPT_LOG_INDIVIDUAL 0x00000040
198 extern guint blist_options;
199 #define OPT_BLIST_APP_BUDDY_SHOW 0x00000001
200 #define OPT_BLIST_SAVED_WINDOWS 0x00000002
201 #define OPT_BLIST_NEAR_APPLET 0x00000004
202 #define OPT_BLIST_SHOW_GRPNUM 0x00000008
203 #define OPT_BLIST_SHOW_PIXMAPS 0x00000010
204 #define OPT_BLIST_SHOW_IDLETIME 0x00000020
205 #define OPT_BLIST_SHOW_BUTTON_XPM 0x00000040
206 #define OPT_BLIST_NO_BUTTONS 0x00000080
207 #define OPT_BLIST_NO_MT_GRP 0x00000100
208 #define OPT_BLIST_SHOW_WARN 0x00000200
209 #define OPT_BLIST_GREY_IDLERS 0x00000400
210 #define OPT_BLIST_BOTTOM_TAB 0X00000800
212 extern guint convo_options;
213 #define OPT_CONVO_ENTER_SENDS 0x00000001
214 #define OPT_CONVO_SEND_LINKS 0x00000002
215 #define OPT_CONVO_CHECK_SPELLING 0x00000004
216 #define OPT_CONVO_CTL_CHARS 0x00000008
217 #define OPT_CONVO_CTL_SMILEYS 0x00000010
218 #define OPT_CONVO_ESC_CAN_CLOSE 0x00000020
219 #define OPT_CONVO_CTL_ENTER 0x00000040
220 #define OPT_CONVO_F2_TOGGLES 0x00000080
221 #define OPT_CONVO_SHOW_TIME 0x00000100
222 #define OPT_CONVO_IGNORE_COLOUR 0x00000200
223 #define OPT_CONVO_SHOW_SMILEY 0x00000400
224 #define OPT_CONVO_IGNORE_FONTS 0x00000800
225 #define OPT_CONVO_IGNORE_SIZES 0x00001000
226 #define OPT_CONVO_COMBINE 0x00002000
228 extern guint im_options;
229 #define OPT_IM_POPUP 0x00000001
230 #define OPT_IM_LOGON 0x00000002
231 #define OPT_IM_BUTTON_TEXT 0x00000004
232 #define OPT_IM_BUTTON_XPM 0x00000008
233 #define OPT_IM_ONE_WINDOW 0x00000010
234 #define OPT_IM_SIDE_TAB 0x00000020
235 #define OPT_IM_BR_TAB 0x00000040
236 #define OPT_IM_HIDE_ICONS 0x00000080
237 #define OPT_IM_NO_ANIMATION 0x00000100
238 #define OPT_IM_ALIAS_TAB 0x00002000
239 #define OPT_IM_POPDOWN 0x00004000
241 extern guint chat_options;
242 #define OPT_CHAT_ONE_WINDOW 0x00000001
243 #define OPT_CHAT_BUTTON_TEXT 0x00000002
244 #define OPT_CHAT_BUTTON_XPM 0x00000004
245 #define OPT_CHAT_LOGON 0x00000008
246 #define OPT_CHAT_POPUP 0x00000010
247 #define OPT_CHAT_SIDE_TAB 0x00000020
248 #define OPT_CHAT_BR_TAB 0x00000040
249 #define OPT_CHAT_TAB_COMPLETE 0x00000080
250 #define OPT_CHAT_OLD_STYLE_TAB 0x00000100
252 extern guint font_options;
253 #define OPT_FONT_BOLD 0x00000001
254 #define OPT_FONT_ITALIC 0x00000002
255 #define OPT_FONT_UNDERLINE 0x00000008
256 #define OPT_FONT_STRIKE 0x00000010
257 #define OPT_FONT_FACE 0x00000020
258 #define OPT_FONT_FGCOL 0x00000040
259 #define OPT_FONT_BGCOL 0x00000080
260 #define OPT_FONT_SIZE 0x00000100
262 extern guint sound_options;
263 #define OPT_SOUND_LOGIN 0x00000001
264 #define OPT_SOUND_LOGOUT 0x00000002
265 #define OPT_SOUND_RECV 0x00000004
266 #define OPT_SOUND_SEND 0x00000008
267 #define OPT_SOUND_FIRST_RCV 0x00000010
268 #define OPT_SOUND_WHEN_AWAY 0x00000020
269 #define OPT_SOUND_SILENT_SIGNON 0x00000040
270 #define OPT_SOUND_THROUGH_GNOME 0x00000080
271 #define OPT_SOUND_CHAT_JOIN 0x00000100
272 #define OPT_SOUND_CHAT_SAY 0x00000200
273 #define OPT_SOUND_BEEP 0x00000400
274 #define OPT_SOUND_CHAT_PART 0x00000800
275 #define OPT_SOUND_CHAT_YOU_SAY 0x00001000
276 #define OPT_SOUND_NORMAL 0x00002000
277 #define OPT_SOUND_NAS 0x00004000
278 #define OPT_SOUND_ARTSC 0x00008000
279 #define OPT_SOUND_ESD 0x00010000
280 #define OPT_SOUND_CMD 0x00020000
282 #define BUDDY_ARRIVE 0
283 #define BUDDY_LEAVE 1
284 #define RECEIVE 2
285 #define FIRST_RECEIVE 3
286 #define SEND 4
287 #define CHAT_JOIN 5
288 #define CHAT_LEAVE 6
289 #define CHAT_YOU_SAY 7
290 #define CHAT_SAY 8
291 #define POUNCE_DEFAULT 9
292 #define NUM_SOUNDS 10
293 extern char *sound_file[NUM_SOUNDS];
295 extern guint away_options;
296 #define OPT_AWAY_DISCARD 0x00000001
297 #define OPT_AWAY_BACK_ON_IM 0x00000002
298 #define OPT_AWAY_TIK_HACK 0x00000004
299 #define OPT_AWAY_AUTO 0x00000008
300 #define OPT_AWAY_NO_AUTO_RESP 0x00000010
301 #define OPT_AWAY_QUEUE 0x00000020
302 #define OPT_AWAY_IDLE_RESP 0x00000040
304 extern guint away_resend;
305 extern int report_idle;
306 extern int web_browser;
307 extern GSList *aim_users;
308 extern GSList *message_queue;
309 extern GSList *away_time_queue;
310 extern char sound_cmd[2048];
311 extern char web_command[2048];
312 extern struct save_pos blist_pos;
313 extern struct window_size conv_size, buddy_chat_size;
315 /* Functions in buddy.c */
316 extern void do_quit();
317 extern void signoff(struct gaim_connection *);
318 extern void do_pounce(struct gaim_connection *, char *, int);
320 /* Functions in buddy_chat.c */
321 extern void show_new_buddy_chat(struct conversation *);
322 extern void chat_set_topic(struct conversation*, char*, char*);
323 extern void add_chat_buddy(struct conversation *, char *);
324 extern void rename_chat_buddy(struct conversation *, char *, char *);
325 extern void remove_chat_buddy(struct conversation *, char *, char *);
327 /* Functions in conversation.c */
328 extern void write_to_conv(struct conversation *, char *, int, char *, time_t, int);
329 extern struct conversation *find_conversation(char *);
331 /* Functions in dialogs.c */
332 extern void g_show_info_text(struct gaim_connection *, char *, int, char *, ...);
333 extern GtkWidget *do_error_dialog(char *, char *);
334 extern void show_change_passwd(struct gaim_connection *);
335 extern void show_set_dir(struct gaim_connection *);
336 extern void show_find_email(struct gaim_connection *);
337 extern void show_find_info(struct gaim_connection *);
338 extern void show_set_info(struct gaim_connection *);
339 extern void show_confirm_del(struct gaim_connection *, gchar *);
341 /* Functions in gaimrc.c */
342 extern gint sort_awaymsg_list(gconstpointer, gconstpointer);
344 /* Functions in html.c */
345 extern void grab_url(char *, gboolean, void (*callback)(gpointer, char *), gpointer);
346 extern gchar *strip_html(gchar *);
348 /* Functions in idle.c */
349 extern gint check_idle(gpointer);
351 /* Functions in prefs.c */
352 extern void debug_printf(char * fmt, ...);
354 /* Functions in server.c */
355 /* input to serv */
356 extern void serv_login(struct aim_user *);
357 extern void serv_close(struct gaim_connection *);
358 extern void serv_touch_idle(struct gaim_connection *);
359 extern int serv_send_im(struct gaim_connection *, char *, char *, int, int);
360 extern void serv_get_info(struct gaim_connection *, char *);
361 extern void serv_get_dir(struct gaim_connection *, char *);
362 extern void serv_set_idle(struct gaim_connection *, int);
363 extern void serv_set_info(struct gaim_connection *, char *);
364 extern void serv_set_away(struct gaim_connection *, char *, char *);
365 extern void serv_set_away_all(char *);
366 extern int serv_send_typing(struct gaim_connection *, char *, int);
367 extern void serv_change_passwd(struct gaim_connection *, char *, char *);
368 extern void serv_add_buddy(struct gaim_connection *, char *);
369 extern void serv_add_buddies(struct gaim_connection *, GList *);
370 extern void serv_remove_buddy(struct gaim_connection *, char *, char *);
371 extern void serv_remove_buddies(struct gaim_connection *, GList *, char *);
372 extern void serv_add_permit(struct gaim_connection *, char *);
373 extern void serv_add_deny(struct gaim_connection *, char *);
374 extern void serv_rem_permit(struct gaim_connection *, char *);
375 extern void serv_rem_deny(struct gaim_connection *, char *);
376 extern void serv_set_permit_deny(struct gaim_connection *);
377 extern void serv_warn(struct gaim_connection *, char *, int);
378 extern void serv_set_dir(struct gaim_connection *, char *, char *, char *, char *, char *, char *, char *, int);
379 extern void serv_dir_search(struct gaim_connection *, char *, char *, char *, char *, char *, char *, char *, char *);
380 extern void serv_join_chat(struct gaim_connection *, GList *);
381 extern void serv_chat_invite(struct gaim_connection *, int, char *, char *);
382 extern void serv_chat_leave(struct gaim_connection *, int);
383 extern void serv_chat_whisper(struct gaim_connection *, int, char *, char *);
384 extern int serv_chat_send(struct gaim_connection *, int, char *);
385 extern void serv_got_popup(char *, char *, int, int);
386 extern void serv_get_away(struct gaim_connection *, char *);
388 /* Functions in util.c */
389 extern char *normalize(const char *);
390 extern char *tobase64(const char *);
391 extern void frombase64(const char *, char **, int *);
392 extern gint clean_pid(gpointer);
393 extern char *date();
394 extern gint linkify_text(char *);
395 extern FILE *open_log_file (char *);
396 extern char *sec_to_text(guint);
397 extern struct aim_user *find_user(const char *, int);
398 extern char *full_date();
399 extern void check_gaim_versions();
400 extern char *away_subs(char *, char *);
401 extern char *stylize(gchar *, int);
402 extern void show_usage (int, char *);
403 extern int do_auto_login (char *);
404 extern char *gaim_user_dir();
405 extern void strncpy_nohtml(gchar *, const gchar *, size_t);
406 extern void strncpy_withhtml(gchar *, const gchar *, size_t);
407 extern gchar *strdup_withhtml(const gchar *);
408 extern void away_on_login(char *);
409 extern void system_log(enum log_event, struct gaim_connection *, struct buddy *, int);
410 extern unsigned char *utf8_to_str(unsigned char *);
411 extern char *str_to_utf8(unsigned char *);
412 extern char *add_cr(char *);
413 extern void strip_linefeed(char *);
414 extern time_t get_time(int, int, int, int, int, int);
416 /*------------------------------------------------------------------------*/
417 /* Multi-Entry dialog and vCard dialog support */
418 /*------------------------------------------------------------------------*/
421 * Struct for "instructions" dialog data
423 typedef struct multi_instr_dlg {
424 GtkWidget *label; /* dialog instructions widget */
425 gchar *text; /* dialog instructions */
426 } MultiInstrData;
429 * Struct for multiple-entry dialog data
431 typedef struct multi_entry_data {
432 GtkWidget *widget; /* entry widget object */
433 char *label; /* label text pointer */
434 char *text; /* entry text pointer */
435 int visible; /* should entry field be "visible?" */
436 int editable; /* should entry field be editable? */
437 } MultiEntryData;
440 * Struct for multiple-textbox dialog data
442 typedef struct multi_text_data {
443 char *label; /* frame label */
444 GtkWidget *textbox; /* text entry widget object */
445 char *text; /* textbox text pointer */
446 } MultiTextData;
449 * Struct to create a multi-entry dialog
451 typedef struct multi_entry_dlg {
452 GtkWidget *window; /* dialog main window */
453 gchar *wmclass_name; /* window name */
454 gchar *wmclass_class; /* window class */
455 char *title; /* window title */
457 struct aim_user *user; /* user info - needed for most everything */
459 MultiInstrData *instructions; /* instructions (what else?) */
461 GtkWidget *entries_table; /* table widget containing m-e lables & entries */
462 GtkWidget *entries_frame; /* frame widget containing the table widget */
463 gchar *entries_title; /* title of multi-entries list */
464 GSList *multi_entry_items; /* entry dialogs parameters */
466 GtkWidget *texts_ibox; /* inner vbox containing multi-text frames */
467 GtkWidget *texts_obox; /* outer vbox containing multi-text frames */
468 GSList *multi_text_items; /* text dialogs parameters */
470 void * (*custom)(struct multi_entry_dlg *); /* Custom function that may be used by */
471 /* multi-entry dialog "wrapper" functions */
472 /* (Not used by multi-entry dialog routines) */
474 void (*ok)(GtkWidget *, gpointer); /* "Save/OK" action */
475 void (*cancel)(GtkWidget *, gpointer); /* "Cancel" action */
476 } MultiEntryDlg;
478 extern MultiTextData *multi_text_list_update(GSList **, const char *, const char *, int);
479 extern void multi_text_items_free_all(GSList **);
480 extern MultiEntryData *multi_entry_list_update(GSList **, const char *, const char *, int);
481 extern void multi_entry_items_free_all(GSList **);
483 extern void re_show_multi_entry_instr(MultiInstrData *);
484 extern void re_show_multi_entry_entries(GtkWidget **, GtkWidget *, GSList *);
485 extern void re_show_multi_entry_textboxes(GtkWidget **, GtkWidget *, GSList *);
487 extern MultiEntryDlg *multi_entry_dialog_new(void);
488 extern void show_multi_entry_dialog(gpointer);
490 extern void show_set_vcard(MultiEntryDlg *);
492 /*------------------------------------------------------------------------*/
493 /* End Multi-Entry dialog and vCard dialog support */
494 /*------------------------------------------------------------------------*/
496 #endif /* _GAIM_H_ */