# HG changeset patch # User Eric Warmenhoven # Date 1006218082 0 # Node ID a0fd8f91e294232ecf111b06942219e9b4a579a0 # Parent f9227268db2512f5468075e8f54cd1d8d1b346ea [gaim-migrate @ 2786] SPAM!!! All recipients of the email generated by this commit each owe me $125 per email sent, plus a $75 handling fee for all messages combined. Or was that supposed to be the other way around. committer: Tailor Script diff -r f9227268db25 -r a0fd8f91e294 src/conversation.c --- a/src/conversation.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/conversation.c Tue Nov 20 01:01:22 2001 +0000 @@ -604,7 +604,7 @@ gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); return TRUE; - } else if (!(event->state & GDK_SHIFT_MASK) && (convo_options & OPT_CONVO_ENTER_SENDS)) { + } else if (!(event->state & (GDK_SHIFT_MASK | GDK_CONTROL_MASK)) && (convo_options & OPT_CONVO_ENTER_SENDS)) { gtk_signal_emit_by_name(GTK_OBJECT(entry), "activate", c); gtk_signal_emit_stop_by_name(GTK_OBJECT(entry), "key_press_event"); return TRUE; diff -r f9227268db25 -r a0fd8f91e294 src/dialogs.c --- a/src/dialogs.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/dialogs.c Tue Nov 20 01:01:22 2001 +0000 @@ -172,11 +172,30 @@ }; struct info_dlg { + struct gaim_connection *gc; + char *who; GtkWidget *window; GtkWidget *text; - GtkWidget *close; }; - +static GSList *info_dlgs = NULL; + +static struct info_dlg *find_info_dlg(struct gaim_connection *gc, char *who) +{ + GSList *i = info_dlgs; + while (i) { + struct info_dlg *d = i->data; + i = i->next; + if (d->gc != gc) + continue; + if (d->who == NULL) + continue; + if (!who) + continue; + if (!g_strcasecmp(normalize(who), d->who)) + return d; + } + return NULL; +} struct set_info_dlg { GtkWidget *window; @@ -1732,6 +1751,9 @@ static void info_dlg_free(GtkWidget *b, struct info_dlg *d) { + if (g_slist_find(info_dlgs, d)) + info_dlgs = g_slist_remove(info_dlgs, d); + g_free(d->who); g_free(d); } @@ -1750,7 +1772,7 @@ return NULL; } -void g_show_info_text(char *info, ...) +void g_show_info_text(struct gaim_connection *gc, char *who, gboolean away, char *info, ...) { GtkWidget *ok; GtkWidget *label; @@ -1761,41 +1783,48 @@ char *more_info; va_list ap; - struct info_dlg *b = g_new0(struct info_dlg, 1); - - va_start(ap, info); - - GAIM_DIALOG(b->window); - gtk_window_set_title(GTK_WINDOW(b->window), "Gaim"); - gtk_container_border_width(GTK_CONTAINER(b->window), 5); - bbox = gtk_vbox_new(FALSE, 5); - gtk_container_add(GTK_CONTAINER(b->window), bbox); - gtk_widget_realize(GTK_WIDGET(b->window)); - ok = picture_button(b->window, _("OK"), ok_xpm); - gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(destroy_dialog), b->window); - gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(info_dlg_free), b); - gtk_signal_connect(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(destroy_dialog), b->window); - - label = gtk_label_new(_("Below are the results of your search: ")); - - sw = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - text = gtk_imhtml_new(NULL, NULL); - b->text = text; - gtk_container_add(GTK_CONTAINER(sw), text); - - GTK_LAYOUT(text)->hadjustment->step_increment = 10.0; - GTK_LAYOUT(text)->vadjustment->step_increment = 10.0; - gtk_widget_set_usize(sw, 300, 250); - gtk_imhtml_set_img_handler(GTK_IMHTML(text), info_img_handler); - gaim_setup_imhtml(text); - - gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); - gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); - gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); - - aol_icon(b->window->window); - gtk_widget_show_all(b->window); + struct info_dlg *b = find_info_dlg(gc, who); + if (!b && away) + return; + if (!b) { + b = g_new0(struct info_dlg, 1); + b->gc = gc; + b->who = who ? g_strdup(normalize(who)) : NULL; + info_dlgs = g_slist_append(info_dlgs, b); + + GAIM_DIALOG(b->window); + gtk_window_set_title(GTK_WINDOW(b->window), "Gaim"); + gtk_container_border_width(GTK_CONTAINER(b->window), 5); + gtk_widget_realize(GTK_WIDGET(b->window)); + gtk_signal_connect(GTK_OBJECT(b->window), "destroy", GTK_SIGNAL_FUNC(info_dlg_free), b); + aol_icon(b->window->window); + + bbox = gtk_vbox_new(FALSE, 5); + gtk_container_add(GTK_CONTAINER(b->window), bbox); + + label = gtk_label_new(_("Below are the results of your search: ")); + gtk_box_pack_start(GTK_BOX(bbox), label, FALSE, FALSE, 0); + + sw = gtk_scrolled_window_new(NULL, NULL); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); + gtk_box_pack_start(GTK_BOX(bbox), sw, TRUE, TRUE, 0); + + text = gtk_imhtml_new(NULL, NULL); + b->text = text; + gtk_container_add(GTK_CONTAINER(sw), text); + GTK_LAYOUT(text)->hadjustment->step_increment = 10.0; + GTK_LAYOUT(text)->vadjustment->step_increment = 10.0; + gtk_widget_set_usize(sw, 300, 250); + gtk_imhtml_set_img_handler(GTK_IMHTML(text), info_img_handler); + gaim_setup_imhtml(text); + + ok = picture_button(b->window, _("OK"), ok_xpm); + gtk_signal_connect_object(GTK_OBJECT(ok), "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), + GTK_OBJECT(b->window)); + gtk_box_pack_start(GTK_BOX(bbox), ok, FALSE, FALSE, 0); + + gtk_widget_show_all(b->window); + } if (convo_options & OPT_CONVO_IGNORE_COLOUR) options ^= GTK_IMHTML_NO_COLOURS; @@ -1807,13 +1836,20 @@ options ^= GTK_IMHTML_NO_TITLE; options ^= GTK_IMHTML_NO_NEWLINE; options ^= GTK_IMHTML_NO_SCROLL; + gtk_imhtml_append_text(GTK_IMHTML(b->text), info, options); + + va_start(ap, info); while ((more_info = va_arg(ap, char *)) != NULL) gtk_imhtml_append_text(GTK_IMHTML(b->text), more_info, options); va_end(ap); + gtk_imhtml_append_text(GTK_IMHTML(b->text), "
", 0); - gtk_adjustment_set_value(gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(sw)), 0); + if (away) + info_dlgs = g_slist_remove(info_dlgs, b); + else + serv_get_away(gc, who); } /*------------------------------------------------------------------------*/ diff -r f9227268db25 -r a0fd8f91e294 src/gaim.h --- a/src/gaim.h Mon Nov 19 23:32:04 2001 +0000 +++ b/src/gaim.h Tue Nov 20 01:01:22 2001 +0000 @@ -331,7 +331,7 @@ extern struct conversation *find_conversation(char *); /* Functions in dialogs.c */ -extern void g_show_info_text(char *, ...); +extern void g_show_info_text(struct gaim_connection *, char *, gboolean, char *, ...); extern GtkWidget *do_error_dialog(char *, char *); extern void show_change_passwd(struct gaim_connection *); extern void show_set_dir(struct gaim_connection *); @@ -384,6 +384,7 @@ extern void serv_chat_whisper(struct gaim_connection *, int, char *, char *); extern int serv_chat_send(struct gaim_connection *, int, char *); extern void serv_got_popup(char *, char *, int, int); +extern void serv_get_away(struct gaim_connection *, char *); /* Functions in util.c */ extern char *normalize(const char *); diff -r f9227268db25 -r a0fd8f91e294 src/protocols/gg/gg.c --- a/src/protocols/gg/gg.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/gg/gg.c Tue Nov 20 01:01:22 2001 +0000 @@ -1,6 +1,6 @@ /* * gaim - Gadu-Gadu Protocol Plugin - * $Id: gg.c 2719 2001-11-10 08:02:40Z warmenhoven $ + * $Id: gg.c 2786 2001-11-20 01:01:22Z warmenhoven $ * * Copyright (C) 2001, Arkadiusz Mi¶kiewicz * @@ -790,7 +790,7 @@ g_strfreev(webdata_tbl); - g_show_info_text(buf, NULL); + g_show_info_text(gc, NULL, FALSE, buf, NULL); g_free(buf); } diff -r f9227268db25 -r a0fd8f91e294 src/protocols/icq/gaim_icq.c --- a/src/protocols/icq/gaim_icq.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/icq/gaim_icq.c Tue Nov 20 01:01:22 2001 +0000 @@ -187,8 +187,11 @@ static void icq_info_reply(icq_Link *link, unsigned long uin, const char *nick, const char *first, const char *last, const char *email, char auth) { + struct gaim_connection *gc = link->icq_UserData; char buf[16 * 1024]; + char who[16]; + g_snprintf(who, sizeof who, "%lu", uin); g_snprintf(buf, sizeof buf, "UIN: %lu
" "Nick: %s
" @@ -198,7 +201,7 @@ nick, first, last, email); - g_show_info_text(buf, NULL); + g_show_info_text(gc, who, FALSE, buf, NULL); } static void icq_web_pager(icq_Link *link, unsigned char hour, unsigned char minute, diff -r f9227268db25 -r a0fd8f91e294 src/protocols/irc/irc.c --- a/src/protocols/irc/irc.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/irc/irc.c Tue Nov 20 01:01:22 2001 +0000 @@ -639,7 +639,7 @@ case 318: if (id->in_whois && id->whois_str) { GString *str = decode_html(id->whois_str->str); - g_show_info_text(str->str, NULL); + g_show_info_text(gc, NULL, FALSE, str->str, NULL); g_string_free(str, TRUE); g_string_free(id->whois_str, TRUE); id->whois_str = NULL; diff -r f9227268db25 -r a0fd8f91e294 src/protocols/jabber/jabber.c --- a/src/protocols/jabber/jabber.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/jabber/jabber.c Tue Nov 20 01:01:22 2001 +0000 @@ -926,6 +926,7 @@ } static void jabber_handlevcard(gjconn j, xmlnode querynode, char *from) { + struct gaim_connection *gc = GJ_GC(j); char buf[1024]; char *fn, *url, *email, *nickname, *status, *desc; jid who; @@ -960,7 +961,7 @@ if (desc) at += g_snprintf(buf + at, sizeof(buf) - at, "
%s
\n", desc); - g_show_info_text(buf, NULL); + g_show_info_text(gc, buddy, FALSE, buf, NULL); g_free(buddy); } diff -r f9227268db25 -r a0fd8f91e294 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/msn/msn.c Tue Nov 20 01:01:22 2001 +0000 @@ -669,12 +669,9 @@ static void msn_accept_add(gpointer w, struct msn_add_permit *map) { struct msn_data *md = map->gc->proto_data; - char *user; char buf[MSN_BUF_LEN]; - user = g_strdup(url_encode(map->user)); - g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, user, url_encode(map->friend)); - g_free(user); + g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, map->user, url_encode(map->friend)); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(map->gc, "Write error"); signoff(map->gc); @@ -1712,7 +1709,6 @@ if (l) return; - who = url_encode(who); g_snprintf(buf, sizeof(buf), "ADD %d FL %s %s\r\n", ++md->trId, who, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); @@ -1726,7 +1722,6 @@ struct msn_data *md = gc->proto_data; char buf[MSN_BUF_LEN]; - who = url_encode(who); g_snprintf(buf, sizeof(buf), "REM %d FL %s\r\n", ++md->trId, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); @@ -1838,7 +1833,6 @@ t = g_slist_append(t, who); continue; } - who = url_encode(who); g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); @@ -1866,7 +1860,6 @@ t = g_slist_append(t, who); continue; } - who = url_encode(who); g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); @@ -1898,7 +1891,6 @@ return; } - who = url_encode(who); g_snprintf(buf, sizeof(buf), "ADD %d AL %s %s\r\n", ++md->trId, who, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); @@ -1912,7 +1904,6 @@ struct msn_data *md = gc->proto_data; char buf[MSN_BUF_LEN]; - who = url_encode(who); g_snprintf(buf, sizeof(buf), "REM %d AL %s\r\n", ++md->trId, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); @@ -1933,7 +1924,6 @@ return; } - who = url_encode(who); g_snprintf(buf, sizeof(buf), "ADD %d BL %s %s\r\n", ++md->trId, who, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); @@ -1947,7 +1937,6 @@ struct msn_data *md = gc->proto_data; char buf[MSN_BUF_LEN]; - who = url_encode(who); g_snprintf(buf, sizeof(buf), "REM %d BL %s\r\n", ++md->trId, who); if (msn_write(md->fd, buf, strlen(buf)) < 0) { hide_login_progress(gc, "Write error"); diff -r f9227268db25 -r a0fd8f91e294 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/oscar/oscar.c Tue Nov 20 01:01:22 2001 +0000 @@ -1558,6 +1558,7 @@ char buf[BUF_LONG]; char legend[BUF_LONG]; struct gaim_connection *gc = sess->aux_data; + gboolean away; va_list ap; char *asc; @@ -1568,12 +1569,24 @@ infotype = (fu16_t)va_arg(ap, unsigned int); va_end(ap); + g_snprintf(legend, sizeof legend, + _("

Legend:

" + " : Normal AIM User
" + " : AOL User
" + " : Trial AIM User
" + " : Administrator")); + + away = infotype != AIM_GETINFO_GENERALINFO; + if (away && (!prof || !*prof)) { + g_show_info_text(gc, info->sn, away, legend, NULL); + return 1; + } + if (info->membersince) asc = g_strdup_printf("Member Since : %s
\n", asctime(localtime(&info->membersince))); else asc = g_strdup(""); - g_snprintf(buf, sizeof buf, _("Username : %s %s
\n" "%s" @@ -1585,24 +1598,18 @@ info->warnlevel/10, asctime(localtime(&info->onlinesince)), info->idletime); - g_snprintf(legend, sizeof legend, - _("

Legend:

" - " : Normal AIM User
" - " : AOL User
" - " : Trial AIM User
" - " : Administrator")); - g_show_info_text(buf, + g_free(asc); + + g_show_info_text(gc, info->sn, away, away ? "

" : buf, (prof && strlen(prof)) ? away_subs(prof, gc->username) : - (infotype == AIM_GETINFO_GENERALINFO ? - _("No Information Provided") : - _("User has no away message")), - legend, + away ? + _("User has no away message") : + _("No Information Provided"), + away ? legend : NULL, NULL); - g_free(asc); - return 1; } @@ -2047,14 +2054,17 @@ static int gaim_simpleinfo(aim_session_t *sess, aim_frame_t *fr, ...) { + struct gaim_connection *gc = sess->aux_data; va_list ap; struct aim_icq_simpleinfo *info; char buf[16 * 1024]; + char who[16]; va_start(ap, fr); info = va_arg(ap, struct aim_icq_simpleinfo *); va_end(ap); + g_snprintf(who, sizeof who, "%lu", info->uin); g_snprintf(buf, sizeof buf, "UIN: %lu
" "Nick: %s
" @@ -2065,7 +2075,7 @@ info->first, info->last, info->email); - g_show_info_text(buf, NULL); + g_show_info_text(gc, who, FALSE, buf, NULL); return 1; } @@ -2107,7 +2117,7 @@ at += g_snprintf(buf + at, len - at, "%s has the following screen names:
", address); for (i = 0; i < num; i++) at += g_snprintf(buf + at, len - at, "%s
", &SNs[i * (MAXSNLEN + 1)]); - g_show_info_text(buf, NULL); + g_show_info_text(NULL, NULL, FALSE, buf, NULL); g_free(buf); return 1; @@ -2261,7 +2271,8 @@ static void oscar_get_away_msg(struct gaim_connection *g, char *name) { struct oscar_data *odata = (struct oscar_data *)g->proto_data; - aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); + if (!odata->icq) + aim_getinfo(odata->sess, odata->conn, name, AIM_GETINFO_AWAYMESSAGE); } static void oscar_set_dir(struct gaim_connection *g, char *first, char *middle, char *last, @@ -2690,12 +2701,6 @@ pbm->gc = gc; m = g_list_append(m, pbm); - pbm = g_new0(struct proto_buddy_menu, 1); - pbm->label = _("Get Away Msg"); - pbm->callback = oscar_get_away_msg; - pbm->gc = gc; - m = g_list_append(m, pbm); - if (strcmp(n, normalize(who))) { pbm = g_new0(struct proto_buddy_menu, 1); pbm->label = _("Direct IM"); @@ -2908,6 +2913,7 @@ ret->set_info = oscar_set_info; ret->get_info = oscar_get_info; ret->set_away = oscar_set_away; + ret->get_away = oscar_get_away_msg; ret->set_dir = oscar_set_dir; ret->get_dir = NULL; /* Oscar really doesn't have this */ ret->dir_search = oscar_dir_search; diff -r f9227268db25 -r a0fd8f91e294 src/protocols/toc/toc.c --- a/src/protocols/toc/toc.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/toc/toc.c Tue Nov 20 01:01:22 2001 +0000 @@ -382,7 +382,7 @@ if (!url_text) return; - g_show_info_text(url_text, NULL); + g_show_info_text(NULL, NULL, FALSE, url_text, NULL); } static char *show_error_message() diff -r f9227268db25 -r a0fd8f91e294 src/protocols/zephyr/zephyr.c --- a/src/protocols/zephyr/zephyr.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/protocols/zephyr/zephyr.c Tue Nov 20 01:01:22 2001 +0000 @@ -349,7 +349,7 @@ g_string_sprintfa(str, "
At %s since %s", locs.host, locs.time); } - g_show_info_text(str->str, NULL); + g_show_info_text(NULL, NULL, FALSE, str->str, NULL); g_string_free(str, TRUE); } else serv_got_update(zgc, b->name, nlocs, 0, 0, 0, 0, 0); diff -r f9227268db25 -r a0fd8f91e294 src/prpl.h --- a/src/prpl.h Mon Nov 19 23:32:04 2001 +0000 +++ b/src/prpl.h Tue Nov 20 01:01:22 2001 +0000 @@ -106,6 +106,7 @@ void (* set_info) (struct gaim_connection *, char *info); void (* get_info) (struct gaim_connection *, char *who); void (* set_away) (struct gaim_connection *, char *state, char *message); + void (* get_away) (struct gaim_connection *, char *who); void (* set_dir) (struct gaim_connection *, char *first, char *middle, char *last, diff -r f9227268db25 -r a0fd8f91e294 src/server.c --- a/src/server.c Mon Nov 19 23:32:04 2001 +0000 +++ b/src/server.c Tue Nov 20 01:01:22 2001 +0000 @@ -162,6 +162,12 @@ g->prpl->get_info(g, name); } +void serv_get_away(struct gaim_connection *g, char *name) +{ + if (g && g->prpl && g->prpl->get_away) + g->prpl->get_away(g, name); +} + void serv_get_dir(struct gaim_connection *g, char *name) { if (g && g_slist_find(connections, g) && g->prpl && g->prpl->get_dir)