changeset 25601:15d9825a5621

* adding receive callback; preparing receiving and boot code
author Tobias Markmann <tfar@soc.pidgin.im>
date Tue, 05 Aug 2008 22:24:39 +0000
parents 1cbe5a9f6efb
children f9322be084c4
files libpurple/protocols/jabber/bosh.c libpurple/protocols/jabber/bosh.h libpurple/protocols/jabber/jabber.c
diffstat 3 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/bosh.c	Tue Aug 05 18:44:42 2008 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Tue Aug 05 22:24:39 2008 +0000
@@ -52,9 +52,19 @@
 	conn->conn_a->userdata = conn;
 }
 
+static void jabber_bosh_connection_boot(PurpleBOSHConnection *conn) {
+    
+}
+
+void jabber_bosh_connection_send(PurpleBOSHConnection *conn, xmlnode *node) {
+	
+}
+
 static void jabber_bosh_connection_connected(PurpleHTTPConnection *conn) {
 	PurpleBOSHConnection *bosh_conn = conn->userdata;
-	if (bosh_conn->connect_cb) bosh_conn->connect_cb(bosh_conn);
+	
+	if (bosh->ready && bosh_conn->connect_cb) bosh_conn->connect_cb(bosh_conn);
+	else jabber_bosh_connection_boot(conn);
 }
 
 void jabber_bosh_connection_connect(PurpleBOSHConnection *conn) {
@@ -62,6 +72,9 @@
 	jabber_bosh_http_connection_connect(conn->conn_a);	
 }
 
+static void jabber_bosh_http_connection_receive(gpointer data, gint source, PurpleInputCondition condition) {
+	PurpleHTTPConnection conn = data;
+}
 
 void jabber_bosh_http_connection_init(PurpleHTTPConnection *conn, PurpleAccount *account, char *host, int port) {
 	conn->account = account;
@@ -77,11 +90,12 @@
 		return;
 	}
 	conn->fd = source;
+	conn->ie_handle = purple_input_add(conn->fd, jabber_bosh_http_connection_receive, PURPLE_INPUT_READ, cond);
 	if (conn->connect_cb) conn->connect_cb(conn);
 }
 
 void jabber_bosh_http_connection_connect(PurpleHTTPConnection *conn) {
 	if((purple_proxy_connect(&(conn->handle), conn->account, conn->host, conn->port, jabber_bosh_http_connection_callback, conn)) == NULL) {
 		purple_debug_info("jabber", "Unable to connect to %s.\n", conn->host);
-	}
+	} 
 }
\ No newline at end of file
--- a/libpurple/protocols/jabber/bosh.h	Tue Aug 05 18:44:42 2008 +0000
+++ b/libpurple/protocols/jabber/bosh.h	Tue Aug 05 22:24:39 2008 +0000
@@ -48,6 +48,7 @@
     PurpleHTTPConnection *conn_a;
     PurpleHTTPConnection *conn_b;
     
+    gboolean ready;
     PurpleBOSHConnectionConnectFunction connect_cb;
     PurpleBOSHConnectionReciveFunction receive_cb;
 };
@@ -57,10 +58,11 @@
     char *host;
     int port;
     int handle;
+    int ie_handle;
     PurpleConnection *conn;
     PurpleAccount *account;
     GQueue *requests;
-    
+    int pih
     PurpleHTTPConnectionConnectFunction connect_cb;
     void *userdata;
 };
@@ -82,6 +84,7 @@
 
 void jabber_bosh_connection_init(PurpleBOSHConnection *conn, PurpleAccount *account, char *url);
 void jabber_bosh_connection_connect(PurpleBOSHConnection *conn);
+void jabber_bosh_connection_send(PurpleBOSHConnection *conn, xmlnode *node);
 
 void jabber_bosh_http_connection_init(PurpleHTTPConnection *conn, PurpleAccount *account, char *host, int port);
 void jabber_bosh_http_connection_connect(PurpleHTTPConnection *conn);
--- a/libpurple/protocols/jabber/jabber.c	Tue Aug 05 18:44:42 2008 +0000
+++ b/libpurple/protocols/jabber/jabber.c	Tue Aug 05 22:24:39 2008 +0000
@@ -556,7 +556,6 @@
 	}
 	if (js->bosh.host) {
 		js->bosh.userdata = gc;
-		js->bosh.connect_cb = jabber_bosh_login_callback;
 		jabber_bosh_connection_connect(&(js->bosh));
 	} else {
 		purple_debug_info("jabber","Didn't find an alternative connection method.\n");