diff src/protocols/oscar/ft.c @ 8982:a4fd6666bb83

[gaim-migrate @ 9757] Some Direct IM fixes. 1. Let's send our correct ip. We were usually sending localhost, so the other side would try to connect to localhost and immediately fail and so say, hey! I can't connect to you! Connect to me instead! 2. Add some gaim_conversation_writes to keep the user more informed as to what's going on. This changes the libfaim API. libfaim users take note. I removed the util get local ip function, and made the function that used to use it take an ip as an argument instead, so that oscar.c could just call gaim's function, which works better. I also made it possible to specify a cookie to use, because I think I'll need that later. Probably. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Thu, 20 May 2004 00:14:14 +0000
parents 535449a13b07
children 460d02fe03df
line wrap: on
line diff
--- a/src/protocols/oscar/ft.c	Thu May 20 00:07:15 2004 +0000
+++ b/src/protocols/oscar/ft.c	Thu May 20 00:14:14 2004 +0000
@@ -440,27 +440,31 @@
 /**
  * For those times when we want to open up the direct connection channel ourselves.
  *
- * You'll want to set up some kind of watcher on this socket.  
- * When the state changes, call aim_handlerendconnection with 
- * the connection returned by this.  aim_handlerendconnection 
+ * You'll want to set up some kind of watcher on this socket.
+ * When the state changes, call aim_handlerendconnection with
+ * the connection returned by this.  aim_handlerendconnection
  * will accept the pending connection and stop listening.
  *
  * @param sess The session
  * @param sn The screen name to connect to.
  * @return The new connection.
  */
-faim_export aim_conn_t *aim_odc_initiate(aim_session_t *sess, const char *sn, int listenfd, fu16_t port)
+faim_export aim_conn_t *aim_odc_initiate(aim_session_t *sess, const char *sn, int listenfd,
+                                         const fu8_t *localip, fu16_t port, const fu8_t *mycookie)
 {
 	aim_conn_t *newconn;
 	aim_msgcookie_t *cookie;
 	struct aim_odc_intdata *priv;
-	fu8_t localip[4];
 	fu8_t ck[8];
 
-	if (aim_util_getlocalip(localip) == -1)
+	if (!localip)
 		return NULL;
 
-	aim_im_sendch2_odcrequest(sess, ck, sn, localip, port);
+	if (mycookie) {
+		memcpy(ck, mycookie, 8);
+		aim_im_sendch2_odcrequest(sess, ck, TRUE, sn, localip, port);
+	} else
+		aim_im_sendch2_odcrequest(sess, ck, FALSE, sn, localip, port);
 
 	cookie = (aim_msgcookie_t *)calloc(1, sizeof(aim_msgcookie_t));
 	memcpy(cookie->cookie, ck, 8);