diff libfaim/aim_chat.c @ 338:9d258a0aa560

[gaim-migrate @ 348] Whoa, all kinds of things happened here. The applet looks better. The preferences dialog changes based on your compile-time options (oscar, gnome). Whispering works again. libfaim got updated; it can almost do RVOUS stuff, and hopefully soon can make requests too. The applet doesn't need to have its sounds go through GNOME, although it still can. There is code to facilitate SOCKS5 support (all that needs to be done is to actually write the code to communicate with the proxy server). committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Tue, 06 Jun 2000 09:55:30 +0000
parents 8cdc4ab449ec
children e4c34ca88d9b
line wrap: on
line diff
--- a/libfaim/aim_chat.c	Tue Jun 06 09:36:12 2000 +0000
+++ b/libfaim/aim_chat.c	Tue Jun 06 09:55:30 2000 +0000
@@ -19,20 +19,18 @@
 
 struct aim_conn_t *aim_chat_getconn(struct aim_session_t *sess, char *name)
 {
-  int i;
+  struct aim_conn_t *cur;
+  
+  faim_mutex_lock(&sess->connlistlock);
+  for (cur = sess->connlist; cur; cur = cur->next) {
+    if (cur->type != AIM_CONN_TYPE_CHAT)
+      continue;
+    if (strcmp((char *)cur->priv, name) == 0)
+      break;
+  }
+  faim_mutex_unlock(&sess->connlistlock);
 
-  for (i=0;i<AIM_CONN_MAX;i++)
-    {
-      if (sess->conns[i].type == AIM_CONN_TYPE_CHAT)
-	{
-	  if (sess->conns[i].priv)
-	    if (!strcmp((char *)sess->conns[i].priv, name))
-	      {
-		return &sess->conns[i];
-	      }
-	}
-    }
-  return NULL;
+  return cur;
 }
 
 int aim_chat_attachname(struct aim_conn_t *conn, char *roomname)
@@ -542,21 +540,14 @@
 
 int aim_chat_leaveroom(struct aim_session_t *sess, char *name)
 {
-  int i;
+  struct aim_conn_t *conn;
 
-  for (i=0;i<AIM_CONN_MAX;i++)
-    {
-      if (sess->conns[i].type == AIM_CONN_TYPE_CHAT)
-	{
-	  if (sess->conns[i].priv)
-	    if (!strcmp((char *)sess->conns[i].priv, name))
-	      {
-		aim_conn_close(&sess->conns[i]);
-		return 0;
-	      }
-	}
-    }
-  return -1;
+  if ((conn = aim_chat_getconn(sess, name)))
+    aim_conn_kill(sess, &conn);
+
+  if (!conn)
+    return -1;
+  return 0;
 }
 
 /*