aboutsummaryrefslogtreecommitdiff
path: root/libdino
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-04-29 15:03:37 +0200
committerfiaxh <git@lightrise.org>2021-04-29 16:14:17 +0200
commit4c6664a365bb64904078c07c588f129456583457 (patch)
tree4b386cbfdb0ea3bd65bc5448c0a38a2aa1008519 /libdino
parent421f43dd8bd993eb88581e1b5011cc061ceb4fc8 (diff)
downloaddino-4c6664a365bb64904078c07c588f129456583457.tar.gz
dino-4c6664a365bb64904078c07c588f129456583457.zip
Improve JMI handling (type=chat, filter message sender)
Diffstat (limited to 'libdino')
-rw-r--r--libdino/src/service/calls.vala12
1 files changed, 11 insertions, 1 deletions
diff --git a/libdino/src/service/calls.vala b/libdino/src/service/calls.vala
index 3615e24f..26a0492a 100644
--- a/libdino/src/service/calls.vala
+++ b/libdino/src/service/calls.vala
@@ -185,8 +185,8 @@ namespace Dino {
if (stream == null) return;
string sid = sid_by_call[call.account][call];
- stream.get_module(Xep.JingleMessageInitiation.Module.IDENTITY).send_session_reject_to_self(stream, sid);
stream.get_module(Xep.JingleMessageInitiation.Module.IDENTITY).send_session_reject_to_peer(stream, call.counterpart, sid);
+ stream.get_module(Xep.JingleMessageInitiation.Module.IDENTITY).send_session_reject_to_self(stream, sid);
remove_call_from_datastructures(call);
}
}
@@ -632,6 +632,11 @@ namespace Dino {
mi_module.session_rejected.connect((from, to, sid) => {
if (!call_by_sid[account].has_key(sid)) return;
Call call = call_by_sid[account][sid];
+
+ bool outgoing_reject = call.direction == Call.DIRECTION_OUTGOING && from.equals_bare(call.counterpart);
+ bool incoming_reject = call.direction == Call.DIRECTION_INCOMING && from.equals_bare(account.bare_jid);
+ if (!(outgoing_reject || incoming_reject)) return;
+
call.state = Call.State.DECLINED;
remove_call_from_datastructures(call);
call_terminated(call, null, null);
@@ -639,6 +644,11 @@ namespace Dino {
mi_module.session_retracted.connect((from, to, sid) => {
if (!call_by_sid[account].has_key(sid)) return;
Call call = call_by_sid[account][sid];
+
+ bool outgoing_retract = call.direction == Call.DIRECTION_OUTGOING && from.equals_bare(call.counterpart);
+ bool incoming_retract = call.direction == Call.DIRECTION_INCOMING && from.equals_bare(account.bare_jid);
+ if (!(outgoing_retract || incoming_retract)) return;
+
call.state = Call.State.MISSED;
remove_call_from_datastructures(call);
call_terminated(call, null, null);