WockyXmppReader

WockyXmppReader — Xmpp XML to stanza deserializer

Functions

Properties

gchar * default-namespace Read / Write / Construct Only
gchar * from Read
gchar * id Read
gchar * lang Read
gboolean streaming-mode Read / Write / Construct Only
gchar * to Read
gchar * version Read

Types and Values

Object Hierarchy

    GEnum
    ├── WockyXmppReaderError
    ╰── WockyXmppReaderState
    GObject
    ╰── WockyXmppReader

Description

The WockyXmppReader deserializes XML to WockyStanzas, misc, other

Functions

wocky_xmpp_reader_error_quark ()

GQuark
wocky_xmpp_reader_error_quark (void);

Get the error quark used by the reader.

Returns

the quark for reader errors.


WOCKY_XMPP_READER_ERROR

#define WOCKY_XMPP_READER_ERROR (wocky_xmpp_reader_error_quark ())

Get access to the error quark of the reader.


wocky_xmpp_reader_new ()

WockyXmppReader *
wocky_xmpp_reader_new (void);

Convenience function to create a new WockyXmppReader.

Returns

a new WockyXmppReader


wocky_xmpp_reader_new_no_stream ()

WockyXmppReader *
wocky_xmpp_reader_new_no_stream (void);

Convenience function to create a new WockyXmppReader that has streaming mode disabled.

Returns

a new WockyXmppReader in non-streaming mode


wocky_xmpp_reader_new_no_stream_ns ()

WockyXmppReader *
wocky_xmpp_reader_new_no_stream_ns (const gchar *default_namespace);

Create a new WockyXmppReader, with “streaming-mode” disabled and the specified “default-namespace”.

Parameters

default_namespace

default XML namespace to apply to the top-level element

 

Returns

a new WockyXmppReader in non-streaming mode.

[transfer full]


wocky_xmpp_reader_get_state ()

WockyXmppReaderState
wocky_xmpp_reader_get_state (WockyXmppReader *reader);

Parameters

reader

a WockyXmppReader

 

Returns

The current state of the reader


wocky_xmpp_reader_push ()

void
wocky_xmpp_reader_push (WockyXmppReader *reader,
                        const guint8 *data,
                        gsize length);

Push an amount of data to parse.

Parameters

reader

a WockyXmppReader

 

data

Data to read

 

length

Size of data

 

wocky_xmpp_reader_pop_stanza ()

WockyStanza *
wocky_xmpp_reader_pop_stanza (WockyXmppReader *reader);

Gets one WockyStanza out of the reader or NULL if there are no available stanzas.

Parameters

reader

a WockyXmppReader

 

Returns

One WockyStanza or NULL if there are no available stanzas. Caller owns the returned stanza.


wocky_xmpp_reader_peek_stanza ()

WockyStanza *
wocky_xmpp_reader_peek_stanza (WockyXmppReader *reader);

Returns the first WockyStanza available from reader or NULL if there are no available stanzas. The stanza is not removed from the readers queue

Parameters

reader

a WockyXmppReader

 

Returns

One WockyStanza or NULL if there are no available stanzas. The stanza is owned by the WockyXmppReader


wocky_xmpp_reader_get_error ()

GError *
wocky_xmpp_reader_get_error (WockyXmppReader *reader);

Get the error from the reader

Parameters

reader

a WockyXmppReader

 

Returns

A copy of the error as encountered by the reader or NULL if there was no error. Free after use.


wocky_xmpp_reader_reset ()

void
wocky_xmpp_reader_reset (WockyXmppReader *reader);

Reset the xml parser.

Parameters

reader

a WockyXmppReader

 

Types and Values

struct WockyXmppReaderClass

struct WockyXmppReaderClass {
};

The class of a WockyXmppReader.


enum WockyXmppReaderState

The possible states a reader can be in.

Members

WOCKY_XMPP_READER_STATE_INITIAL

initial state

 

WOCKY_XMPP_READER_STATE_OPENED

stream is open

 

WOCKY_XMPP_READER_STATE_CLOSED

stream has been closed

 

WOCKY_XMPP_READER_STATE_ERROR

stream reader hit an error

 

enum WockyXmppReaderError

The different errors that can occur while reading a stream

Members

WOCKY_XMPP_READER_ERROR_INVALID_STREAM_START

invalid start of xmpp stream

 

WOCKY_XMPP_READER_ERROR_PARSE_ERROR

error in parsing the XML

 

Property Details

The “default-namespace” property

  “default-namespace”        gchar *

The default namespace for the root element of the document. Only meaningful if streaming-mode is FALSE.

Flags: Read / Write / Construct Only

Default value: ""


The “from” property

  “from”                     gchar *

from attribute in the xml stream opening.

Flags: Read

Default value: NULL


The “id” property

  “id”                       gchar *

id attribute in the xml stream opening.

Flags: Read

Default value: NULL


The “lang” property

  “lang”                     gchar *

xml:lang attribute in the xml stream opening.

Flags: Read

Default value: NULL


The “streaming-mode” property

  “streaming-mode”           gboolean

Whether the xml to be read is one big stream or separate documents.

Flags: Read / Write / Construct Only

Default value: TRUE


The “to” property

  “to”                       gchar *

to attribute in the xml stream opening.

Flags: Read

Default value: NULL


The “version” property

  “version”                  gchar *

version attribute in the xml stream opening.

Flags: Read

Default value: NULL