soc.2009.telepathy: d8f33141: Undeprecated purple_presence_add_list() ...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Tue Jun 9 18:20:34 EDT 2009


-----------------------------------------------------------------
Revision: d8f331418a2616565113e0cde29208931b1f0aa2
Ancestor: 787e2f80f0a2a2fbcc89b9cbd84ecb84d3705ce3
Author: sttwister at soc.pidgin.im
Date: 2009-06-09T22:12:48
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/d8f331418a2616565113e0cde29208931b1f0aa2

Modified files:
        libpurple/protocols/telepathy/telepathy.c libpurple/status.h

ChangeLog: 

Undeprecated purple_presence_add_list() and purple_presence_add_status(). Fixes storing buddy list locally.

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy.c	b18d5455e32bec54eb7e9c09ad488fc20cae45a2
+++ libpurple/protocols/telepathy/telepathy.c	03f7415a2a3f94f1777cd810e86804d9fb716e22
@@ -270,23 +270,34 @@ contacts_ready_cb (TpConnection *connect
 			/* the buddy might already be stored locally */
 			buddy = purple_find_buddy(data->acct, tp_contact_get_identifier(contact));
 
-			/* TODO: Get rid of the NO_SAVE flag so we can get that blist stored locally.
-			 * Fix setting statuses for buddies stored locally 
-			 */
 			if (buddy == NULL)
 			{
 				/* Buddy was not stored locally */
 				buddy = purple_buddy_new(data->acct, tp_contact_get_identifier(contact), tp_contact_get_alias(contact));
-				purple_blist_node_set_flags((PurpleBlistNode *)buddy, PURPLE_BLIST_NODE_FLAG_NO_SAVE);
+				purple_blist_node_set_flags((PurpleBlistNode *)buddy, 0);
+
+				purple_blist_add_buddy(buddy, NULL, NULL, NULL);
 			}
+			else
+			{
+				/* we should check if it has statuses for the presence,
+				 * since the prpl was not yet loaded when status_types was being called
+				 */
+				PurplePresence *presence = purple_buddy_get_presence(buddy);
 
+				if (presence != NULL)
+				{
+					if (purple_presence_get_statuses(presence) == NULL)
+					{
+						purple_presence_add_list(presence, purple_prpl_get_statuses(data->acct, presence));
+					}
+				}
+			}
+
 			handle = tp_contact_get_handle(contact);
 
 			if (g_hash_table_lookup(data->contacts, (gpointer)handle) == NULL)
 			{
-				/* if we haven't cached the handle yet, the buddy isn't in the buddy list either */
-				purple_blist_add_buddy(buddy, NULL, NULL, NULL);
-
 				g_hash_table_insert(data->contacts, (gpointer)handle, contact);
 
 				g_object_ref(contact);
============================================================
--- libpurple/status.h	867e95f5725b4421c6ccc5adf5e94d25624dc0b8
+++ libpurple/status.h	f232051d4b46a100825a4d76ecd5ffa59c1c3d56
@@ -814,31 +814,22 @@ void purple_presence_destroy(PurplePrese
  */
 void purple_presence_destroy(PurplePresence *presence);
 
-#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
 /**
  * Adds a status to a presence.
  *
  * @param presence The presence.
  * @param status   The status to add.
- *
- * @deprecated This function is only used by purple_presence_add_list,
- *             and both should be removed in 3.0.0.
  */
 void purple_presence_add_status(PurplePresence *presence, PurpleStatus *status);
-#endif
 
-#if !(defined PURPLE_DISABLE_DEPRECATED) || (defined _PURPLE_STATUS_C_)
 /**
  * Adds a list of statuses to the presence.
  *
  * @param presence    The presence.
  * @param source_list The source list of statuses to add, which is not
  *                    modified or freed by this function.
- *
- * @deprecated This function isn't used and should be removed in 3.0.0.
  */
 void purple_presence_add_list(PurplePresence *presence, GList *source_list);
-#endif
 
 /**
  * Sets the active state of a status in a presence.


More information about the Commits mailing list