Mercurial > pidgin.yaz
comparison src/protocols/jabber/jabber.c @ 12970:ec9b92104904
[gaim-migrate @ 15323]
Pass the tooltip GString to the prpls. This make the prpl tooltip_text consistent with the drawing-tooltip signal callbacks. It also eliminates a little bit of duplicated code from the prpls. It's also theoretically more efficient, but I'm sure the difference is irrelevant. However, this change will allow me to kill a bunch more duplicated code.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Fri, 20 Jan 2006 20:35:18 +0000 |
parents | 563fb4f1e9fc |
children | 7d8da9d4da49 |
comparison
equal
deleted
inserted
replaced
12969:b98a28bf29d9 | 12970:ec9b92104904 |
---|---|
999 } | 999 } |
1000 | 1000 |
1001 return ret; | 1001 return ret; |
1002 } | 1002 } |
1003 | 1003 |
1004 static char *jabber_tooltip_text(GaimBuddy *b, gboolean full) | 1004 static void jabber_tooltip_text(GaimBuddy *b, GString *str, gboolean full) |
1005 { | 1005 { |
1006 JabberBuddy *jb; | 1006 JabberBuddy *jb; |
1007 GString *ret; | 1007 |
1008 | 1008 g_return_if_fail(b != NULL); |
1009 g_return_val_if_fail(b != NULL, NULL); | 1009 g_return_if_fail(b->account != NULL); |
1010 g_return_val_if_fail(b->account != NULL, NULL); | 1010 g_return_if_fail(b->account->gc != NULL); |
1011 g_return_val_if_fail(b->account->gc != NULL, NULL); | 1011 g_return_if_fail(b->account->gc->proto_data != NULL); |
1012 g_return_val_if_fail(b->account->gc->proto_data != NULL, NULL); | |
1013 | 1012 |
1014 jb = jabber_buddy_find(b->account->gc->proto_data, b->name, | 1013 jb = jabber_buddy_find(b->account->gc->proto_data, b->name, |
1015 FALSE); | 1014 FALSE); |
1016 ret = g_string_new(""); | |
1017 | 1015 |
1018 if(jb) { | 1016 if(jb) { |
1019 JabberBuddyResource *jbr = NULL; | 1017 JabberBuddyResource *jbr = NULL; |
1020 const char *sub; | 1018 const char *sub; |
1021 GList *l; | 1019 GList *l; |
1034 else if(jb->subscription & JABBER_SUB_PENDING) | 1032 else if(jb->subscription & JABBER_SUB_PENDING) |
1035 sub = _("None (To pending)"); | 1033 sub = _("None (To pending)"); |
1036 else | 1034 else |
1037 sub = _("None"); | 1035 sub = _("None"); |
1038 } | 1036 } |
1039 g_string_append_printf(ret, "\n<b>%s:</b> %s", _("Subscription"), sub); | 1037 g_string_append_printf(str, "\n<b>%s:</b> %s", _("Subscription"), sub); |
1040 } | 1038 } |
1041 | 1039 |
1042 for(l=jb->resources; l; l = l->next) { | 1040 for(l=jb->resources; l; l = l->next) { |
1043 char *text = NULL; | 1041 char *text = NULL; |
1044 char *res = NULL; | 1042 char *res = NULL; |
1062 if (text != NULL && !gaim_utf8_strcasecmp(state, text)) { | 1060 if (text != NULL && !gaim_utf8_strcasecmp(state, text)) { |
1063 g_free(text); | 1061 g_free(text); |
1064 text = NULL; | 1062 text = NULL; |
1065 } | 1063 } |
1066 | 1064 |
1067 g_string_append_printf(ret, "\n<b>%s%s:</b> %s%s%s", | 1065 g_string_append_printf(str, "\n<b>%s%s:</b> %s%s%s", |
1068 _("Status"), | 1066 _("Status"), |
1069 res ? res : "", | 1067 res ? res : "", |
1070 state, | 1068 state, |
1071 text ? ": " : "", | 1069 text ? ": " : "", |
1072 text ? text : ""); | 1070 text ? text : ""); |
1074 g_free(text); | 1072 g_free(text); |
1075 g_free(res); | 1073 g_free(res); |
1076 } | 1074 } |
1077 | 1075 |
1078 if(!GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) { | 1076 if(!GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) { |
1079 g_string_append_printf(ret, "\n<b>%s:</b> %s", | 1077 g_string_append_printf(str, "\n<b>%s:</b> %s", |
1080 _("Error"), jb->error_msg); | 1078 _("Error"), jb->error_msg); |
1081 } | 1079 } |
1082 } | 1080 } |
1083 | |
1084 return g_string_free(ret, FALSE); | |
1085 } | 1081 } |
1086 | 1082 |
1087 static GList *jabber_status_types(GaimAccount *account) | 1083 static GList *jabber_status_types(GaimAccount *account) |
1088 { | 1084 { |
1089 GaimStatusType *type; | 1085 GaimStatusType *type; |