# HG changeset patch # User Paul Aurich # Date 1260061280 0 # Node ID 516e5391696250064eac54f31e9733f82c713313 # Parent 0f7025534fc53f3c7b64b5765b8aa653ee94a5bb Tighter scoping and slightly less memory usage. diff -r 0f7025534fc5 -r 516e53916962 libpurple/protocols/jabber/buddy.c --- 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); diff -r 0f7025534fc5 -r 516e53916962 libpurple/protocols/jabber/jutil.c --- 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; }