changeset 28761:516e53916962

Tighter scoping and slightly less memory usage.
author Paul Aurich <paul@darkrain42.org>
date Sun, 06 Dec 2009 01:01:20 +0000
parents 0f7025534fc5
children 4f4211e712b6
files libpurple/protocols/jabber/buddy.c libpurple/protocols/jabber/jutil.c
diffstat 2 files changed, 15 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/buddy.c	Sun Dec 06 00:52:10 2009 +0000
+++ b/libpurple/protocols/jabber/buddy.c	Sun Dec 06 01:01:20 2009 +0000
@@ -816,10 +816,7 @@
 	if (!jbi->jb->resources) {
 		/* the buddy is offline */
 		gboolean is_domain = jabber_jid_is_domain(jbi->jid);
-		gchar *status =
-			g_strdup_printf("%s%s%s",	_("Offline"),
-			                jbi->last_message ? ": " : "",
-			                jbi->last_message ? jbi->last_message : "");
+
 		if (jbi->last_seconds > 0) {
 			char *last = purple_str_seconds_to_string(jbi->last_seconds);
 			gchar *message = NULL;
@@ -836,9 +833,14 @@
 			g_free(message);
 		}
 
-		if (!is_domain)
+		if (!is_domain) {
+			gchar *status =
+				g_strdup_printf("%s%s%s",	_("Offline"),
+				                jbi->last_message ? ": " : "",
+				                jbi->last_message ? jbi->last_message : "");
 			purple_notify_user_info_prepend_pair(user_info, _("Status"), status);
-		g_free(status);
+			g_free(status);
+		}
 	}
 
 	g_free(resource_name);
--- a/libpurple/protocols/jabber/jutil.c	Sun Dec 06 00:52:10 2009 +0000
+++ b/libpurple/protocols/jabber/jutil.c	Sun Dec 06 01:01:20 2009 +0000
@@ -565,11 +565,14 @@
 gboolean
 jabber_jid_is_domain(const char *jid)
 {
-	char *domain = jabber_get_domain(jid);
-	gboolean is_domain = purple_strequal(jid, domain);
+	const char *c;
 
-	g_free(domain);
-	return is_domain;
+	for (c = jid; *c; ++c) {
+		if (*c == '@' || *c == '/')
+			return FALSE;
+	}
+
+	return TRUE;
 }