aboutsummaryrefslogtreecommitdiffstats
path: root/res/res_jabber.c
diff options
context:
space:
mode:
authorphsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-02 14:32:53 +0000
committerphsultan <phsultan@f38db490-d61c-443f-a65b-d21fe96a405b>2008-06-02 14:32:53 +0000
commitca32b1a38e9503b4b453a298fe8b06e5659d071a (patch)
tree9f1c6c0a4992e5d867eb760d478416f6f64b596a /res/res_jabber.c
parentc99b1330741e025ba30580a77b1de7f951b80e15 (diff)
Do not link the guest account with any configured XMPP client (in
jabber.conf). The actual connection is made when a call comes in Asterisk. Fix the ast_aji_get_client function that was not able to retrieve an XMPP client from its JID. (closes issue #12085) Reported by: junky Tested by: phsultan git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@119740 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res/res_jabber.c')
-rw-r--r--res/res_jabber.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c
index 687bc1c33..4decdf4d6 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -2359,17 +2359,30 @@ static int aji_load_config(void)
}
/*!
- * \brief grab a aji_client structure by label name.
- * \param void.
- * \return 1.
+ * \brief grab a aji_client structure by label name or JID
+ * (without the resource string)
+ * \param name label or JID
+ * \return aji_client.
*/
struct aji_client *ast_aji_get_client(const char *name)
{
struct aji_client *client = NULL;
+ char *aux = NULL;
client = ASTOBJ_CONTAINER_FIND(&clients, name);
- if (!client && !strchr(name, '@'))
- client = ASTOBJ_CONTAINER_FIND_FULL(&clients, name, user,,, strcasecmp);
+ if (!client && strchr(name, '@')) {
+ ASTOBJ_CONTAINER_TRAVERSE(&clients, 1, {
+ aux = ast_strdupa(iterator->user);
+ if (strchr(aux, '/')) {
+ /* strip resource for comparison */
+ aux = strsep(&aux, "/");
+ }
+ if (!strcasecmp(aux, name)) {
+ client = iterator;
+ }
+ });
+ }
+
return client;
}