mod_admin_extra: Let send_message omit subject

Let the send_message command omit the subject if the user either
specified an empty subject or a message type of "chat".
This commit is contained in:
Holger Weiss 2015-03-11 20:56:10 +01:00
parent 94c690661b
commit 7ca2ae6947
1 changed files with 3 additions and 4 deletions

View File

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