changeset 21143:7be910c7cff7

merge of '20236f54c97e87512b7eb716559a4bd86b73f833' and '756265e6ef8651abedbdc0a1aad9d50cc32e140f'
author John Bailey <rekkanoryo@rekkanoryo.org>
date Mon, 05 Nov 2007 00:35:07 +0000
parents 1d92b85ef5d9 (diff) 846e6800d956 (current diff)
children aa3933394eec
files pidgin/pixmaps/animations/16/Makefile.am pidgin/pixmaps/animations/16/Makefile.mingw pidgin/pixmaps/animations/Makefile.am pidgin/pixmaps/animations/Makefile.mingw pidgin/pixmaps/buddy_icons/Makefile.am pidgin/pixmaps/buddy_icons/Makefile.mingw pidgin/pixmaps/dialogs/16/scalable/Makefile.am pidgin/pixmaps/dialogs/64/scalable/Makefile.am pidgin/pixmaps/dialogs/Makefile.am pidgin/pixmaps/dialogs/Makefile.mingw pidgin/pixmaps/emblems/16/scalable/Makefile.am pidgin/pixmaps/emblems/Makefile.am pidgin/pixmaps/emblems/Makefile.mingw pidgin/pixmaps/emotes/Makefile.am pidgin/pixmaps/emotes/Makefile.mingw pidgin/pixmaps/emotes/default/24/scalable/Makefile.am pidgin/pixmaps/emotes/default/Makefile.am pidgin/pixmaps/icons/16/scalable/Makefile.am pidgin/pixmaps/icons/22/scalable/Makefile.am pidgin/pixmaps/icons/24/scalable/Makefile.am pidgin/pixmaps/icons/32/scalable/Makefile.am pidgin/pixmaps/icons/48/scalable/Makefile.am pidgin/pixmaps/icons/Makefile.am pidgin/pixmaps/icons/Makefile.mingw pidgin/pixmaps/protocols/16/scalable/Makefile.am pidgin/pixmaps/protocols/22/scalable/Makefile.am pidgin/pixmaps/protocols/48/scalable/Makefile.am pidgin/pixmaps/protocols/Makefile.am pidgin/pixmaps/protocols/Makefile.mingw pidgin/pixmaps/status/11/scalable/Makefile.am pidgin/pixmaps/status/16/scalable/Makefile.am pidgin/pixmaps/status/22/scalable/Makefile.am pidgin/pixmaps/status/32/scalable/Makefile.am pidgin/pixmaps/status/Makefile.am pidgin/pixmaps/status/Makefile.mingw pidgin/pixmaps/toolbar/16/scalable/Makefile.am pidgin/pixmaps/toolbar/22/scalable/Makefile.am pidgin/pixmaps/toolbar/Makefile.am pidgin/pixmaps/toolbar/Makefile.mingw pidgin/pixmaps/tray/Makefile.am pidgin/pixmaps/tray/Makefile.mingw
diffstat 3 files changed, 50 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/gg/gg-utils.c	Mon Nov 05 00:12:08 2007 +0000
+++ b/libpurple/protocols/gg/gg-utils.c	Mon Nov 05 00:35:07 2007 +0000
@@ -112,5 +112,36 @@
 }
 /* }}} */
 
+void ggp_status_fake_to_self(PurpleAccount *account)
+{
+	PurplePresence *presence;
+	PurpleStatus *status;
+	const char *status_id;
+	const char *msg;
+
+	if (! purple_find_buddy(account, purple_account_get_username(account)))
+		return;
+
+	presence = purple_account_get_presence(account);
+	status = purple_presence_get_active_status(presence);
+	msg = purple_status_get_attr_string(status, "message");
+	if (msg && !*msg)
+		msg = NULL;
+
+	status_id = purple_status_get_id(status);
+	if (strcmp(status_id, "invisible") == 0) {
+		status_id = "offline";
+	}
+
+	if (msg) {
+		if (strlen(msg) > GG_STATUS_DESCR_MAXSIZE) {
+			msg = purple_markup_slice(msg, 0, GG_STATUS_DESCR_MAXSIZE);
+		}
+	}
+	purple_prpl_got_user_status(account, purple_account_get_username(account),
+				    status_id,
+				    msg ? "message" : NULL, msg, NULL);
+}
+
 
 /* vim: set ts=8 sts=0 sw=8 noet: */
--- a/libpurple/protocols/gg/gg-utils.h	Mon Nov 05 00:12:08 2007 +0000
+++ b/libpurple/protocols/gg/gg-utils.h	Mon Nov 05 00:35:07 2007 +0000
@@ -92,6 +92,15 @@
 char *
 ggp_buddy_get_name(PurpleConnection *gc, const uin_t uin);
 
+/**
+ * Manages the display of account's status in the buddylist.
+ *
+ * @param account Current account.
+ */
+void
+ggp_status_fake_to_self(PurpleAccount *account);
+
+
 #endif /* _PURPLE_GG_UTILS_H */
 
 /* vim: set ts=8 sts=0 sw=8 noet: */
--- a/libpurple/protocols/gg/gg.c	Mon Nov 05 00:12:08 2007 +0000
+++ b/libpurple/protocols/gg/gg.c	Mon Nov 05 00:35:07 2007 +0000
@@ -828,6 +828,7 @@
 {
 	GGPInfo *info = gc->proto_data;
 	PurpleRequestField *field;
+	/* TODO: sel may be null. */
 	GList *sel;
 
 	field = purple_request_fields_get_field(fields, "name");
@@ -1868,15 +1869,24 @@
 		gg_change_status_descr(info->session, new_status_descr, new_msg);
 		g_free(new_msg);
 	}
+
+	ggp_status_fake_to_self(account);
+
 }
 /* }}} */
 
 /* static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) {{{ */
 static void ggp_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
 {
+	PurpleAccount *account;
 	GGPInfo *info = gc->proto_data;
 
 	gg_add_notify(info->session, ggp_str_to_uin(buddy->name));
+
+	account = purple_connection_get_account(gc);
+	if (strcmp(purple_account_get_username(account), buddy->name) == 0) {
+		ggp_status_fake_to_self(account);
+	}
 }
 /* }}} */