comparison src/protocols/jabber/jabber.c @ 4777:e23a7e166680

[gaim-migrate @ 5097] - a couple compile cleanups - status messages and tooltips won't crash gaim when people put up certain away messages - yahoo status messages will show the current "custom" message instead of the previous one committer: Tailor Script <tailor@pidgin.im>
author Nathan Walp <nwalp@pidgin.im>
date Fri, 14 Mar 2003 22:49:32 +0000
parents 92ae181271e9
children 677d3cb193a1
comparison
equal deleted inserted replaced
4776:6219ffd18c63 4777:e23a7e166680
3188 3188
3189 static char *jabber_tooltip_text(struct buddy *b) 3189 static char *jabber_tooltip_text(struct buddy *b)
3190 { 3190 {
3191 jab_res_info jri = jabber_find_resource(b->account->gc, b->name); 3191 jab_res_info jri = jabber_find_resource(b->account->gc, b->name);
3192 if(jri) { 3192 if(jri) {
3193 char *text = strip_html(jabber_lookup_away(GC_GJ(b->account->gc), 3193 char *stripped = strip_html(jabber_lookup_away(GC_GJ(b->account->gc),
3194 b->name)); 3194 b->name));
3195 char *ret = g_strdup_printf(_("<b>Status:</b> %s%s%s"), 3195 char *text = NULL;
3196 char *ret;
3197 if(stripped)
3198 text = g_markup_escape_text(stripped, strlen(stripped));
3199 ret = g_strdup_printf(_("<b>Status:</b> %s%s%s"),
3196 jabber_get_state_string(jri->state), text ? ": " : "", 3200 jabber_get_state_string(jri->state), text ? ": " : "",
3197 text ? text : ""); 3201 text ? text : "");
3198 3202
3199 if(text) 3203 if(stripped) {
3204 g_free(stripped);
3200 g_free(text); 3205 g_free(text);
3206 }
3201 return ret; 3207 return ret;
3202 } 3208 }
3203 return NULL; 3209 return NULL;
3204 } 3210 }
3205 3211
3206 static char *jabber_status_text(struct buddy *b) 3212 static char *jabber_status_text(struct buddy *b)
3207 { 3213 {
3208 if (b->uc & UC_UNAVAILABLE) { 3214 if (b->uc & UC_UNAVAILABLE) {
3209 char *ret = strip_html(jabber_lookup_away(GC_GJ(b->account->gc), 3215 char *stripped = strip_html(jabber_lookup_away(GC_GJ(b->account->gc),
3210 b->name)); 3216 b->name));
3211 if(!ret) { 3217 char *ret;
3218 if(!stripped) {
3212 jab_res_info jri = jabber_find_resource(b->account->gc, b->name); 3219 jab_res_info jri = jabber_find_resource(b->account->gc, b->name);
3213 if(jri) 3220 if(jri)
3214 ret = g_strdup(jabber_get_state_string(jri->state)); 3221 stripped = g_strdup(jabber_get_state_string(jri->state));
3215 } 3222 }
3223 ret = g_markup_escape_text(stripped, strlen(stripped));
3224 g_free(stripped);
3216 return ret; 3225 return ret;
3217 } 3226 }
3218 return NULL; 3227 return NULL;
3219 } 3228 }
3220 3229