changeset 1999:591ebfe8ec00

[gaim-migrate @ 2009] can be in two rooms of the same name committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 12 Jun 2001 07:57:27 +0000
parents 00dc6b2df5b6
children ae11844fa2b1
files src/oscar.c
diffstat 1 files changed, 7 insertions(+), 46 deletions(-) [+]
line wrap: on
line diff
--- a/src/oscar.c	Tue Jun 12 05:14:56 2001 +0000
+++ b/src/oscar.c	Tue Jun 12 07:57:27 2001 +0000
@@ -102,6 +102,7 @@
 	int inpa;
 	int id;
 	struct gaim_connection *gc; /* i hate this. */
+	struct conversation *cnv; /* bah. */
 	gpointer priv; /* don't ask. */
 };
 
@@ -984,7 +985,7 @@
 		aim_chat_clientready(sess, command->conn);
 		chatcon = find_oscar_chat_by_conn(gc, command->conn);
 		chatcon->id = id;
-		serv_got_joined_chat(gc, id++, chatcon->show);
+		chatcon->cnv = serv_got_joined_chat(gc, id++, chatcon->show);
 		break;
 	case AIM_CONN_TYPE_RENDEZVOUS:
 		break;
@@ -2158,8 +2159,6 @@
 	struct aim_userinfo_s *info;
 	struct gaim_connection *g = sess->aux_data;
 
-	GSList *bcs = g->buddy_chats;
-	struct conversation *b = NULL;
 	struct chat_connection *c = NULL;
 
 	va_start(ap, command);
@@ -2171,18 +2170,8 @@
 	if (!c)
 		return 1;
 
-	while (bcs) {
-		b = (struct conversation *)bcs->data;
-		if (!strcasecmp(b->name, c->show))
-			break;	
-		bcs = bcs->next;
-		b = NULL;
-	}
-	if (!b)
-		return 1;
-		
 	while (i < count)
-		add_chat_buddy(b, info[i++].sn);
+		add_chat_buddy(c->cnv, info[i++].sn);
 
 	return 1;
 }
@@ -2194,8 +2183,6 @@
 	struct aim_userinfo_s *info;
 	struct gaim_connection *g = sess->aux_data;
 
-	GSList *bcs = g->buddy_chats;
-	struct conversation *b = NULL;
 	struct chat_connection *c = NULL;
 
 	va_start(ap, command);
@@ -2207,18 +2194,8 @@
 	if (!c)
 		return 1;
 
-	while (bcs) {
-		b = (struct conversation *)bcs->data;
-		if (!strcasecmp(b->name, c->show))
-			break;	
-		bcs = bcs->next;
-		b = NULL;
-	}
-	if (!b)
-		return 1;
-		
 	while (i < count)
-		remove_chat_buddy(b, info[i++].sn);
+		remove_chat_buddy(c->cnv, info[i++].sn);
 
 	return 1;
 }
@@ -2235,32 +2212,16 @@
 	struct aim_userinfo_s *info;
 	char *msg;
 	struct gaim_connection *gc = sess->aux_data;
+	struct chat_connection *ccon = find_oscar_chat_by_conn(gc, command->conn);
 	char *tmp;
 
-	GSList *bcs = gc->buddy_chats;
-	struct conversation *b = NULL;
-
 	va_start(ap, command);
 	info = va_arg(ap, struct aim_userinfo_s *);
 	msg  = va_arg(ap, char *);
 
-	while(bcs) {
-		b = (struct conversation *)bcs->data;
-		tmp = extract_name(command->conn->priv);
-		if (!strcasecmp(b->name, tmp)) {
-			g_free(tmp);
-			break;
-		}
-		g_free(tmp);
-		bcs = bcs->next;
-		b = NULL;
-	}
-	if (!b)
-		return 0;
-
 	tmp = g_malloc(BUF_LONG);
 	g_snprintf(tmp, BUF_LONG, "%s", msg);
-	serv_got_chat_in(gc, b->id, info->sn, 0, tmp, time((time_t)NULL));
+	serv_got_chat_in(gc, ccon->id, info->sn, 0, tmp, time((time_t)NULL));
 	g_free(tmp);
 
 	return 1;
@@ -2790,7 +2751,7 @@
 	bcs = odata->oscar_chats;
 	while (bcs) {
 		c = (struct chat_connection *)bcs->data;
-		if (!strcmp(b->name, c->show))
+		if (b == c->cnv)
 			break;
 		bcs = bcs->next;
 		c = NULL;