aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2020-07-15 15:08:56 +0200
committerfiaxh <git@lightrise.org>2020-07-16 23:31:19 +0200
commit7309c6f3ac4e580f197b4835d05bb011fa90780b (patch)
treede269a5c89ea5d7b01d35f011d928f678e076c8f /xmpp-vala/src
parente159fd2492c28c1ef4ab64828ca0e8c2de877b41 (diff)
downloaddino-7309c6f3ac4e580f197b4835d05bb011fa90780b.tar.gz
dino-7309c6f3ac4e580f197b4835d05bb011fa90780b.zip
Visually highlight pending messages, improve resending
Diffstat (limited to 'xmpp-vala/src')
-rw-r--r--xmpp-vala/src/core/xmpp_stream.vala2
-rw-r--r--xmpp-vala/src/module/xep/0198_stream_management.vala14
2 files changed, 11 insertions, 5 deletions
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala
index f4cdf09a..7e7588b1 100644
--- a/xmpp-vala/src/core/xmpp_stream.vala
+++ b/xmpp-vala/src/core/xmpp_stream.vala
@@ -410,7 +410,7 @@ public class StartTlsConnectionProvider : ConnectionProvider {
}
public interface WriteNodeFunc : Object {
- public abstract async void write_stanza(XmppStream stream, StanzaNode node) throws IOError;
+ public abstract async void write_stanza(XmppStream stream, StanzaNode node) throws IOStreamError;
}
}
diff --git a/xmpp-vala/src/module/xep/0198_stream_management.vala b/xmpp-vala/src/module/xep/0198_stream_management.vala
index c44e2c70..bc695ddb 100644
--- a/xmpp-vala/src/module/xep/0198_stream_management.vala
+++ b/xmpp-vala/src/module/xep/0198_stream_management.vala
@@ -25,14 +25,18 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
}
}
- public async void write_stanza(XmppStream stream, StanzaNode node) throws IOError {
+ public async void write_stanza(XmppStream stream, StanzaNode node) throws IOStreamError {
if (stream.has_flag(Flag.IDENTITY)) {
var promise = new Promise<IOError?>();
node_queue.add(new QueueItem(node, promise));
check_queue(stream);
- yield promise.future.wait_async();
+ try {
+ yield promise.future.wait_async();
+ } catch (FutureError e) {
+ throw new IOStreamError.WRITE("Future returned error %i".printf(e.code));
+ }
} else {
yield write_node(stream, node);
}
@@ -141,10 +145,11 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
flags = stream.flags;
stream.write_obj = this;
} else if (node.name == "resumed") {
+ stream.get_flag(Flag.IDENTITY).resumed = true;
+
foreach (XmppStreamFlag flag in flags) {
stream.add_flag(flag);
}
- stream.negotiation_complete = true;
h_outbound = int.parse(node.get_attribute("h", NS_URI));
handle_incoming_h(stream, h_outbound);
@@ -158,7 +163,7 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
stream.received_features_node(stream);
session_id = null;
foreach (var id in in_flight_stanzas.keys) {
- in_flight_stanzas[id].promise.set_exception(new IOError.FAILED("bla"));
+ in_flight_stanzas[id].promise.set_exception(new IOStreamError.WRITE("Stanza not acked and session not resumed"));
}
in_flight_stanzas.clear();
check_queue(stream);
@@ -200,6 +205,7 @@ public class Module : XmppStreamNegotiationModule, WriteNodeFunc {
public class Flag : XmppStreamFlag {
public static FlagIdentity<Flag> IDENTITY = new FlagIdentity<Flag>(NS_URI, "stream_management");
public bool finished = false;
+ public bool resumed = false;
public override string get_ns() { return NS_URI; }
public override string get_id() { return IDENTITY.id; }