00001
00027 #ifndef _GAIM_CONNECTION_H_
00028 #define _GAIM_CONNECTION_H_
00029
00030 #include <stdlib.h>
00031 #include <time.h>
00032
00033 typedef struct _GaimConnection GaimConnection;
00034
00038 typedef enum
00039 {
00040 GAIM_CONNECTION_HTML = 0x0001,
00041 GAIM_CONNECTION_NO_BGCOLOR = 0x0002,
00043 GAIM_CONNECTION_AUTO_RESP = 0x0004,
00044 GAIM_CONNECTION_FORMATTING_WBFO = 0x0008,
00045 GAIM_CONNECTION_NO_NEWLINES = 0x0010,
00046 GAIM_CONNECTION_NO_FONTSIZE = 0x0020
00047 } GaimConnectionFlags;
00048
00049 typedef enum
00050 {
00051 GAIM_DISCONNECTED = 0,
00052 GAIM_CONNECTED,
00053 GAIM_CONNECTING
00055 } GaimConnectionState;
00056
00057 #include "account.h"
00058 #include "plugin.h"
00059
00060 typedef struct
00061 {
00062 void (*connect_progress)(GaimConnection *gc, const char *text,
00063 size_t step, size_t step_count);
00064 void (*connected)(GaimConnection *gc);
00065 void (*disconnected)(GaimConnection *gc);
00066 void (*notice)(GaimConnection *gc, const char *text);
00067 void (*report_disconnect)(GaimConnection *gc, const char *text);
00068
00069 } GaimConnectionUiOps;
00070
00071 struct _GaimConnection
00072 {
00073 GaimPlugin *prpl;
00074 GaimConnectionFlags flags;
00076 GaimConnectionState state;
00078 GaimAccount *account;
00079 int inpa;
00081 GSList *buddy_chats;
00082 void *proto_data;
00084 char *display_name;
00085 guint keep_alive;
00087 guint idle_timer;
00088 time_t login_time;
00089 time_t login_time_official;
00090 time_t last_sent_time;
00091 int is_idle;
00093 char *away;
00094 char *away_state;
00095 gboolean is_auto_away;
00097 int evil;
00100 gboolean wants_to_die;
00106 guint disconnect_timeout;
00107 };
00108
00109 #ifdef __cplusplus
00110 extern "C" {
00111 #endif
00112
00113
00115
00125 GaimConnection *gaim_connection_new(GaimAccount *account);
00126
00132 void gaim_connection_destroy(GaimConnection *gc);
00133
00141 void gaim_connection_connect(GaimConnection *gc);
00142
00148 void gaim_connection_register(GaimConnection *gc);
00149
00157 void gaim_connection_disconnect(GaimConnection *gc);
00158
00165 void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state);
00166
00173 void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account);
00174
00181 void gaim_connection_set_display_name(GaimConnection *gc, const char *name);
00182
00190 GaimConnectionState gaim_connection_get_state(const GaimConnection *gc);
00191
00199 GaimAccount *gaim_connection_get_account(const GaimConnection *gc);
00200
00208 const char *gaim_connection_get_display_name(const GaimConnection *gc);
00209
00218 void gaim_connection_update_progress(GaimConnection *gc, const char *text,
00219 size_t step, size_t count);
00220
00227 void gaim_connection_notice(GaimConnection *gc, const char *text);
00228
00235 void gaim_connection_error(GaimConnection *gc, const char *reason);
00236
00239
00241
00247 void gaim_connections_disconnect_all(void);
00248
00254 GList *gaim_connections_get_all(void);
00255
00261 GList *gaim_connections_get_connecting(void);
00262
00265
00267
00275 void gaim_connections_set_ui_ops(GaimConnectionUiOps *ops);
00276
00282 GaimConnectionUiOps *gaim_connections_get_ui_ops(void);
00283
00286
00288
00294 void gaim_connections_init(void);
00295
00299 void gaim_connections_uninit(void);
00300
00306 void *gaim_connections_get_handle(void);
00307
00311 #ifdef __cplusplus
00312 }
00313 #endif
00314
00315 #endif