示例#1
0
文件: iq.c 项目: dotoole/profanity
static void
_iq_send_caps_request(const char * const to, const char * const id,
    const char * const node, const char * const ver)
{
    xmpp_conn_t * const conn = connection_get_conn();
    xmpp_ctx_t * const ctx = connection_get_ctx();

    if (!node) {
        log_error("Could not create caps request, no node");
        return;
    }
    if (!ver) {
        log_error("Could not create caps request, no ver");
        return;
    }

    GString *node_str = g_string_new("");
    g_string_printf(node_str, "%s#%s", node, ver);
    xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, to, node_str->str);
    g_string_free(node_str, TRUE);

    xmpp_id_handler_add(conn, _caps_response_handler, id, NULL);

    xmpp_send(conn, iq);
    xmpp_stanza_release(iq);
}
示例#2
0
static void
_iq_disco_info_request(gchar *jid)
{
    xmpp_conn_t * const conn = connection_get_conn();
    xmpp_ctx_t * const ctx = connection_get_ctx();
    xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, "discoinforeq", jid, NULL);
    xmpp_send(conn, iq);
    xmpp_stanza_release(iq);
}
示例#3
0
文件: iq.c 项目: dotoole/profanity
static void
_iq_disco_info_request(gchar *jid)
{
    xmpp_conn_t * const conn = connection_get_conn();
    xmpp_ctx_t * const ctx = connection_get_ctx();
    char *id = create_unique_id("disco_info");
    xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, jid, NULL);

    xmpp_id_handler_add(conn, _disco_info_response_handler, id, NULL);

    xmpp_send(conn, iq);
    xmpp_stanza_release(iq);
}
示例#4
0
void
_send_caps_request(char *node, char *caps_key, char *id, char *from)
{
    xmpp_ctx_t *ctx = connection_get_ctx();
    xmpp_conn_t *conn = connection_get_conn();

    if (node != NULL) {
        log_debug("Node string: %s.", node);
        if (!caps_contains(caps_key)) {
            log_debug("Capabilities not cached for '%s', sending discovery IQ.", from);
            xmpp_stanza_t *iq = stanza_create_disco_info_iq(ctx, id, from, node);
            xmpp_send(conn, iq);
            xmpp_stanza_release(iq);
        } else {
            log_debug("Capabilities already cached, for %s", caps_key);
        }
    } else {
        log_debug("No node string, not sending discovery IQ.");
    }
}