changeset 6640:314111e7b601

[gaim-migrate @ 7165] Changed several calls from gaim_find_conversation() to gaim_find_conversation_with_account(). committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Thu, 28 Aug 2003 01:18:50 +0000
parents 1b91cb6be4c3
children c3a50a8ba85e
files src/away.c src/blist.c src/conversation.c src/dialogs.c src/gtkconv.c src/gtkpounce.c src/protocols/jabber/jabber.c src/protocols/msn/switchboard.c src/protocols/oscar/oscar.c src/prpl.c src/server.c
diffstat 11 files changed, 43 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/src/away.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/away.c	Thu Aug 28 01:18:50 2003 +0000
@@ -70,7 +70,7 @@
 				if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0)
 					account = qm->account;
 
-				cnv = gaim_find_conversation(name);
+				cnv = gaim_find_conversation_with_account(name, account);
 
 				if (!cnv)
 					cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name);
@@ -88,7 +88,7 @@
 			}
 		}
 	}
-	
+
 	g_free(name);
 	/* In GTK 2.2, _store_remove actually returns whether iter is valid or not
 	 * after the remove, but in GTK 2.0 it is a void function. */
@@ -110,7 +110,7 @@
 		if (g_list_index(gaim_accounts_get_all(), qm->account) >= 0)
 			account = qm->account;
 
-		cnv = gaim_find_conversation(qm->name);
+		cnv = gaim_find_conversation_with_account(qm->name, account);
 
 		if (!cnv)
 			cnv = gaim_conversation_new(GAIM_CONV_IM, account, qm->name);
--- a/src/blist.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/blist.c	Thu Aug 28 01:18:50 2003 +0000
@@ -170,7 +170,9 @@
 
 static gboolean presence_update_timeout_cb(struct buddy *buddy) {
 	struct gaim_blist_ui_ops *ops = gaimbuddylist->ui_ops;
-	GaimConversation *conv = gaim_find_conversation(buddy->name);
+	GaimConversation *conv;
+
+	conv = gaim_find_conversation_with_account(buddy->name, buddy->account);
 
 	if(buddy->present == GAIM_BUDDY_SIGNING_ON) {
 		buddy->present = GAIM_BUDDY_ONLINE;
--- a/src/conversation.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/conversation.c	Thu Aug 28 01:18:50 2003 +0000
@@ -137,11 +137,10 @@
 static gboolean
 reset_typing(gpointer data)
 {
-	char *name = (char *)data;
-	GaimConversation *c = gaim_find_conversation(name);
+	GaimConversation *c = (GaimConversation *)data;
 	GaimIm *im;
 
-	if (!c)
+	if (!g_list_find(conversations, c))
 		return FALSE;
 
 	im = GAIM_IM(c);
@@ -1604,7 +1603,7 @@
 	name = gaim_conversation_get_name(conv);
 
 	im->typing_timeout = g_timeout_add_full(G_PRIORITY_DEFAULT_IDLE,
-		timeout * 1000, reset_typing, g_strdup(name), g_free);
+		timeout * 1000, reset_typing, conv, NULL);
 }
 
 void
--- a/src/dialogs.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/dialogs.c	Thu Aug 28 01:18:50 2003 +0000
@@ -325,7 +325,7 @@
 	GtkWidget *hbox, *vbox;
 	GtkWidget *label;
 	GtkWidget *img = gtk_image_new_from_stock(GAIM_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
-	GaimConversation *c = gaim_find_conversation(who);
+	GaimConversation *c = gaim_find_conversation_with_account(who, gc->account);
 
 	struct warning *w = g_new0(struct warning, 1);
 	w->who = who;
@@ -392,12 +392,14 @@
 	struct group *g;
 	GaimConversation *c;
 	gchar *name;
+	GaimAccount *account;
 
 	if (!b)
 		return;
 
 	g = gaim_find_buddys_group(b);
-	name = g_strdup(b->name); /* b->name is null after remove_buddy */
+	name = g_strdup(b->name); /* b->name is a crasher after remove_buddy */
+	account = b->account;
 
 	gaim_debug(GAIM_DEBUG_INFO, "blist",
 			   "Removing '%s' from buddy list.\n", b->name);
@@ -405,7 +407,7 @@
 	gaim_blist_remove_buddy(b);
 	gaim_blist_save();
 
-	c = gaim_find_conversation(name);
+	c = gaim_find_conversation_with_account(name, account);
 
 	if (c != NULL)
 		gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE);
@@ -419,7 +421,7 @@
 	while (b) {
 		if(GAIM_BLIST_NODE_IS_BUDDY(b)) {
 			struct buddy *bd = (struct buddy *)b;
-			GaimConversation *c = gaim_find_conversation(bd->name);
+			GaimConversation *c = gaim_find_conversation_with_account(bd->name, bd->account);
 			if (gaim_account_is_connected(bd->account)) {
 				serv_remove_buddy(bd->account->gc, bd->name, g->name);
 				gaim_blist_remove_buddy(bd);
@@ -498,15 +500,12 @@
 
 		account = (info->gc ? info->gc->account : NULL);
 
-		conv = gaim_find_conversation(who);
+		conv = gaim_find_conversation_with_account(who, account);
 
 		if (conv == NULL)
 			conv = gaim_conversation_new(GAIM_CONV_IM, account, who);
 		else {
 			gaim_window_raise(gaim_conversation_get_window(conv));
-
-			if (account)
-				gaim_conversation_set_account(conv, account);
 		}
 	}
 
@@ -791,7 +790,7 @@
 		grp = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(a->combo)->entry));
 		whoalias = gtk_entry_get_text(GTK_ENTRY(a->entry_for_alias));
 
-		c = gaim_find_conversation(who);
+		c = gaim_find_conversation_with_account(who, a->gc->account);
 		if (!(g = gaim_find_group(grp))) {
 			g = gaim_group_new(grp);
 			gaim_blist_add_group(g, NULL);
--- a/src/gtkconv.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/gtkconv.c	Thu Aug 28 01:18:50 2003 +0000
@@ -878,12 +878,10 @@
 
 	account = gaim_conversation_get_account(conv);
 
-	conv2 = gaim_find_conversation(name);
-
-	if (conv2 != NULL) {
+	conv2 = gaim_find_conversation_with_account(name, account);
+
+	if (conv2 != NULL)
 		gaim_window_raise(gaim_conversation_get_window(conv2));
-		gaim_conversation_set_account(conv2, account);
-	}
 	else
 		conv2 = gaim_conversation_new(GAIM_CONV_IM, account, name);
 }
@@ -935,7 +933,7 @@
 
 	account = gaim_conversation_get_account(conv);
 
-	conv2 = gaim_find_conversation(who);
+	conv2 = gaim_find_conversation_with_account(who, account);
 
 	if (conv2 != NULL)
 		gaim_window_show(gaim_conversation_get_window(conv2));
@@ -1053,7 +1051,7 @@
 	if (event->button == 1 && event->type == GDK_2BUTTON_PRESS) {
 		GaimConversation *c;
 
-		if ((c = gaim_find_conversation(who)) == NULL)
+		if ((c = gaim_find_conversation_with_account(who, account)) == NULL)
 			c = gaim_conversation_new(GAIM_CONV_IM, account, who);
 		else
 			gaim_conversation_set_account(c, account);
--- a/src/gtkpounce.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/gtkpounce.c	Thu Aug 28 01:18:50 2003 +0000
@@ -822,7 +822,7 @@
 	account = gaim_pounce_get_pouncer(pounce);
 
 	if (gaim_pounce_action_is_enabled(pounce, "open-window")) {
-		conv = gaim_find_conversation(pouncee);
+		conv = gaim_find_conversation_with_account(pouncee, account);
 
 		if (conv == NULL)
 			conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
@@ -853,7 +853,7 @@
 												   "message");
 
 		if (message != NULL) {
-			conv = gaim_find_conversation(pouncee);
+			conv = gaim_find_conversation_with_account(pouncee, account);
 
 			if (conv == NULL)
 				conv = gaim_conversation_new(GAIM_CONV_IM, account, pouncee);
--- a/src/protocols/jabber/jabber.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/protocols/jabber/jabber.c	Thu Aug 28 01:18:50 2003 +0000
@@ -1388,7 +1388,7 @@
 					jri->has_xhtml = has_xhtml;
 				}
 				jabber_track_convo_thread(gjc, from, thread_id);
-				if (gaim_find_conversation(from))
+				if (gaim_find_conversation_with_account(from, GJ_GC(gjc)->account))
 					serv_got_im(GJ_GC(gjc), from, m, flags,
 						time_sent, -1);
 				else {
--- a/src/protocols/msn/switchboard.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/protocols/msn/switchboard.c	Thu Aug 28 01:18:50 2003 +0000
@@ -93,7 +93,8 @@
 bye_cmd(MsnServConn *servconn, const char *command, const char **params,
 		 size_t param_count)
 {
-	GaimConnection *gc = servconn->session->account->gc;
+	GaimAccount *account = servconn->session->account;
+	GaimConnection *gc = account->gc;
 	MsnSwitchBoard *swboard = servconn->data;
 	const char *user = params[0];
 
@@ -108,7 +109,7 @@
 		struct buddy *b;
 		char buf[MSN_BUF_LEN];
 
-		if ((b = gaim_find_buddy(gc->account, user)) != NULL)
+		if ((b = gaim_find_buddy(account, user)) != NULL)
 			username = gaim_get_buddy_alias(b);
 		else
 			username = user;
@@ -130,7 +131,7 @@
 			}
 		}
 
-		if (*buf != '\0' && (conv = gaim_find_conversation(user)) != NULL) {
+		if (*buf != '\0' && (conv = gaim_find_conversation_with_account(user, account)) != NULL) {
 			gaim_conversation_write(conv, NULL, buf, -1, GAIM_MESSAGE_SYSTEM,
 									time(NULL));
 		}
@@ -157,7 +158,7 @@
 		if (swboard->chat == NULL) {
 			GaimConversation *conv;
 
-			conv = gaim_find_conversation(msn_user_get_passport(swboard->user));
+			conv = gaim_find_conversation_with_account(msn_user_get_passport(swboard->user), account);
 
 			swboard->chat = serv_got_joined_chat(gc, ++swboard->chat_id,
 												 "MSN Chat");
@@ -188,7 +189,7 @@
 	if (swboard->total_users == 2 && swboard->chat == NULL) {
 		GaimConversation *conv;
 
-		conv = gaim_find_conversation(msn_user_get_passport(swboard->user));
+		conv = gaim_find_conversation_with_account(msn_user_get_passport(swboard->user), account);
 
 		swboard->chat = serv_got_joined_chat(gc, ++swboard->chat_id,
 											 "MSN Chat");
--- a/src/protocols/oscar/oscar.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Aug 28 01:18:50 2003 +0000
@@ -475,8 +475,9 @@
 		g_snprintf(buf, sizeof buf, _("Direct IM with %s closed"), sn);
 	else 
 		g_snprintf(buf, sizeof buf, _("Direct IM with %s failed"), sn);
-		
-	if ((cnv = gaim_find_conversation(sn)))
+
+	cnv = gaim_find_conversation_with_account(sn, gaim_connection_get_account(gc));
+	if (cnv)
 		gaim_conversation_write(cnv, NULL, buf, -1, GAIM_MESSAGE_SYSTEM, time(NULL));
 
 	gaim_conversation_update_progress(cnv, 0);
@@ -1905,8 +1906,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->gc->account, dim->name);
+	cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, dim->name);
 
 	/* This is the best way to see if we're connected or not */
 	if (getpeername(source, &name, &name_len) == 0) {
@@ -5583,8 +5583,7 @@
 			   "DirectIM: initiate success to %s\n", sn);
 	dim = find_direct_im(od, sn);
 
-	if (!(cnv = gaim_find_conversation(sn)))
-		cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn);
+	cnv = gaim_conversation_new(GAIM_CONV_IM, dim->gc->account, sn);
 	gaim_input_remove(dim->watcher);
 	dim->conn = newconn;
 	dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ, oscar_callback, dim->conn);
@@ -5622,9 +5621,8 @@
 	}
 	while (gtk_events_pending())
 		gtk_main_iteration();
-	
-	if ((c = gaim_find_conversation(sn)))
-		gaim_conversation_update_progress(c, percent);
+
+	gaim_conversation_update_progress(c, percent);
 	dim->watcher = gaim_input_add(dim->conn->fd, GAIM_INPUT_READ,
 				      oscar_callback, dim->conn);
 
--- a/src/prpl.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/prpl.c	Thu Aug 28 01:18:50 2003 +0000
@@ -168,7 +168,7 @@
 	id->len = len;
 
 	/* Update the buddy icon for this user. */
-	conv = gaim_find_conversation(realwho);
+	conv = gaim_find_conversation_with_account(realwho, gc->account);
 
 	/* XXX Buddy Icon should probalby be part of struct buddy instead of this weird global
 	 * linked list stuff. */
--- a/src/server.c	Wed Aug 27 23:03:03 2003 +0000
+++ b/src/server.c	Thu Aug 28 01:18:50 2003 +0000
@@ -267,7 +267,7 @@
 	if (gc != NULL && gc->prpl != NULL)
 		prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl);
 
-	c = gaim_find_conversation(name);
+	c = gaim_find_conversation_with_account(name, gc->account);
 
 	if (prpl_info && prpl_info->send_im)
 		val = prpl_info->send_im(gc, name, message, len, imflags);
@@ -1037,7 +1037,7 @@
 		 */
 		if (docklet_count &&
 		    gaim_prefs_get_bool("/plugins/gtk/docklet/queue_messages") &&
-		    !gaim_find_conversation(name)) {
+		    !gaim_find_conversation_with_account(name, gc->account)) {
 			/*
 			 * We're gonna queue it up and wait for the user to ask for
 			 * it... probably by clicking the docklet or windows tray icon.
@@ -1234,7 +1234,7 @@
 					 GaimTypingState state) {
 
 	struct buddy *b;
-	GaimConversation *cnv = gaim_find_conversation(name);
+	GaimConversation *cnv = gaim_find_conversation_with_account(name, gc->account);
 	GaimIm *im;
 
 	if (!cnv)
@@ -1263,7 +1263,7 @@
 
 void serv_got_typing_stopped(GaimConnection *gc, const char *name) {
 
-	GaimConversation *c = gaim_find_conversation(name);
+	GaimConversation *c = gaim_find_conversation_with_account(name, gc->account);
 	GaimIm *im;
 	struct buddy *b;