aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authormogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-03 22:35:43 +0000
committermogorman <mogorman@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-03 22:35:43 +0000
commite225c770d1d5319b1442606829a92d8d73db8ea8 (patch)
tree8ae34088e4a2d9b4ffacf7e027fbe8e2c087a9a4 /res
parentd0ecdbc0e6148607c6e0fb99efca30460ebce5a4 (diff)
fix issue with dialing client without resource.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@44312 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_jabber.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/res/res_jabber.c b/res/res_jabber.c
index 9a4b52db6..d9b76c630 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -871,7 +871,6 @@ static int aji_client_info_handler(void *data, ikspak *pak)
struct aji_buddy *buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, pak->from->partial);
resource = aji_find_resource(buddy, pak->from->resource);
-
if (pak->subtype == IKS_TYPE_RESULT) {
if (!resource) {
ast_log(LOG_NOTICE,"JABBER: Received client info from %s when not requested.\n", pak->from->full);
@@ -927,13 +926,26 @@ static int aji_client_info_handler(void *data, ikspak *pak)
static int aji_dinfo_handler(void *data, ikspak *pak)
{
struct aji_client *client = ASTOBJ_REF((struct aji_client *) data);
- char *node = NULL, *type = NULL;
- type = iks_find_attrib(pak->x,"type");
- if (!strcasecmp(type,"error")) {
+ char *node = NULL;
+ struct aji_resource *resource = NULL;
+ struct aji_buddy *buddy = ASTOBJ_CONTAINER_FIND(&client->buddies, pak->from->partial);
+
+ resource = aji_find_resource(buddy, pak->from->resource);
+ if (pak->subtype == IKS_TYPE_ERROR) {
ast_log(LOG_WARNING, "Recieved error from a client, turn on jabber debug!\n");
return IKS_FILTER_EAT;
}
- if (!strcasecmp(type,"get") && !(node = iks_find_attrib(pak->query, "node"))) {
+ if (pak->subtype == IKS_TYPE_RESULT) {
+ if (!resource) {
+ ast_log(LOG_NOTICE,"JABBER: Received client info from %s when not requested.\n", pak->from->full);
+ ASTOBJ_UNREF(client, aji_client_destroy);
+ return IKS_FILTER_EAT;
+ }
+ if (iks_find_with_attrib(pak->query, "feature", "var", "http://www.google.com/xmpp/protocol/voice/v1")) {
+ resource->cap->jingle = 1;
+ } else
+ resource->cap->jingle = 0;
+ } else if (pak->subtype == IKS_TYPE_GET && !(node = iks_find_attrib(pak->query, "node"))) {
iks *iq, *query, *identity, *disco, *reg, *commands, *gateway, *version, *vcard, *search;
iq = iks_new("iq");
@@ -999,7 +1011,7 @@ static int aji_dinfo_handler(void *data, ikspak *pak)
if (search)
iks_delete(search);
- } else if (!strcasecmp(type,"get") && !strcasecmp(node, "http://jabber.org/protocol/commands")) {
+ } else if (pak->subtype == IKS_TYPE_GET && !strcasecmp(node, "http://jabber.org/protocol/commands")) {
iks *iq, *query, *confirm;
iq = iks_new("iq");
query = iks_new("query");
@@ -1028,7 +1040,7 @@ static int aji_dinfo_handler(void *data, ikspak *pak)
if (confirm)
iks_delete(confirm);
- } else if (!strcasecmp(type,"get") && !strcasecmp(node, "confirmaccount")) {
+ } else if (pak->subtype == IKS_TYPE_GET && !strcasecmp(node, "confirmaccount")) {
iks *iq, *query, *feature;
iq = iks_new("iq");