changeset 248:cfc73b8501a7

[gaim-migrate @ 258] Oscar chat is there now. Adam will be happy, that's the only thing he asked me specifically about. committer: Tailor Script <tailor@pidgin.im>
author Eric Warmenhoven <eric@warmenhoven.org>
date Sun, 21 May 2000 11:58:18 +0000
parents f6e8ea29b24f
children 810c595258c8
files libfaim/CHANGES.gaim libfaim/README.gaim libfaim/aim_login.c src/oscar.c src/server.c
diffstat 5 files changed, 157 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/libfaim/CHANGES.gaim	Sat May 20 23:00:20 2000 +0000
+++ b/libfaim/CHANGES.gaim	Sun May 21 11:58:18 2000 +0000
@@ -1,3 +1,8 @@
+
+Sun May 21 11:42:22 UTC 2000 EWarmenhoven
+	- There were small changes to the libfaim code, which I updated
+	- Went ahead and implemented chat (since I said I wouldn't touch it
+	  until libfaim got updated again)
 
 Sat May 20 22:42:24 UTC 2000 EWarmenhoven
 	- Getting a user's info now displays the familiar dialog window
--- a/libfaim/README.gaim	Sat May 20 23:00:20 2000 +0000
+++ b/libfaim/README.gaim	Sun May 21 11:58:18 2000 +0000
@@ -4,8 +4,7 @@
 I'm going to start trying to get gaim to use Oscar through libfaim. As far as I
 can tell, the only thing it used to be able to do is sign on and receive IMs. I
 updated libfaim to what's currently in the libfaim CVS on sourceforge. As of
-right now, I haven't even gotten it to sign on, but theoretically it can receive
-IMs.
+right now, I've been able to implement most of the features libfaim offers.
 
 I'm going to try to make as few modifications as possible to the libfaim code.
 The only two modifications I'll probably ever make to it are 1) to make my life
@@ -27,17 +26,40 @@
 Setting your info
 Getting other users' info
 Telling the server who's on your permit/deny lists (buggy)
+Chat:
+ - joining rooms
+ - leaving rooms
+ - talking
 
 CURRENTLY UNSUPPORTED FEATURES
 ==============================
-Warning users (libfaim's problem)
-Chat (gaim's problem)
-Getting users' away messages (libfaim's problem? doesn't work with TOC either)
-Getting/setting dir info (libfaim's problem?)
-Changing your password (gaim's problem?)
-File transfer/IM images/voice chat/etc. (gaim's problem?)
+Warning users/getting warned
+Chat:
+ - whispering
+ - refreshing the chatlist in the preferences dialog
+ - invitations (both to and from you)
+Getting users' away messages
+Getting/setting dir info
+Changing your password
+File transfer/IM images/voice chat/etc.
 
-(If I assigned problems incorrectly, sorry.)
+KNOWN ISSUES
+============
+- libfaim apparently has a problem with receiving messages to fast (sort of). If
+someone sends you a message "too fast", the server says "slow down" basically,
+and lets you know that a message was dropped. The time interval between messages
+seems to be much longer with libfaim than with TOC (i.e. you can receive more
+messages in less time with TOC than with libfaim). The outgoing limit seems to
+be about the same. So if all your friends are slow typists, this shouldn't be a
+problem.
+
+- Signing on every once in a while acts really bizarrely for me. Maybe it's just
+me.
+
+- Adding or removing people to your permit/deny lists causes the server to tell
+you everyone on your buddy list signed off and then immediately signed in again.
+While you won't ever see that it happens (other than everyone will suddenly have
+the guy-in-the-door icon), you'll hear it. Be warned.
 
 HOW TO HELP
 ===========
--- a/libfaim/aim_login.c	Sat May 20 23:00:20 2000 +0000
+++ b/libfaim/aim_login.c	Sun May 21 11:58:18 2000 +0000
@@ -322,7 +322,7 @@
   struct command_tx_struct *tx;
   struct aim_tlvlist_t *tlvlist = NULL;
 
-  if (!(tx = aim_tx_new(0x0001 /*right??*/, conn, 1152)))
+  if (!(tx = aim_tx_new(0x0004, conn, 1152)))
     return -1;
   
   tx->lock = 1;
@@ -370,16 +370,12 @@
   struct command_tx_struct *tx;
   int i = 0;
 
-  if (!(tx = aim_tx_new(0x0002, conn, 10+0x20)))
+  if (!(tx = aim_tx_new(0x0002, conn, 10+0x22)))
     return -1;
 
   tx->lock = 1;
 
-  i += aimutil_put16(tx->data+i, 0x0001);
-  i += aimutil_put16(tx->data+i, 0x0003);
-  i += aimutil_put16(tx->data+i, 0x0000);
-  i += aimutil_put16(tx->data+i, 0x0000);
-  i += aimutil_put16(tx->data+i, 0x0000);
+  i += aim_putsnac(tx->data, 0x0001, 0x0003, 0x0000, sess->snac_nextid++);
   
   i += aimutil_put16(tx->data+i, 0x0001);  
   i += aimutil_put16(tx->data+i, 0x0002);
@@ -391,9 +387,11 @@
   i += aimutil_put16(tx->data+i, 0x000a);
   i += aimutil_put16(tx->data+i, 0x000b);
   i += aimutil_put16(tx->data+i, 0x000c);
+  i += aimutil_put16(tx->data+i, 0x0013);
+  i += aimutil_put16(tx->data+i, 0x0015);
 
+  tx->commandlen = i;
   tx->lock = 0;
-
   return aim_tx_enqueue(sess, tx);
 }
 
--- a/src/oscar.c	Sat May 20 23:00:20 2000 +0000
+++ b/src/oscar.c	Sun May 21 11:58:18 2000 +0000
@@ -373,6 +373,7 @@
 	case 0xe: /* Chat */
 		{
 		struct aim_conn_t *tstconn = aim_newconn(sess, AIM_CONN_TYPE_CHAT, ip);
+		static int id = 1;
 		char *roomname = va_arg(ap, char *);
 		if (tstconn == NULL || tstconn->status >= AIM_CONN_STATUS_RESOLVERR) {
 			debug_print("unable to connect to chat server\n");
@@ -381,6 +382,7 @@
 		aim_chat_attachname(tstconn, roomname);
 		aim_conn_addhandler(sess, tstconn, 0x0001, 0x0003, gaim_server_ready, 0);
 		aim_auth_sendcookie(sess, tstconn, cookie);
+		serv_got_joined_chat(id++, roomname);
 		}
 		break;
 	default: /* huh? */
@@ -553,30 +555,102 @@
 int gaim_chatnav_info(struct aim_session_t *sess,
 		      struct command_rx_struct *command, ...) {
 	/* FIXME */
+	debug_print("inside chatnav_info\n");
 	return 1;
 }
 
 int gaim_chat_join(struct aim_session_t *sess,
 		   struct command_rx_struct *command, ...) {
-	/* FIXME */
+	va_list ap;
+	int count, i = 0;
+	struct aim_userinfo_s *info;
+
+	GList *bcs = buddy_chats;
+	struct buddy_chat *b = NULL;
+
+	va_start(ap, command);
+	count = va_arg(ap, int);
+	info  = va_arg(ap, struct aim_userinfo_s *);
+	va_end(ap);
+
+	while(bcs) {
+		b = (struct buddy_chat *)bcs->data;
+		if (!strcasecmp(b->name, (char *)command->conn->priv))
+			break;	
+		bcs = bcs->next;
+		b = NULL;
+	}
+	if (!b)
+		return 1;
+		
+	while (i < count)
+		add_chat_buddy(b, info[i++].sn);
+
 	return 1;
 }
 
 int gaim_chat_leave(struct aim_session_t *sess,
 		    struct command_rx_struct *command, ...) {
-	/* FIXME */
+	va_list ap;
+	int count, i = 0;
+	struct aim_userinfo_s *info;
+
+	GList *bcs = buddy_chats;
+	struct buddy_chat *b = NULL;
+
+	va_start(ap, command);
+	count = va_arg(ap, int);
+	info  = va_arg(ap, struct aim_userinfo_s *);
+	va_end(ap);
+
+	while(bcs) {
+		b = (struct buddy_chat *)bcs->data;
+		if (!strcasecmp(b->name, (char *)command->conn->priv))
+			break;	
+		bcs = bcs->next;
+		b = NULL;
+	}
+	if (!b)
+		return 1;
+		
+	while (i < count)
+		remove_chat_buddy(b, info[i++].sn);
+
 	return 1;
 }
 
 int gaim_chat_info_update(struct aim_session_t *sess,
 			  struct command_rx_struct *command, ...) {
 	/* FIXME */
+	debug_print("inside chat_info_update\n");
 	return 1;
 }
 
 int gaim_chat_incoming_msg(struct aim_session_t *sess,
 			   struct command_rx_struct *command, ...) {
-	/* FIXME */
+	va_list ap;
+	struct aim_userinfo_s *info;
+	char *msg;
+
+	GList *bcs = buddy_chats;
+	struct buddy_chat *b = NULL;
+
+	va_start(ap, command);
+	info = va_arg(ap, struct aim_userinfo_s *);
+	msg  = va_arg(ap, char *);
+
+	while(bcs) {
+		b = (struct buddy_chat *)bcs->data;
+		if (!strcasecmp(b->name, (char *)command->conn->priv))
+			break;
+		bcs = bcs->next;
+		b = NULL;
+	}
+	if (!b)
+		return;
+
+	serv_got_chat_in(b->id, info->sn, 0, msg);
+
 	return 1;
 }
 
--- a/src/server.c	Sat May 20 23:00:20 2000 +0000
+++ b/src/server.c	Sun May 21 11:58:18 2000 +0000
@@ -442,6 +442,8 @@
 #ifndef USE_OSCAR
         g_snprintf(buf, sizeof(buf)/2, "toc_chat_join %d \"%s\"", exchange, name);
         sflap_send(buf, -1, TYPE_DATA);
+#else
+	aim_chat_join(gaim_sess, gaim_conn, 0x0004, name);
 #endif
 }
 
@@ -461,6 +463,22 @@
         g_snprintf(buf, 255, "toc_chat_leave %d",  id);
         sflap_send(buf, -1, TYPE_DATA);
         g_free(buf);
+#else
+	GList *bcs = buddy_chats;
+	struct buddy_chat *b = NULL;
+
+	while (bcs) {
+		b = (struct buddy_chat *)bcs->data;
+		if (id == b->id)
+			break;
+		bcs = bcs->next;
+		b = NULL;
+	}
+
+	if (!b)
+		return;
+
+	aim_chat_leaveroom(gaim_sess, b->name);
 #endif
 }
 
@@ -470,6 +488,9 @@
 #ifndef USE_OSCAR
         g_snprintf(buf2, sizeof(buf2), "toc_chat_whisper %d %s \"%s\"", id, who, message);
         sflap_send(buf2, -1, TYPE_DATA);
+#else
+	/* FIXME : libfaim doesn't whisper */
+	serv_chat_send(id, message);
 #endif
 }
 
@@ -479,6 +500,23 @@
 #ifndef USE_OSCAR
         g_snprintf(buf, sizeof(buf), "toc_chat_send %d \"%s\"",id, message);
         sflap_send(buf, -1, TYPE_DATA);
+#else
+	struct aim_conn_t *cn;
+	GList *bcs = buddy_chats;
+	struct buddy_chat *b = NULL;
+
+	while (bcs) {
+		b = (struct buddy_chat *)bcs->data;
+		if (id == b->id)
+			break;
+		bcs = bcs->next;
+		b = NULL;
+	}
+	if (!b)
+		return;
+
+	cn = aim_chat_getconn(gaim_sess, b->name);
+	aim_chat_send_im(gaim_sess, cn, message);
 #endif
 }