diff options
author | Joshua Colp <jcolp@digium.com> | 2016-02-04 12:26:58 -0600 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-02-04 12:26:58 -0600 |
commit | 014fc9ef65f923fb44a20b101700d851f2cc964d (patch) | |
tree | 0d711467ad38777195ca3ba189c497252532c4a0 /res | |
parent | 4e8e6d3922303711335bee677676c4cddc18dd5d (diff) | |
parent | 0405c31756e45047cec20caccf228e5862550f9c (diff) |
Merge "res_xmpp: Does not connect in component mode" into 13
Diffstat (limited to 'res')
-rw-r--r-- | res/res_xmpp.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/res/res_xmpp.c b/res/res_xmpp.c index d9791431d..ed35cd169 100644 --- a/res/res_xmpp.c +++ b/res/res_xmpp.c @@ -3130,6 +3130,10 @@ done: /*! \brief Internal function called when we authenticated as a component */ static int xmpp_component_authenticating(struct ast_xmpp_client *client, struct ast_xmpp_client_config *cfg, int type, iks *node) { + if (!strcmp(iks_name(node), "stream:features")) { + return 0; + } + if (strcmp(iks_name(node), "handshake")) { ast_log(LOG_ERROR, "Failed to authenticate component '%s'\n", client->name); return -1; @@ -3305,6 +3309,11 @@ static int xmpp_pak_presence(struct ast_xmpp_client *client, struct ast_xmpp_cli int status = pak->show ? pak->show : STATUS_DISAPPEAR; enum ast_device_state state = AST_DEVICE_UNAVAILABLE; + /* If this is a component presence probe request answer immediately with our presence status */ + if (ast_test_flag(&cfg->flags, XMPP_COMPONENT) && !ast_strlen_zero(type) && !strcasecmp(type, "probe")) { + xmpp_client_set_presence(client, pak->from->full, iks_find_attrib(pak->x, "to"), cfg->status, cfg->statusmsg); + } + /* If no resource is available this is a general buddy presence update, which we will ignore */ if (!pak->from->resource) { return 0; @@ -3319,11 +3328,6 @@ static int xmpp_pak_presence(struct ast_xmpp_client *client, struct ast_xmpp_cli return 0; } - /* If this is a component presence probe request answer immediately with our presence status */ - if (ast_test_flag(&cfg->flags, XMPP_COMPONENT) && !ast_strlen_zero(type) && !strcasecmp(type, "probe")) { - xmpp_client_set_presence(client, pak->from->full, iks_find_attrib(pak->x, "to"), cfg->status, cfg->statusmsg); - } - ao2_lock(buddy->resources); if (!(resource = ao2_callback(buddy->resources, OBJ_NOLOCK, xmpp_resource_cmp, pak->from->resource))) { @@ -3864,7 +3868,7 @@ static int xmpp_client_config_post_apply(void *obj, void *arg, int flags) cfg->client->jid = iks_id_new(cfg->client->stack, cfg->user); } - if (!cfg->client->jid || ast_strlen_zero(cfg->client->jid->user)) { + if (!cfg->client->jid || (ast_strlen_zero(cfg->client->jid->user) && !ast_test_flag(&cfg->flags, XMPP_COMPONENT))) { ast_log(LOG_ERROR, "Jabber identity '%s' could not be created for client '%s' - client not active\n", cfg->user, cfg->name); return -1; } |