summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2016-02-04 12:26:49 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2016-02-04 12:26:49 -0600
commit8b311bebd84e2d255de5330fc7ee1ffdce59d092 (patch)
treee1403203a86c26fcfff78e2c88674bc88faba80d
parentd83dba7099f990027e1d6408c12a2ef9b0db3af0 (diff)
parent2a6f18cd55d0108e7a3de2f6f71602c11ac2d485 (diff)
Merge "res_xmpp: Does not connect in component mode"
-rw-r--r--res/res_xmpp.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/res/res_xmpp.c b/res/res_xmpp.c
index 2a087b055..67e479d86 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;
}