diff --git a/plugins/windows-notification/CMakeLists.txt b/plugins/windows-notification/CMakeLists.txt index 9cef5965..915fd121 100644 --- a/plugins/windows-notification/CMakeLists.txt +++ b/plugins/windows-notification/CMakeLists.txt @@ -12,6 +12,7 @@ vala_precompile(WINDOWS_NOTIFICATION_VALA_C SOURCES src/windows_notifications_plugin.vala src/windows_notifications_register_plugin.vala + src/toast_notification_builder.vala # src/win_notification_provider.vala CUSTOM_VAPIS ${CMAKE_BINARY_DIR}/exports/xmpp-vala.vapi diff --git a/plugins/windows-notification/api/src/converter.cpp b/plugins/windows-notification/api/src/converter.cpp index b6ab3c7b..67a52071 100644 --- a/plugins/windows-notification/api/src/converter.cpp +++ b/plugins/windows-notification/api/src/converter.cpp @@ -10,7 +10,7 @@ char* wsview_to_char(const std::wstring_view wstr) return nullptr; } int final_size = WideCharToMultiByte(CP_UTF8, 0, wstr.data(), (int)wstr.size(), nullptr, 0, nullptr, nullptr); - char* strTo = new char[final_size]; + char* strTo = new char[final_size + 1]{ 0 }; WideCharToMultiByte(CP_UTF8, 0, wstr.data(), (int)wstr.size(), strTo, final_size, nullptr, nullptr); return strTo; } diff --git a/plugins/windows-notification/src/toast_notification_builder.vala b/plugins/windows-notification/src/toast_notification_builder.vala new file mode 100644 index 00000000..6abf3f65 --- /dev/null +++ b/plugins/windows-notification/src/toast_notification_builder.vala @@ -0,0 +1,166 @@ +using Dino.Entities; +using Dino.Plugins.WindowsNotification.Vapi; +using winrt.Windows.UI.Notifications; +using Dino.Plugins.WindowsNotification.Vapi.Win32Api; +using Xmpp; + +namespace Dino.Plugins.WindowsNotification { + private delegate void NodeFunction(StanzaNode node); + private class Button { + public string title; + public string arguments; + } + + public class ToastNotificationBuilder { + private static bool _supportsModernFeatures = SupportsModernNotifications(); + private Gee.List