]> granicus.if.org Git - ejabberd/commitdiff
Always include <actions/> with ad-hoc responses
authorHolger Weiss <holger@zedat.fu-berlin.de>
Thu, 13 Oct 2016 20:34:29 +0000 (22:34 +0200)
committerHolger Weiss <holger@zedat.fu-berlin.de>
Thu, 13 Oct 2016 20:34:29 +0000 (22:34 +0200)
XEP-0050 says: "The result for each stage (other than the last) of a
command's execution SHOULD include an <actions/> element."  Some clients
insist on this.

src/adhoc.erl

index 6970584f97cf4a486d654513679a0f8de063eb7e..23ffd8dd860cf20a967d51c199aa950d7ce4f741 100644 (file)
@@ -112,9 +112,17 @@ produce_response(
         ProvidedSessionID /= <<"">> -> ProvidedSessionID;
         true                        -> jlib:now_to_utc_string(p1_time_compat:timestamp())
     end,
-    case Actions of
-        [] ->
+    case {Actions, Status} of
+        {[], completed} ->
             ActionsEls = [];
+        {[], _} ->
+            ActionsEls = [
+                #xmlel{
+                    name = <<"actions">>,
+                    attrs = [{<<"execute">>, <<"complete">>}],
+                    children = [#xmlel{name = <<"complete">>}]
+                }
+            ];
         _ ->
             case DefaultAction of
                 <<"">> -> ActionsElAttrs = [];