Main Page | Modules | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

blist.h

Go to the documentation of this file.
00001 
00026 /* I can't believe I let ChipX86 inspire me to write good code. -Sean */
00027 
00028 #ifndef _BLIST_H_
00029 #define _BLIST_H_
00030 
00031 #include <glib.h>
00032 
00033 typedef struct _GaimBuddyList GaimBuddyList;
00034 typedef struct _GaimBlistUiOps GaimBlistUiOps;
00035 typedef struct _GaimBlistNode GaimBlistNode;
00036 
00037 typedef struct _GaimChat GaimChat;
00038 typedef struct _GaimGroup GaimGroup;
00039 typedef struct _GaimContact GaimContact;
00040 typedef struct _GaimBuddy GaimBuddy;
00041 
00042 #include "account.h"
00043 #include "buddyicon.h"
00044 
00045 /**************************************************************************/
00046 /* Enumerations                                                           */
00047 /**************************************************************************/
00048 typedef enum
00049 {
00050     GAIM_BLIST_GROUP_NODE,
00051     GAIM_BLIST_CONTACT_NODE,
00052     GAIM_BLIST_BUDDY_NODE,
00053     GAIM_BLIST_CHAT_NODE,
00054     GAIM_BLIST_OTHER_NODE
00055 
00056 } GaimBlistNodeType;
00057 
00058 #define GAIM_BLIST_NODE_IS_CHAT(n) ((n)->type == GAIM_BLIST_CHAT_NODE)
00059 #define GAIM_BLIST_NODE_IS_BUDDY(n) ((n)->type == GAIM_BLIST_BUDDY_NODE)
00060 #define GAIM_BLIST_NODE_IS_CONTACT(n) ((n)->type == GAIM_BLIST_CONTACT_NODE)
00061 #define GAIM_BLIST_NODE_IS_GROUP(n) ((n)->type == GAIM_BLIST_GROUP_NODE)
00062 
00063 typedef enum
00064 {
00065     GAIM_BUDDY_SIGNING_OFF = -1,
00066     GAIM_BUDDY_OFFLINE = 0,
00067     GAIM_BUDDY_ONLINE,
00068     GAIM_BUDDY_SIGNING_ON
00069 
00070 } GaimBuddyPresenceState;
00071 
00072 #define GAIM_BUDDY_IS_ONLINE(b) ((b)->account->gc && \
00073         ((b)->present == GAIM_BUDDY_ONLINE || \
00074          (b)->present == GAIM_BUDDY_SIGNING_ON))
00075 
00076 
00077 /**************************************************************************/
00078 /* Data Structures                                                        */
00079 /**************************************************************************/
00080 
00084 struct _GaimBlistNode {
00085     GaimBlistNodeType type;             
00086     GaimBlistNode *prev;                
00087     GaimBlistNode *next;                
00088     GaimBlistNode *parent;              
00089     GaimBlistNode *child;               
00090     GHashTable *settings;               
00091     void          *ui_data;             
00092 };
00093 
00097 struct _GaimBuddy {
00098     GaimBlistNode node;                     
00099     char *name;                             
00100     char *alias;                            
00101     char *server_alias;                     
00102     GaimBuddyPresenceState present;         
00104     int evil;                               
00105     time_t signon;                          
00106     int idle;                               
00107     int uc;                                 
00108     void *proto_data;                       
00109     GaimBuddyIcon *icon;                    
00110     GaimAccount *account;           
00111     guint timer;                            
00112 };
00113 
00117 struct _GaimContact {
00118     GaimBlistNode node;     
00119     char *alias;            
00120     int totalsize;          
00121     int currentsize;        
00122     int online;             
00123     GaimBuddy *priority;    
00124 };
00125 
00126 
00130 struct _GaimGroup {
00131     GaimBlistNode node;                    
00132     char *name;                            
00133     int totalsize;                 
00134     int currentsize;               
00135     int online;                
00136 };
00137 
00142 struct _GaimChat {
00143     GaimBlistNode node;      
00144     char *alias;             
00145     GHashTable *components;  
00146     GaimAccount *account; 
00147 };
00148 
00149 
00153 struct _GaimBuddyList {
00154     GaimBlistNode *root;          
00155     GHashTable *buddies;          
00156     GaimBlistUiOps *ui_ops;       
00158     void *ui_data;                
00159 };
00160 
00167 struct _GaimBlistUiOps
00168 {
00169     void (*new_list)(GaimBuddyList *list); 
00170     void (*new_node)(GaimBlistNode *node);      
00171     void (*show)(GaimBuddyList *list);     
00172     void (*update)(GaimBuddyList *list,
00173                GaimBlistNode *node);            
00174     void (*remove)(GaimBuddyList *list,
00175                GaimBlistNode *node);            
00176     void (*destroy)(GaimBuddyList *list);  
00177     void (*set_visible)(GaimBuddyList *list,
00178                 gboolean show);             
00179     void (*request_add_buddy)(GaimAccount *account, const char *username,
00180                               const char *group, const char *alias);
00181     void (*request_add_chat)(GaimAccount *account, GaimGroup *group, 
00182                              const char *alias);
00183     void (*request_add_group)(void);
00184 };
00185 
00186 #ifdef __cplusplus
00187 extern "C" {
00188 #endif
00189 
00190 /**************************************************************************/
00192 /**************************************************************************/
00198 GaimBuddyList *gaim_blist_new();
00199 
00205 void gaim_set_blist(GaimBuddyList *blist);
00206 
00212 GaimBuddyList *gaim_get_blist(void);
00213 
00218 void gaim_blist_show();
00219 
00220 
00224 void gaim_blist_destroy();
00225 
00231 void gaim_blist_set_visible(gboolean show);
00232 
00241 void gaim_blist_update_buddy_status(GaimBuddy *buddy, int status);
00242 
00243 
00250 void gaim_blist_update_buddy_presence(GaimBuddy *buddy, int presence);
00251 
00258 void gaim_blist_update_buddy_signon(GaimBuddy *buddy, time_t signon);
00259 
00266 void gaim_blist_update_buddy_idle(GaimBuddy *buddy, int idle);
00267 
00268 
00275 void gaim_blist_update_buddy_evil(GaimBuddy *buddy, int warning);
00276 
00282 void gaim_blist_update_buddy_icon(GaimBuddy *buddy);
00283 
00290 void gaim_blist_rename_buddy(GaimBuddy *buddy, const char *name);
00291 
00292 
00299 void gaim_blist_alias_buddy(GaimBuddy *buddy, const char *alias);
00300 
00307 void gaim_blist_server_alias_buddy(GaimBuddy *buddy, const char *alias);
00308 
00315 void gaim_blist_alias_chat(GaimChat *chat, const char *alias);
00316 
00323 void gaim_blist_rename_group(GaimGroup *group, const char *name);
00324 
00333 GaimChat *gaim_chat_new(GaimAccount *account, const char *alias, GHashTable *components);
00334 
00341 char *gaim_chat_get_display_name(GaimChat *chat);
00342 
00354 void gaim_blist_add_chat(GaimChat *chat, GaimGroup *group, GaimBlistNode *node);
00355 
00364 GaimBuddy *gaim_buddy_new(GaimAccount *account, const char *screenname, const char *alias);
00365 
00377 void gaim_buddy_set_icon(GaimBuddy *buddy, GaimBuddyIcon *icon);
00378 
00386 GaimBuddyIcon *gaim_buddy_get_icon(const GaimBuddy *buddy);
00387 
00395 GaimContact *gaim_buddy_get_contact(GaimBuddy *buddy);
00396 
00409 void gaim_blist_add_buddy(GaimBuddy *buddy, GaimContact *contact, GaimGroup *group, GaimBlistNode *node);
00410 
00420 GaimGroup *gaim_group_new(const char *name);
00421 
00431 void gaim_blist_add_group(GaimGroup *group, GaimBlistNode *node);
00432 
00438 GaimContact *gaim_contact_new();
00439 
00450 void gaim_blist_add_contact(GaimContact *contact, GaimGroup *group, GaimBlistNode *node);
00451 
00460 void gaim_blist_merge_contact(GaimContact *source, GaimBlistNode *node);
00461 
00468 GaimBuddy *gaim_contact_get_priority_buddy(GaimContact *contact);
00469 
00476 void gaim_contact_set_alias(GaimContact *contact, const char *alias);
00477 
00484 const char *gaim_contact_get_alias(GaimContact *contact);
00485 
00491 void gaim_blist_remove_buddy(GaimBuddy *buddy);
00492 
00499 void gaim_blist_remove_contact(GaimContact *contact);
00500 
00506 void gaim_blist_remove_chat(GaimChat *chat);
00507 
00514 void gaim_blist_remove_group(GaimGroup *group);
00515 
00522 const char *gaim_get_buddy_alias_only(GaimBuddy *buddy);
00523 
00524 
00531 const char *gaim_get_buddy_alias(GaimBuddy *buddy);
00532 
00539 const char *gaim_chat_get_name(GaimChat *chat);
00540 
00548 GaimBuddy *gaim_find_buddy(GaimAccount *account, const char *name);
00549 
00558 GaimBuddy *gaim_find_buddy_in_group(GaimAccount *account, const char *name,
00559         GaimGroup *group);
00560 
00569 GSList *gaim_find_buddies(GaimAccount *account, const char *name);
00570 
00571 
00578 GaimGroup *gaim_find_group(const char *name);
00579 
00588 GaimChat *gaim_blist_find_chat(GaimAccount *account, const char *name);
00589 
00597 GaimGroup *gaim_chat_get_group(GaimChat *chat);
00598 
00605 GaimGroup *gaim_find_buddys_group(GaimBuddy *buddy);
00606 
00607 
00615 GSList *gaim_group_get_accounts(GaimGroup *g);
00616 
00625 gboolean gaim_group_on_account(GaimGroup *g, GaimAccount *account);
00626 
00633 void gaim_blist_add_account(GaimAccount *account);
00634 
00635 
00642 void gaim_blist_remove_account(GaimAccount *account);
00643 
00644 
00652 int gaim_blist_get_group_size(GaimGroup *group, gboolean offline);
00653 
00660 int gaim_blist_get_group_online_count(GaimGroup *group);
00661 
00664 /****************************************************************************************/
00666 /****************************************************************************************/
00667 
00672 void gaim_blist_save();
00673 
00680 void gaim_blist_parse_toc_buddy_list(GaimAccount *account, char *config);
00681 
00682 
00686 void gaim_blist_load();
00687 
00697 void gaim_blist_request_add_buddy(GaimAccount *account, const char *username,
00698                                   const char *group, const char *alias);
00699 
00707 void gaim_blist_request_add_chat(GaimAccount *account, GaimGroup *group,
00708                                  const char *alias);
00709 
00714 void gaim_blist_request_add_group(void);
00715 
00723 void gaim_blist_node_set_bool(GaimBlistNode *node, const char *key, gboolean value);
00724 
00733 gboolean gaim_blist_node_get_bool(GaimBlistNode *node, const char *key);
00734 
00742 void gaim_blist_node_set_int(GaimBlistNode *node, const char *key, int value);
00743 
00752 int gaim_blist_node_get_int(GaimBlistNode *node, const char *key);
00753 
00761 void gaim_blist_node_set_string(GaimBlistNode *node, const char *key,
00762         const char *value);
00763 
00772 const char *gaim_blist_node_get_string(GaimBlistNode *node, const char *key);
00773 
00780 void gaim_blist_node_remove_setting(GaimBlistNode *node, const char *key);
00781 
00792 void gaim_group_set_setting(GaimGroup *g, const char *key, const char *value);
00793 
00804 const char *gaim_group_get_setting(GaimGroup *g, const char *key);
00805 
00816 void gaim_chat_set_setting(GaimChat *c, const char *key, const char *value);
00817 
00829 const char *gaim_chat_get_setting(GaimChat *c, const char *key);
00830 
00841 void gaim_buddy_set_setting(GaimBuddy *b, const char *key, const char *value);
00842 
00853 const char *gaim_buddy_get_setting(GaimBuddy *b, const char *key);
00854 
00862 GList *gaim_buddy_get_extended_menu(GaimBuddy *b);
00863 
00864 
00865 /**************************************************************************/
00867 /**************************************************************************/
00875 void gaim_blist_set_ui_ops(GaimBlistUiOps *ops);
00876 
00882 GaimBlistUiOps *gaim_blist_get_ui_ops(void);
00883 
00886 /**************************************************************************/
00888 /**************************************************************************/
00896 void *gaim_blist_get_handle(void);
00897 
00901 void gaim_blist_init(void);
00902 
00906 void gaim_blist_uninit(void);
00907 
00910 #ifdef __cplusplus
00911 }
00912 #endif
00913 
00914 #endif /* _BLIST_H_ */

Generated on Tue Aug 3 17:36:34 2004 for gaim by doxygen 1.3.4