Mercurial > pidgin.yaz
changeset 4476:62c1e5e656d0
[gaim-migrate @ 4751]
gaim_conversation_new() now takes an aim_user parameter. This should fix
the new placement grouping bugs, as the default "user" (account)
selected was the first account in the list of connections. There may be
side-effects, especially with perl plugins, but I'm not sure. Please report
anything odd that you see as a result of this.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Thu, 30 Jan 2003 18:45:50 +0000 |
parents | 1f3241831734 |
children | 2ea86ba4670b |
files | plugins/iconaway.c plugins/notify.c plugins/ticker/ticker.c src/away.c src/buddy.c src/conversation.c src/conversation.h src/dialogs.c src/gtkconv.c src/perl.c src/protocols/irc/irc.c src/protocols/oscar/oscar.c src/server.c src/util.c |
diffstat | 14 files changed, 104 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/iconaway.c Thu Jan 30 18:38:34 2003 +0000 +++ b/plugins/iconaway.c Thu Jan 30 18:45:50 2003 +0000 @@ -40,7 +40,7 @@ win = (struct gaim_window *)windows->data; - if (gaim_window_get_ui_ops(win) == gaim_get_gtk_window_ui_ops()) { + if (GAIM_IS_GTK_WINDOW(win)) { struct gaim_gtk_window *gtkwin; gtkwin = GAIM_GTK_WINDOW(win);
--- a/plugins/notify.c Thu Jan 30 18:38:34 2003 +0000 +++ b/plugins/notify.c Thu Jan 30 18:45:50 2003 +0000 @@ -562,7 +562,7 @@ } void gaim_plugin_remove() { - GList *c = gaim_get_ims(); + GList *c = gaim_get_conversations(); while (c) { struct gaim_conversation *cnv = (struct gaim_conversation *)c->data;
--- a/plugins/ticker/ticker.c Thu Jan 30 18:38:34 2003 +0000 +++ b/plugins/ticker/ticker.c Thu Jan 30 18:45:50 2003 +0000 @@ -121,7 +121,7 @@ ButtonPressCallback( GtkWidget *widget, GdkEvent *event, gpointer callback_data ) { TickerData *p = (TickerData *) callback_data; - gaim_conversation_new(GAIM_CONV_IM, p->buddy); + gaim_conversation_new(GAIM_CONV_IM, NULL, p->buddy); return TRUE; }
--- a/src/away.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/away.c Thu Jan 30 18:45:50 2003 +0000 @@ -72,13 +72,17 @@ struct queued_message *qm = templist->data; if (templist->data) { if (!g_strcasecmp(qm->name, name)) { + struct aim_user *user = NULL; + + if (g_slist_index(connections, qm->gc) >= 0) + user = qm->gc->user; + cnv = gaim_find_conversation(name); if (!cnv) - cnv = gaim_conversation_new(GAIM_CONV_IM, qm->name); - - if (g_slist_index(connections, qm->gc) >= 0) - gaim_conversation_set_user(cnv, qm->gc->user); + cnv = gaim_conversation_new(GAIM_CONV_IM, user, qm->name); + else + gaim_conversation_set_user(cnv, user); gaim_im_write(GAIM_IM(cnv), NULL, qm->message, qm->len, qm->flags, qm->tm); @@ -103,17 +107,22 @@ GSList *q = *queue; struct queued_message *qm; struct gaim_conversation *cnv; + struct aim_user *user; while (q) { qm = q->data; + user = NULL; + + if (g_slist_index(connections, qm->gc) >= 0) + user = qm->gc->user; + cnv = gaim_find_conversation(qm->name); if (!cnv) - cnv = gaim_conversation_new(GAIM_CONV_IM, qm->name); - - if (g_slist_index(connections, qm->gc) >= 0) - gaim_conversation_set_user(cnv, qm->gc->user); + cnv = gaim_conversation_new(GAIM_CONV_IM, user, qm->name); + else + gaim_conversation_set_user(cnv, user); gaim_im_write(GAIM_IM(cnv), NULL, qm->message, -1, qm->flags, qm->tm);
--- a/src/buddy.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/buddy.c Thu Jan 30 18:45:50 2003 +0000 @@ -440,13 +440,10 @@ c = gaim_find_conversation(b->name); - if (c != NULL) { + if (c != NULL) gaim_window_show(gaim_conversation_get_window(c)); - } else { - c = gaim_conversation_new(GAIM_CONV_IM, b->name); - - gaim_conversation_set_user(c, b->user); - } + else + c = gaim_conversation_new(GAIM_CONV_IM, b->user, b->name); } void pressed_im(GtkWidget *widget, struct buddy_show *b) @@ -458,12 +455,10 @@ if (c != NULL) { gaim_window_show(gaim_conversation_get_window(c)); } else { - struct gaim_connection *gc; - - gc = (struct gaim_connection *)b->connlist->data; - c = gaim_conversation_new(GAIM_CONV_IM, b->name); - - gaim_conversation_set_user(c, gc->user); + struct aim_user *user; + + user = ((struct gaim_connection *)b->connlist->data)->user; + c = gaim_conversation_new(GAIM_CONV_IM, user, b->name); } } @@ -500,9 +495,12 @@ { if (!b->connlist) return FALSE; + if (event->type == GDK_2BUTTON_PRESS && event->button == 1) { struct gaim_conversation *c; - struct gaim_connection *gc; + struct aim_user *user; + + user = ((struct gaim_connection *)b->connlist->data)->user; c = gaim_find_conversation(b->name); @@ -512,16 +510,17 @@ gaim_window_switch_conversation(win, index); gaim_window_show(win); + + gaim_conversation_set_user(c, user); } else - c = gaim_conversation_new(GAIM_CONV_IM, b->name); - - gc = (struct gaim_connection *)b->connlist->data; - gaim_conversation_set_user(c, gc->user); + c = gaim_conversation_new(GAIM_CONV_IM, user, b->name); gaim_window_switch_conversation(gaim_conversation_get_window(c), gaim_conversation_get_index(c)); + gaim_window_raise(gaim_conversation_get_window(c)); + /* XXX-GTK gtk_widget_grab_focus(c->entry); */ } else if (event->type == GDK_BUTTON_PRESS && event->button == 3) { static GtkWidget *menu = NULL; @@ -1292,15 +1291,16 @@ if (!b->name) return; + user = ((struct gaim_connection *)b->connlist->data)->user; + c = gaim_find_conversation(b->name); if (c == NULL) - c = gaim_conversation_new(GAIM_CONV_IM, b->name); - else + c = gaim_conversation_new(GAIM_CONV_IM, user, b->name); + else { + gaim_conversation_set_user(c, user); gaim_window_raise(gaim_conversation_get_window(c)); - - user = ((struct gaim_connection *)b->connlist->data)->user; - gaim_conversation_set_user(c, user); + } } static void info_callback(GtkWidget *widget, GtkTree *tree) @@ -1398,9 +1398,9 @@ c = gaim_find_conversation(name); if (c == NULL) - c = gaim_conversation_new(GAIM_CONV_IM, name); - - gaim_conversation_set_user(c, u); + c = gaim_conversation_new(GAIM_CONV_IM, u, name); + else + gaim_conversation_set_user(c, u); } if (b->options & OPT_POUNCE_NOTIFY) { char tmp[1024]; @@ -1421,9 +1421,9 @@ c = gaim_find_conversation(name); if (c == NULL) - c = gaim_conversation_new(GAIM_CONV_IM, name); - - gaim_conversation_set_user(c, u); + c = gaim_conversation_new(GAIM_CONV_IM, u, name); + else + gaim_conversation_set_user(c, u); gaim_conversation_write(c, NULL, b->message, -1, WFLAG_SEND, time(NULL));
--- a/src/conversation.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/conversation.c Thu Jan 30 18:45:50 2003 +0000 @@ -841,7 +841,8 @@ * Conversation API **************************************************************************/ struct gaim_conversation * -gaim_conversation_new(GaimConversationType type, const char *name) +gaim_conversation_new(GaimConversationType type, struct aim_user *user, + const char *name) { struct gaim_conversation *conv; @@ -849,12 +850,13 @@ return NULL; /* Check if this conversation already exists. */ - if ((conv = gaim_find_conversation(name)) != NULL) + if ((conv = gaim_find_conversation_with_user(name, user)) != NULL) return conv; conv = g_malloc0(sizeof(struct gaim_conversation)); conv->type = type; + conv->user = user; conv->name = g_strdup(name); conv->title = g_strdup(name); conv->send_history = g_list_append(NULL, NULL); @@ -882,12 +884,6 @@ conversations = g_list_append(conversations, conv); - /* Set the gc */ - if (connections != NULL) { - gaim_conversation_set_user(conv, - ((struct gaim_connection *)connections->data)->user); - } - /* Auto-set the title. */ gaim_conversation_autoset_title(conv); @@ -1329,7 +1325,7 @@ char *cuser; GList *cnv; - if (name == NULL || user == NULL) + if (name == NULL) return NULL; cuser = g_strdup(normalize(name));
--- a/src/conversation.h Thu Jan 30 18:38:34 2003 +0000 +++ b/src/conversation.h Thu Jan 30 18:45:50 2003 +0000 @@ -419,11 +419,14 @@ * Creates a new conversation of the specified type. * * @param type The type of conversation. + * @param user The account opening the conversation window on the gaim + * user's end. * @param name The name of the conversation. * * @return The new conversation. */ struct gaim_conversation *gaim_conversation_new(GaimConversationType type, + struct aim_user *user, const char *name); /**
--- a/src/dialogs.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/dialogs.c Thu Jan 30 18:45:50 2003 +0000 @@ -561,24 +561,28 @@ { const char *who; struct gaim_conversation *conv; + struct aim_user *user; if (resp == GTK_RESPONSE_OK) { who = gtk_entry_get_text(GTK_ENTRY(info->entry)); - + if (!g_strcasecmp(who, "")) { g_free(info); return; } + user = (info->gc ? info->gc->user : NULL); + conv = gaim_find_conversation(who); if (conv == NULL) - conv = gaim_conversation_new(GAIM_CONV_IM, who); - else + conv = gaim_conversation_new(GAIM_CONV_IM, user, who); + else { gaim_window_raise(gaim_conversation_get_window(conv)); - if (info->gc) - gaim_conversation_set_user(conv, info->gc->user); + if (user) + gaim_conversation_set_user(conv, info->gc->user); + } } destroy_dialog(NULL, imdialog);
--- a/src/gtkconv.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/gtkconv.c Thu Jan 30 18:45:50 2003 +0000 @@ -530,6 +530,7 @@ struct gaim_conversation *conv2; struct gaim_gtk_conversation *gtkconv; struct gaim_gtk_chat_pane *gtkchat; + struct aim_user *user; GtkTreeIter iter; GtkTreeModel *model; GtkTreeSelection *sel; @@ -549,14 +550,16 @@ if (*name == '@') name++; if (*name == '+') name++; + user = gaim_conversation_get_user(conv); + conv2 = gaim_find_conversation(name); - if (conv2 != NULL) + if (conv2 != NULL) { gaim_window_raise(gaim_conversation_get_window(conv2)); + gaim_conversation_set_user(conv2, user); + } else - conv2 = gaim_conversation_new(GAIM_CONV_IM, name); - - gaim_conversation_set_user(conv2, gaim_conversation_get_user(conv)); + conv2 = gaim_conversation_new(GAIM_CONV_IM, user, name); } static void @@ -600,17 +603,18 @@ { const char *who; struct gaim_conversation *conv2; + struct aim_user *user; who = g_object_get_data(G_OBJECT(w), "user_data"); + user = gaim_conversation_get_user(conv); + conv2 = gaim_find_conversation(who); if (conv2 != NULL) gaim_window_show(gaim_conversation_get_window(conv2)); - else { - conv2 = gaim_conversation_new(GAIM_CONV_IM, who); - gaim_conversation_set_user(conv2, gaim_conversation_get_user(conv)); - } + else + conv2 = gaim_conversation_new(GAIM_CONV_IM, user, who); } static void @@ -710,9 +714,9 @@ struct gaim_conversation *c; if ((c = gaim_find_conversation(who)) == NULL) - c = gaim_conversation_new(GAIM_CONV_IM, who); - - gaim_conversation_set_user(c, user); + c = gaim_conversation_new(GAIM_CONV_IM, user, who); + else + gaim_conversation_set_user(c, user); } else if (event->button == 3 && event->type == GDK_BUTTON_PRESS) { static GtkWidget *menu = NULL;
--- a/src/perl.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/perl.c Thu Jan 30 18:45:50 2003 +0000 @@ -781,12 +781,12 @@ case 2: wflags=WFLAG_SYSTEM; break; default: wflags=WFLAG_RECV; } - + c = gaim_find_conversation(nick); if (!c) - c = gaim_conversation_new(GAIM_CONV_IM, nick); - + c = gaim_conversation_new(GAIM_CONV_IM, NULL, nick); + gaim_conversation_write(c, who, what, -1, wflags, time(NULL)); XSRETURN(0); } @@ -831,10 +831,14 @@ XSRETURN(0); return; } + c = gaim_find_conversation(nick); + if (!c) - c = gaim_conversation_new(GAIM_CONV_IM, nick); - gaim_conversation_set_user(c, gc->user); + c = gaim_conversation_new(GAIM_CONV_IM, gc->user, nick); + else + gaim_conversation_set_user(c, gc->user); + gaim_conversation_write(c, NULL, what, -1, (WFLAG_SEND | (isauto ? WFLAG_AUTO : 0)), time(NULL));
--- a/src/protocols/irc/irc.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/protocols/irc/irc.c Thu Jan 30 18:45:50 2003 +0000 @@ -505,7 +505,8 @@ else { g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"), chat->nick); - convo = gaim_conversation_new(GAIM_CONV_IM, chat->nick); + convo = gaim_conversation_new(GAIM_CONV_IM, chat->gc->user, + chat->nick); gaim_conversation_write(convo, NULL, buf, -1, WFLAG_SYSTEM, time(NULL)); dcc_chat_cancel (chat); @@ -567,7 +568,7 @@ struct gaim_conversation *convo; char buf[IRC_BUF_LEN]; - convo = gaim_conversation_new(GAIM_CONV_IM, chat->nick); + convo = gaim_conversation_new(GAIM_CONV_IM, chat->gc->user, chat->nick); chat->fd = source; g_snprintf (buf, sizeof buf, @@ -2377,7 +2378,8 @@ chat->fd = accept (chat->fd, (struct sockaddr *) (&addr), &addrlen); if (!chat->fd) { dcc_chat_cancel (chat); - convo = gaim_conversation_new(GAIM_CONV_IM, chat->nick); + convo = gaim_conversation_new(GAIM_CONV_IM, chat->gc->user, + chat->nick); g_snprintf (buf, sizeof buf, _("DCC Chat with %s closed"), chat->nick); gaim_conversation_write(convo, NULL, buf, -1, @@ -2386,7 +2388,7 @@ } chat->inpa = gaim_input_add (chat->fd, GAIM_INPUT_READ, dcc_chat_in, chat); - convo = gaim_conversation_new(GAIM_CONV_IM, chat->nick); + convo = gaim_conversation_new(GAIM_CONV_IM, chat->gc->user, chat->nick); g_snprintf (buf, sizeof buf, _("DCC Chat with %s established"), chat->nick); gaim_conversation_write(convo, NULL, buf, -1, WFLAG_SYSTEM, time(NULL));
--- a/src/protocols/oscar/oscar.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/protocols/oscar/oscar.c Thu Jan 30 18:45:50 2003 +0000 @@ -1510,7 +1510,7 @@ dim->conn->fd = source; aim_conn_completeconnect(od->sess, dim->conn); if (!(cnv = gaim_find_conversation(dim->name))) - cnv = gaim_conversation_new(GAIM_CONV_IM, dim->name); + cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->user, dim->name); /* This is the best way to see if we're connected or not */ if (getpeername(source, &name, &name_len) == 0) { @@ -4758,7 +4758,7 @@ dim = find_direct_im(od, sn); if (!(cnv = gaim_find_conversation(sn))) - cnv = gaim_conversation_new(GAIM_CONV_IM, sn); + cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->user, sn); gaim_input_remove(dim->watcher); dim->conn = newconn; dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
--- a/src/server.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/server.c Thu Jan 30 18:45:50 2003 +0000 @@ -733,10 +733,8 @@ * the receive sound (sound.c will take care of not playing * while away), and then write it to the convo window. */ - if (cnv == NULL) { - cnv = gaim_conversation_new(GAIM_CONV_IM, name); - gaim_conversation_set_user(cnv, gc->user); - } + if (cnv == NULL) + cnv = gaim_conversation_new(GAIM_CONV_IM, gc->user, name); gaim_im_write(GAIM_IM(cnv), NULL, message, len, away | WFLAG_RECV, mtime); @@ -827,10 +825,8 @@ qm->len = len; unread_message_queue = g_slist_append(unread_message_queue, qm); } else { - if (cnv == NULL) { - cnv = gaim_conversation_new(GAIM_CONV_IM, name); - gaim_conversation_set_user(cnv, gc->user); - } + if (cnv == NULL) + cnv = gaim_conversation_new(GAIM_CONV_IM, gc->user, name); /* CONV XXX gaim_conversation_set_name(cnv, name); */ @@ -1078,14 +1074,13 @@ struct gaim_conversation *b; struct gaim_chat *chat; - b = gaim_conversation_new(GAIM_CONV_CHAT, name); + b = gaim_conversation_new(GAIM_CONV_CHAT, gc->user, name); chat = GAIM_CHAT(b); gc->buddy_chats = g_slist_append(gc->buddy_chats, b); gaim_chat_set_id(chat, id); - gaim_conversation_set_user(b, gc->user); - + if ((logging_options & OPT_LOG_CHATS) || find_log_info(gaim_conversation_get_name(b))) {
--- a/src/util.c Thu Jan 30 18:38:34 2003 +0000 +++ b/src/util.c Thu Jan 30 18:45:50 2003 +0000 @@ -1000,8 +1000,7 @@ g_string_free(str, TRUE); } - c = gaim_conversation_new(GAIM_CONV_IM, who); - gaim_conversation_set_user(c, gc->user); + c = gaim_conversation_new(GAIM_CONV_IM, gc->user, who); g_free(who); if (what) {