res_xmpp and res_jabber need to search 'cachable' in the attrib section of the receiv...
authorAlec L Davis <sivad.a@paradise.net.nz>
Tue, 16 Apr 2013 23:44:18 +0000 (23:44 +0000)
committerAlec L Davis <sivad.a@paradise.net.nz>
Tue, 16 Apr 2013 23:44:18 +0000 (23:44 +0000)
(issue ASTERISK-20175)
(closes issue ASTERISK-21429)
(closes issue ASTERISK-21069)
(closes issue ASTERISK-21164)

Reported by: alecdavis
Tested by: alecdavis
alecdavis (license 585)

Review https://reviewboard.asterisk.org/r/2452/

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@385939 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_jabber.c
res/res_xmpp.c

index 04bc614..69f3665 100644 (file)
@@ -3355,10 +3355,10 @@ static int aji_handle_pubsub_event(void *data, ikspak *pak)
                return IKS_FILTER_EAT;
        }
        if (!strcasecmp(iks_name(item_content), "state")) {
-               device_state = iks_find_cdata(item, "state");
-               if ((cachable_str = iks_find_cdata(item, "cachable"))) {
+               if ((cachable_str = iks_find_attrib(item_content, "cachable"))) {
                        sscanf(cachable_str, "%30d", &cachable);
                }
+               device_state = iks_find_cdata(item, "state");
                ast_publish_device_state_full(item_id,
                                                ast_devstate_val(device_state),
                                                cachable == AST_DEVSTATE_CACHABLE ? AST_DEVSTATE_CACHABLE : AST_DEVSTATE_NOT_CACHABLE,
index f9cfdac..dea8372 100644 (file)
@@ -1470,10 +1470,10 @@ static int xmpp_pubsub_handle_event(void *data, ikspak *pak)
                return IKS_FILTER_EAT;
        }
        if (!strcasecmp(iks_name(item_content), "state")) {
-               device_state = iks_find_cdata(item, "state");
-               if ((cachable_str = iks_find_cdata(item, "cachable"))) {
+               if ((cachable_str = iks_find_attrib(item_content, "cachable"))) {
                        sscanf(cachable_str, "%30d", &cachable);
                }
+               device_state = iks_find_cdata(item, "state");
                ast_publish_device_state_full(item_id,
                                                ast_devstate_val(device_state),
                                                cachable == AST_DEVSTATE_CACHABLE ? AST_DEVSTATE_CACHABLE : AST_DEVSTATE_NOT_CACHABLE,