Mercurial > pidgin
comparison src/protocols/jabber/jabber.c @ 11609:f38655b98ba0
[gaim-migrate @ 13880]
this never made it from oldstatus to HEAD
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Tue, 04 Oct 2005 13:38:39 +0000 |
parents | ea98c27f1a34 |
children | 69bd7af50d31 |
comparison
equal
deleted
inserted
replaced
11608:5e3f07172dab | 11609:f38655b98ba0 |
---|---|
943 return ret; | 943 return ret; |
944 } | 944 } |
945 | 945 |
946 static char *jabber_tooltip_text(GaimBuddy *b) | 946 static char *jabber_tooltip_text(GaimBuddy *b) |
947 { | 947 { |
948 JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name, | 948 JabberBuddy *jb; |
949 GString *ret; | |
950 | |
951 g_return_val_if_fail(b != NULL, NULL); | |
952 g_return_val_if_fail(b->account != NULL, NULL); | |
953 g_return_val_if_fail(b->account->gc != NULL, NULL); | |
954 g_return_val_if_fail(b->account->gc->proto_data != NULL, NULL); | |
955 | |
956 jb = jabber_buddy_find(b->account->gc->proto_data, b->name, | |
949 FALSE); | 957 FALSE); |
950 GString *ret = g_string_new(""); | 958 ret = g_string_new(""); |
951 | 959 |
952 if(jb) { | 960 if(jb) { |
953 JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); | 961 JabberBuddyResource *jbr = NULL; |
954 const char *sub; | 962 const char *sub; |
963 GList *l; | |
964 | |
955 if(jb->subscription & JABBER_SUB_FROM) { | 965 if(jb->subscription & JABBER_SUB_FROM) { |
956 if(jb->subscription & JABBER_SUB_TO) | 966 if(jb->subscription & JABBER_SUB_TO) |
957 sub = _("Both"); | 967 sub = _("Both"); |
958 else if(jb->subscription & JABBER_SUB_PENDING) | 968 else if(jb->subscription & JABBER_SUB_PENDING) |
959 sub = _("From (To pending)"); | 969 sub = _("From (To pending)"); |
967 else | 977 else |
968 sub = _("None"); | 978 sub = _("None"); |
969 } | 979 } |
970 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Subscription"), sub); | 980 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Subscription"), sub); |
971 | 981 |
972 if(jbr) { | 982 for(l=jb->resources; l; l = l->next) { |
973 char *text = NULL; | 983 char *text = NULL; |
984 char *res = NULL; | |
985 | |
986 jbr = l->data; | |
987 | |
974 if(jbr->status) { | 988 if(jbr->status) { |
975 char *stripped; | 989 char *stripped; |
976 stripped = gaim_markup_strip_html(jbr->status); | 990 stripped = gaim_markup_strip_html(jbr->status); |
977 text = g_markup_escape_text(stripped, -1); | 991 text = g_markup_escape_text(stripped, -1); |
978 g_free(stripped); | 992 g_free(stripped); |
979 /* XXX: need some nl to br love here */ | 993 /* XXX: need some nl to br love here */ |
980 } | 994 } |
981 | 995 |
982 g_string_append_printf(ret, "\n<b>%s:</b> %s%s%s", | 996 if(jbr->name) |
997 res = g_strdup_printf(" _(%s)", jbr->name); | |
998 | |
999 g_string_append_printf(ret, "\n<b>%s%s:</b> %s%s%s", | |
983 _("Status"), | 1000 _("Status"), |
1001 res ? res : "", | |
984 jabber_buddy_state_get_name(jbr->state), | 1002 jabber_buddy_state_get_name(jbr->state), |
985 text ? ": " : "", | 1003 text ? ": " : "", |
986 text ? text : ""); | 1004 text ? text : ""); |
987 if(text) | 1005 if(text) |
988 g_free(text); | 1006 g_free(text); |
989 } else if(!GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) { | 1007 if(res) |
1008 g_free(res); | |
1009 } | |
1010 | |
1011 if(!GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) { | |
990 g_string_append_printf(ret, "\n<b>%s:</b> %s", | 1012 g_string_append_printf(ret, "\n<b>%s:</b> %s", |
991 _("Error"), jb->error_msg); | 1013 _("Error"), jb->error_msg); |
992 } | 1014 } |
993 } | 1015 } |
994 | 1016 |