diff --git a/CMakeLists.txt b/CMakeLists.txt
index 590398c5..518555bc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -206,7 +206,11 @@ include(${VALA_USE_FILE})
include(MultiFind)
include(GlibCompileResourcesSupport)
-set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --target-glib=${GLib_GLOBAL_VERSION}")
+find_package(GLib ${GLib_GLOBAL_VERSION} REQUIRED)
+string(REGEX REPLACE "^([0-9]+)\\.[0-9]+(\\.[0-9]+)?" "\\1" GLib_MAJOR_VERSION "${GLib_VERSION}")
+string(REGEX REPLACE "^[0-9]+\\.([0-9]+)(\\.[0-9]+)?" "\\1" GLib_MINOR_VERSION "${GLib_VERSION}")
+math(EXPR GLib_LAST_RELEASE_MINOR_VERSION "${GLib_MINOR_VERSION} / 2 * 2")
+set(CMAKE_VALA_FLAGS "${CMAKE_VALA_FLAGS} --target-glib=${GLib_MAJOR_VERSION}.${GLib_LAST_RELEASE_MINOR_VERSION}")
add_subdirectory(qlite)
add_subdirectory(xmpp-vala)
diff --git a/cmake/FindSoup.cmake b/cmake/FindSoup.cmake
deleted file mode 100644
index d5afab48..00000000
--- a/cmake/FindSoup.cmake
+++ /dev/null
@@ -1,31 +0,0 @@
-include(PkgConfigWithFallback)
-find_pkg_config_with_fallback(Soup
- PKG_CONFIG_NAME libsoup-2.4
- LIB_NAMES soup-2.4
- INCLUDE_NAMES libsoup/soup.h
- INCLUDE_DIR_SUFFIXES libsoup-2.4 libsoup-2.4/include libsoup libsoup/include
- DEPENDS GIO
-)
-
-if(Soup_FOUND AND NOT Soup_VERSION)
- find_file(Soup_VERSION_HEADER "libsoup/soup-version.h" HINTS ${Soup_INCLUDE_DIRS})
- mark_as_advanced(Soup_VERSION_HEADER)
-
- if(Soup_VERSION_HEADER)
- file(STRINGS "${Soup_VERSION_HEADER}" Soup_MAJOR_VERSION REGEX "^#define SOUP_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
- string(REGEX REPLACE "^#define SOUP_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup_MAJOR_VERSION "${Soup_MAJOR_VERSION}")
- file(STRINGS "${Soup_VERSION_HEADER}" Soup_MINOR_VERSION REGEX "^#define SOUP_MINOR_VERSION +\\(?([0-9]+)\\)?$")
- string(REGEX REPLACE "^#define SOUP_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup_MINOR_VERSION "${Soup_MINOR_VERSION}")
- file(STRINGS "${Soup_VERSION_HEADER}" Soup_MICRO_VERSION REGEX "^#define SOUP_MICRO_VERSION +\\(?([0-9]+)\\)?$")
- string(REGEX REPLACE "^#define SOUP_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup_MICRO_VERSION "${Soup_MICRO_VERSION}")
- set(Soup_VERSION "${Soup_MAJOR_VERSION}.${Soup_MINOR_VERSION}.${Soup_MICRO_VERSION}")
- unset(Soup_MAJOR_VERSION)
- unset(Soup_MINOR_VERSION)
- unset(Soup_MICRO_VERSION)
- endif()
-endif()
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(Soup
- REQUIRED_VARS Soup_LIBRARY
- VERSION_VAR Soup_VERSION)
diff --git a/cmake/FindSoup2.cmake b/cmake/FindSoup2.cmake
new file mode 100644
index 00000000..07ffed14
--- /dev/null
+++ b/cmake/FindSoup2.cmake
@@ -0,0 +1,31 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Soup2
+ PKG_CONFIG_NAME libsoup-2.4
+ LIB_NAMES soup-2.4
+ INCLUDE_NAMES libsoup/soup.h
+ INCLUDE_DIR_SUFFIXES libsoup-2.4 libsoup-2.4/include libsoup libsoup/include
+ DEPENDS GIO
+)
+
+if(Soup2_FOUND AND NOT Soup2_VERSION)
+ find_file(Soup2_VERSION_HEADER "libsoup/soup-version.h" HINTS ${Soup_INCLUDE_DIRS})
+ mark_as_advanced(Soup2_VERSION_HEADER)
+
+ if(Soup_VERSION_HEADER)
+ file(STRINGS "${Soup2_VERSION_HEADER}" Soup2_MAJOR_VERSION REGEX "^#define SOUP_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define SOUP_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup_MAJOR_VERSION "${Soup2_MAJOR_VERSION}")
+ file(STRINGS "${Soup2_VERSION_HEADER}" Soup2_MINOR_VERSION REGEX "^#define SOUP_MINOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define SOUP_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup_MINOR_VERSION "${Soup2_MINOR_VERSION}")
+ file(STRINGS "${Soup2_VERSION_HEADER}" Soup2_MICRO_VERSION REGEX "^#define SOUP_MICRO_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define SOUP_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup_MICRO_VERSION "${Soup2_MICRO_VERSION}")
+ set(Soup_VERSION "${Soup2_MAJOR_VERSION}.${Soup2_MINOR_VERSION}.${Soup2_MICRO_VERSION}")
+ unset(Soup2_MAJOR_VERSION)
+ unset(Soup2_MINOR_VERSION)
+ unset(Soup2_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Soup2
+ REQUIRED_VARS Soup2_LIBRARY
+ VERSION_VAR Soup2_VERSION)
diff --git a/cmake/FindSoup3.cmake b/cmake/FindSoup3.cmake
new file mode 100644
index 00000000..07b4893a
--- /dev/null
+++ b/cmake/FindSoup3.cmake
@@ -0,0 +1,31 @@
+include(PkgConfigWithFallback)
+find_pkg_config_with_fallback(Soup3
+ PKG_CONFIG_NAME libsoup-3.0
+ LIB_NAMES soup-3.0
+ INCLUDE_NAMES libsoup/soup.h
+ INCLUDE_DIR_SUFFIXES libsoup-2.4 libsoup-2.4/include libsoup libsoup/include
+ DEPENDS GIO
+)
+
+if(Soup3_FOUND AND NOT Soup3_VERSION)
+ find_file(Soup3_VERSION_HEADER "libsoup/soup-version.h" HINTS ${Soup3_INCLUDE_DIRS})
+ mark_as_advanced(Soup3_VERSION_HEADER)
+
+ if(Soup3_VERSION_HEADER)
+ file(STRINGS "${Soup3_VERSION_HEADER}" Soup3_MAJOR_VERSION REGEX "^#define SOUP_MAJOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define SOUP_MAJOR_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup3_MAJOR_VERSION "${Soup3_MAJOR_VERSION}")
+ file(STRINGS "${Soup3_VERSION_HEADER}" Soup3_MINOR_VERSION REGEX "^#define SOUP_MINOR_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define SOUP_MINOR_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup3_MINOR_VERSION "${Soup3_MINOR_VERSION}")
+ file(STRINGS "${Soup3_VERSION_HEADER}" Soup3_MICRO_VERSION REGEX "^#define SOUP_MICRO_VERSION +\\(?([0-9]+)\\)?$")
+ string(REGEX REPLACE "^#define SOUP_MICRO_VERSION \\(?([0-9]+)\\)?$" "\\1" Soup3_MICRO_VERSION "${Soup3_MICRO_VERSION}")
+ set(Soup3_VERSION "${Soup3_MAJOR_VERSION}.${Soup3_MINOR_VERSION}.${Soup3_MICRO_VERSION}")
+ unset(Soup3_MAJOR_VERSION)
+ unset(Soup3_MINOR_VERSION)
+ unset(Soup3_MICRO_VERSION)
+ endif()
+endif()
+
+include(FindPackageHandleStandardArgs)
+find_package_handle_standard_args(Soup3
+ REQUIRED_VARS Soup3_LIBRARY
+ VERSION_VAR Soup3_VERSION)
diff --git a/dino.doap b/dino.doap
index ba5814e3..819777b0 100644
--- a/dino.doap
+++ b/dino.doap
@@ -250,11 +250,15 @@
+ complete
+ For use with XEP-0261
+ deprecated
+ Migrating to XEP-0402 if supported by server
@@ -273,6 +277,8 @@
+ partial
+ For use with XEP-0313
@@ -284,6 +290,7 @@
+ partial
For use with XEP-0260
@@ -291,6 +298,7 @@
complete
+ For file transfers using XEP-0363
@@ -326,27 +334,32 @@
+ deprecated
+ Only to fetch Avatars from other users
- partial
+ complete
+ partial
+ partial
+ partial
@@ -358,7 +371,7 @@
- partial
+ complete
@@ -382,21 +395,25 @@
+ partial
+ complete
+ complete
+ partial
@@ -409,11 +426,14 @@
+ partial
+ No support for sending
+ complete
@@ -431,21 +451,26 @@
+ partial
+ partial
+ complete
+ For use with XEP-0280
+ complete
1.2.0
0.2
@@ -460,6 +485,8 @@
+ complete
+ 1.0.0
@@ -471,16 +498,20 @@
+ partial
+ complete
+ 0.3.1
+ complete
@@ -506,11 +537,13 @@
complete
+ 0.3.0
+ partial
@@ -522,6 +555,7 @@
+ complete
@@ -533,16 +567,20 @@
+ complete
+ complete
+ partial
+ No support for embedded thumbnails
diff --git a/dino.doap.in b/dino.doap.in
index 941fd11b..563de1d4 100644
--- a/dino.doap.in
+++ b/dino.doap.in
@@ -70,11 +70,15 @@
+ complete
+ For use with XEP-0261
+ deprecated
+ Migrating to XEP-0402 if supported by server
@@ -93,6 +97,8 @@
+ partial
+ For use with XEP-0313
@@ -104,6 +110,7 @@
+ partial
For use with XEP-0260
@@ -111,6 +118,7 @@
complete
+ For file transfers using XEP-0363
@@ -146,27 +154,32 @@
+ deprecated
+ Only to fetch Avatars from other users
- partial
+ complete
+ partial
+ partial
+ partial
@@ -178,7 +191,7 @@
- partial
+ complete
@@ -202,21 +215,25 @@
+ partial
+ complete
+ complete
+ partial
@@ -229,11 +246,14 @@
+ partial
+ No support for sending
+ complete
@@ -251,21 +271,26 @@
+ partial
+ partial
+ complete
+ For use with XEP-0280
+ complete
1.2.0
0.2
@@ -280,6 +305,8 @@
+ complete
+ 1.0.0
@@ -291,16 +318,20 @@
+ partial
+ complete
+ 0.3.1
+ complete
@@ -326,11 +357,13 @@
complete
+ 0.3.0
+ partial
@@ -342,6 +375,7 @@
+ complete
@@ -353,16 +387,20 @@
+ complete
+ complete
+ partial
+ No support for embedded thumbnails
diff --git a/libdino/CMakeLists.txt b/libdino/CMakeLists.txt
index ce836f62..20f5ffee 100644
--- a/libdino/CMakeLists.txt
+++ b/libdino/CMakeLists.txt
@@ -89,7 +89,7 @@ DEPENDS
${CMAKE_BINARY_DIR}/exports/dino_i18n.h
)
-add_definitions(${VALA_CFLAGS} -DDINO_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}" -DG_LOG_DOMAIN="libdino")
+add_definitions(${VALA_CFLAGS} -DDINO_SYSTEM_PLUGIN_DIR="${PLUGIN_INSTALL_DIR}" -DDINO_SYSTEM_LIBDIR_NAME="${LIBDIR_NAME}" -DG_LOG_DOMAIN="libdino" -DDINO_VERSION=\"${PROJECT_VERSION}\")
add_library(libdino SHARED ${LIBDINO_VALA_C} ${CMAKE_BINARY_DIR}/exports/dino_i18n.h)
add_dependencies(libdino dino-vapi)
target_link_libraries(libdino xmpp-vala qlite ${LIBDINO_PACKAGES} m)
diff --git a/libdino/src/application.vala b/libdino/src/application.vala
index f381c21d..9b36dd79 100644
--- a/libdino/src/application.vala
+++ b/libdino/src/application.vala
@@ -1,7 +1,13 @@
using Dino.Entities;
namespace Dino {
+
extern const string VERSION;
+public string get_version() { return VERSION; }
+public string get_short_version() {
+ if (!VERSION.contains("~")) return VERSION;
+ return VERSION.split("~")[0] + "+";
+}
public interface Application : GLib.Application {
diff --git a/libdino/src/entity/file_transfer.vala b/libdino/src/entity/file_transfer.vala
index 1823478f..20bc1a7a 100644
--- a/libdino/src/entity/file_transfer.vala
+++ b/libdino/src/entity/file_transfer.vala
@@ -70,6 +70,7 @@ public class FileTransfer : Object {
public State state { get; set; default=State.NOT_STARTED; }
public int provider { get; set; }
public string info { get; set; }
+ public Cancellable cancellable { get; default=new Cancellable(); }
private Database? db;
private string storage_dir;
diff --git a/libdino/src/service/file_manager.vala b/libdino/src/service/file_manager.vala
index 6249f7ab..95afc45a 100644
--- a/libdino/src/service/file_manager.vala
+++ b/libdino/src/service/file_manager.vala
@@ -246,7 +246,7 @@ public class FileManager : StreamInteractionModule, Object {
File file = File.new_for_path(Path.build_filename(get_storage_dir(), filename));
OutputStream os = file.create(FileCreateFlags.REPLACE_DESTINATION);
- yield os.splice_async(input_stream, OutputStreamSpliceFlags.CLOSE_SOURCE|OutputStreamSpliceFlags.CLOSE_TARGET);
+ yield os.splice_async(input_stream, OutputStreamSpliceFlags.CLOSE_SOURCE | OutputStreamSpliceFlags.CLOSE_TARGET, Priority.LOW, file_transfer.cancellable);
file_transfer.path = file.get_basename();
file_transfer.input_stream = yield file.read_async();
@@ -299,14 +299,15 @@ public class FileManager : StreamInteractionModule, Object {
if (is_sender_trustworthy(file_transfer, conversation)) {
try {
yield get_file_meta(file_provider, file_transfer, conversation, receive_data);
-
- if (file_transfer.size >= 0 && file_transfer.size < 5000000) {
- yield download_file_internal(file_provider, file_transfer, conversation);
- }
} catch (Error e) {
warning("Error downloading file: %s", e.message);
file_transfer.state = FileTransfer.State.FAILED;
}
+ if (file_transfer.size >= 0 && file_transfer.size < 5000000) {
+ download_file_internal.begin(file_provider, file_transfer, conversation, (_, res) => {
+ download_file_internal.end(res);
+ });
+ }
}
conversation.last_active = file_transfer.time;
diff --git a/libdino/tests/testcase.vala b/libdino/tests/testcase.vala
index 87147604..59fcf193 100644
--- a/libdino/tests/testcase.vala
+++ b/libdino/tests/testcase.vala
@@ -48,7 +48,7 @@ public abstract class Gee.TestCase : Object {
}
public GLib.TestSuite get_suite () {
- return this.suite;
+ return (owned) this.suite;
}
private class Adaptor {
diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt
index 63bd4101..1670fb04 100644
--- a/main/CMakeLists.txt
+++ b/main/CMakeLists.txt
@@ -218,7 +218,7 @@ else()
set(DINO_NUMERIC_VERSION "0,0,0,0")
endif ()
-add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\" -DDINO_VERSION=\"${PROJECT_VERSION}\" -DDINO_NUMERIC_VERSION=${DINO_NUMERIC_VERSION})
+add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\" -DDINO_NUMERIC_VERSION=${DINO_NUMERIC_VERSION})
if(WIN32)
add_link_options("-Wl,--export-all-symbols")
set(CMAKE_RC_COMPILE_OBJECT " --use-temp-file -O coff -i