/cpw/tomkiewicz/gg11: 198c6f5c19ca: Gadu-Gadu: Add support for G...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Fri Nov 16 12:28:59 EST 2012


Changeset: 198c6f5c19ca5ce74096a4c6fedbb15b4a0481f8
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-11-16 18:28 +0100
Branch:	 default
URL: http://hg.pidgin.im/cpw/tomkiewicz/gg11/rev/198c6f5c19ca

Description:

Gadu-Gadu: Add support for GG_STATUS_UNKNOWN status

diffstat:

 libpurple/protocols/gg/gg.c     |   6 ++++++
 libpurple/protocols/gg/gg.h     |   1 +
 libpurple/protocols/gg/status.c |  12 ++++++++----
 3 files changed, 15 insertions(+), 4 deletions(-)

diffs (83 lines):

diff --git a/libpurple/protocols/gg/gg.c b/libpurple/protocols/gg/gg.c
--- a/libpurple/protocols/gg/gg.c
+++ b/libpurple/protocols/gg/gg.c
@@ -595,6 +595,10 @@ static const char *ggp_normalize(const P
 	return normalized;
 }
 
+/* TODO:
+ * - move to status.c ?
+ * - add information about not adding to his buddy list (not_a_friend)
+ */
 static void ggp_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
 {
 	PurpleStatus *status;
@@ -893,6 +897,8 @@ static const char* ggp_list_emblem(Purpl
 
 	if (buddy_data->blocked)
 		return "not-authorized";
+	if (buddy_data->not_a_friend)
+		return "unavailable";
 
 	return NULL;
 }
diff --git a/libpurple/protocols/gg/gg.h b/libpurple/protocols/gg/gg.h
--- a/libpurple/protocols/gg/gg.h
+++ b/libpurple/protocols/gg/gg.h
@@ -61,6 +61,7 @@ typedef struct {
 typedef struct
 {
 	gboolean blocked;
+	gboolean not_a_friend;
 } ggp_buddy_data;
 
 ggp_buddy_data * ggp_buddy_get_data(PurpleBuddy *buddy);
diff --git a/libpurple/protocols/gg/status.c b/libpurple/protocols/gg/status.c
--- a/libpurple/protocols/gg/status.c
+++ b/libpurple/protocols/gg/status.c
@@ -164,6 +164,7 @@ const gchar * ggp_status_to_purplestatus
 		case GG_STATUS_NOT_AVAIL:
 		case GG_STATUS_NOT_AVAIL_DESCR:
 		case GG_STATUS_BLOCKED:
+		case GG_STATUS_UNKNOWN:
 			return purple_primitive_get_id_from_type(
 				PURPLE_STATUS_OFFLINE);
 		case GG_STATUS_FFC:
@@ -186,7 +187,7 @@ const gchar * ggp_status_to_purplestatus
 			return purple_primitive_get_id_from_type(
 				PURPLE_STATUS_UNAVAILABLE);
 		default:
-			purple_debug_warning("gg", "ggp_status_to_purplestatus: unknown status %d\n", status);
+			purple_debug_warning("gg", "ggp_status_to_purplestatus: unknown status %#02x\n", status);
 			return purple_primitive_get_id_from_type(
 				PURPLE_STATUS_AVAILABLE);
 	}
@@ -419,6 +420,7 @@ void ggp_status_got_others_buddy(PurpleC
 		return;
 	}
 	ggp_buddy_get_data(buddy)->blocked = (status == GG_STATUS_BLOCKED);
+	ggp_buddy_get_data(buddy)->not_a_friend = (status == GG_STATUS_UNKNOWN);
 	
 	if (descr != NULL)
 	{
@@ -462,15 +464,17 @@ char * ggp_status_buddy_text(PurpleBuddy
 {
 	ggp_buddy_data *buddy_data = ggp_buddy_get_data(buddy);
 	const gchar *purple_message;
-	
+
 	if (buddy_data->blocked)
 		return g_strdup(_("Blocked"));
-	
+	if (buddy_data->not_a_friend)
+		return g_strdup(_("Not a buddy"));
+
 	purple_message = purple_status_get_attr_string(
 		purple_presence_get_active_status(
 			purple_buddy_get_presence(buddy)), "message");
 	if (!purple_message)
 		return NULL;
-	
+
 	return g_markup_escape_text(purple_message, -1);
 }



More information about the Commits mailing list