diff options
-rw-r--r-- | plugins/Toaster/Toaster.vcxproj | 1 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_event_handler.cpp | 2 | ||||
-rw-r--r-- | plugins/Toaster/src/toast_notification.cpp | 31 |
3 files changed, 31 insertions, 3 deletions
diff --git a/plugins/Toaster/Toaster.vcxproj b/plugins/Toaster/Toaster.vcxproj index f177101654..8784acd268 100644 --- a/plugins/Toaster/Toaster.vcxproj +++ b/plugins/Toaster/Toaster.vcxproj @@ -51,6 +51,7 @@ <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <ExceptionHandling>Sync</ExceptionHandling>
</ClCompile>
<Link>
<AdditionalOptions Condition="'$(VisualStudioVersion)' == '12.0'">/PDBALTPATH:%_PDB%</AdditionalOptions>
diff --git a/plugins/Toaster/src/toast_event_handler.cpp b/plugins/Toaster/src/toast_event_handler.cpp index 49e3105dbc..a3240b1490 100644 --- a/plugins/Toaster/src/toast_event_handler.cpp +++ b/plugins/Toaster/src/toast_event_handler.cpp @@ -48,7 +48,7 @@ IFACEMETHODIMP ToastEventHandler::QueryInterface(_In_ REFIID riid, _COM_Outptr_ return E_NOINTERFACE;
}
-IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification *sender, _In_ IInspectable* args)
+IFACEMETHODIMP ToastEventHandler::Invoke(_In_ IToastNotification * /*sender*/, _In_ IInspectable* /*args*/)
{
if (_callback != nullptr)
_callback(_arg);
diff --git a/plugins/Toaster/src/toast_notification.cpp b/plugins/Toaster/src/toast_notification.cpp index aa1f6ee5df..89a24f32d7 100644 --- a/plugins/Toaster/src/toast_notification.cpp +++ b/plugins/Toaster/src/toast_notification.cpp @@ -2,6 +2,19 @@ using namespace Microsoft::WRL;
+CMString GetStringChunk(const TCHAR *haystack, const TCHAR *start, const TCHAR *end)
+{
+ const TCHAR *sstart = wcsstr(haystack, start);
+ if (sstart == NULL)
+ return CMString();
+
+ sstart = sstart + mir_wstrlen(start);
+ const TCHAR *send = wcsstr(sstart, end);
+ if (send == NULL)
+ return CMString(sstart);
+ return CMString(sstart, send - sstart);
+}
+
ToastNotification::ToastNotification(_In_ wchar_t* text, _In_ wchar_t* caption, _In_ wchar_t* imagePath)
: _text(text), _caption(caption), _imagePath(imagePath)
{
@@ -39,7 +52,7 @@ HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXml xmlAddAttr(xmlImageNode, L"placement", L"appLogoOverride");
xmlAddAttr(xmlImageNode, L"id", L"1");
- xmlAddAttr(xmlImageNode, L"src", CMStringW(FORMAT, L"file:///%s", _imagePath));
+ xmlAddAttr(xmlImageNode, L"src", CMString(FORMAT, L"file:///%s", _imagePath));
}
HXML xmlTitleNode = xmlAddChild(xmlBindingNode, L"text", _caption != NULL ? _caption : L"Miranda NG");
@@ -48,6 +61,19 @@ HRESULT ToastNotification::CreateXml(_Outptr_ ABI::Windows::Data::Xml::Dom::IXml {
HXML xmlTextNode = xmlAddChild(xmlBindingNode, L"text", _text);
xmlAddAttr(xmlTextNode, L"id", L"2");
+
+/*
+ if (IsWinVer10Plus())
+ {
+ CMString link = GetStringChunk(_text, L"[img]", L"[/img]");
+ if (!link.IsEmpty())
+ {
+ HXML xmlInlineImageNode = xmlAddChild(xmlBindingNode, L"image", NULL);
+ xmlAddAttr(xmlInlineImageNode, L"placement", L"inline");
+ xmlAddAttr(xmlInlineImageNode, L"src", link);
+ }
+ }
+*/
}
TCHAR *xtmp = xmlToString(xmlToast, NULL);
@@ -90,4 +116,5 @@ HRESULT ToastNotification::Show(_In_ ToastEventHandler* handler) HRESULT ToastNotification::Hide()
{
return notifier->Hide(notification.Get());
-}
\ No newline at end of file +}
+
|