Mercurial > pidgin.yaz
changeset 8213:8d41a4250bb7
[gaim-migrate @ 8936]
fix the buddy ticker for when accounts sign off, and fix newlines in jabber profiles
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Fri, 06 Feb 2004 00:30:35 +0000 |
parents | ad164c1ca79d |
children | 3418a6d51464 |
files | plugins/ticker/ticker.c src/protocols/jabber/buddy.c |
diffstat | 2 files changed, 62 insertions(+), 63 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/ticker/ticker.c Thu Feb 05 16:28:51 2004 +0000 +++ b/plugins/ticker/ticker.c Fri Feb 06 00:30:35 2004 +0000 @@ -210,36 +210,6 @@ } static void -signoff_cb(GaimConnection *gc) -{ - TickerData *td; - if (!gaim_connections_get_all()) { - while (tickerbuds) { - td = tickerbuds->data; - tickerbuds = g_list_delete_link(tickerbuds, tickerbuds); - if (td->timeout != 0) - g_source_remove(td->timeout); - g_free(td); - } - gtk_widget_destroy(tickerwindow); - tickerwindow = NULL; - ticker = NULL; - } else { - GList *t = tickerbuds; - while (t) { - td = t->data; - t = t->next; - if (td->buddy->account == gc->account) { - tickerbuds = g_list_remove(tickerbuds, td); - if (td->timeout != 0) - g_source_remove(td->timeout); - g_free(td); - } - } - } -} - -static void buddy_signon_cb(GaimBuddy *b) { if(buddy_ticker_find_buddy(b)) @@ -265,6 +235,34 @@ buddy_ticker_add_buddy(b); } +static void +signoff_cb(GaimConnection *gc) +{ + TickerData *td; + if (!gaim_connections_get_all()) { + while (tickerbuds) { + td = tickerbuds->data; + tickerbuds = g_list_delete_link(tickerbuds, tickerbuds); + if (td->timeout != 0) + g_source_remove(td->timeout); + g_free(td); + } + gtk_widget_destroy(tickerwindow); + tickerwindow = NULL; + ticker = NULL; + } else { + GList *t = tickerbuds; + while (t) { + td = t->data; + t = t->next; + if (td->buddy->account == gc->account) { + buddy_signoff_cb(td->buddy); + } + } + } +} + + /* * EXPORTED FUNCTIONS */
--- a/src/protocols/jabber/buddy.c Thu Feb 05 16:28:51 2004 +0000 +++ b/src/protocols/jabber/buddy.c Fri Feb 06 00:30:35 2004 +0000 @@ -532,6 +532,7 @@ char *resource_name; char *bare_jid; char *title; + char *text; xmlnode *vcard; GaimBuddy *b; @@ -548,7 +549,7 @@ jb = jabber_buddy_find(js, from, TRUE); info_text = g_string_new(""); - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", _("Jabber ID"), + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Jabber ID"), from); if(resource_name) { @@ -557,14 +558,14 @@ char *purdy = NULL; if(jbr->status) purdy = gaim_strdup_withhtml(jbr->status); - g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/>", _("Status"), jabber_get_state_string(jbr->state), purdy ? ": " : "", purdy ? purdy : ""); if(purdy) g_free(purdy); } else { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Status"), _("Unknown")); } } else { @@ -573,9 +574,9 @@ jbr = resources->data; if(jbr->status) purdy = gaim_strdup_withhtml(jbr->status); - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Resource"), jbr->name); - g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/><br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s%s%s<br/><br/>", _("Status"), jabber_get_state_string(jbr->state), purdy ? ": " : "", purdy ? purdy : ""); @@ -592,14 +593,13 @@ for(child = vcard->child; child; child = child->next) { xmlnode *child2; - char *text; if(child->type != XMLNODE_TYPE_TAG) continue; text = xmlnode_get_data(child); if(text && !strcmp(child->name, "FN")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Full Name"), text); } else if(!strcmp(child->name, "N")) { for(child2 = child->child; child2; child2 = child2->next) @@ -612,15 +612,15 @@ text2 = xmlnode_get_data(child2); if(text2 && !strcmp(child2->name, "FAMILY")) { g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>\n", + "<b>%s:</b> %s<br/>", _("Family Name"), text2); } else if(text2 && !strcmp(child2->name, "GIVEN")) { g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>\n", + "<b>%s:</b> %s<br/>", _("Given Name"), text2); } else if(text2 && !strcmp(child2->name, "MIDDLE")) { g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>\n", + "<b>%s:</b> %s<br/>", _("Middle Name"), text2); } g_free(text2); @@ -631,15 +631,15 @@ gaim_blist_node_set_string((GaimBlistNode*)b, "servernick", text); gaim_blist_save(); } - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Nickname"), text); } else if(text && !strcmp(child->name, "BDAY")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Birthday"), text); } else if(!strcmp(child->name, "ADR")) { /* show which address it is */ if(child->child) - g_string_append_printf(info_text, "<b>%s:</b><br/>\n", + g_string_append_printf(info_text, "<b>%s:</b><br/>", _("Address")); for(child2 = child->child; child2; child2 = child2->next) { @@ -651,32 +651,32 @@ text2 = xmlnode_get_data(child2); if(text2 && !strcmp(child2->name, "POBOX")) { g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>\n", + " <b>%s:</b> %s<br/>", _("P.O. Box"), text2); } else if(text2 && !strcmp(child2->name, "EXTADR")) { g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>\n", + " <b>%s:</b> %s<br/>", _("Extended Address"), text2); } else if(text2 && !strcmp(child2->name, "STREET")) { g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>\n", + " <b>%s:</b> %s<br/>", _("Street Address"), text2); } else if(text2 && !strcmp(child2->name, "LOCALITY")) { g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>\n", + " <b>%s:</b> %s<br/>", _("Locality"), text2); } else if(text2 && !strcmp(child2->name, "REGION")) { g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>\n", + " <b>%s:</b> %s<br/>", _("Region"), text2); } else if(text2 && !strcmp(child2->name, "PCODE")) { g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>\n", + " <b>%s:</b> %s<br/>", _("Postal Code"), text2); } else if(text2 && (!strcmp(child2->name, "CTRY") || !strcmp(child2->name, "COUNTRY"))) { g_string_append_printf(info_text, - " <b>%s:</b> %s<br/>\n", + " <b>%s:</b> %s<br/>", _("Country"), text2); } g_free(text2); @@ -688,14 +688,14 @@ number = xmlnode_get_data(child2); if(number) { g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>\n", _("Telephone"), number); + "<b>%s:</b> %s<br/>", _("Telephone"), number); g_free(number); } } else if((number = xmlnode_get_data(child))) { /* lots of clients (including gaim) do this, but it's * out of spec */ g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>\n", _("Telephone"), number); + "<b>%s:</b> %s<br/>", _("Telephone"), number); g_free(number); } } else if(!strcmp(child->name, "EMAIL")) { @@ -705,7 +705,7 @@ userid = xmlnode_get_data(child2); if(userid) { g_string_append_printf(info_text, - "<b>%s:</b> <a href='mailto:%s'>%s</a><br/>\n", + "<b>%s:</b> <a href='mailto:%s'>%s</a><br/>", _("Email"), userid, userid); g_free(userid); } @@ -713,7 +713,7 @@ /* lots of clients (including gaim) do this, but it's * out of spec */ g_string_append_printf(info_text, - "<b>%s:</b> <a href='mailto:%s'>%s</a><br/>\n", + "<b>%s:</b> <a href='mailto:%s'>%s</a><br/>", _("Email"), userid, userid); g_free(userid); } @@ -728,26 +728,24 @@ text2 = xmlnode_get_data(child2); if(text2 && !strcmp(child2->name, "ORGNAME")) { g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>\n", + "<b>%s:</b> %s<br/>", _("Organization Name"), text2); } else if(text2 && !strcmp(child2->name, "ORGUNIT")) { g_string_append_printf(info_text, - "<b>%s:</b> %s<br/>\n", + "<b>%s:</b> %s<br/>", _("Organization Unit"), text2); } g_free(text2); } } else if(text && !strcmp(child->name, "TITLE")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Title"), text); } else if(text && !strcmp(child->name, "ROLE")) { - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", _("Role"), text); } else if(text && !strcmp(child->name, "DESC")) { - char *text2 = gaim_strdup_withhtml(text); - g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", - _("Description"), text2); - g_free(text2); + g_string_append_printf(info_text, "<b>%s:</b> %s<br/>", + _("Description"), text); } else if(!strcmp(child->name, "PHOTO") || !strcmp(child->name, "LOGO")) { if((child2 = xmlnode_get_child(child, "BINVAL"))) { @@ -774,11 +772,14 @@ title = g_strdup_printf("User info for %s", from); + text = gaim_strdup_withhtml(info_text->str); + gaim_notify_formatted(NULL, title, _("Jabber Profile"), - NULL, info_text->str, NULL, NULL); + NULL, text, NULL, NULL); g_free(title); g_string_free(info_text, TRUE); + g_free(text); } void jabber_buddy_get_info(GaimConnection *gc, const char *who)