Fixed problem with using id attribute with apostrophe.
Needs a better solution, but the current one stop the crash
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
|
#include <glib/gprintf.h>
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "config/preferences.h"
|
#include "config/preferences.h"
|
||||||
@@ -36,6 +37,8 @@
|
|||||||
#include "xmpp/stanza.h"
|
#include "xmpp/stanza.h"
|
||||||
#include "xmpp/xmpp.h"
|
#include "xmpp/xmpp.h"
|
||||||
|
|
||||||
|
#include "ui/ui.h"
|
||||||
|
|
||||||
static GHashTable *sub_requests;
|
static GHashTable *sub_requests;
|
||||||
|
|
||||||
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, \
|
#define HANDLE(ns, type, func) xmpp_handler_add(conn, func, ns, \
|
||||||
@@ -462,6 +465,10 @@ _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.");
|
||||||
char *hash_type = stanza_caps_get_hash(stanza);
|
char *hash_type = stanza_caps_get_hash(stanza);
|
||||||
@@ -494,14 +501,14 @@ _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;
|
caps_key = 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.", caps_key);
|
||||||
GString *id = g_string_new("disco_");
|
GString *id = g_string_new("disco_");
|
||||||
g_string_append(id, from);
|
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);
|
||||||
xmpp_send(conn, iq);
|
xmpp_send(conn, iq);
|
||||||
xmpp_stanza_release(iq);
|
xmpp_stanza_release(iq);
|
||||||
@@ -520,14 +527,14 @@ _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;
|
caps_key = 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.", caps_key);
|
||||||
GString *id = g_string_new("disco_");
|
GString *id = g_string_new("disco_");
|
||||||
g_string_append(id, from);
|
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);
|
||||||
xmpp_send(conn, iq);
|
xmpp_send(conn, iq);
|
||||||
xmpp_stanza_release(iq);
|
xmpp_stanza_release(iq);
|
||||||
|
|||||||
Reference in New Issue
Block a user