From d9ef079522891a0a256e455158704e82228370d7 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 12 Jul 2011 00:37:25 +0300 Subject: [PATCH] gobex: Add g_obex_packet_get_body convenience function --- gobex/gobex-packet.c | 11 +++++++++++ gobex/gobex-packet.h | 1 + 2 files changed, 12 insertions(+) diff --git a/gobex/gobex-packet.c b/gobex/gobex-packet.c index 679a2dd9f..8303456c3 100644 --- a/gobex/gobex-packet.c +++ b/gobex/gobex-packet.c @@ -60,6 +60,17 @@ GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id) return NULL; } +GObexHeader *g_obex_packet_get_body(GObexPacket *pkt) +{ + GObexHeader *body; + + body = g_obex_packet_get_header(pkt, G_OBEX_HDR_BODY); + if (body != NULL) + return body; + + return g_obex_packet_get_header(pkt, G_OBEX_HDR_BODY_END); +} + guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final) { if (final) diff --git a/gobex/gobex-packet.h b/gobex/gobex-packet.h index ea61d99be..ff6dcd295 100644 --- a/gobex/gobex-packet.h +++ b/gobex/gobex-packet.h @@ -82,6 +82,7 @@ typedef struct _GObexPacket GObexPacket; GObexHeader *g_obex_packet_get_header(GObexPacket *pkt, guint8 id); +GObexHeader *g_obex_packet_get_body(GObexPacket *pkt); guint8 g_obex_packet_get_operation(GObexPacket *pkt, gboolean *final); GObexHeader *g_obex_packet_find_header(GObexPacket *pkt, guint8 id); gboolean g_obex_packet_prepend_header(GObexPacket *pkt, GObexHeader *header); -- 2.47.3