aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep/0166_jingle
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2021-11-04 17:33:08 +0100
committerfiaxh <git@lightrise.org>2021-11-10 11:05:34 +0100
commit26d10d1dcb95f11b65611473c9840e13683cb5ec (patch)
treefb09e36aba28ff1b971ea11ad3da2dd3d92f31d4 /xmpp-vala/src/module/xep/0166_jingle
parent38944d702331bb9d7a91d8ed05a33c935562e3c0 (diff)
downloaddino-26d10d1dcb95f11b65611473c9840e13683cb5ec.tar.gz
dino-26d10d1dcb95f11b65611473c9840e13683cb5ec.zip
Add multiparty call support to libdino and xmpp-vala
Diffstat (limited to 'xmpp-vala/src/module/xep/0166_jingle')
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/component.vala2
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/content.vala15
-rw-r--r--xmpp-vala/src/module/xep/0166_jingle/session.vala5
3 files changed, 16 insertions, 6 deletions
diff --git a/xmpp-vala/src/module/xep/0166_jingle/component.vala b/xmpp-vala/src/module/xep/0166_jingle/component.vala
index 5d573522..e30175d5 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/component.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/component.vala
@@ -2,6 +2,8 @@ namespace Xmpp.Xep.Jingle {
public abstract class ComponentConnection : Object {
public uint8 component_id { get; set; default = 0; }
+ public ulong bytes_sent { get; protected set; default=0; }
+ public ulong bytes_received { get; protected set; default=0; }
public abstract async void terminate(bool we_terminated, string? reason_name = null, string? reason_text = null);
public signal void connection_closed();
public signal void connection_error(IOError e);
diff --git a/xmpp-vala/src/module/xep/0166_jingle/content.vala b/xmpp-vala/src/module/xep/0166_jingle/content.vala
index b51bb26d..31d8f9fc 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/content.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/content.vala
@@ -95,16 +95,27 @@ public class Xmpp.Xep.Jingle.Content : Object {
}
public void accept() {
+ if (state != State.PENDING) {
+ warning("accepting a non-pending content");
+ return;
+ }
state = State.WANTS_TO_BE_ACCEPTED;
-
session.accept_content(this);
}
public void reject() {
+ if (state != State.PENDING) {
+ warning("rejecting a non-pending content");
+ return;
+ }
session.reject_content(this);
}
public void terminate(bool we_terminated, string? reason_name, string? reason_text) {
+ if (state == State.PENDING) {
+ warning("terminating a pending call");
+ return;
+ }
content_params.terminate(we_terminated, reason_name, reason_text);
transport_params.dispose();
@@ -137,7 +148,7 @@ public class Xmpp.Xep.Jingle.Content : Object {
this.content_params.handle_accept(stream, this.session, this, content_node.description);
}
- private async void select_new_transport() {
+ public async void select_new_transport() {
XmppStream stream = session.stream;
Transport? new_transport = yield stream.get_module(Module.IDENTITY).select_transport(stream, transport.type_, transport_params.components, peer_full_jid, tried_transport_methods);
if (new_transport == null) {
diff --git a/xmpp-vala/src/module/xep/0166_jingle/session.vala b/xmpp-vala/src/module/xep/0166_jingle/session.vala
index a45fc6db..af913aab 100644
--- a/xmpp-vala/src/module/xep/0166_jingle/session.vala
+++ b/xmpp-vala/src/module/xep/0166_jingle/session.vala
@@ -264,10 +264,7 @@ public class Xmpp.Xep.Jingle.Session : Object {
warning("Received invalid session accept: %s", e.message);
}
}
- // TODO(hrxi): more sanity checking, perhaps replace who we're talking to
- if (!responder.is_full()) {
- throw new IqError.BAD_REQUEST("invalid responder JID");
- }
+
foreach (ContentNode content_node in content_nodes) {
handle_content_accept(content_node);
}