summaryrefslogtreecommitdiff
path: root/res/res_xmpp.c
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2013-03-16 15:15:44 +0000
committerJoshua Colp <jcolp@digium.com>2013-03-16 15:15:44 +0000
commit2f89b7a6ebc3f000c297872c37bd95c2dac992c6 (patch)
tree0465af286a4aa0006aca2c52d7b0b098e9030a11 /res/res_xmpp.c
parent49e3489cac88927c87ce2b9c3e69a51aacf0bdc5 (diff)
Fix a bug where resources were not found due to hashing on the priority itself.
........ Merged revisions 383266 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383267 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_xmpp.c')
-rw-r--r--res/res_xmpp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_xmpp.c b/res/res_xmpp.c
index d9c07255d..5939d30d4 100644
--- a/res/res_xmpp.c
+++ b/res/res_xmpp.c
@@ -831,10 +831,10 @@ static int xmpp_resource_hash(const void *obj, const int flags)
/*! \brief Comparator function for XMPP resource */
static int xmpp_resource_cmp(void *obj, void *arg, int flags)
{
- struct ast_xmpp_resource *resource1 = obj, *resource2 = arg;
+ struct ast_xmpp_resource *resource1 = obj;
const char *resource = arg;
- return !strcmp(resource1->resource, flags & OBJ_KEY ? resource : resource2->resource) ? CMP_MATCH | CMP_STOP : 0;
+ return !strcmp(resource1->resource, resource) ? CMP_MATCH | CMP_STOP : 0;
}
/*! \brief Destructor callback function for XMPP buddy */
@@ -1681,7 +1681,7 @@ static int xmpp_status_exec(struct ast_channel *chan, const char *data)
return -1;
}
- if (ast_strlen_zero(jid.resource) || !(resource = ao2_find(buddy->resources, jid.resource, OBJ_KEY))) {
+ if (ast_strlen_zero(jid.resource) || !(resource = ao2_callback(buddy->resources, 0, xmpp_resource_cmp, jid.resource))) {
resource = ao2_callback(buddy->resources, OBJ_NODATA, xmpp_resource_immediate, NULL);
}
@@ -1752,7 +1752,7 @@ static int acf_jabberstatus_read(struct ast_channel *chan, const char *name, cha
return -1;
}
- if (ast_strlen_zero(jid.resource) || !(resource = ao2_find(buddy->resources, jid.resource, OBJ_KEY))) {
+ if (ast_strlen_zero(jid.resource) || !(resource = ao2_callback(buddy->resources, 0, xmpp_resource_cmp, jid.resource))) {
resource = ao2_callback(buddy->resources, OBJ_NODATA, xmpp_resource_immediate, NULL);
}
@@ -2480,7 +2480,7 @@ static int xmpp_client_service_discovery_result_hook(void *data, ikspak *pak)
return IKS_FILTER_EAT;
}
- if (!(resource = ao2_find(buddy->resources, pak->from->resource, OBJ_KEY))) {
+ if (!(resource = ao2_callback(buddy->resources, 0, xmpp_resource_cmp, pak->from->resource))) {
ao2_ref(buddy, -1);
return IKS_FILTER_EAT;
}
@@ -3273,7 +3273,7 @@ static int xmpp_pak_presence(struct ast_xmpp_client *client, struct ast_xmpp_cli
ao2_lock(buddy->resources);
- if (!(resource = ao2_find(buddy->resources, pak->from->resource, OBJ_KEY | OBJ_NOLOCK))) {
+ if (!(resource = ao2_callback(buddy->resources, OBJ_NOLOCK, xmpp_resource_cmp, pak->from->resource))) {
/* Only create the new resource if it is not going away - in reality this should not happen */
if (status != STATUS_DISAPPEAR) {
if (!(resource = ao2_alloc(sizeof(*resource), xmpp_resource_destructor))) {