]> granicus.if.org Git - ejabberd/commitdiff
mod_admin_extra: Let send_message omit subject
authorHolger Weiss <holger@zedat.fu-berlin.de>
Wed, 11 Mar 2015 19:56:10 +0000 (20:56 +0100)
committerBadlop <badlop@process-one.net>
Thu, 26 Mar 2015 13:00:48 +0000 (14:00 +0100)
Let the send_message command omit the subject if the user either
specified an empty subject or a message type of "chat".

src/mod_admin_extra.erl

index a98a22cae1b5841cf9d744a2f52dd543a9738011..7729d89fd208c086bf2ee35bc5f1db9d2f70e6dd 100644 (file)
@@ -1406,10 +1406,9 @@ send_packet_all_resources(FromJID, ToU, ToS, ToR, Packet) ->
     ejabberd_router:route(FromJID, ToJID, Packet).
 
 build_packet(Type, Subject, Body) ->
-    Tail = case Subject of
-       <<"chat">> -> [];
-       _ -> [{xmlel, <<"subject">>, [], [{xmlcdata, Subject}]}]
-    end,
+    Tail = if Subject == <<"">>; Type == <<"chat">> -> [];
+             true -> [{xmlel, <<"subject">>, [], [{xmlcdata, Subject}]}]
+          end,
     {xmlel, <<"message">>,
      [{<<"type">>, Type}, {<<"id">>, randoms:get_string()}],
      [{xmlel, <<"body">>, [], [{xmlcdata, Body}]} | Tail]