From 7ca2ae69477692d14ed5b48a53a2f0245b99b201 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Wed, 11 Mar 2015 20:56:10 +0100 Subject: [PATCH] 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". --- mod_admin_extra/src/mod_admin_extra.erl | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mod_admin_extra/src/mod_admin_extra.erl b/mod_admin_extra/src/mod_admin_extra.erl index a98a22c..7729d89 100644 --- a/mod_admin_extra/src/mod_admin_extra.erl +++ b/mod_admin_extra/src/mod_admin_extra.erl @@ -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]