soc.2008.xmpp: 03e8a74a: * adding receive callback; preparing rec...

tfar at soc.pidgin.im tfar at soc.pidgin.im
Fri Aug 15 10:10:59 EDT 2008


-----------------------------------------------------------------
Revision: 03e8a74a25cb561cd1bb4963b3f71ad05e27afef
Ancestor: 848dfd939dfe271c06ad52dc6e66036ecfda48a0
Author: tfar at soc.pidgin.im
Date: 2008-08-05T22:24:39
Branch: im.pidgin.soc.2008.xmpp
URL: http://d.pidgin.im/viewmtn/revision/info/03e8a74a25cb561cd1bb4963b3f71ad05e27afef

Modified files:
        libpurple/protocols/jabber/bosh.c
        libpurple/protocols/jabber/bosh.h
        libpurple/protocols/jabber/jabber.c

ChangeLog: 

* adding receive callback; preparing receiving and boot code

-------------- next part --------------
============================================================
--- libpurple/protocols/jabber/bosh.c	1464502d62858b38127a53f672676bfec0ee1fb7
+++ libpurple/protocols/jabber/bosh.c	accdae9cf18f18dd8a3bdc07708bfa6dc2fe933c
@@ -52,9 +52,19 @@ void jabber_bosh_connection_init(PurpleB
 	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 @@ void jabber_bosh_connection_connect(Purp
 	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 @@ static void jabber_bosh_http_connection_
 		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);
-	}
+	} 
 }
============================================================
--- libpurple/protocols/jabber/bosh.h	30dfe2e7aaeba8942284fda762d3e0db4bd22426
+++ libpurple/protocols/jabber/bosh.h	7fb48e2372eac6412601c492cf5cfe6d1e94a8d7
@@ -48,6 +48,7 @@ struct _PurpleBOSHConnection {
     PurpleHTTPConnection *conn_a;
     PurpleHTTPConnection *conn_b;
     
+    gboolean ready;
     PurpleBOSHConnectionConnectFunction connect_cb;
     PurpleBOSHConnectionReciveFunction receive_cb;
 };
@@ -57,10 +58,11 @@ struct _PurpleHTTPConnection {
     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_connect(Purp
 
 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);
============================================================
--- libpurple/protocols/jabber/jabber.c	ab1cf692d3d867232a6c5b1660cc108bc6fb813b
+++ libpurple/protocols/jabber/jabber.c	057b47d8f56be167f44d06ad8094c7c30f62ce07
@@ -556,7 +556,6 @@ txt_resolved_cb(PurpleTxtResponse *resp,
 	}
 	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");


More information about the Commits mailing list