aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala
diff options
context:
space:
mode:
Diffstat (limited to 'xmpp-vala')
-rw-r--r--xmpp-vala/CMakeLists.txt7
-rw-r--r--xmpp-vala/meson.build7
-rw-r--r--xmpp-vala/src/core/module_flag.vala10
-rw-r--r--xmpp-vala/src/core/xmpp_stream.vala4
-rw-r--r--xmpp-vala/src/module/xep/0004_data_forms.vala2
-rw-r--r--xmpp-vala/src/module/xep/0082_date_time_profiles.vala16
-rw-r--r--xmpp-vala/src/module/xep/0384_omemo/omemo_encryptor.vala36
-rw-r--r--xmpp-vala/xmpp-vala.deps5
8 files changed, 51 insertions, 36 deletions
diff --git a/xmpp-vala/CMakeLists.txt b/xmpp-vala/CMakeLists.txt
index 39c090fe..cfbc0aaf 100644
--- a/xmpp-vala/CMakeLists.txt
+++ b/xmpp-vala/CMakeLists.txt
@@ -9,6 +9,11 @@ find_packages(ENGINE_PACKAGES REQUIRED
set(ENGINE_EXTRA_OPTIONS ${MAIN_EXTRA_OPTIONS} --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi)
+set(ENGINE_DEFINITIONS)
+if(VALA_VERSION VERSION_EQUAL "0.56.11")
+ set(ENGINE_DEFINITIONS ${ENGINE_DEFINITIONS} VALA_0_56_11)
+endif()
+
vala_precompile(ENGINE_VALA_C
SOURCES
"src/core/direct_tls_xmpp_stream.vala"
@@ -152,6 +157,8 @@ CUSTOM_VAPIS
"${CMAKE_CURRENT_SOURCE_DIR}/src/glib_fixes.vapi"
OPTIONS
${ENGINE_EXTRA_OPTIONS}
+DEFINITIONS
+ ${ENGINE_DEFINITIONS}
)
add_custom_target(xmpp-vala-vapi
diff --git a/xmpp-vala/meson.build b/xmpp-vala/meson.build
index 3064339a..be5e96a8 100644
--- a/xmpp-vala/meson.build
+++ b/xmpp-vala/meson.build
@@ -129,5 +129,10 @@ sources = files(
c_args = [
'-DG_LOG_DOMAIN="xmpp-vala"',
]
-lib_xmpp_vala = library('xmpp-vala', sources, c_args: c_args, vala_args: ['--vapidir', meson.current_source_dir() / 'vapi'], dependencies: dependencies)
+vala_args = [
+ '--vapidir', meson.current_source_dir() / 'vapi',
+]
+lib_xmpp_vala = library('xmpp-vala', sources, c_args: c_args, vala_args: vala_args, dependencies: dependencies, version: '0.1', install: true, install_dir: [true, true, true])
dep_xmpp_vala = declare_dependency(link_with: lib_xmpp_vala, include_directories: include_directories('.'))
+
+install_data('xmpp-vala.deps', install_dir: get_option('datadir') / 'vala/vapi') # TODO: workaround for https://github.com/mesonbuild/meson/issues/9756
diff --git a/xmpp-vala/src/core/module_flag.vala b/xmpp-vala/src/core/module_flag.vala
index 95547852..76ae4dc1 100644
--- a/xmpp-vala/src/core/module_flag.vala
+++ b/xmpp-vala/src/core/module_flag.vala
@@ -10,7 +10,12 @@ namespace Xmpp {
}
public T? cast(XmppStreamFlag flag) {
+#if VALA_0_56_11
+ // We can't typecheck due to compiler bug
+ return (T) module;
+#else
return flag.get_type().is_a(typeof(T)) ? (T?) flag : null;
+#endif
}
public bool matches(XmppStreamFlag module) {
@@ -34,7 +39,12 @@ namespace Xmpp {
}
public T? cast(XmppStreamModule module) {
+#if VALA_0_56_11
+ // We can't typecheck due to compiler bug
+ return (T) module;
+#else
return module.get_type().is_a(typeof(T)) ? (T?) module : null;
+#endif
}
public bool matches(XmppStreamModule module) {
diff --git a/xmpp-vala/src/core/xmpp_stream.vala b/xmpp-vala/src/core/xmpp_stream.vala
index 42e90bf9..54433b67 100644
--- a/xmpp-vala/src/core/xmpp_stream.vala
+++ b/xmpp-vala/src/core/xmpp_stream.vala
@@ -30,9 +30,9 @@ public abstract class Xmpp.XmppStream : Object {
this.remote_name = remote_name;
}
- public abstract async void connect() throws IOError;
+ public abstract new async void connect() throws IOError;
- public abstract async void disconnect() throws IOError;
+ public abstract new async void disconnect() throws IOError;
public abstract async StanzaNode read() throws IOError;
diff --git a/xmpp-vala/src/module/xep/0004_data_forms.vala b/xmpp-vala/src/module/xep/0004_data_forms.vala
index fe39874a..6b5624da 100644
--- a/xmpp-vala/src/module/xep/0004_data_forms.vala
+++ b/xmpp-vala/src/module/xep/0004_data_forms.vala
@@ -38,7 +38,7 @@ public class DataForm {
}
}
- public class Field {
+ public class Field : Object {
public StanzaNode node { get; set; }
public string? label {
get { return node.get_attribute("label", NS_URI); }
diff --git a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala
index 32d4d3ac..8b40d3ac 100644
--- a/xmpp-vala/src/module/xep/0082_date_time_profiles.vala
+++ b/xmpp-vala/src/module/xep/0082_date_time_profiles.vala
@@ -1,23 +1,11 @@
namespace Xmpp.Xep.DateTimeProfiles {
public DateTime? parse_string(string time_string) {
- // TODO with glib >= 2.56
- // return new DateTime.from_iso8601(time_string, null);
-
- TimeVal time_val = TimeVal();
- if (time_val.from_iso8601(time_string)) {
- return new DateTime.from_unix_utc(time_val.tv_sec);
- }
- return null;
-
+ return new DateTime.from_iso8601(time_string, null);
}
-
public string to_datetime(DateTime time) {
- // TODO with glib >= 2.62
- // return time.to_utc().format_iso8601().to_string();
-
- return time.to_utc().format("%Y-%m-%dT%H:%M:%SZ");
+ return time.to_utc().format_iso8601().to_string();
}
}
diff --git a/xmpp-vala/src/module/xep/0384_omemo/omemo_encryptor.vala b/xmpp-vala/src/module/xep/0384_omemo/omemo_encryptor.vala
index 6509bfe3..c68de329 100644
--- a/xmpp-vala/src/module/xep/0384_omemo/omemo_encryptor.vala
+++ b/xmpp-vala/src/module/xep/0384_omemo/omemo_encryptor.vala
@@ -72,27 +72,27 @@ namespace Xmpp.Xep.Omemo {
}
public class EncryptionResult {
- public int lost { get; internal set; }
- public int success { get; internal set; }
- public int unknown { get; internal set; }
- public int failure { get; internal set; }
+ public int lost { get; set; }
+ public int success { get; set; }
+ public int unknown { get; set; }
+ public int failure { get; set; }
}
public class EncryptState {
- public bool encrypted { get; internal set; }
- public int other_devices { get; internal set; }
- public int other_success { get; internal set; }
- public int other_lost { get; internal set; }
- public int other_unknown { get; internal set; }
- public int other_failure { get; internal set; }
- public int other_waiting_lists { get; internal set; }
-
- public int own_devices { get; internal set; }
- public int own_success { get; internal set; }
- public int own_lost { get; internal set; }
- public int own_unknown { get; internal set; }
- public int own_failure { get; internal set; }
- public bool own_list { get; internal set; }
+ public bool encrypted { get; set; }
+ public int other_devices { get; set; }
+ public int other_success { get; set; }
+ public int other_lost { get; set; }
+ public int other_unknown { get; set; }
+ public int other_failure { get; set; }
+ public int other_waiting_lists { get; set; }
+
+ public int own_devices { get; set; }
+ public int own_success { get; set; }
+ public int own_lost { get; set; }
+ public int own_unknown { get; set; }
+ public int own_failure { get; set; }
+ public bool own_list { get; set; }
public void add_result(EncryptionResult enc_res, bool own) {
if (own) {
diff --git a/xmpp-vala/xmpp-vala.deps b/xmpp-vala/xmpp-vala.deps
new file mode 100644
index 00000000..97323d51
--- /dev/null
+++ b/xmpp-vala/xmpp-vala.deps
@@ -0,0 +1,5 @@
+gdk-pixbuf-2.0
+gee-0.8
+gio-2.0
+glib-2.0
+icu-uc