Fix compiler warnings ('Type `uint8[]' can not be used for a GLib.Object property')

This commit is contained in:
fiaxh 2021-10-12 17:07:59 +02:00
parent 237081e573
commit 9285fd07bf
4 changed files with 21 additions and 8 deletions

View File

@ -211,7 +211,7 @@ public class Handler {
srtp_session.set_encryption_key(Crypto.Srtp.AES_CM_128_HMAC_SHA1_80, client_key.extract(), client_salt.extract());
srtp_session.set_decryption_key(Crypto.Srtp.AES_CM_128_HMAC_SHA1_80, server_key.extract(), server_salt.extract());
}
return new Xmpp.Xep.Jingle.ContentEncryption() { encryption_ns=Xmpp.Xep.JingleIceUdp.DTLS_NS_URI, encryption_name = "DTLS-SRTP", our_key=credentials.own_fingerprint, peer_key=peer_fingerprint };
return new Xmpp.Xep.Jingle.ContentEncryption(Xmpp.Xep.JingleIceUdp.DTLS_NS_URI, "DTLS-SRTP", credentials.own_fingerprint, peer_fingerprint);
}
private static ssize_t pull_function(void* transport_ptr, uint8[] buffer) {

View File

@ -66,7 +66,7 @@ namespace Dino.Plugins.Omemo.DtlsSrtpVerificationDraft {
stream.get_flag(Xep.Jingle.Flag.IDENTITY).get_session.begin(jingle_sid, (_, res) => {
Xep.Jingle.Session? session = stream.get_flag(Xep.Jingle.Flag.IDENTITY).get_session.end(res);
if (session == null || !session.contents_map.has_key(content_name)) return;
var encryption = new OmemoContentEncryption() { encryption_ns=NS_URI, encryption_name="OMEMO", our_key=new uint8[0], peer_key=new uint8[0], sid=device_id_by_jingle_sid[jingle_sid], jid=iq.from.bare_jid };
var encryption = new OmemoContentEncryption(NS_URI, "OMEMO", iq.from.bare_jid, device_id_by_jingle_sid[jingle_sid]);
session.contents_map[content_name].encryptions[NS_URI] = encryption;
if (iq.stanza.get_deep_attribute(Xep.Jingle.NS_URI + ":jingle", "action") == "session-accept") {
@ -143,7 +143,7 @@ namespace Dino.Plugins.Omemo.DtlsSrtpVerificationDraft {
private void on_content_add_received(XmppStream stream, Xep.Jingle.Content content) {
if (!content_names_by_jingle_sid.has_key(content.session.sid) || content_names_by_jingle_sid[content.session.sid].contains(content.content_name)) {
var encryption = new OmemoContentEncryption() { encryption_ns=NS_URI, encryption_name="OMEMO", our_key=new uint8[0], peer_key=new uint8[0], sid=device_id_by_jingle_sid[content.session.sid], jid=content.peer_full_jid.bare_jid };
var encryption = new OmemoContentEncryption(NS_URI, "OMEMO", content.peer_full_jid.bare_jid, device_id_by_jingle_sid[content.session.sid]);
content.encryptions[encryption.encryption_ns] = encryption;
}
}
@ -190,6 +190,12 @@ namespace Dino.Plugins.Omemo.DtlsSrtpVerificationDraft {
public class OmemoContentEncryption : Xep.Jingle.ContentEncryption {
public Jid jid { get; set; }
public int sid { get; set; }
public OmemoContentEncryption(string encryption_ns, string encryption_name, Jid jid, int sid) {
base(encryption_ns, encryption_name);
this.jid = jid;
this.sid = sid;
}
}
}

View File

@ -238,8 +238,15 @@ public class Xmpp.Xep.Jingle.Content : Object {
}
public class Xmpp.Xep.Jingle.ContentEncryption : Object {
public string encryption_ns { get; set; }
public string encryption_name { get; set; }
public uint8[] our_key { get; set; }
public uint8[] peer_key { get; set; }
public string encryption_ns;
public string encryption_name;
public uint8[] our_key;
public uint8[] peer_key;
public class ContentEncryption(string encryption_ns, string encryption_name, uint8[] our_key = new uint8[]{}, uint8[] peer_key = new uint8[]{}) {
this.encryption_ns = encryption_ns;
this.encryption_name = encryption_name;
this.our_key = our_key;
this.peer_key = peer_key;
}
}

View File

@ -133,7 +133,7 @@ public class Xmpp.Xep.JingleRtp.Parameters : Jingle.ContentParameters, Object {
local_crypto = null;
}
if (remote_crypto != null && local_crypto != null) {
var content_encryption = new Xmpp.Xep.Jingle.ContentEncryption() { encryption_ns = "", encryption_name = "SRTP", our_key=local_crypto.key, peer_key=remote_crypto.key };
var content_encryption = new Xmpp.Xep.Jingle.ContentEncryption("", "SRTP", local_crypto.key, remote_crypto.key);
content.encryptions[content_encryption.encryption_name] = content_encryption;
}