aboutsummaryrefslogtreecommitdiff
path: root/libdino/src
diff options
context:
space:
mode:
Diffstat (limited to 'libdino/src')
-rw-r--r--libdino/src/service/calls.vala15
-rw-r--r--libdino/src/service/notification_events.vala10
2 files changed, 16 insertions, 9 deletions
diff --git a/libdino/src/service/calls.vala b/libdino/src/service/calls.vala
index 7900824e..a77dcb79 100644
--- a/libdino/src/service/calls.vala
+++ b/libdino/src/service/calls.vala
@@ -7,7 +7,7 @@ namespace Dino {
public class Calls : StreamInteractionModule, Object {
- public signal void call_incoming(Call call, CallState state, Conversation conversation, bool video);
+ public signal void call_incoming(Call call, CallState state, Conversation conversation, bool video, bool multiparty);
public signal void call_outgoing(Call call, CallState state, Conversation conversation);
public signal void call_terminated(Call call, string? reason_name, string? reason_text);
@@ -76,6 +76,8 @@ namespace Dino {
}
public async bool can_conversation_do_calls(Conversation conversation) {
+ if (!can_we_do_calls(conversation.account)) return false;
+
if (conversation.type_ == Conversation.Type.CHAT) {
return (yield get_call_resources(conversation.account, conversation.counterpart)).size > 0 || has_jmi_resources(conversation.counterpart);
} else {
@@ -104,7 +106,9 @@ namespace Dino {
if (full_jids == null) return ret;
foreach (Jid full_jid in full_jids) {
- bool supports_rtc = yield stream.get_module(Xep.JingleRtp.Module.IDENTITY).is_available(stream, full_jid);
+ var module = stream.get_module(Xep.JingleRtp.Module.IDENTITY);
+ if (module == null) return ret;
+ bool supports_rtc = yield module.is_available(stream, full_jid);
if (!supports_rtc) continue;
ret.add(full_jid);
}
@@ -236,7 +240,7 @@ namespace Dino {
call_state.we_should_send_audio = true;
if (call.direction == Call.DIRECTION_INCOMING) {
- call_incoming(call, call_state, conversation, video_requested);
+ call_incoming(call, call_state, conversation, video_requested, false);
} else {
call_outgoing(call, call_state, conversation);
}
@@ -414,6 +418,7 @@ namespace Dino {
if (from_jid.equals_bare(account.bare_jid)) return;
if (stream_interactor.get_module(MucManager.IDENTITY).is_own_muc_jid(from_jid, account)) return;
+ bool multiparty = false;
CallState? call_state = null;
foreach (StanzaNode join_method_node in join_methods) {
@@ -428,6 +433,8 @@ namespace Dino {
if (room_jid_str == null) return;
Jid room_jid = new Jid(room_jid_str);
call_state = create_recv_muji_call(account, from_jid, room_jid, message_stanza.type_);
+
+ multiparty = true;
break;
} else if (join_method_node.name == "jingle" && join_method_node.ns_uri == Xep.CallInvites.NS_URI) {
@@ -463,7 +470,7 @@ namespace Dino {
conversation.last_active = call_state.call.time;
if (conversation == null) return;
- call_incoming(call_state.call, call_state, conversation, video_requested);
+ call_incoming(call_state.call, call_state, conversation, video_requested, multiparty);
});
call_invites_module.call_accepted.connect((from_jid, to_jid, call_id, message_type) => {
CallState? call_state = get_call_state_by_call_id(account, call_id, from_jid, to_jid);
diff --git a/libdino/src/service/notification_events.vala b/libdino/src/service/notification_events.vala
index 5b8db842..8771b5a9 100644
--- a/libdino/src/service/notification_events.vala
+++ b/libdino/src/service/notification_events.vala
@@ -30,8 +30,8 @@ public class NotificationEvents : StreamInteractionModule, Object {
stream_interactor.get_module(MucManager.IDENTITY).invite_received.connect((account, room_jid, from_jid, password, reason) => on_invite_received.begin(account, room_jid, from_jid, password, reason));
stream_interactor.get_module(MucManager.IDENTITY).voice_request_received.connect((account, room_jid, from_jid, nick) => on_voice_request_received.begin(account, room_jid, from_jid, nick));
- stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect((call, state, conversation, video) => on_call_incoming.begin(call, state, conversation, video));
- stream_interactor.connection_manager.connection_error.connect((account, error) => on_connection_error(account, error));
+ stream_interactor.get_module(Calls.IDENTITY).call_incoming.connect((call, state, conversation, video, multiparty) => on_call_incoming.begin(call, state, conversation, video, multiparty));
+ stream_interactor.connection_manager.connection_error.connect((account, error) => on_connection_error.begin(account, error));
stream_interactor.get_module(ChatInteraction.IDENTITY).focused_in.connect((conversation) => on_focused_in.begin(conversation));
notifier_promise = new Promise<NotificationProvider>();
@@ -117,12 +117,12 @@ public class NotificationEvents : StreamInteractionModule, Object {
yield notifier.notify_subscription_request(conversation);
}
- private async void on_call_incoming(Call call, CallState call_state, Conversation conversation, bool video) {
+ private async void on_call_incoming(Call call, CallState call_state, Conversation conversation, bool video, bool multiparty) {
if (!stream_interactor.get_module(Calls.IDENTITY).can_we_do_calls(call.account)) return;
string conversation_display_name = get_conversation_display_name(stream_interactor, conversation, null);
NotificationProvider notifier = yield notifier.wait_async();
- yield notifier.notify_call(call, conversation, video, conversation_display_name);
+ yield notifier.notify_call(call, conversation, video, multiparty, conversation_display_name);
call.notify["state"].connect(() => {
if (call.state != Call.State.RINGING) {
notifier.retract_call_notification.begin(call, conversation);
@@ -160,7 +160,7 @@ public interface NotificationProvider : Object {
public abstract async void notify_message(Message message, Conversation conversation, string conversation_display_name, string? participant_display_name);
public abstract async void notify_file(FileTransfer file_transfer, Conversation conversation, bool is_image, string conversation_display_name, string? participant_display_name);
- public abstract async void notify_call(Call call, Conversation conversation, bool video, string conversation_display_name);
+ public abstract async void notify_call(Call call, Conversation conversation, bool video, bool multiparty, string conversation_display_name);
public abstract async void retract_call_notification(Call call, Conversation conversation);
public abstract async void notify_subscription_request(Conversation conversation);
public abstract async void notify_connection_error(Account account, ConnectionManager.ConnectionError error);