27#ifndef _PURPLE_BLIST_H_
28#define _PURPLE_BLIST_H_
55 PURPLE_BLIST_GROUP_NODE,
56 PURPLE_BLIST_CONTACT_NODE,
57 PURPLE_BLIST_BUDDY_NODE,
58 PURPLE_BLIST_CHAT_NODE,
59 PURPLE_BLIST_OTHER_NODE
63#define PURPLE_BLIST_NODE_IS_CHAT(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE)
64#define PURPLE_BLIST_NODE_IS_BUDDY(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE)
65#define PURPLE_BLIST_NODE_IS_CONTACT(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CONTACT_NODE)
66#define PURPLE_BLIST_NODE_IS_GROUP(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_GROUP_NODE)
68#define PURPLE_BUDDY_IS_ONLINE(b) \
69 ((b) != NULL && purple_account_is_connected(purple_buddy_get_account(b)) && \
70 purple_presence_is_online(purple_buddy_get_presence(b)))
82#define PURPLE_BLIST_NODE(obj) ((PurpleBlistNode *)(obj))
84#define PURPLE_BLIST_NODE_HAS_FLAG(b, f) (purple_blist_node_get_flags((PurpleBlistNode*)(b)) & (f))
85#define PURPLE_BLIST_NODE_SHOULD_SAVE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_NO_SAVE))
86#define PURPLE_BLIST_NODE_IS_VISIBLE(b) (! PURPLE_BLIST_NODE_HAS_FLAG(b, PURPLE_BLIST_NODE_FLAG_INVISIBLE))
88#define PURPLE_BLIST_NODE_NAME(n) (purple_blist_node_get_type(n) == PURPLE_BLIST_CHAT_NODE ? purple_chat_get_name((PurpleChat*)n) : \
89 purple_blist_node_get_type(n) == PURPLE_BLIST_BUDDY_NODE ? purple_buddy_get_name((PurpleBuddy*)n) : NULL)
94#define PURPLE_GROUP(obj) ((PurpleGroup *)(obj))
99#define PURPLE_CONTACT(obj) ((PurpleContact *)(obj))
104#define PURPLE_BUDDY(obj) ((PurpleBuddy *)(obj))
109#define PURPLE_CHAT(obj) ((PurpleChat *)(obj))
120#if !(defined PURPLE_HIDE_STRUCTS) || (defined _PURPLE_BLIST_C_)
148 PurplePresence *presence;
217 void (*request_add_buddy)(
PurpleAccount *account,
const char *username,
218 const char *group,
const char *alias);
220 const char *alias,
const char *name);
221 void (*request_add_group)(void);
265 void (*_purple_reserved1)(void);
464#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_)
779#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_)
881#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_BLIST_C_)
1105 const char *group,
const char *alias);
1117 const char *alias,
const char *name);
void purple_chat_destroy(PurpleChat *chat)
Destroys a chat.
PurpleBlistNode * purple_blist_get_root(void)
Returns the root node of the main buddy list.
void purple_contact_set_alias(PurpleContact *contact, const char *alias)
Sets the alias for a contact.
void purple_blist_rename_buddy(PurpleBuddy *buddy, const char *name)
Renames a buddy in the buddy list.
void purple_blist_set_ui_data(gpointer ui_data)
Sets the UI data for the list.
PurpleBlistNode * purple_blist_node_get_sibling_next(PurpleBlistNode *node)
Returns the sibling node of a given node.
void purple_buddy_set_protocol_data(PurpleBuddy *buddy, gpointer data)
Sets a buddy's protocol-specific data.
PurpleChat * purple_chat_new(PurpleAccount *account, const char *alias, GHashTable *components)
Creates a new chat for the buddy list.
void purple_blist_alias_contact(PurpleContact *contact, const char *alias)
Aliases a contact in the buddy list.
gpointer purple_blist_node_get_ui_data(const PurpleBlistNode *node)
Returns the UI data of a given node.
void purple_blist_remove_chat(PurpleChat *chat)
Removes a chat from the buddy list and frees the memory allocated to it.
@ PURPLE_BLIST_NODE_FLAG_INVISIBLE
node should not be displayed
@ PURPLE_BLIST_NODE_FLAG_NO_SAVE
node should not be saved with the buddy list
PurpleContact * purple_contact_new(void)
Creates a new contact.
PurpleBlistNode * purple_blist_node_get_parent(PurpleBlistNode *node)
Returns the parent node of a given node.
const char * purple_buddy_get_local_buddy_alias(PurpleBuddy *buddy)
Returns the local alias for the buddy, or NULL if none exists.
const char * purple_buddy_get_contact_alias(PurpleBuddy *buddy)
Returns the correct name to display for a buddy, taking the contact alias into account.
void purple_blist_node_set_ui_data(PurpleBlistNode *node, gpointer ui_data)
Sets the UI data of a given node.
void purple_blist_add_group(PurpleGroup *group, PurpleBlistNode *node)
Adds a new group to the buddy list.
void purple_blist_remove_contact(PurpleContact *contact)
Removes a contact, and any buddies it contains, and frees the memory allocated to it.
PurpleBuddyList * purple_blist_new(void)
Creates a new buddy list.
PurpleMediaCaps purple_buddy_get_media_caps(const PurpleBuddy *buddy)
Gets the media caps from a buddy.
const char * purple_buddy_get_local_alias(PurpleBuddy *buddy)
Returns the correct alias for this user, ignoring server aliases.
int purple_blist_node_get_int(PurpleBlistNode *node, const char *key)
Retrieves a named integer setting from a node in the buddy list.
void purple_blist_add_contact(PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node)
Adds a new contact to the buddy list.
PurpleBuddy * purple_contact_get_priority_buddy(PurpleContact *contact)
Returns the highest priority buddy for a given contact.
PurpleBlistNode * purple_blist_node_get_first_child(PurpleBlistNode *node)
Returns the the first child node of a given node.
void purple_blist_load(void)
Loads the buddy list from ~/.purple/blist.xml.
PurpleAccount * purple_chat_get_account(PurpleChat *chat)
Returns the account the chat belongs to.
void purple_blist_node_set_bool(PurpleBlistNode *node, const char *key, gboolean value)
Associates a boolean with a node in the buddy list.
PurpleBlistNode * purple_blist_node_next(PurpleBlistNode *node, gboolean offline)
Returns the next node of a given node.
PurpleBuddy * purple_find_buddy(PurpleAccount *account, const char *name)
Finds the buddy struct given a name and an account.
PurpleGroup * purple_chat_get_group(PurpleChat *chat)
Returns the group of which the chat is a member.
void purple_blist_add_chat(PurpleChat *chat, PurpleGroup *group, PurpleBlistNode *node)
Adds a new chat to the buddy list.
void purple_blist_set_ui_ops(PurpleBlistUiOps *ops)
Sets the UI operations structure to be used for the buddy list.
const char * purple_contact_get_alias(PurpleContact *contact)
Gets the alias for a contact.
PurpleBlistNodeType purple_blist_node_get_type(PurpleBlistNode *node)
Get the type of a given node.
PurpleGroup * purple_buddy_get_group(PurpleBuddy *buddy)
Returns the group of which the buddy is a member.
const char * purple_blist_node_get_string(PurpleBlistNode *node, const char *key)
Retrieves a named string setting from a node in the buddy list.
PurpleChat * purple_blist_find_chat(PurpleAccount *account, const char *name)
Finds a chat by name.
void purple_blist_rename_group(PurpleGroup *group, const char *name)
Renames a group.
void purple_blist_node_set_int(PurpleBlistNode *node, const char *key, int value)
Associates an integer with a node in the buddy list.
PurpleBuddyList * purple_get_blist(void)
Returns the main buddy list.
void purple_blist_update_node_icon(PurpleBlistNode *node)
Updates a node's custom icon.
PurpleAccount * purple_buddy_get_account(const PurpleBuddy *buddy)
Returns a buddy's account.
GList * purple_blist_node_get_extended_menu(PurpleBlistNode *n)
Retrieves the extended menu items for a buddy list node.
void purple_blist_show(void)
Shows the buddy list, creating a new one if necessary.
int purple_blist_get_group_size(PurpleGroup *group, gboolean offline)
Determines the total size of a group.
void purple_blist_set_visible(gboolean show)
Hides or unhides the buddy list.
gboolean purple_contact_on_account(PurpleContact *contact, PurpleAccount *account)
Determines whether an account owns any buddies in a given contact.
void purple_blist_destroy(void)
Destroys the buddy list window.
void purple_set_blist(PurpleBuddyList *blist)
Sets the main buddy list.
void purple_buddy_destroy(PurpleBuddy *buddy)
Destroys a buddy.
void purple_blist_node_set_string(PurpleBlistNode *node, const char *key, const char *value)
Associates a string with a node in the buddy list.
void purple_blist_add_account(PurpleAccount *account)
Called when an account connects.
PurpleGroup * purple_contact_get_group(const PurpleContact *contact)
Gets the PurpleGroup from a PurpleContact.
PurpleGroup * purple_group_new(const char *name)
Creates a new group.
void purple_buddy_set_icon(PurpleBuddy *buddy, PurpleBuddyIcon *icon)
Sets a buddy's icon.
GSList * purple_group_get_accounts(PurpleGroup *g)
Returns a list of accounts that have buddies in this group.
void purple_blist_request_add_chat(PurpleAccount *account, PurpleGroup *group, const char *alias, const char *name)
Requests from the user information needed to add a chat to the buddy list.
PurpleBlistUiOps * purple_blist_get_ui_ops(void)
Returns the UI operations structure to be used for the buddy list.
void purple_blist_request_add_buddy(PurpleAccount *account, const char *username, const char *group, const char *alias)
Requests from the user information needed to add a buddy to the buddy list.
void purple_contact_invalidate_priority_buddy(PurpleContact *contact)
Invalidates the priority buddy so that the next call to purple_contact_get_priority_buddy recomputes ...
const char * purple_buddy_get_alias(PurpleBuddy *buddy)
Returns the correct name to display for a buddy.
void purple_blist_server_alias_buddy(PurpleBuddy *buddy, const char *alias)
Sets the server-sent alias of a buddy in the buddy list.
void purple_blist_update_buddy_icon(PurpleBuddy *buddy)
Updates a buddy's icon.
const char * purple_chat_get_name(PurpleChat *chat)
Returns the correct name to display for a blist chat.
void purple_contact_destroy(PurpleContact *contact)
Destroys a contact.
void purple_blist_request_add_group(void)
Requests from the user information needed to add a group to the buddy list.
GSList * purple_blist_get_buddies(void)
Returns a list of every buddy in the list.
void purple_blist_node_remove_setting(PurpleBlistNode *node, const char *key)
Removes a named setting from a blist node.
PurpleBlistNodeFlags purple_blist_node_get_flags(PurpleBlistNode *node)
Get the current flags on a given node.
void purple_buddy_set_media_caps(PurpleBuddy *buddy, PurpleMediaCaps media_caps)
Sets the media caps for a buddy.
void purple_blist_init(void)
Initializes the buddy list subsystem.
void purple_blist_schedule_save(void)
Schedule a save of the blist.xml file.
void purple_blist_merge_contact(PurpleContact *source, PurpleBlistNode *node)
Merges two contacts.
PurpleBuddyIcon * purple_buddy_get_icon(const PurpleBuddy *buddy)
Returns a buddy's icon.
void purple_blist_add_buddy(PurpleBuddy *buddy, PurpleContact *contact, PurpleGroup *group, PurpleBlistNode *node)
Adds a new buddy to the buddy list.
gpointer purple_blist_get_ui_data(void)
Returns the UI data for the list.
void purple_group_destroy(PurpleGroup *group)
Destroys a group.
int purple_blist_get_group_online_count(PurpleGroup *group)
Determines the number of online buddies in a group.
void * purple_blist_get_handle(void)
Returns the handle for the buddy list subsystem.
void purple_blist_remove_group(PurpleGroup *group)
Removes a group from the buddy list and frees the memory allocated to it and to its children.
const char * purple_buddy_get_alias_only(PurpleBuddy *buddy)
Returns the alias of a buddy.
GHashTable * purple_chat_get_components(PurpleChat *chat)
Get a hashtable containing information about a chat.
void purple_blist_alias_chat(PurpleChat *chat, const char *alias)
Aliases a chat in the buddy list.
gboolean purple_group_on_account(PurpleGroup *g, PurpleAccount *account)
Determines whether an account owns any buddies in a given group.
gpointer purple_buddy_get_protocol_data(const PurpleBuddy *buddy)
Returns a buddy's protocol-specific data.
GSList * purple_find_buddies(PurpleAccount *account, const char *name)
Finds all PurpleBuddy structs given a name and an account.
PurpleContact * purple_buddy_get_contact(PurpleBuddy *buddy)
Returns a buddy's contact.
PurpleGroup * purple_find_group(const char *name)
Finds a group by name.
void purple_blist_remove_account(PurpleAccount *account)
Called when an account disconnects.
gboolean purple_blist_node_get_bool(PurpleBlistNode *node, const char *key)
Retrieves a named boolean setting from a node in the buddy list.
void purple_blist_alias_buddy(PurpleBuddy *buddy, const char *alias)
Aliases a buddy in the buddy list.
PurpleBlistNode * purple_blist_node_get_sibling_prev(PurpleBlistNode *node)
Returns the previous sibling node of a given node.
PurpleBuddy * purple_buddy_new(PurpleAccount *account, const char *name, const char *alias)
Creates a new buddy.
PurpleBuddy * purple_find_buddy_in_group(PurpleAccount *account, const char *name, PurpleGroup *group)
Finds the buddy struct given a name, an account, and a group.
const char * purple_buddy_get_server_alias(PurpleBuddy *buddy)
Gets the server alias for a buddy.
PurplePresence * purple_buddy_get_presence(const PurpleBuddy *buddy)
Returns a buddy's presence.
void purple_blist_uninit(void)
Uninitializes the buddy list subsystem.
const char * purple_buddy_get_name(const PurpleBuddy *buddy)
Returns a buddy's name.
void purple_blist_node_set_flags(PurpleBlistNode *node, PurpleBlistNodeFlags flags)
Set the flags for the given node.
void purple_blist_update_buddy_status(PurpleBuddy *buddy, PurpleStatus *old_status)
Updates a buddy's status.
void purple_blist_remove_buddy(PurpleBuddy *buddy)
Removes a buddy from the buddy list and frees the memory allocated to it.
const char * purple_group_get_name(PurpleGroup *group)
Returns the name of a group.
struct _PurpleBuddyIcon PurpleBuddyIcon
An opaque structure representing a buddy icon for a particular user on a particular PurpleAccount.
Structure representing an account.
PurpleBlistNodeType type
The type of node this is
PurpleBlistNodeFlags flags
The buddy flags
PurpleBlistNode * child
The child of this node
void * ui_data
The UI can put data here.
PurpleBlistNode * prev
The sibling before this buddy.
GHashTable * settings
per-node settings
PurpleBlistNode * parent
The parent of this node
PurpleBlistNode * next
The sibling after this buddy.
Buddy list UI operations.
void(* remove)(PurpleBuddyList *list, PurpleBlistNode *node)
This removes a node from the list.
void(* new_list)(PurpleBuddyList *list)
Sets UI-specific data on a buddy list.
void(* new_node)(PurpleBlistNode *node)
Sets UI-specific data on a node.
void(* update)(PurpleBuddyList *list, PurpleBlistNode *node)
This will update a node in the buddy list.
void(* remove_node)(PurpleBlistNode *node)
Called when a node is about to be removed from the buddy list.
void(* set_visible)(PurpleBuddyList *list, gboolean show)
Hides or unhides the buddy list.
void(* save_account)(PurpleAccount *account)
Called to save all the data for an account.
void(* destroy)(PurpleBuddyList *list)
When the list is destroyed, this is called to destroy the UI.
void(* save_node)(PurpleBlistNode *node)
This is called when a node has been modified and should be saved.
void(* show)(PurpleBuddyList *list)
The core will call this when it's finished doing its core stuff.
void * ui_data
UI-specific data.
GHashTable * buddies
Every buddy in this list.
PurpleBlistNode * root
The first node in the buddy list.
char * server_alias
The server-specified alias of the buddy.
PurpleBuddyIcon * icon
The buddy icon.
char * alias
The user-set alias of the buddy.
PurpleAccount * account
the account this buddy belongs to
void * proto_data
This allows the prpl to associate whatever data it wants with a buddy.
PurpleMediaCaps media_caps
The media capabilities of the buddy.
char * name
The name of the buddy.
PurpleBlistNode node
The node that this buddy inherits from.
PurpleAccount * account
The account this chat is attached to.
PurpleBlistNode node
The node that this chat inherits from.
char * alias
The display name of this chat.
GHashTable * components
the stuff the protocol needs to know to join the chat
int online
The number of chats and contacts in this group who are currently online.
int totalsize
The number of chats and contacts in this group.
PurpleBlistNode node
The node that this group inherits from.
int currentsize
The number of chats and contacts in this group corresponding to online accounts.
char * name
The name of this group.