diff --git a/res/res_xmpp.c b/res/res_xmpp.c index 2a087b055b9d90eeeaa0faba0f32ceb4c2a72ebb..67e479d8620ebb4da31759fa1382ff748fc56546 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; }