changeset 13644:d70f4e25eab5

[gaim-migrate @ 16042] GG PRPL: Display a more meaningful status of a buddy is User Info. committer: Tailor Script <tailor@pidgin.im>
author Bartoz Oler <bartosz@pidgin.im>
date Sun, 16 Apr 2006 20:18:17 +0000
parents 68157ab4e1c9
children 073bc6da6403
files src/protocols/gg/gg.c
diffstat 1 files changed, 34 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/gg/gg.c	Sun Apr 16 18:28:53 2006 +0000
+++ b/src/protocols/gg/gg.c	Sun Apr 16 20:18:17 2006 +0000
@@ -975,6 +975,38 @@
 }
 /* }}} */
 
+/**
+ * Translate a status' ID to a more user-friendly name.
+ *
+ * @param id The ID of the status.
+ *
+ * @return The user-friendly name of the status.
+ */
+/* static const char *ggp_status_by_id(unsigned int id) {{{ */
+static const char *ggp_status_by_id(unsigned int id)
+{
+	const char *st;
+
+	gaim_debug_info("gg", "ggp_status_by_id: %d\n", id);
+	switch (id) {
+		case GG_STATUS_NOT_AVAIL:
+			st = _("Offline");
+			break;
+		case GG_STATUS_AVAIL:
+			st = _("Available");
+			break;
+		case GG_STATUS_BUSY:
+			st = _("Away");
+			break;
+		default:
+			st = _("Unknown");
+			break;
+	}
+
+	return st;
+}
+/* }}} */
+
 /*
  */
 /* static void ggp_pubdir_handle_info(GaimConnection *gc, gg_pubdir50_t req, GGPSearchForm *form) {{{ */
@@ -987,8 +1019,9 @@
 	text = g_string_new("");
 
 	val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS);
+	/* XXX: Use of ggp_str_to_uin() is an ugly hack! */
 	g_string_append_printf(text, "<b>%s:</b> %s<br/>",
-	                       _("Status"), val);
+	                       _("Status"), ggp_status_by_id(ggp_str_to_uin(val)));
 	g_free(val);
 
 	who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN);