# HG changeset patch # User Marcus Lundblad # Date 1259703415 0 # Node ID cfcf5076b73f9850455cd082cabb5c229242e364 # Parent 1bb466ce21b82ee5d2020288c6946077f1525986# Parent bc1eb4dacd004bddf897e61a59a1a2a98c4ebc5f merge of '1cebb8e5585732c30dcfb31a6700dcb78ae47b44' and '9e66a21277bce5b8be225115269300903be335ea' diff -r 1bb466ce21b8 -r cfcf5076b73f ChangeLog --- a/ChangeLog Tue Dec 01 21:24:11 2009 +0000 +++ b/ChangeLog Tue Dec 01 21:36:55 2009 +0000 @@ -1,8 +1,10 @@ Pidgin and Finch: The Pimpin' Penguin IM Clients That're Good for the Soul version 2.6.5 (??/??/20??): - XMPP: - * Do not crash when attempting to register for a new account on Windows. + libpurple: + * XMPP: when getting info on a domain-only (server) JID, show uptime + (when given by the result of the "last query") and don't show status as + offline. version 2.6.4 (11/29/2009): libpurple: diff -r 1bb466ce21b8 -r cfcf5076b73f libpurple/protocols/jabber/buddy.c --- a/libpurple/protocols/jabber/buddy.c Tue Dec 01 21:24:11 2009 +0000 +++ b/libpurple/protocols/jabber/buddy.c Tue Dec 01 21:36:55 2009 +0000 @@ -815,19 +815,29 @@ 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 = g_strdup_printf(_("%s ago"), last); - purple_notify_user_info_prepend_pair(user_info, - _("Logged Off"), message); + gchar *message = NULL; + const gchar *title = NULL; + if (is_domain) { + title = _("Uptime"); + message = g_strdup_printf(_("%s"), last); + } else { + title = _("Logged Off"); + message = g_strdup_printf(_("%s ago"), last); + } + purple_notify_user_info_prepend_pair(user_info, title, message); g_free(last); g_free(message); } - purple_notify_user_info_prepend_pair(user_info, _("Status"), status); + + if (!is_domain) + purple_notify_user_info_prepend_pair(user_info, _("Status"), status); g_free(status); } diff -r 1bb466ce21b8 -r cfcf5076b73f libpurple/protocols/jabber/jutil.c --- a/libpurple/protocols/jabber/jutil.c Tue Dec 01 21:24:11 2009 +0000 +++ b/libpurple/protocols/jabber/jutil.c Tue Dec 01 21:36:55 2009 +0000 @@ -473,6 +473,19 @@ } } +char *jabber_get_domain(const char *in) +{ + JabberID *jid = jabber_id_new(in); + char *out; + + if (!jid) + return NULL; + + out = g_strdup(jid->domain); + jabber_id_free(jid); + + return out; +} char *jabber_get_resource(const char *in) { @@ -513,6 +526,17 @@ NULL); } +gboolean +jabber_jid_is_domain(const char *jid) +{ + char *domain = jabber_get_domain(jid); + gboolean is_domain = purple_strequal(jid, domain); + + g_free(domain); + return is_domain; +} + + JabberID * jabber_id_new(const char *str) { diff -r 1bb466ce21b8 -r cfcf5076b73f libpurple/protocols/jabber/jutil.h --- a/libpurple/protocols/jabber/jutil.h Tue Dec 01 21:24:11 2009 +0000 +++ b/libpurple/protocols/jabber/jutil.h Tue Dec 01 21:36:55 2009 +0000 @@ -35,10 +35,13 @@ JabberID* jabber_id_new(const char *str); void jabber_id_free(JabberID *jid); +char *jabber_get_domain(const char *jid); char *jabber_get_resource(const char *jid); char *jabber_get_bare_jid(const char *jid); char *jabber_id_get_bare_jid(const JabberID *jid); +gboolean jabber_jid_is_domain(const char *jid); + const char *jabber_normalize(const PurpleAccount *account, const char *in); /* Returns true if JID is the bare JID of our server. */