Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/processone/ejabberd.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2014-05-12 01:52:20 +0400
committerHolger Weiss <holger@zedat.fu-berlin.de>2014-05-12 01:52:20 +0400
commit9b16d09261f7008bb2d9f64fbb32a047c8118389 (patch)
treea587d55e4a3ea3e2da17777bc1959a8d6ab8f858 /src/mod_carboncopy.erl
parent5d22159e9a4cd7f94e4f0285d78e2ecbcd8a04cf (diff)
Don't carbon copy messages with <no-copy/> hint
Honor the <no-copy/> hint defined in XEP-0334.
Diffstat (limited to 'src/mod_carboncopy.erl')
-rw-r--r--src/mod_carboncopy.erl37
1 files changed, 21 insertions, 16 deletions
diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl
index 16f0c06fc..6f3101fcd 100644
--- a/src/mod_carboncopy.erl
+++ b/src/mod_carboncopy.erl
@@ -143,24 +143,29 @@ check_and_forward(JID, To, #xmlel{name = <<"message">>, attrs = Attrs} = Packet,
<<"chat">> ->
case xml:get_subtag(Packet, <<"private">>) of
false ->
- case xml:get_subtag(Packet,<<"received">>) of
+ case xml:get_subtag(Packet, <<"no-copy">>) of
false ->
- %% We must check if a packet contains "<sent><forwarded></sent></forwarded>" tags in order to avoid
- %% receiving message back to original sender.
- SubTag = xml:get_subtag(Packet,<<"sent">>),
- if SubTag == false ->
- send_copies(JID, To, Packet, Direction);
- true ->
- case xml:get_subtag(SubTag,<<"forwarded">>) of
- false->
- send_copies(JID, To, Packet, Direction);
- _ ->
- stop
- end
- end;
+ case xml:get_subtag(Packet,<<"received">>) of
+ false ->
+ %% We must check if a packet contains "<sent><forwarded></sent></forwarded>"
+ %% tags in order to avoid receiving message back to original sender.
+ SubTag = xml:get_subtag(Packet,<<"sent">>),
+ if SubTag == false ->
+ send_copies(JID, To, Packet, Direction);
+ true ->
+ case xml:get_subtag(SubTag,<<"forwarded">>) of
+ false->
+ send_copies(JID, To, Packet, Direction);
+ _ ->
+ stop
+ end
+ end;
+ _ ->
+ %% stop the hook chain, we don't want mod_logdb to register this message (duplicate)
+ stop
+ end;
_ ->
- %% stop the hook chain, we don't want mod_logdb to register this message (duplicate)
- stop
+ ok
end;
_ ->
ok