Ejemplo n.º 1
0
static enum conflate_mgmt_cb_result process_get_private(void *opaque,
                                                        conflate_handle_t *handle,
                                                        const char *cmd,
                                                        bool direct,
                                                        kvpair_t *form,
                                                        conflate_form_result *r)
{
    /* Only direct stat requests are handled. */
    assert(direct);
    enum conflate_mgmt_cb_result rv = RV_ERROR;

    char *key = get_simple_kvpair_val(form, "key");

    if (key) {
        /* Initialize the form so there's always one there */
        conflate_init_form(r);
        char *value = conflate_get_private(handle, key,
                                           handle->conf->save_path);
        if (value) {
            conflate_add_field(r, key, value);
            free(value);
        }

        rv = RV_OK;
    } else {
        rv = RV_BADARG;
    }

    return rv;
}
Ejemplo n.º 2
0
void conflate_add_field_multi(conflate_form_result *r, const char *k,
                              const char **v)
{
    conflate_init_form(r);
    if (!r->current) {
        r->current = r->container;
    }
    if (k) {
        add_form_values(r->ctx, r->current, k, v);
    }
}
Ejemplo n.º 3
0
void conflate_next_fieldset(conflate_form_result *r)
{
    conflate_init_form(r);
    /* Fail if some k/v pairs were already added */
    assert(r->current == NULL || r->current != r->container);

    r->current = xmpp_stanza_new(r->ctx);
    assert(r->current);

    xmpp_stanza_set_name(r->current, "item");
    add_and_release(r->container, r->current);
}