diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2018-02-22 00:40:09 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2018-02-22 00:40:09 +0100 |
commit | 7a1ed065fe61266d720a265f0ba26944225227b9 (patch) | |
tree | 5a84c135988759fe2228c6959292fb279490ceb9 | |
parent | Move some log messages to debug level (diff) |
mod_carboncopy: Copy outgoing MUC PMs
Incoming MUC PMs aren't carbon-copied, as the MUC service usually forks
them. However, don't suppress copying of outgoing PMs, where no such
forking takes place.
Diffstat (limited to '')
-rw-r--r-- | src/mod_carboncopy.erl | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/mod_carboncopy.erl b/src/mod_carboncopy.erl index dd6a1d646..8794e4087 100644 --- a/src/mod_carboncopy.erl +++ b/src/mod_carboncopy.erl @@ -164,7 +164,7 @@ user_receive_packet({Packet, #{jid := JID} = C2SState}) -> stanza() | {stop, stanza()}. check_and_forward(JID, To, Packet, Direction)-> case is_chat_message(Packet) andalso - not is_muc_pm(To, Packet) andalso + not is_received_muc_pm(To, Packet, Direction) andalso xmpp:has_subtag(Packet, #carbons_private{}) == false andalso xmpp:has_subtag(Packet, #hint{type = 'no-copy'}) == false of true -> @@ -282,9 +282,12 @@ is_chat_message(#message{type = normal, body = [_|_]}) -> is_chat_message(_) -> false. -is_muc_pm(#jid{lresource = <<>>}, _Packet) -> +-spec is_received_muc_pm(jid(), message(), direction()) -> boolean(). +is_received_muc_pm(#jid{lresource = <<>>}, _Packet, _Direction) -> false; -is_muc_pm(_To, Packet) -> +is_received_muc_pm(_To, _Packet, sent) -> + false; +is_received_muc_pm(_To, Packet, received) -> xmpp:has_subtag(Packet, #muc_user{}). -spec list(binary(), binary()) -> [{Resource :: binary(), Namespace :: binary()}]. |