diff options
-rw-r--r-- | plugins/WebView/src/main.cpp | 6 | ||||
-rw-r--r-- | plugins/WebView/src/stdafx.h | 1 | ||||
-rw-r--r-- | plugins/WebView/src/webview_alerts.cpp | 44 | ||||
-rw-r--r-- | plugins/WebView/src/webview_opts.cpp | 2 | ||||
-rw-r--r-- | plugins/WebView/src/webview_services.cpp | 5 |
5 files changed, 31 insertions, 27 deletions
diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 5048e2bf2d..2678c19031 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -26,8 +26,9 @@ HANDLE hNetlibUser;
HANDLE hWindowList;
HANDLE hHookDisplayDataAlert, hHookAlertPopup, hHookAlertWPopup, hHookErrorPopup, hHookAlertOSD;
-int hLangpack = 0;
+int hLangpack = 0;
+CLIST_INTERFACE *pcli;
static HMODULE hRichEd = NULL;
PLUGININFOEX pluginInfoEx = {
@@ -150,6 +151,7 @@ extern "C" int __declspec(dllexport) Unload(void) extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfoEx);
+ mir_getCLI();
strncpy_s(optionsname, MODULENAME, sizeof(optionsname));
optionsname[0] = toupper(optionsname[0]);
@@ -179,7 +181,7 @@ extern "C" int __declspec(dllexport) Load() hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu);
// register webview protocol
- PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
+ PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
pd.szName = MODULENAME;
pd.type = PROTOTYPE_PROTOCOL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/plugins/WebView/src/stdafx.h b/plugins/WebView/src/stdafx.h index fc6c4130e4..a568c030c9 100644 --- a/plugins/WebView/src/stdafx.h +++ b/plugins/WebView/src/stdafx.h @@ -18,6 +18,7 @@ #include <newpluginapi.h>
#include <m_system.h>
#include <m_clist.h>
+#include <m_clistint.h>
#include <m_clui.h>
#include <m_database.h>
#include <m_protomod.h>
diff --git a/plugins/WebView/src/webview_alerts.cpp b/plugins/WebView/src/webview_alerts.cpp index fb2e287127..141a3c3251 100644 --- a/plugins/WebView/src/webview_alerts.cpp +++ b/plugins/WebView/src/webview_alerts.cpp @@ -220,28 +220,30 @@ int OSDAlert(WPARAM wParam, LPARAM lParam) /*****************************************************************************/
int ErrorMsgs(WPARAM wParam, LPARAM lParam)
{
- char newdisplaytext[2000];
- char *contactname = (char*)wParam, *displaytext = (char*)lParam;
+ HANDLE hContact = (HANDLE)wParam;
+ TCHAR newdisplaytext[2000], *displaytext = (TCHAR*)lParam;
- if ( !db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0)) {
- if ((ServiceExists(MS_POPUP_ADDPOPUP) != 0) && ((db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)))) {
- _snprintf(newdisplaytext, sizeof(newdisplaytext), "%s\n%s", contactname, displaytext);
- PUShowMessage(newdisplaytext, SM_WARNING);
- }
- else if ( ServiceExists("OSD/Announce") && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
- _snprintf(newdisplaytext, sizeof(newdisplaytext), "%s: %s", contactname, Translate(displaytext));
- CallService("OSD/Announce", (WPARAM) newdisplaytext, 0);
- }
- else if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
- MIRANDASYSTRAYNOTIFY webview_tip = {0};
- webview_tip.cbSize = sizeof(MIRANDASYSTRAYNOTIFY);
- webview_tip.szProto = NULL;
- webview_tip.szInfoTitle = contactname;
- webview_tip.szInfo = Translate(displaytext);
- webview_tip.dwInfoFlags = NIIF_ERROR;
- webview_tip.uTimeout = 15000;
- CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) &webview_tip);
- }
+ if ( db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0))
+ return 0;
+
+ TCHAR *ptszContactName = pcli->pfnGetContactDisplayName(hContact, 0);
+ if (ServiceExists(MS_POPUP_ADDPOPUPT) && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
+ mir_sntprintf(newdisplaytext, SIZEOF(newdisplaytext), _T("%s\n%s"), ptszContactName, displaytext);
+ PUShowMessageT(newdisplaytext, SM_WARNING);
+ }
+ else if ( ServiceExists("OSD/Announce") && db_get_b(NULL, MODULENAME, ERROR_POPUP_KEY, 0)) {
+ mir_sntprintf(newdisplaytext, SIZEOF(newdisplaytext), _T("%s: %s"), ptszContactName, TranslateTS(displaytext));
+ CallService("OSD/Announce", (WPARAM)newdisplaytext, 0);
+ }
+ else if (ServiceExists(MS_CLIST_SYSTRAY_NOTIFY)) {
+ MIRANDASYSTRAYNOTIFY webview_tip = {0};
+ webview_tip.cbSize = sizeof(MIRANDASYSTRAYNOTIFY);
+ webview_tip.szProto = NULL;
+ webview_tip.tszInfoTitle = ptszContactName;
+ webview_tip.tszInfo = TranslateTS(displaytext);
+ webview_tip.dwInfoFlags = NIIF_ERROR | NIIF_INTERN_UNICODE;
+ webview_tip.uTimeout = 15000;
+ CallService(MS_CLIST_SYSTRAY_NOTIFY, 0, (LPARAM) &webview_tip);
}
return 0;
}
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index c739027a4a..ba9ed25852 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -279,7 +279,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l for (i = 0; i < SIZEOF(AlertTypes); i++)
SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(AlertTypes[i]));
- for (i = 0; i < sizeof(EventTypes); i++)
+ for (i = 0; i < SIZEOF(EventTypes); i++)
SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_ADDSTRING, 0, (LPARAM)TranslateTS(EventTypes[i]));
if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0)) {
diff --git a/plugins/WebView/src/webview_services.cpp b/plugins/WebView/src/webview_services.cpp index 1992092f8c..274b539352 100644 --- a/plugins/WebView/src/webview_services.cpp +++ b/plugins/WebView/src/webview_services.cpp @@ -358,10 +358,9 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) db_unset(hContact, "CList", "NotOnList");
db_unset(hContact, "CList", "Hidden");
}
- db_free(&dbv);
}
+ db_free(&dbv);
}
- db_free(&dbv);
}
if (psr->nick == NULL) {
@@ -404,7 +403,7 @@ INT_PTR AddToList(WPARAM wParam, LPARAM lParam) }
TCHAR *Nend = _tcschr(Newnick, '.');
- *Nend = '\0';
+ if (Nend) *Nend = '\0';
for (HANDLE hContact2 = db_find_first(MODULENAME); hContact2 != NULL; hContact2 = db_find_next(hContact2, MODULENAME)) {
if (!db_get_ts(hContact2, MODULENAME, PRESERVE_NAME_KEY, &dbv)) {
|