summaryrefslogtreecommitdiff
path: root/src/mod_carboncopy.erl
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2016-11-22 22:21:34 +0100
committerHolger Weiss <holger@zedat.fu-berlin.de>2016-11-22 22:21:34 +0100
commit3325e69ae6d625968ce8ec09d9100b5eeca9fb28 (patch)
treeed5c24153c827ef73bc13b297e200296f3b599c5 /src/mod_carboncopy.erl
parentLet ejabberd_sm mark copied messages (diff)
Let mod_carboncopy mark copied messages
Carbon copies are now marked with a 'carbon_copy' flag. This makes it easier to identify them.
Diffstat (limited to 'src/mod_carboncopy.erl')
-rw-r--r--src/mod_carboncopy.erl10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl
index f1eb3e79..5839a65b 100644
--- a/src/mod_carboncopy.erl
+++ b/src/mod_carboncopy.erl
@@ -52,9 +52,10 @@
-callback list(binary(), binary()) -> [{binary(), binary()}].
-spec is_carbon_copy(stanza()) -> boolean().
-is_carbon_copy(Packet) ->
- xmpp:has_subtag(Packet, #carbons_sent{}) orelse
- xmpp:has_subtag(Packet, #carbons_received{}).
+is_carbon_copy(#message{meta = #{carbon_copy := true}}) ->
+ true;
+is_carbon_copy(_) ->
+ false.
start(Host, Opts) ->
IQDisc = gen_mod:get_opt(iqdisc, Opts,fun gen_iq_handler:check_type/1, one_queue),
@@ -203,7 +204,8 @@ build_forward_packet(JID, #message{type = T} = Msg, Sender, Dest, Direction) ->
sent -> #carbons_sent{forwarded = Forwarded};
received -> #carbons_received{forwarded = Forwarded}
end,
- #message{from = Sender, to = Dest, type = T, sub_els = [Carbon]}.
+ #message{from = Sender, to = Dest, type = T, sub_els = [Carbon],
+ meta = #{carbon_copy => true}}.
-spec enable(binary(), binary(), binary(), binary()) -> ok | {error, any()}.
enable(Host, U, R, CC)->