connection.h

Go to the documentation of this file.
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     GAIM_CONNECTION_NO_URLDESC = 0x0040,  
00048     GAIM_CONNECTION_NO_IMAGES = 0x0080,  
00049 } GaimConnectionFlags;
00050 
00051 typedef enum
00052 {
00053     GAIM_DISCONNECTED = 0, 
00054     GAIM_CONNECTED,        
00055     GAIM_CONNECTING        
00057 } GaimConnectionState;
00058 
00059 #include "account.h"
00060 #include "plugin.h"
00061 
00062 typedef struct
00063 {
00064     void (*connect_progress)(GaimConnection *gc, const char *text,
00065                              size_t step, size_t step_count);
00066     void (*connected)(GaimConnection *gc);
00067     void (*disconnected)(GaimConnection *gc);
00068     void (*notice)(GaimConnection *gc, const char *text);
00069     void (*report_disconnect)(GaimConnection *gc, const char *text);
00070 
00071 } GaimConnectionUiOps;
00072 
00073 struct _GaimConnection
00074 {
00075     GaimPlugin *prpl;            
00076     GaimConnectionFlags flags;   
00078     GaimConnectionState state;   
00080     GaimAccount *account;        
00081     int inpa;                    
00083     GSList *buddy_chats;         
00084     void *proto_data;            
00086     char *display_name;          
00087     guint keep_alive;            
00089     guint idle_timer;            
00090     time_t login_time;           
00091     time_t login_time_official;  
00092     time_t last_sent_time;       
00093     int is_idle;                 
00095     char *away;                  
00096     char *away_state;            
00097     gboolean is_auto_away;       
00099     int evil;                    
00102     gboolean wants_to_die;       
00108     guint disconnect_timeout;    
00109 };
00110 
00111 #ifdef __cplusplus
00112 extern "C" {
00113 #endif
00114 
00115 /**************************************************************************/
00117 /**************************************************************************/
00127 GaimConnection *gaim_connection_new(GaimAccount *account);
00128 
00134 void gaim_connection_destroy(GaimConnection *gc);
00135 
00143 void gaim_connection_connect(GaimConnection *gc);
00144 
00150 void gaim_connection_register(GaimConnection *gc);
00151 
00159 void gaim_connection_disconnect(GaimConnection *gc);
00160 
00167 void gaim_connection_set_state(GaimConnection *gc, GaimConnectionState state);
00168 
00175 void gaim_connection_set_account(GaimConnection *gc, GaimAccount *account);
00176 
00183 void gaim_connection_set_display_name(GaimConnection *gc, const char *name);
00184 
00192 GaimConnectionState gaim_connection_get_state(const GaimConnection *gc);
00193 
00199 #define GAIM_CONNECTION_IS_CONNECTED(gc) \
00200     (gc->state == GAIM_CONNECTED)
00201 
00209 GaimAccount *gaim_connection_get_account(const GaimConnection *gc);
00210 
00218 const char *gaim_connection_get_display_name(const GaimConnection *gc);
00219 
00228 void gaim_connection_update_progress(GaimConnection *gc, const char *text,
00229                                      size_t step, size_t count);
00230 
00237 void gaim_connection_notice(GaimConnection *gc, const char *text);
00238 
00245 void gaim_connection_error(GaimConnection *gc, const char *reason);
00246 
00249 /**************************************************************************/
00251 /**************************************************************************/
00257 void gaim_connections_disconnect_all(void);
00258 
00264 GList *gaim_connections_get_all(void);
00265 
00271 GList *gaim_connections_get_connecting(void);
00272 
00278 #define GAIM_CONNECTION_IS_VALID(gc) (g_list_find(gaim_connections_get_all(), (gc)) || g_list_find(gaim_connections_get_connecting(), (gc)))
00279 
00282 /**************************************************************************/
00284 /**************************************************************************/
00292 void gaim_connections_set_ui_ops(GaimConnectionUiOps *ops);
00293 
00299 GaimConnectionUiOps *gaim_connections_get_ui_ops(void);
00300 
00303 /**************************************************************************/
00305 /**************************************************************************/
00311 void gaim_connections_init(void);
00312 
00316 void gaim_connections_uninit(void);
00317 
00323 void *gaim_connections_get_handle(void);
00324 
00328 #ifdef __cplusplus
00329 }
00330 #endif
00331 
00332 #endif /* _GAIM_CONNECTION_H_ */

Generated on Sun Feb 18 08:38:11 2007 for gaim by  doxygen 1.5.1