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); }
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); }
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); }
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."); } }