aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2014-05-30 23:36:02 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2014-05-30 23:36:02 +0200
commitbb952f9ecc7dac549ace3ac0d02cb5621e1749e8 (patch)
tree31475d174b819ba5081ac2c6d1b800d0c942eab5 /src
parentDon't send XEP-0280 v1 copies back to sender (diff)
Let is_carbon_copy/1 recognize <received/> carbons
The mod_carboncopy:is_carbon_copy/1 function now returns true not only for <sent/>, but also for <received/> carbon copies.
Diffstat (limited to 'src')
-rw-r--r--src/mod_carboncopy.erl20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl
index 009d17ed2..4cf3bed71 100644
--- a/src/mod_carboncopy.erl
+++ b/src/mod_carboncopy.erl
@@ -57,15 +57,19 @@
version :: binary() | matchspec_atom()}).
is_carbon_copy(Packet) ->
- case xml:get_subtag(Packet, <<"sent">>) of
- #xmlel{name= <<"sent">>, attrs = AAttrs} ->
- case xml:get_attr_s(<<"xmlns">>, AAttrs) of
- ?NS_CC_2 -> true;
- ?NS_CC_1 -> true;
- _ -> false
- end;
+ is_carbon_copy(Packet, <<"sent">>) orelse
+ is_carbon_copy(Packet, <<"received">>).
+
+is_carbon_copy(Packet, Direction) ->
+ case xml:get_subtag(Packet, Direction) of
+ #xmlel{name = Direction, attrs = Attrs} ->
+ case xml:get_attr_s(<<"xmlns">>, Attrs) of
+ ?NS_CC_2 -> true;
+ ?NS_CC_1 -> true;
_ -> false
- end.
+ end;
+ _ -> false
+ end.
start(Host, Opts) ->
IQDisc = gen_mod:get_opt(iqdisc, Opts,fun gen_iq_handler:check_type/1, one_queue),