Moved stanza_new function
This commit is contained in:
@@ -32,6 +32,27 @@ typedef struct parse_state_t {
|
||||
XMPPStanza *curr_stanza;
|
||||
} ParseState;
|
||||
|
||||
XMPPStanza*
|
||||
stanza_new(const char *name, const char **attributes)
|
||||
{
|
||||
XMPPStanza *stanza = malloc(sizeof(XMPPStanza));
|
||||
stanza->name = strdup(name);
|
||||
stanza->content = NULL;
|
||||
stanza->children = NULL;
|
||||
stanza->attrs = NULL;
|
||||
if (attributes[0]) {
|
||||
int i;
|
||||
for (i = 0; attributes[i]; i += 2) {
|
||||
XMPPAttr *attr = malloc(sizeof(XMPPAttr));
|
||||
attr->name = strdup(attributes[i]);
|
||||
attr->value = strdup(attributes[i+1]);
|
||||
stanza->attrs = g_list_append(stanza->attrs, attr);
|
||||
}
|
||||
}
|
||||
|
||||
return stanza;
|
||||
}
|
||||
|
||||
static void
|
||||
start_element(void *data, const char *element, const char **attributes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user