comparison libpurple/protocols/jabber/buddy.c @ 29110:bc1eb4dacd00

jabber: When getting info on a "bare" domain JID, interpret the value of "last" as the server's uptime. Don't show status (as offline).
author Marcus Lundblad <ml@update.uu.se>
date Tue, 01 Dec 2009 21:26:58 +0000
parents 9ae3e70a327b
children cfcf5076b73f
comparison
equal deleted inserted replaced
29109:6ebacc1710b2 29110:bc1eb4dacd00
813 } 813 }
814 } 814 }
815 815
816 if (!jbi->jb->resources) { 816 if (!jbi->jb->resources) {
817 /* the buddy is offline */ 817 /* the buddy is offline */
818 gboolean is_domain = jabber_jid_is_domain(jbi->jid);
818 gchar *status = 819 gchar *status =
819 g_strdup_printf("%s%s%s", _("Offline"), 820 g_strdup_printf("%s%s%s", _("Offline"),
820 jbi->last_message ? ": " : "", 821 jbi->last_message ? ": " : "",
821 jbi->last_message ? jbi->last_message : ""); 822 jbi->last_message ? jbi->last_message : "");
822 if (jbi->last_seconds > 0) { 823 if (jbi->last_seconds > 0) {
823 char *last = purple_str_seconds_to_string(jbi->last_seconds); 824 char *last = purple_str_seconds_to_string(jbi->last_seconds);
824 gchar *message = g_strdup_printf(_("%s ago"), last); 825 gchar *message = NULL;
825 purple_notify_user_info_prepend_pair(user_info, 826 const gchar *title = NULL;
826 _("Logged Off"), message); 827 if (is_domain) {
828 title = _("Uptime");
829 message = g_strdup_printf(_("%s"), last);
830 } else {
831 title = _("Logged Off");
832 message = g_strdup_printf(_("%s ago"), last);
833 }
834 purple_notify_user_info_prepend_pair(user_info, title, message);
827 g_free(last); 835 g_free(last);
828 g_free(message); 836 g_free(message);
829 } 837 }
830 purple_notify_user_info_prepend_pair(user_info, _("Status"), status); 838
839 if (!is_domain)
840 purple_notify_user_info_prepend_pair(user_info, _("Status"), status);
831 g_free(status); 841 g_free(status);
832 } 842 }
833 843
834 g_free(resource_name); 844 g_free(resource_name);
835 845