diff libpurple/protocols/gg/gg-utils.c @ 21300:abbf74f4732b

propagate from branch 'im.pidgin.pidgin' (head e3fd21e6dabb99e5604e8337380353fcbe1a7279) to branch 'im.pidgin.elb.make' (head 7422b9a549f752c05cc75f0c8e56fdd2bced034a)
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 10 Nov 2007 16:17:54 +0000
parents 1d92b85ef5d9
children 03a55a2997d1
line wrap: on
line diff
--- a/libpurple/protocols/gg/gg-utils.c	Tue Nov 06 17:13:21 2007 +0000
+++ b/libpurple/protocols/gg/gg-utils.c	Sat Nov 10 16:17:54 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: */