pidgin: a3ddd520: Tighter scoping and slightly less memory...

darkrain42 at pidgin.im darkrain42 at pidgin.im
Sat Dec 5 20:05:37 EST 2009


-----------------------------------------------------------------
Revision: a3ddd52078f1d9047b38af0a2ddb40e3cf6f3730
Ancestor: 40130e07f40440b64aa3c2e3c05e928b89937780
Author: darkrain42 at pidgin.im
Date: 2009-12-06T01:01:20
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/a3ddd52078f1d9047b38af0a2ddb40e3cf6f3730

Modified files:
        libpurple/protocols/jabber/buddy.c
        libpurple/protocols/jabber/jutil.c

ChangeLog: 

Tighter scoping and slightly less memory usage.

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/buddy.c	086ed2515a7259ecafc07065cbab10cc3810f131
+++ libpurple/protocols/jabber/buddy.c	cb9e9e7c4549c26e5ab45cbde2a0af04eeb90a47
@@ -816,10 +816,7 @@ static void jabber_buddy_info_show_if_re
 	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 @@ static void jabber_buddy_info_show_if_re
 			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);
============================================================
--- libpurple/protocols/jabber/jutil.c	5a192dcb29d177be951ecf204c2528cff010e289
+++ libpurple/protocols/jabber/jutil.c	99af4534d0e0e24e6e0acd64e06d681311e59078
@@ -565,11 +565,14 @@ jabber_jid_is_domain(const char *jid)
 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;
 }
 
 


More information about the Commits mailing list