mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-31 13:06:22 +00:00
@@ -1213,6 +1213,7 @@ cons_show_caps(const char * const contact, Resource *resource)
|
|||||||
wprintw(win, ":\n");
|
wprintw(win, ":\n");
|
||||||
|
|
||||||
if (resource->caps_str != NULL) {
|
if (resource->caps_str != NULL) {
|
||||||
|
log_debug("Getting caps, caps_str: %s", resource->caps_str);
|
||||||
Capabilities *caps = caps_get(resource->caps_str);
|
Capabilities *caps = caps_get(resource->caps_str);
|
||||||
if (caps != NULL) {
|
if (caps != NULL) {
|
||||||
// show identity
|
// show identity
|
||||||
@@ -1268,6 +1269,8 @@ cons_show_caps(const char * const contact, Resource *resource)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log_debug("No caps string found in resource");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_index == 0) {
|
if (current_index == 0) {
|
||||||
|
|||||||
@@ -350,6 +350,7 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
|
|||||||
|
|
||||||
// xep-0115
|
// xep-0115
|
||||||
if (g_strcmp0(id, "disco") == 0) {
|
if (g_strcmp0(id, "disco") == 0) {
|
||||||
|
log_debug("xep-0115 supported capabilities");
|
||||||
caps_key = strdup(node);
|
caps_key = strdup(node);
|
||||||
|
|
||||||
// validate sha1
|
// validate sha1
|
||||||
@@ -371,7 +372,9 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
|
|||||||
|
|
||||||
// non supported hash, or legacy caps
|
// non supported hash, or legacy caps
|
||||||
} else {
|
} else {
|
||||||
|
log_debug("Unsupported hash, or legacy capabilities");
|
||||||
caps_key = strdup(id + 6);
|
caps_key = strdup(id + 6);
|
||||||
|
log_debug("Caps key: %s", caps_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
// already cached
|
// already cached
|
||||||
@@ -380,6 +383,8 @@ _iq_handle_discoinfo_result(xmpp_conn_t * const conn, xmpp_stanza_t * const stan
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_debug("Client info not cached");
|
||||||
|
|
||||||
DataForm *form = NULL;
|
DataForm *form = NULL;
|
||||||
FormField *formField = NULL;
|
FormField *formField = NULL;
|
||||||
|
|
||||||
|
|||||||
@@ -465,9 +465,6 @@ _get_caps_key(xmpp_stanza_t * const stanza)
|
|||||||
char *caps_key = NULL;
|
char *caps_key = NULL;
|
||||||
char *node = NULL;
|
char *node = NULL;
|
||||||
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
char *from = xmpp_stanza_get_attribute(stanza, STANZA_ATTR_FROM);
|
||||||
guint from_hash = g_str_hash(from);
|
|
||||||
char from_hash_str[100];
|
|
||||||
g_sprintf(from_hash_str, "%d", from_hash);
|
|
||||||
|
|
||||||
if (stanza_contains_caps(stanza)) {
|
if (stanza_contains_caps(stanza)) {
|
||||||
log_debug("Presence contains capabilities.");
|
log_debug("Presence contains capabilities.");
|
||||||
@@ -501,12 +498,15 @@ _get_caps_key(xmpp_stanza_t * const stanza)
|
|||||||
} else {
|
} else {
|
||||||
log_debug("Hash type unsupported.");
|
log_debug("Hash type unsupported.");
|
||||||
node = stanza_get_caps_str(stanza);
|
node = stanza_get_caps_str(stanza);
|
||||||
caps_key = from_hash_str;
|
guint from_hash = g_str_hash(from);
|
||||||
|
char from_hash_str[9];
|
||||||
|
g_sprintf(from_hash_str, "%08x", from_hash);
|
||||||
|
caps_key = strdup(from_hash_str);
|
||||||
|
|
||||||
if (node != NULL) {
|
if (node != NULL) {
|
||||||
log_debug("Node string: %s.", node);
|
log_debug("Node string: %s.", node);
|
||||||
if (!caps_contains(caps_key)) {
|
if (!caps_contains(caps_key)) {
|
||||||
log_debug("Capabilities not cached for '%s', sending discovery IQ.", caps_key);
|
log_debug("Capabilities not cached for '%s', sending discovery IQ.", from);
|
||||||
GString *id = g_string_new("disco_");
|
GString *id = g_string_new("disco_");
|
||||||
g_string_append(id, from_hash_str);
|
g_string_append(id, from_hash_str);
|
||||||
xmpp_stanza_t *iq = stanza_create_disco_iq(ctx, id->str, from, node);
|
xmpp_stanza_t *iq = stanza_create_disco_iq(ctx, id->str, from, node);
|
||||||
@@ -514,7 +514,7 @@ _get_caps_key(xmpp_stanza_t * const stanza)
|
|||||||
xmpp_stanza_release(iq);
|
xmpp_stanza_release(iq);
|
||||||
g_string_free(id, TRUE);
|
g_string_free(id, TRUE);
|
||||||
} else {
|
} else {
|
||||||
log_debug("Capabilities already cached, for %s", caps_key);
|
log_debug("Capabilities already cached, for %s", from);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log_debug("No node string, not sending discovery IQ.");
|
log_debug("No node string, not sending discovery IQ.");
|
||||||
@@ -527,12 +527,15 @@ _get_caps_key(xmpp_stanza_t * const stanza)
|
|||||||
} else {
|
} else {
|
||||||
log_debug("No hash type, using legacy capabilities.");
|
log_debug("No hash type, using legacy capabilities.");
|
||||||
node = stanza_get_caps_str(stanza);
|
node = stanza_get_caps_str(stanza);
|
||||||
caps_key = from_hash_str;
|
guint from_hash = g_str_hash(from);
|
||||||
|
char from_hash_str[9];
|
||||||
|
g_sprintf(from_hash_str, "%08x", from_hash);
|
||||||
|
caps_key = strdup(from_hash_str);
|
||||||
|
|
||||||
if (node != NULL) {
|
if (node != NULL) {
|
||||||
log_debug("Node string: %s.", node);
|
log_debug("Node string: %s.", node);
|
||||||
if (!caps_contains(caps_key)) {
|
if (!caps_contains(caps_key)) {
|
||||||
log_debug("Capabilities not cached for '%s', sending discovery IQ.", caps_key);
|
log_debug("Capabilities not cached for '%s', sending discovery IQ.", from);
|
||||||
GString *id = g_string_new("disco_");
|
GString *id = g_string_new("disco_");
|
||||||
g_string_append(id, from_hash_str);
|
g_string_append(id, from_hash_str);
|
||||||
xmpp_stanza_t *iq = stanza_create_disco_iq(ctx, id->str, from, node);
|
xmpp_stanza_t *iq = stanza_create_disco_iq(ctx, id->str, from, node);
|
||||||
@@ -540,7 +543,7 @@ _get_caps_key(xmpp_stanza_t * const stanza)
|
|||||||
xmpp_stanza_release(iq);
|
xmpp_stanza_release(iq);
|
||||||
g_string_free(id, TRUE);
|
g_string_free(id, TRUE);
|
||||||
} else {
|
} else {
|
||||||
log_debug("Capabilities already cached, for %s", caps_key);
|
log_debug("Capabilities already cached, for %s", from);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log_debug("No node string, not sending discovery IQ.");
|
log_debug("No node string, not sending discovery IQ.");
|
||||||
|
|||||||
Reference in New Issue
Block a user