Hi,

        A few little fixes to OpenObex and some status...
        The fixes :
                o Allow to re-set the callback. I want to do a PUT and
a GET as part of the same session, but I don't want those two guys to
share the same callback (I like my callback streamlined, this help
readability).
                o Allow re-parsing of Obex headers. I have a function
that handle the common fields of the object, and in some cases I want
to re-parse them to get the extra fields.

        The status :
                o With OpenObex I can send a body in the GET request,
and this request can span multiple packets. Sweet. Don't ask why we
need such abomination...
                o With OpenObex I can set headers in the PUT reply and
recover them. Useful for extra status information.

        That's it...

        Jean
diff -u -p openobex-0.9.7/src/obex.p1.h openobex-0.9.7/src/obex.h
--- openobex-0.9.7/src/obex.p1.h        Wed Dec 13 17:53:16 2000
+++ openobex-0.9.7/src/obex.h   Wed Dec 13 18:17:07 2000
@@ -53,6 +53,7 @@ obex_t *OBEX_Init(gint transport, obex_e
 void    OBEX_Cleanup(obex_t *self);
 void OBEX_SetUserData(obex_t *self, gpointer data);
 gpointer OBEX_GetUserData(obex_t *self);
+void OBEX_SetUserCallBack(obex_t *self, obex_event_t eventcb, gpointer data);
 gint OBEX_GetFD(obex_t *self);
 
 gint OBEX_RegisterCTransport(obex_t *self, obex_ctrans_t *ctrans);
diff -u -p openobex-0.9.7/src/obex.p1.c openobex-0.9.7/src/obex.c
--- openobex-0.9.7/src/obex.p1.c        Wed Dec 13 17:53:31 2000
+++ openobex-0.9.7/src/obex.c   Wed Dec 13 18:18:08 2000
@@ -182,6 +182,21 @@ gpointer OBEX_GetUserData(obex_t *self)
 }
 
 /*
+ * Function OBEX_ObjectSetUserData()
+ *
+ *    Set eventcb on handle (and optionally userdata)
+ *
+ */
+void OBEX_SetUserCallBack(obex_t *self, obex_event_t eventcb, gpointer data)
+{
+       g_return_if_fail(self != NULL);
+       if(eventcb != NULL)
+               self->eventcb = eventcb;
+       if(data != NULL)
+               self->userdata = data;
+}
+
+/*
  * Function OBEX_ServerRegister (self, service)
  *
  *    Register server interest in OBEX
diff -u -p openobex-0.9.7/src/obex_object.p1.c openobex-0.9.7/src/obex_object.c
--- openobex-0.9.7/src/obex_object.p1.c Tue Dec 12 13:51:12 2000
+++ openobex-0.9.7/src/obex_object.c    Tue Dec 12 13:59:29 2000
@@ -379,8 +379,11 @@ gint obex_object_getnextheader(obex_t *s
        DEBUG(4, G_GNUC_FUNCTION "()\n");
 
        /* Return if no headers */
-       if(object->rx_lasthdr == NULL)
+       if(object->rx_lasthdr == NULL) {
+               /* Allow user to re-parse the header list if he wants - JII */
+               object->rx_lasthdr = object->rx_headerq;
                return 0;
+       }
 
        h = object->rx_lasthdr->data;
 

Reply via email to