Mercurial > pidgin
changeset 5131:feda37d46e17
[gaim-migrate @ 5494]
Added an overlay icon for "Not Authorized" buddies for ICQ, as suggested
by Nathan Walp.
Added a "Status: Not Authorized" line to the tooltip for ICQ buddies whose
authorization you don't have. This required making the gaim core call the
tooltip_text prpl function for offline buddies (previously it was only
called for online buddies).
Fixed the right-click "Re-request authorization" action. That was a stupid
problem with a } being in the wrong place at the wrong time. I put it in
line. Some brackets just require more guidance than others.
Fixed a minor crashbug on solaris when trying to print NULL values.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Mon, 14 Apr 2003 18:24:38 +0000 |
parents | b9822577ce00 |
children | 494b6b6a6ffa |
files | pixmaps/status/default/Makefile.am src/buddy.c src/gtkft.c src/protocols/oscar/oscar.c |
diffstat | 4 files changed, 100 insertions(+), 60 deletions(-) [+] |
line wrap: on
line diff
--- a/pixmaps/status/default/Makefile.am Mon Apr 14 05:17:35 2003 +0000 +++ b/pixmaps/status/default/Makefile.am Mon Apr 14 18:24:38 2003 +0000 @@ -1,7 +1,8 @@ EXTRA_DIST = activebuddy.png admin.png aim.png aol.png away.png dnd.png \ extendedaway.png freeforchat.png gadu-gadu.png game.png icq.png \ invisible.png irc.png jabber.png login.png logout.png msn.png \ - na.png napster.png occupied.png offline.png wireless.png yahoo.png + na.png napster.png notauthorized.png occupied.png offline.png \ + wireless.png yahoo.png gaimstatuspixdir = $(datadir)/pixmaps/gaim/status/default @@ -9,5 +10,5 @@ dnd.png extendedaway.png freeforchat.png gadu-gadu.png \ game.png icq.png invisible.png irc.png jabber.png \ login.png logout.png msn.png na.png napster.png \ - occupied.png offline.png wireless.png yahoo.png - + notauthorized.png occupied.png offline.png \ + wireless.png yahoo.png
--- a/src/buddy.c Mon Apr 14 05:17:35 2003 +0000 +++ b/src/buddy.c Mon Apr 14 18:24:38 2003 +0000 @@ -695,6 +695,9 @@ } } + if (!statustext && !GAIM_BUDDY_IS_ONLINE(b)) + statustext = g_strdup(_("<b>Status:</b> Offline")); + if (b->idle > 0) { int ihrs, imin; time_t t; @@ -721,7 +724,6 @@ "%s %s" /* Nickname */ "%s %s" /* Idle */ "%s %s" /* Warning */ - "%s" /* Offline */ "%s%s" /* Status */ "%s", b->name, @@ -729,7 +731,6 @@ nicktext ? _("\n<b>Nickname:</b>") : "", nicktext ? nicktext : "", idletime ? _("\n<b>Idle:</b>") : "", idletime ? idletime : "", b->evil ? _("\n<b>Warned:</b>") : "", b->evil ? warning : "", - !GAIM_BUDDY_IS_ONLINE(b) ? _("\n<b>Status:</b> Offline") : "", statustext ? "\n" : "", statustext ? statustext : "", !g_ascii_strcasecmp(b->name, "robflynn") ? _("\n<b>Description:</b> Spooky") : "");
--- a/src/gtkft.c Mon Apr 14 05:17:35 2003 +0000 +++ b/src/gtkft.c Mon Apr 14 18:24:38 2003 +0000 @@ -990,7 +990,24 @@ name = gtk_file_selection_get_filename(GTK_FILE_SELECTION(data->filesel)); - if (stat(name, &st) == 0) { + if (stat(name, &st) != 0) { + /* File not found. */ + if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { + gaim_xfer_request_accepted(xfer, g_strdup(name)); + } + else { + do_error_dialog(_("That file does not exist."), + NULL, GAIM_ERROR); + + gaim_xfer_request_denied(xfer); + } + } + else if ((gaim_xfer_get_type(xfer) == GAIM_XFER_SEND) && (st.st_size == 0)) { + do_error_dialog(_("Can not send a file of 0 bytes."), NULL, GAIM_ERROR); + + gaim_xfer_request_denied(xfer); + } + else { if (S_ISDIR(st.st_mode)) { /* XXX */ gaim_xfer_request_denied(xfer); @@ -1009,18 +1026,6 @@ gaim_xfer_request_accepted(xfer, g_strdup(name)); } } - else { - /* File not found. */ - if (gaim_xfer_get_type(xfer) == GAIM_XFER_RECEIVE) { - gaim_xfer_request_accepted(xfer, g_strdup(name)); - } - else { - do_error_dialog(_("That file does not exist."), - NULL, GAIM_ERROR); - - gaim_xfer_request_denied(xfer); - } - } gtk_widget_destroy(data->filesel); data->filesel = NULL;
--- a/src/protocols/oscar/oscar.c Mon Apr 14 05:17:35 2003 +0000 +++ b/src/protocols/oscar/oscar.c Mon Apr 14 18:24:38 2003 +0000 @@ -3090,34 +3090,6 @@ return buf; } -static char *oscar_tooltip_text(struct buddy *b) { - struct gaim_connection *gc = b->account->gc; - struct oscar_data *od = gc->proto_data; - struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); - - if (bi) { - gchar *yay; - char *caps = caps_string(bi->caps); - char *tstr = sec_to_text(time(NULL) - bi->signon + - (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); - yay = g_strdup_printf(_("<b>Logged In:</b> %s%s%s"), tstr, - caps ? _("\n<b>Capabilities:</b> ") : "", caps ? caps : ""); - free(tstr); - - if (isdigit(b->name[0])) { - char *tmp, *status = gaim_icq_status((b->uc & 0xffff0000) >> 16); - tmp = yay; - yay = g_strconcat(tmp, _("\n<b>Status:</b> "), status, NULL); - g_free(tmp); - g_free(status); - } - - return yay; - } else { - return NULL; - } -} - static int gaim_parse_user_info(aim_session_t *sess, aim_frame_t *fr, ...) { struct gaim_connection *gc = sess->aux_data; struct oscar_data *od = gc->proto_data; @@ -4740,7 +4712,7 @@ gaim_blist_add_group(g, NULL); } - debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, gname); + debug_printf("ssi: adding buddy %s to group %s to local list\n", curitem->name, gname_utf8 ? gname_utf8 : _("Orphans")); gaim_blist_add_buddy(buddy, g, NULL); export = TRUE; } @@ -5229,8 +5201,20 @@ char *emblems[4] = {NULL,NULL,NULL,NULL}; int i = 0; - if (b->present == GAIM_BUDDY_OFFLINE) - emblems[i++] = "offline"; + if (!GAIM_BUDDY_IS_ONLINE(b)) { + struct gaim_account *account; + struct gaim_connection *gc; + struct oscar_data *od; + char *gname; + if ((b->name) && (account = b->account) && (gc = account->gc) && + (od = gc->proto_data) && (od->sess->ssi.received_data) && + (gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name)) && + (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name))) { + emblems[i++] = "notauthorized"; + } else { + emblems[i++] = "offline"; + } + } if (b->name && (b->uc & 0xffff0000) && isdigit(b->name[0])) { int uc = b->uc >> 16; @@ -5266,6 +5250,56 @@ *ne = emblems[3]; } +static char *oscar_tooltip_text(struct buddy *b) { + struct gaim_connection *gc = b->account->gc; + struct oscar_data *od = gc->proto_data; + struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, normalize(b->name)); + gchar *tmp, *yay = g_strdup(""); + + if (GAIM_BUDDY_IS_ONLINE(b)) { + if (isdigit(b->name[0])) { + char *tmp, *status; + status = gaim_icq_status((b->uc & 0xffff0000) >> 16); + tmp = yay; + yay = g_strconcat(tmp, _("<b>Status:</b> "), status, "\n", NULL); + g_free(tmp); + g_free(status); + } + + if (bi) { + char *tstr = sec_to_text(time(NULL) - bi->signon + + (gc->login_time_official ? gc->login_time_official - gc->login_time : 0)); + tmp = yay; + yay = g_strconcat(tmp, _("<b>Logged In:</b> "), tstr, "\n", NULL); + free(tmp); + free(tstr); + + if (bi->caps) { + char *caps = caps_string(bi->caps); + tmp = yay; + yay = g_strconcat(tmp, _("<b>Capabilities:</b> "), caps, "\n", NULL); + free(tmp); + } + } + } else { + char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); + if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { + tmp = yay; + yay = g_strconcat(tmp, _("<b>Status:</b> Not Authorized"), "\n", NULL); + g_free(tmp); + } else { + tmp = yay; + yay = g_strconcat(tmp, _("<b>Status:</b> Offline"), "\n", NULL); + g_free(tmp); + } + } + + /* remove the trailing newline character */ + if (yay) + yay[strlen(yay)-1] = '\0'; + return yay; +} + /* * We have just established a socket with the other dude, so set up some handlers. */ @@ -5613,18 +5647,17 @@ m = g_list_append(m, pbm); #endif } + } - if (od->sess->ssi.received_data) { - char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); - if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { - pbm = g_new0(struct proto_buddy_menu, 1); - pbm->label = _("Re-request Authorization"); - pbm->callback = gaim_auth_sendrequest; - pbm->gc = gc; - m = g_list_append(m, pbm); - } + if (od->sess->ssi.received_data) { + char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, who); + if (gname && aim_ssi_waitingforauth(od->sess->ssi.local, gname, who)) { + pbm = g_new0(struct proto_buddy_menu, 1); + pbm->label = _("Re-request Authorization"); + pbm->callback = gaim_auth_sendrequest; + pbm->gc = gc; + m = g_list_append(m, pbm); } - } return m; @@ -5868,6 +5901,7 @@ ret->name = g_strdup("AIM/ICQ"); ret->list_icon = oscar_list_icon; ret->list_emblems = oscar_list_emblems; + ret->tooltip_text = oscar_tooltip_text; ret->away_states = oscar_away_states; ret->actions = oscar_actions; ret->buddy_menu = oscar_buddy_menu; @@ -5908,7 +5942,6 @@ ret->chat_send = oscar_chat_send; ret->keepalive = oscar_keepalive; ret->convo_closed = oscar_convo_closed; - ret->tooltip_text = oscar_tooltip_text; puo = g_new0(struct proto_user_opt, 1); puo->label = g_strdup("Auth Host:");