changeset 25598:b238da95f39a

* some refactoring
author Tobias Markmann <tfar@soc.pidgin.im>
date Sun, 03 Aug 2008 22:50:13 +0000
parents 9f8951284a2e
children 3176d5a0b9dd
files libpurple/protocols/jabber/bosh.c libpurple/protocols/jabber/bosh.h
diffstat 2 files changed, 54 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/jabber/bosh.c	Sun Aug 03 22:21:49 2008 +0000
+++ b/libpurple/protocols/jabber/bosh.c	Sun Aug 03 22:50:13 2008 +0000
@@ -37,3 +37,13 @@
 #include "pep.h"
 #include "adhoccommands.h"
 
+PurpleHTTPHeaderField* jabber_bosh_http_header_field(const char *name, *const char *value) {
+	PurpleHTTPHeaderField *tmp = g_new0(PurpleHTTPHeaderField, 0);
+	tmp->name = g_strdup(name);
+	tmp->value = g_strdup(value);
+	return tmp;
+}
+
+void jabber_bosh_http_connection_connect(PurpleHTTPConnection *conn) {
+	
+}
\ No newline at end of file
--- a/libpurple/protocols/jabber/bosh.h	Sun Aug 03 22:21:49 2008 +0000
+++ b/libpurple/protocols/jabber/bosh.h	Sun Aug 03 22:50:13 2008 +0000
@@ -22,13 +22,54 @@
 #ifndef _PURPLE_JABBER_BOSH_H_
 #define _PURPLE_JABBER_BOSH_H_
 
+#include <glib.h>
+
+typedef struct _PurpleHTTPRequest PurpleHTTPRequest;
+typedef struct _PurpleHTTPResponse PurpleHTTPResponse;
+typedef struct _PurpleHTTPHeaderField PurpleHTTPHeaderField;
+
+typedef void (*PurpleHTTPRequestCallback)(PurpleHTTPRequest *req, PurpleHTTPResponse *res, void *userdata);
+
+typedef struct {
+    int fd;
+    PurpleConnection *conn;
+    GQueue *requests;
+    void *userdata;
+} PurpleHTTPConnection;
+
 typedef struct {
     char *url;
     gboolean pipelining;
+    PurpleHTTPConnection *conn_a;
+    PurpleHTTPConnection *conn_b;
 } PurpleBOSHConnection;
 
-typedef struct {
-    
-} PurpleHTTPRequest;
+struct _PurpleHTTPRequest {
+    PurpleHTTPRequestCallback cb;
+    char *method;
+    char *url;
+    GList *header;
+    char *data;
+    void *userdata;
+};
+
+struct _PurpleHTTPResponse {
+    int status;
+    GList *header;
+    char *data;
+};
 
+struct _PurpleHTTPHeaderField {
+    char *name;
+    char *value;
+};
+
+PurpleHTTPHeaderField *jabber_bosh_http_header_field(const char *name, const char *value);
+
+void jabber_bosh_http_connection_connect(PurpleHTTPConnection *conn);
+void jabber_bosh_http_send_request(PurpleHTTPConnection *conn, PurpleHTTPRequest *req);
+void jabber_bosh_http_connection_clean(PurpleHTTPConnection *conn);
+
+void jabber_bosh_http_request_init(PurpleHTTPRequest *req, const char *method, const char *url, PurpleHTTPRequestCallback cb, void *userdata);
+void jabber_bosh_http_request_clean(PurpleHTTPRequest *req);
 #endif /* _PURPLE_JABBER_BOSH_H_ */