Fix OMEMO plugin for latest changes
This commit is contained in:
parent
d5ea5172a7
commit
766af21d87
|
@ -256,7 +256,7 @@ public class Module : XmppStreamModule {
|
||||||
|
|
||||||
public void start_session_with(XmppStream stream, string bare_jid, int device_id) {
|
public void start_session_with(XmppStream stream, string bare_jid, int device_id) {
|
||||||
print(@"Asking for bundle from $bare_jid/$device_id\n");
|
print(@"Asking for bundle from $bare_jid/$device_id\n");
|
||||||
stream.get_module(Pubsub.Module.IDENTITY).request(stream, bare_jid, @"$NODE_BUNDLES:$device_id", new OtherBundleResponseListener(store, device_id));
|
stream.get_module(Pubsub.Module.IDENTITY).request(stream, bare_jid, @"$NODE_BUNDLES:$device_id", on_other_bundle_result, Tuple.create(store, device_id));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ignore_device(string jid, int32 device_id) {
|
public void ignore_device(string jid, int32 device_id) {
|
||||||
|
@ -276,16 +276,11 @@ public class Module : XmppStreamModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OtherBundleResponseListener : Pubsub.RequestResponseListener, Object {
|
private static void on_other_bundle_result(XmppStream stream, string jid, string? id, StanzaNode? node, Object? storage) {
|
||||||
private Store store;
|
Tuple<Store, int> tuple = (Tuple<Store, int>)storage;
|
||||||
private int device_id;
|
Store store = tuple.a;
|
||||||
|
int device_id = tuple.b;
|
||||||
|
|
||||||
public OtherBundleResponseListener(Store store, int device_id) {
|
|
||||||
this.store = store;
|
|
||||||
this.device_id = device_id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void on_result(XmppStream stream, string jid, string? id, StanzaNode? node) {
|
|
||||||
bool fail = false;
|
bool fail = false;
|
||||||
if (node == null) {
|
if (node == null) {
|
||||||
// Device not registered, shouldn't exist
|
// Device not registered, shouldn't exist
|
||||||
|
@ -325,20 +320,13 @@ public class Module : XmppStreamModule {
|
||||||
get_module(stream).ignore_device(jid, device_id);
|
get_module(stream).ignore_device(jid, device_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void publish_bundles_if_needed(XmppStream stream, string jid) {
|
public void publish_bundles_if_needed(XmppStream stream, string jid) {
|
||||||
stream.get_module(Pubsub.Module.IDENTITY).request(stream, jid, @"$NODE_BUNDLES:$(store.local_registration_id)", new SelfBundleResponseListener(store));
|
stream.get_module(Pubsub.Module.IDENTITY).request(stream, jid, @"$NODE_BUNDLES:$(store.local_registration_id)", on_self_bundle_result, store);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SelfBundleResponseListener : Pubsub.RequestResponseListener, Object {
|
private static void on_self_bundle_result(XmppStream stream, string jid, string? id, StanzaNode? node, Object? storage) {
|
||||||
private Store store;
|
Store store = (Store)storage;
|
||||||
|
|
||||||
public SelfBundleResponseListener(Store store) {
|
|
||||||
this.store = store;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void on_result(XmppStream stream, string jid, string? id, StanzaNode? node) {
|
|
||||||
Map<int, ECPublicKey> keys = new HashMap<int, ECPublicKey>();
|
Map<int, ECPublicKey> keys = new HashMap<int, ECPublicKey>();
|
||||||
ECPublicKey identity_key = null;
|
ECPublicKey identity_key = null;
|
||||||
IdentityKeyPair identity_key_pair = null;
|
IdentityKeyPair identity_key_pair = null;
|
||||||
|
@ -400,7 +388,6 @@ public class Module : XmppStreamModule {
|
||||||
publish_bundles(stream, signed_pre_key_record, identity_key_pair, pre_key_records, (int32) store.local_registration_id);
|
publish_bundles(stream, signed_pre_key_record, identity_key_pair, pre_key_records, (int32) store.local_registration_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public static void publish_bundles(XmppStream stream, SignedPreKeyRecord signed_pre_key_record, IdentityKeyPair identity_key_pair, Set<PreKeyRecord> pre_key_records, int32 device_id) {
|
public static void publish_bundles(XmppStream stream, SignedPreKeyRecord signed_pre_key_record, IdentityKeyPair identity_key_pair, Set<PreKeyRecord> pre_key_records, int32 device_id) {
|
||||||
ECKeyPair tmp;
|
ECKeyPair tmp;
|
||||||
|
|
Loading…
Reference in a new issue