aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdino/src/service/presence_manager.vala4
-rw-r--r--qlite/src/query_builder.vala11
-rw-r--r--xmpp-vala/src/module/presence/module.vala4
3 files changed, 17 insertions, 2 deletions
diff --git a/libdino/src/service/presence_manager.vala b/libdino/src/service/presence_manager.vala
index 0525100b..e832687d 100644
--- a/libdino/src/service/presence_manager.vala
+++ b/libdino/src/service/presence_manager.vala
@@ -10,6 +10,7 @@ public class PresenceManager : StreamInteractionModule, Object {
public signal void show_received(Show show, Jid jid, Account account);
public signal void received_subscription_request(Jid jid, Account account);
+ public signal void received_subscription_approval(Jid jid, Account account);
private StreamInteractor stream_interactor;
private HashMap<Jid, HashMap<Jid, ArrayList<Show>>> shows = new HashMap<Jid, HashMap<Jid, ArrayList<Show>>>(Jid.hash_bare_func, Jid.equals_bare_func);
@@ -94,6 +95,9 @@ public class PresenceManager : StreamInteractionModule, Object {
}
received_subscription_request(jid, account);
});
+ stream_interactor.module_manager.get_module(account, Presence.Module.IDENTITY).received_subscription_approval.connect((stream, jid) => {
+ received_subscription_approval(jid, account);
+ });
}
private void on_received_available_show(Account account, Jid jid, string show) {
diff --git a/qlite/src/query_builder.vala b/qlite/src/query_builder.vala
index 75fe0499..915e2d2d 100644
--- a/qlite/src/query_builder.vala
+++ b/qlite/src/query_builder.vala
@@ -20,8 +20,9 @@ public class QueryBuilder : StatementBuilder {
// ORDER BY [...]
private OrderingTerm[]? order_by_terms = {};
- // LIMIT [...]
+ // LIMIT [...] OFFSET [...]
private int limit_val;
+ private int offset_val;
internal QueryBuilder(Database db) {
base(db);
@@ -103,6 +104,12 @@ public class QueryBuilder : StatementBuilder {
return this;
}
+ public QueryBuilder offset(int offset) {
+ if (this.limit_val == 0) error("limit required before offset");
+ this.offset_val = offset;
+ return this;
+ }
+
public QueryBuilder single() {
this.single_result = true;
return limit(1);
@@ -128,7 +135,7 @@ public class QueryBuilder : StatementBuilder {
}
internal override Statement prepare() {
- Statement stmt = db.prepare(@"SELECT $column_selector $(table_name == null ? "" : @"FROM $((!) table_name)") WHERE $selection $(OrderingTerm.all_to_string(order_by_terms)) $(limit_val > 0 ? @" LIMIT $limit_val" : "")");
+ Statement stmt = db.prepare(@"SELECT $column_selector $(table_name == null ? "" : @"FROM $((!) table_name)") WHERE $selection $(OrderingTerm.all_to_string(order_by_terms)) $(limit_val > 0 ? @" LIMIT $limit_val OFFSET $offset_val" : "")");
for (int i = 0; i < selection_args.length; i++) {
selection_args[i].bind(stmt, i+1);
}
diff --git a/xmpp-vala/src/module/presence/module.vala b/xmpp-vala/src/module/presence/module.vala
index cbc7d365..12b40245 100644
--- a/xmpp-vala/src/module/presence/module.vala
+++ b/xmpp-vala/src/module/presence/module.vala
@@ -11,6 +11,7 @@ namespace Xmpp.Presence {
public signal void received_available_show(XmppStream stream, Jid jid, string show);
public signal void received_unavailable(XmppStream stream, Presence.Stanza presence);
public signal void received_subscription_request(XmppStream stream, Jid jid);
+ public signal void received_subscription_approval(XmppStream stream, Jid jid);
public signal void received_unsubscription(XmppStream stream, Jid jid);
public bool available_resource = true;
@@ -79,6 +80,9 @@ namespace Xmpp.Presence {
case Presence.Stanza.TYPE_SUBSCRIBE:
received_subscription_request(stream, presence.from);
break;
+ case Presence.Stanza.TYPE_SUBSCRIBED:
+ received_subscription_approval(stream, presence.from);
+ break;
case Presence.Stanza.TYPE_UNSUBSCRIBE:
stream.get_flag(Flag.IDENTITY).remove_presence(presence.from);
received_unsubscription(stream, presence.from);