Mercurial > pidgin
changeset 4745:01cae9259e2f
[gaim-migrate @ 5060]
fixes a bug where if all your accounts got logged off, thus making the
buddy list disappear, you could never get it back. That makes for a bad
time when your internet connection goes out (like mine did last night)
also makes some of the prpl tooltips spiffier, and re-does some of the
handling of away messages in jabber, thus making it cooler.
committer: Tailor Script <tailor@pidgin.im>
author | Nathan Walp <nwalp@pidgin.im> |
---|---|
date | Thu, 13 Mar 2003 17:52:21 +0000 |
parents | a0746ffce599 |
children | 577825776c70 |
files | src/buddy.c src/gtkimhtml.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/yahoo/yahoo.c |
diffstat | 5 files changed, 74 insertions(+), 55 deletions(-) [+] |
line wrap: on
line diff
--- a/src/buddy.c Thu Mar 13 10:16:59 2003 +0000 +++ b/src/buddy.c Thu Mar 13 17:52:21 2003 +0000 @@ -862,7 +862,7 @@ GtkTargetEntry gte[] = {{"GAIM_BUDDY", GTK_TARGET_SAME_APP, DRAG_ROW}, {"application/x-im-contact", 0, DRAG_BUDDY}}; - if (gtkblist) { + if (gtkblist && gtkblist->window) { gtk_widget_show(gtkblist->window); return; } @@ -1206,6 +1206,17 @@ static void gaim_gtk_blist_destroy(struct gaim_buddy_list *list) { gtk_widget_destroy(gtkblist->window); + + gtkblist->window = gtkblist->vbox = gtkblist->treeview = NULL; + gtkblist->treemodel = NULL; + gtkblist->idle_column = NULL; + gtkblist->warning_column = gtkblist->buddy_icon_column = NULL; + gtkblist->bbox = gtkblist->tipwindow = NULL; + protomenu = NULL; + awaymenu = NULL; + bpmenu = NULL; + + gtkblist->timeout = 0; } static void gaim_gtk_blist_set_visible(struct gaim_buddy_list *list, gboolean show) @@ -1270,7 +1281,7 @@ if (!docklet_count) { if (connections) { gaim_blist_set_visible(TRUE); - } else { + } else if(gtkblist && gtkblist->window) { gtk_window_present(GTK_WINDOW(gtkblist->window)); } }
--- a/src/gtkimhtml.c Thu Mar 13 10:16:59 2003 +0000 +++ b/src/gtkimhtml.c Thu Mar 13 17:52:21 2003 +0000 @@ -302,15 +302,15 @@ g_signal_emit(arg1, signals[URL_CLICKED], 0, url); return FALSE; } else if(event_button->button == 3) { - GtkWidget *img, *item, *label, *menu; + GtkWidget *img, *item, *menu; struct url_data *tempdata = g_new(struct url_data, 1); tempdata->object = g_object_ref(arg1); tempdata->url = g_strdup(url); - + menu = gtk_menu_new(); - gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, + gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, event_button->button, event_button->time); - + /* buttons and such */ img = gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU); item = gtk_image_menu_item_new_with_mnemonic(_("_Copy Link Location")); @@ -326,7 +326,7 @@ tempdata); gtk_menu_shell_append(GTK_MENU_SHELL(menu), item); gtk_widget_show_all(menu); - + return TRUE; } }
--- a/src/protocols/jabber/jabber.c Thu Mar 13 10:16:59 2003 +0000 +++ b/src/protocols/jabber/jabber.c Thu Mar 13 17:52:21 2003 +0000 @@ -1136,18 +1136,28 @@ { jab_res_info jri = jabber_find_resource(GJ_GC(gjc), name); - if(!jri || !jri->away_msg) + if(!jri) return _("Unknown"); return jri->away_msg; } +static const char *jabber_get_state_string(int s) { + switch(s) { + case UC_AWAY: + return _("Away"); + case UC_CHAT: + return _("Chatty"); + case UC_XA: + return _("Extended Away"); + case UC_DND: + return _("Do Not Disturb"); + default: + return _("Available"); + } +} static void jabber_track_away(gjconn gjc, jpacket p, char *type) { - char *show; - char *vshow = NULL; - char *status = NULL; - char *msg = NULL; jab_res_info jri = NULL; if(!p || !p->from || !p->from->user) @@ -1158,40 +1168,10 @@ if(!jri) return; - if (type && (strcasecmp(type, "unavailable") == 0)) { - vshow = _("Unavailable"); - } else { - if((show = xmlnode_get_tag_data(p->x, "show")) != NULL) { - if (!strcasecmp(show, "away")) { - vshow = _("Away"); - } else if (!strcasecmp(show, "chat")) { - vshow = _("Online"); - } else if (!strcasecmp(show, "xa")) { - vshow = _("Extended Away"); - } else if (!strcasecmp(show, "dnd")) { - vshow = _("Do Not Disturb"); - } - } - } - - status = g_strdup(xmlnode_get_tag_data(p->x, "status")); - - if(vshow != NULL || status != NULL ) { - /* kinda hokey, but it works :-) */ - msg = g_strdup_printf("%s%s%s", - (vshow == NULL? "" : vshow), - (vshow == NULL || status == NULL? "" : ": "), - (status == NULL? "" : status)); - } else { - msg = g_strdup(_("Online")); - } - - g_free(status); - if(jri->away_msg) g_free(jri->away_msg); - jri->away_msg = msg; + jri->away_msg = g_strdup(xmlnode_get_tag_data(p->x, "status")); } static void jabber_convo_closed(struct gaim_connection *gc, char *name) @@ -3155,7 +3135,7 @@ realwho = g_strdup_printf("%s/%s", buddy, jri->name); status = strdup_withhtml(jabber_lookup_away(gjc, realwho)); *ap++ = g_strdup_printf("<B>Jabber ID:</B> %s<BR>\n", realwho); - *ap++ = g_strdup_printf("<B>Status:</B> %s<BR>\n", status); + *ap++ = g_strdup_printf("<B>Status:</B> %s%s%s<BR>\n", jabber_get_state_string(jri->state), status ? ": " : "", status ? status : ""); g_free(status); g_free(realwho); resources = resources->next; @@ -3204,18 +3184,32 @@ static char *jabber_tooltip_text(struct buddy *b) { - struct jabber_data *jd = b->account->gc->proto_data; - char *text = jabber_lookup_away(jd->gjc, b->name); - if (text) - return strip_html(text); + jab_res_info jri = jabber_find_resource(b->account->gc, b->name); + if(jri) { + char *text = strip_html(jabber_lookup_away(GC_GJ(b->account->gc), + b->name)); + char *ret = g_strdup_printf(_("<b>Status:</b> %s%s%s"), + jabber_get_state_string(jri->state), text ? ": " : "", + text ? text : ""); + + if(text) + g_free(text); + return ret; + } return NULL; } static char *jabber_status_text(struct buddy *b) { - struct jabber_data *jd = b->account->gc->proto_data; if (b->uc & UC_UNAVAILABLE) { - return strip_html(jabber_lookup_away(jd->gjc, b->name)); + char *ret = strip_html(jabber_lookup_away(GC_GJ(b->account->gc), + b->name)); + if(!ret) { + jab_res_info jri = jabber_find_resource(b->account->gc, b->name); + if(jri) + ret = g_strdup(jabber_get_state_string(jri->state)); + } + return ret; } return NULL; } @@ -3541,11 +3535,15 @@ gchar **ap = str_arr; gchar *buddy, *final; + jab_res_info jri; + if((buddy = get_realwho(gjc, from, TRUE, NULL)) == NULL) { g_strfreev(str_arr); return; } + jri = jabber_find_resource(GJ_GC(gjc), buddy); + *ap++ = g_strdup_printf("<B>Jabber ID:</B> %s<BR>\n", buddy); for(vc_tp = vcard_template_data; vc_tp->label != NULL; ++vc_tp) { @@ -3569,8 +3567,11 @@ } } + status = strdup_withhtml(jabber_lookup_away(gjc, buddy)); - *ap++ = g_strdup_printf("<B>Status:</B> %s<BR>\n", status); + *ap++ = g_strdup_printf("<B>Status:</B> %s%s%s<BR>\n", + jri ? jabber_get_state_string(jri->state) : "", + jri && status ? ": " : "", status ? status : ""); g_free(status); /*
--- a/src/protocols/msn/msn.c Thu Mar 13 10:16:59 2003 +0000 +++ b/src/protocols/msn/msn.c Thu Mar 13 17:52:21 2003 +0000 @@ -1639,12 +1639,12 @@ #endif static char *msn_status_text(struct buddy *b) { if (b->uc & UC_UNAVAILABLE) - return strip_html(msn_get_away_text(b->uc >> 1)); + return g_strdup(msn_get_away_text(b->uc >> 1)); return NULL; } static char *msn_tooltip_text(struct buddy *b) { - return strip_html(msn_get_away_text(b->uc >> 1)); + return g_strdup_printf(_("<b>Status:</b> %s"), msn_get_away_text(b->uc >> 1)); } static GList *msn_buddy_menu(struct gaim_connection *gc, char *who)
--- a/src/protocols/yahoo/yahoo.c Thu Mar 13 10:16:59 2003 +0000 +++ b/src/protocols/yahoo/yahoo.c Thu Mar 13 17:52:21 2003 +0000 @@ -1083,10 +1083,17 @@ { struct yahoo_data *yd = (struct yahoo_data*)b->account->gc->proto_data; if (b->uc & UC_UNAVAILABLE) { + char *status; + char *ret; if ((b->uc >> 2) != YAHOO_STATUS_CUSTOM) - return g_strdup(yahoo_get_status_string(b->uc >> 2)); + status = g_strdup(yahoo_get_status_string(b->uc >> 2)); else - return strip_html(g_hash_table_lookup(yd->hash, b->name)); + status = strip_html(g_hash_table_lookup(yd->hash, b->name)); + if(status) { + ret = g_strdup_printf(_("<b>Status:</b> %s"), status); + g_free(status); + return ret; + } } return NULL; }