Mercurial > pidgin.yaz
changeset 4227:a614423c648f
[gaim-migrate @ 4471]
This is a patch from Nathan Walp that adds a
"char server_alias[BUDDY_ALIAS_MAXLEN]" to struct buddy, and a preference
option to show the server alias instead of the alias set by you. It
shouldn't cause any problems. But then again, faceprint is a crazy patch
writer, with an emphasis on crazy, if you know what I mean. Huh? Get it?
"Crazy"? I kill me. But right after I kill Time Warner.
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 07 Jan 2003 17:44:34 +0000 |
parents | a7d1eddc0afc |
children | 1b37bf971b38 |
files | plugins/ticker/ticker.c src/buddy.c src/conversation.c src/core.h src/dialogs.c src/gaim.h src/gaimrc.c src/list.c src/log.c src/perl.c src/prefs.c src/protocols/gg/gg.c src/protocols/jabber/jabber.c src/protocols/msn/msn.c src/protocols/zephyr/zephyr.c src/server.c |
diffstat | 16 files changed, 125 insertions(+), 118 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/ticker/ticker.c Tue Jan 07 16:18:08 2003 +0000 +++ b/plugins/ticker/ticker.c Tue Jan 07 17:44:34 2003 +0000 @@ -351,7 +351,7 @@ if (xpm == NULL) xpm = (char **)no_icon_xpm; pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); - BuddyTickerAddUser( b->name, b->show, pm, bm ); + BuddyTickerAddUser( b->name, get_buddy_alias(b), pm, bm ); gdk_pixmap_unref(pm); if (bm) gdk_bitmap_unref(bm); @@ -374,7 +374,7 @@ xpm = (char **)no_icon_xpm; pm = gdk_pixmap_create_from_xpm_d(blist->window, &bm, NULL, xpm); - BuddyTickerAddUser(who, b->show, pm, bm); + BuddyTickerAddUser(who, get_buddy_alias(b), pm, bm); gdk_pixmap_unref(pm); if (bm) gdk_bitmap_unref(bm);
--- a/src/buddy.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/buddy.c Tue Jan 07 17:44:34 2003 +0000 @@ -84,7 +84,6 @@ GtkWidget *warn; GtkWidget *idle; char *name; - char *show; GSList *connlist; guint log_timer; gint sound; @@ -148,7 +147,6 @@ g_source_remove(bs->log_timer); bs->log_timer = 0; remove_buddy_show(gs, bs); - g_free(bs->show); g_free(bs->name); g_free(bs); } @@ -202,7 +200,6 @@ g_source_remove(bs->log_timer); bs->log_timer = 0; remove_buddy_show(gs, bs); - g_free(bs->show); g_free(bs->name); g_free(bs); } @@ -236,15 +233,12 @@ GtkCTreeNode *c; char buf[256]; - if (!strcmp(b->show, prevname)) - g_snprintf(b->show, sizeof(b->show), "%s", b->name); - /* well you shouldn't be calling this if nothing changed. duh. */ do_export(b->gc); c = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, b); - if (strcmp(b->show, b->name)) - g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, b->show); + if (get_buddy_alias_only(b)) + g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b)); else g_snprintf(buf, sizeof(buf), "%s", b->name); gtk_ctree_node_set_text(GTK_CTREE(edittree), c, 0, buf); @@ -252,8 +246,6 @@ if ((cnv = find_conversation(b->name)) != NULL) set_convo_title(cnv); - gs = find_group_show(prevname); - g = find_group_by_buddy(b->gc, b->name); if (!g) { /* shouldn't happen */ @@ -277,13 +269,12 @@ g_source_remove(bs->log_timer); bs->log_timer = 0; remove_buddy_show(gs, bs); - g_free(bs->show); g_free(bs->name); g_free(bs); } update_num_group(gs); } else { - gtk_label_set_text(GTK_LABEL(bs->label), b->show); + gtk_label_set_text(GTK_LABEL(bs->label), get_buddy_alias(b)); update_idle_time(bs); } } @@ -306,7 +297,6 @@ g_source_remove(b->log_timer); b->log_timer = 0; gtk_tree_remove_item(GTK_TREE(g->tree), b->item); - g_free(b->show); g_free(b->name); g_free(b); } @@ -750,12 +740,8 @@ static void un_alias(GtkWidget *a, struct buddy *b) { - g_snprintf(b->show, sizeof(b->show), "%s", b->name); - /* passing b->show as the previous name seems to be the (current) - * way to get the bs->lable changed for that buddy. However, this - * function should do everything that needs to be done - */ - handle_buddy_rename(b, b->show); /* make me a sammich! */ + b->alias[0] = '\0'; + handle_buddy_rename(b, b->name); /* make me a sammich! */ serv_alias_buddy(b); } @@ -820,7 +806,7 @@ gtk_menu_append(GTK_MENU(menu), button); gtk_widget_show(button); - if (strcmp(b->name, b->show)) { + if (b->alias[0]) { button = gtk_menu_item_new_with_label(_("Un-Alias")); g_signal_connect(GTK_OBJECT(button), "activate", G_CALLBACK(un_alias), b); gtk_menu_append(GTK_MENU(menu), button); @@ -907,7 +893,6 @@ g_source_remove(bs->log_timer); bs->log_timer = 0; remove_buddy_show(gs, bs); - g_free(bs->show); g_free(bs->name); g_free(bs); if (!g_slist_length(gs->members) && @@ -1013,7 +998,6 @@ m = g_slist_remove(m, bs); if (bs->log_timer > 0) g_source_remove(bs->log_timer); - g_free(bs->show); g_free(bs->name); g_free(bs); } @@ -1182,7 +1166,7 @@ while (mem) { b = (struct buddy *)mem->data; if (!find_buddy(pc, b->name)) - add_buddy(pc, g->name, b->name, b->show); + add_buddy(pc, g->name, b->name, b->alias); mem = mem->next; } } @@ -1301,8 +1285,8 @@ while (mem) { char buf[256]; b = (struct buddy *)mem->data; - if (strcmp(b->name, b->show)) { - g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, b->show); + if (get_buddy_alias_only(b)) { + g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b)); text[0] = buf; } else text[0] = b->name; @@ -1341,8 +1325,8 @@ return; p = gtk_ctree_find_by_row_data(GTK_CTREE(edittree), NULL, g); - if (strcmp(b->name, b->show)) { - g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, b->show); + if (get_buddy_alias_only(b)) { + g_snprintf(buf, sizeof(buf), "%s (%s)", b->name, get_buddy_alias(b)); text[0] = buf; } else text[0] = b->name; @@ -1921,7 +1905,6 @@ } b->name = g_strdup(buddy->name); - b->show = g_strdup(buddy->show); b->item = gtk_tree_item_new(); gtk_tree_insert(GTK_TREE(gs->tree), b->item, pos); @@ -1943,7 +1926,7 @@ gdk_pixmap_unref(pm); gdk_bitmap_unref(bm); - b->label = gtk_label_new(buddy->show); + b->label = gtk_label_new(get_buddy_alias(buddy)); gtk_misc_set_alignment(GTK_MISC(b->label), 0.0, 0.5); gtk_box_pack_start(GTK_BOX(box), b->label, FALSE, FALSE, 1); gtk_widget_show(b->label); @@ -2137,7 +2120,6 @@ g_source_remove(b->log_timer); b->log_timer = 0; g_free(b->name); - g_free(b->show); g_free(b); } else { /* um.... what do we have to do here? just update the pixmap? */ @@ -2250,6 +2232,8 @@ char infotip[2048]; char warn[256]; char caps[256]; + char alias[512]; + char serv_alias[512]; char *sotime = NULL, *itime; int i; @@ -2324,10 +2308,19 @@ else caps[0] = '\0'; - g_snprintf(infotip, sizeof infotip, _("Alias: %s \nScreen Name: %s\n" - "%s%s%s%s%s%s"), - b->show, b->name, - (b->signon ? sotime : ""), warn, + if (b->alias[0]) + g_snprintf(alias, sizeof alias, _("Alias: %s\n"), b->alias); + else + alias[0] = '\0'; + + if (b->server_alias[0]) + g_snprintf(serv_alias, sizeof serv_alias, _("Nickname: %s\n"), + b->server_alias); + else + serv_alias[0] = '\0'; + + g_snprintf(infotip, sizeof infotip, _("%s%sScreen Name: %s\n%s%s%s%s%s%s"), + alias, serv_alias, b->name, (b->signon ? sotime : ""), warn, (b->idle ? _("Idle: ") : ""), itime, (b->idle ? "\n" : ""), caps); gtk_tooltips_set_tip(tips, GTK_WIDGET(bs->item), infotip, ""); @@ -2397,12 +2390,14 @@ struct conversation *c = find_conversation(b->name); if (c) { char tmp[1024]; - g_snprintf(tmp, sizeof(tmp), _("%s logged in."), b->show); + g_snprintf(tmp, sizeof(tmp), _("%s logged in."), + get_buddy_alias(b)); write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1); } else if (clistqueue && find_queue_total_by_name(b->name)) { struct queued_message *qm = g_new0(struct queued_message, 1); g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); - qm->message = g_strdup_printf(_("%s logged in."), b->show); + qm->message = g_strdup_printf(_("%s logged in."), + get_buddy_alias(b)); qm->gc = gc; qm->tm = time(NULL); qm->flags = WFLAG_SYSTEM; @@ -2456,12 +2451,15 @@ struct conversation *c = find_conversation(b->name); if (c) { char tmp[1024]; - g_snprintf(tmp, sizeof(tmp), _("%s logged out."), b->show); + g_snprintf(tmp, sizeof(tmp), _("%s logged out."), + get_buddy_alias(b)); write_to_conv(c, tmp, WFLAG_SYSTEM, NULL, time(NULL), -1); } else if (clistqueue && find_queue_total_by_name(b->name)) { struct queued_message *qm = g_new0(struct queued_message, 1); - g_snprintf(qm->name, sizeof(qm->name), "%s", b->name); - qm->message = g_strdup_printf(_("%s logged out."), b->show); + g_snprintf(qm->name, sizeof(qm->name), "%s", + get_buddy_alias(b)); + qm->message = g_strdup_printf(_("%s logged out."), + get_buddy_alias(b)); qm->gc = gc; qm->tm = time(NULL); qm->flags = WFLAG_SYSTEM;
--- a/src/conversation.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/conversation.c Tue Jan 07 17:44:34 2003 +0000 @@ -1740,8 +1740,8 @@ if (!who) { if (flags & WFLAG_SEND) { b = find_buddy(c->gc, c->gc->username); - if (b && strcmp(b->name, b->show)) - who = b->show; + if (get_buddy_alias(b)) + who = get_buddy_alias(b); else if (c->gc->user->alias[0]) who = c->gc->user->alias; else if (c->gc->displayname[0]) @@ -1751,14 +1751,14 @@ } else { b = find_buddy(c->gc, c->name); if (b) - who = b->show; + who = get_buddy_alias(b); else who = c->name; } } else { b = find_buddy(c->gc, who); if (b) - who = b->show; + who = get_buddy_alias(b); } } @@ -3218,7 +3218,7 @@ GtkNotebook *nb; if ((im_options & OPT_IM_ALIAS_TAB) && c->gc && ((b = find_buddy(c->gc, c->name)) != NULL)) - text = b->show; + text = get_buddy_alias(b); else text = c->name;
--- a/src/core.h Tue Jan 07 16:18:08 2003 +0000 +++ b/src/core.h Tue Jan 07 17:44:34 2003 +0000 @@ -149,8 +149,9 @@ struct buddy { int edittype; /* XXX CUI: this is really a GUI function and we need to put this in ui.h */ char name[80]; - char show[BUDDY_ALIAS_MAXLEN]; - int present; + char alias[BUDDY_ALIAS_MAXLEN]; + char server_alias[BUDDY_ALIAS_MAXLEN]; + int present; int evil; time_t signon; time_t idle; @@ -190,6 +191,8 @@ extern void toc_build_config(struct gaim_connection *, char *, int len, gboolean); extern void parse_toc_buddy_list(struct gaim_connection *, char *); extern void signoff_blocked(struct gaim_connection *); +extern char* get_buddy_alias_only(struct buddy *); +extern char* get_buddy_alias(struct buddy *); /* Functions in core.c */ extern gint UI_write(struct UI *, guchar *, int); @@ -240,6 +243,7 @@ extern struct conversation *serv_got_joined_chat(struct gaim_connection *, int, char *); extern void serv_got_chat_left(struct gaim_connection *, int); extern void serv_got_chat_in(struct gaim_connection *, int, char *, int, char *, time_t); +extern void serv_got_alias(struct gaim_connection *, char *, char *); extern void serv_finish_login(); #endif /* _CORE_H_ */
--- a/src/dialogs.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/dialogs.c Tue Jan 07 17:44:34 2003 +0000 @@ -3760,7 +3760,10 @@ static void do_alias_bud(GtkWidget *w, struct buddy *b) { const char *al = gtk_entry_get_text(GTK_ENTRY(aliasname)); - g_snprintf(b->show, sizeof(b->show), "%s", (al && strlen(al)) ? al : b->name); + if (al && strlen(al)) + g_snprintf(b->alias, sizeof(b->alias), "%s", al); + else + b->alias[0] = '\0'; handle_buddy_rename(b, b->name); serv_alias_buddy(b); destroy_dialog(aliasdlg, aliasdlg); @@ -3811,7 +3814,7 @@ gtk_box_pack_start(GTK_BOX(topbox), bbox, FALSE, FALSE, 0); gtk_entry_set_text(GTK_ENTRY(aliasentry), b->name); - gtk_entry_set_text(GTK_ENTRY(aliasname), b->show); + gtk_entry_set_text(GTK_ENTRY(aliasname), b->alias); /* Put the buttons in the box */ bbox = gtk_hbox_new(FALSE, 5); @@ -4408,8 +4411,6 @@ char *prevname = g_strdup(b->name); if (g) serv_remove_buddy(b->gc, b->name, g->name); - if (!strcmp(b->name, b->show)) - g_snprintf(b->show, sizeof(b->show), "%s", new_name); g_snprintf(b->name, sizeof(b->name), "%s", new_name); serv_add_buddy(b->gc, b->name); handle_buddy_rename(b, prevname);
--- a/src/gaim.h Tue Jan 07 16:18:08 2003 +0000 +++ b/src/gaim.h Tue Jan 07 17:44:34 2003 +0000 @@ -211,6 +211,7 @@ #define OPT_MISC_BROWSER_POPUP 0x00000002 #define OPT_MISC_BUDDY_TICKER 0x00000004 #define OPT_MISC_STEALTH_TYPING 0x00000010 +#define OPT_MISC_USE_SERVER_ALIAS 0x00000020 extern guint logging_options; #define OPT_LOG_CONVOS 0x00000001
--- a/src/gaimrc.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/gaimrc.c Tue Jan 07 17:44:34 2003 +0000 @@ -1187,7 +1187,8 @@ int i; struct away_message *a; - misc_options = 0; + misc_options = + OPT_MISC_USE_SERVER_ALIAS; logging_options = 0;
--- a/src/list.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/list.c Tue Jan 07 17:44:34 2003 +0000 @@ -139,7 +139,10 @@ good = buddy; g_snprintf(b->name, sizeof(b->name), "%s", good); - g_snprintf(b->show, sizeof(b->show), "%s", show ? (show[0] ? show : good) : good); + if(show && show[0]) + g_snprintf(b->alias, sizeof(b->alias), "%s", show); + else + b->alias[0] = '\0'; g->members = g_slist_append(g->members, b); @@ -476,8 +479,8 @@ while (len > pos && mem) { b = (struct buddy *)mem->data; pos += g_snprintf(&s[pos], len - pos, "b %s%s%s\n", b->name, - (show && strcmp(b->name, b->show)) ? ":" : "", - (show && strcmp(b->name, b->show)) ? b->show : ""); + (show && b->alias[0]) ? ":" : "", + (show && b->alias[0]) ? b->alias : ""); mem = mem->next; } grp = g_slist_next(grp); @@ -872,3 +875,22 @@ g = g->next; } } + +char *get_buddy_alias_only(struct buddy *b) { + if(!b) + return NULL; + if(b->alias[0]) + return b->alias; + else if((misc_options & OPT_MISC_USE_SERVER_ALIAS) && b->server_alias[0]) + return b->server_alias; + return NULL; +} + + +char *get_buddy_alias(struct buddy *b) { + char *ret = get_buddy_alias_only(b); + if(!ret) + return b ? b->name : _("Unknown"); + return ret; +} +
--- a/src/log.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/log.c Tue Jan 07 17:44:34 2003 +0000 @@ -374,37 +374,37 @@ g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text); break; } - } else if (strcmp(who->name, who->show)) { + } else if (get_buddy_alias_only(who)) { switch (what) { case log_signon: g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed on @ %s"), - gc->username, gc->prpl->name, who->show, who->name, full_date()); + gc->username, gc->prpl->name, get_buddy_alias(who), who->name, full_date()); g_snprintf(html, sizeof(html), "<B>%s</B>", text); break; case log_signoff: g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) signed off @ %s"), - gc->username, gc->prpl->name, who->show, who->name, full_date()); + gc->username, gc->prpl->name, get_buddy_alias(who), who->name, full_date()); g_snprintf(html, sizeof(html), "<I><FONT COLOR=GRAY>%s</FONT></I>", text); break; case log_away: g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) went away @ %s"), - gc->username, gc->prpl->name, who->show, who->name, full_date()); + gc->username, gc->prpl->name, get_buddy_alias(who), who->name, full_date()); g_snprintf(html, sizeof(html), "<FONT COLOR=OLIVE>%s</FONT>", text); break; case log_back: g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) came back @ %s"), - gc->username, gc->prpl->name, who->show, who->name, full_date()); + gc->username, gc->prpl->name, get_buddy_alias(who), who->name, full_date()); g_snprintf(html, sizeof(html), "%s", text); break; case log_idle: g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) became idle @ %s"), - gc->username, gc->prpl->name, who->show, who->name, full_date()); + gc->username, gc->prpl->name, get_buddy_alias(who), who->name, full_date()); g_snprintf(html, sizeof(html), "<FONT COLOR=GRAY>%s</FONT>", text); break; case log_unidle: g_snprintf(text, sizeof(text), _("%s (%s) reported that %s (%s) returned from idle @ %s"), gc->username, - gc->prpl->name, who->show, who->name, full_date()); + gc->prpl->name, get_buddy_alias(who), who->name, full_date()); g_snprintf(html, sizeof(html), "%s", text); break; default:
--- a/src/perl.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/perl.c Tue Jan 07 17:44:34 2003 +0000 @@ -744,7 +744,7 @@ if (!buddy) XSRETURN(0); XST_mPV(0, buddy->name); - XST_mPV(1, buddy->show); + XST_mPV(1, get_buddy_alias(buddy)); XST_mPV(2, buddy->present ? "Online" : "Offline"); XST_mIV(3, buddy->evil); XST_mIV(4, buddy->signon);
--- a/src/prefs.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/prefs.c Tue Jan 07 17:44:34 2003 +0000 @@ -193,6 +193,8 @@ /* This really shouldn't be in preferences at all */ debugbutton = gaim_button(_("Show _debug window"), &misc_options, OPT_MISC_DEBUG, vbox); + gaim_button(_("D_isplay remote nicknames if no alias is set"), &misc_options, OPT_MISC_USE_SERVER_ALIAS, vbox); + gtk_widget_show_all(ret); return ret; @@ -1645,6 +1647,11 @@ if (option == OPT_MISC_DEBUG) show_debug(); + else if(option == OPT_MISC_USE_SERVER_ALIAS) { + redo_buddy_list(); + build_edit_tree(); + set_convo_titles(); + } } static void set_logging_option(GtkWidget *w, int option)
--- a/src/protocols/gg/gg.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/protocols/gg/gg.c Tue Jan 07 17:44:34 2003 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 4432 2003-01-04 21:01:32Z chipx86 $ + * $Id: gg.c 4471 2003-01-07 17:44:34Z thekingant $ * * Copyright (C) 2001 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL> * @@ -1023,7 +1023,7 @@ /* GG Number */ gchar *name = gg_urlencode(b->name); /* GG Pseudo */ - gchar *show = gg_urlencode(strlen(b->show) ? b->show : b->name); + gchar *show = gg_urlencode(get_buddy_alias(b)); /* Group Name */ gchar *gname = gg_urlencode(g->name);
--- a/src/protocols/jabber/jabber.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/protocols/jabber/jabber.c Tue Jan 07 17:44:34 2003 +0000 @@ -1780,9 +1780,8 @@ serv_got_update(GJ_GC(gjc), buddyname, 1, 0, signon, idle, uc, 0); } - } else if(name != NULL && strcmp(b->show, name)) { - strncpy(b->show, name, BUDDY_ALIAS_MAXLEN); - b->show[BUDDY_ALIAS_MAXLEN - 1] = '\0'; /* cheap safety feature */ + } else if(name != NULL && strcmp(b->alias, name)) { + g_snprintf(b->alias, sizeof(b->alias), "%s", name); handle_buddy_rename(b, buddyname); } } @@ -2525,7 +2524,7 @@ if(alias && alias[0] != '\0') { my_alias = alias; } else if((buddy = find_buddy(gc, realwho)) != NULL) { - my_alias = buddy->show; + my_alias = buddy->alias; } /* If there's an alias for the buddy, it's not 0-length
--- a/src/protocols/msn/msn.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/protocols/msn/msn.c Tue Jan 07 17:44:34 2003 +0000 @@ -483,7 +483,7 @@ struct buddy *b; if ((b = find_buddy(gc, user)) != NULL) - username = b->show; + username = get_buddy_alias(b); else username = user; @@ -1218,11 +1218,7 @@ GET_NEXT(tmp); friend = url_decode(tmp); - if ((b = find_buddy(gc, user)) != NULL) { - if (b->proto_data) - g_free(b->proto_data); - b->proto_data = g_strdup(friend); - } + serv_got_alias(gc, user, friend); if (!g_strcasecmp(state, "BSY")) { status |= UC_UNAVAILABLE | (MSN_BUSY << 1); @@ -1330,14 +1326,11 @@ } while (md->fl) { struct msn_buddy *mb = md->fl->data; - struct buddy *b; + struct buddy *b = find_buddy(gc, mb->user); md->fl = g_slist_remove(md->fl, mb); - if (!(b = find_buddy(gc, mb->user))) - add_buddy(gc, _("Buddies"), mb->user, mb->friend); - else if (!g_strcasecmp(b->name, b->show)) { - g_snprintf(b->show, sizeof(b->show), "%s", mb->friend); - handle_buddy_rename(b, b->name); - } + if(!b) + b = add_buddy(gc, _("Buddies"), mb->user, NULL); + serv_got_alias(gc, mb->user, mb->friend); g_free(mb->user); g_free(mb->friend); g_free(mb); @@ -1360,7 +1353,6 @@ md->msglen = length; } else if (!g_strncasecmp(buf, "NLN", 3)) { char *state, *user, *friend, *tmp = buf; - struct buddy *b; int status = 0; GET_NEXT(tmp); @@ -1372,11 +1364,7 @@ GET_NEXT(tmp); friend = url_decode(tmp); - if ((b = find_buddy(gc, user)) != NULL) { - if (b->proto_data) - g_free(b->proto_data); - b->proto_data = g_strdup(friend); - } + serv_got_alias(gc, user, friend); if (!g_strcasecmp(state, "BSY")) { status |= UC_UNAVAILABLE | (MSN_BUSY << 1); @@ -2439,15 +2427,6 @@ } } -static void msn_reset_friend(struct gaim_connection *gc, char *who) -{ - struct buddy *b = find_buddy(gc, who); - if (!b || !b->proto_data) - return; - g_snprintf(b->show, sizeof(b->show), "%s", (char *)b->proto_data); - handle_buddy_rename(b, b->name); -} - static void msn_ask_send_file(struct gaim_connection *gc, char *destsn) { struct msn_data *md = (struct msn_data *)gc->proto_data; @@ -2470,12 +2449,6 @@ static char buf[MSN_BUF_LEN]; pbm = g_new0(struct proto_buddy_menu, 1); - pbm->label = _("Reset friendly name"); - pbm->callback = msn_reset_friend; - pbm->gc = gc; - m = g_list_append(m, pbm); - - pbm = g_new0(struct proto_buddy_menu, 1); pbm->label = _("Send File"); pbm->callback = msn_ask_send_file; pbm->gc = gc; @@ -2569,18 +2542,6 @@ { if (!strcmp(act, _("Set Friendly Name"))) { do_prompt_dialog(_("Set Friendly Name:"), gc->displayname, gc, msn_act_id, NULL); - } else if (!strcmp(act, _("Reset All Friendly Names"))) { - GSList *g = gc->groups; - while (g) { - GSList *m = ((struct group *)g->data)->members; - while (m) { - struct buddy *b = m->data; - if (b->present) - msn_reset_friend(gc, b->name); - m = m->next; - } - g = g->next; - } } }
--- a/src/protocols/zephyr/zephyr.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue Jan 07 17:44:34 2003 +0000 @@ -335,7 +335,7 @@ GString *str = g_string_new(""); g_string_sprintfa(str, "<b>User:</b> %s<br>" "<b>Alias:</b> %s<br>", - b->name, b->show); + b->name, b->alias); if (!nlocs) { g_string_sprintfa(str, "<br>Hidden or not logged-in"); }
--- a/src/server.c Tue Jan 07 16:18:08 2003 +0000 +++ b/src/server.c Tue Jan 07 17:44:34 2003 +0000 @@ -340,6 +340,19 @@ } } +void serv_got_alias(struct gaim_connection *gc, char *who, char *alias) { + struct buddy *b = find_buddy(gc, who); + if(!b) + return; + + if(alias) + g_snprintf(b->server_alias, sizeof(b->server_alias), "%s", alias); + else + b->server_alias[0] = '\0'; + + handle_buddy_rename(b, b->name); +} + /* * Move a buddy from one group to another on server. * @@ -612,7 +625,7 @@ time_t t; char *tmpmsg; struct buddy *b = find_buddy(gc, name); - char *alias = b ? b->show : name; + char *alias = b ? get_buddy_alias(b) : name; int row; struct queued_away_response *qar;