diff options
author | George Hazan <ghazan@miranda.im> | 2019-03-05 21:10:22 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2019-03-05 21:10:22 +0300 |
commit | d9fddc0cfa9066eb1b5ad3f4807b37426ae6ca88 (patch) | |
tree | f09baaf9b91477d009cedc5bd77449b0fa3e3af7 /plugins/MirOTR/src | |
parent | 8a1ff32e54b39ceef22df61bda17bbfda94918fc (diff) |
Popup:
- wiping out checks for service presence;
- code cleaning
Diffstat (limited to 'plugins/MirOTR/src')
-rw-r--r-- | plugins/MirOTR/src/options.cpp | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/options.h | 2 | ||||
-rw-r--r-- | plugins/MirOTR/src/utils.cpp | 44 |
3 files changed, 5 insertions, 43 deletions
diff --git a/plugins/MirOTR/src/options.cpp b/plugins/MirOTR/src/options.cpp index 82e210f0b4..c75f71a93a 100644 --- a/plugins/MirOTR/src/options.cpp +++ b/plugins/MirOTR/src/options.cpp @@ -86,8 +86,6 @@ void LoadOptions() options.end_offline = (g_plugin.getByte("EndOffline", 1) == 1); options.end_window_close = (g_plugin.getByte("EndWindowClose", 0) == 1); - - options.bHavePopups = 0 != ServiceExists(MS_POPUP_ADDPOPUPW) && ServiceExists(MS_POPUP_SHOWMESSAGE); options.bHaveSecureIM = 0 != ServiceExists("SecureIM/IsContactSecured"); LoadFilenames(); diff --git a/plugins/MirOTR/src/options.h b/plugins/MirOTR/src/options.h index 17efb1c139..46a0afc157 100644 --- a/plugins/MirOTR/src/options.h +++ b/plugins/MirOTR/src/options.h @@ -32,7 +32,7 @@ typedef struct { bool end_offline, end_window_close; // temporary options - bool bHavePopups, bHaveSecureIM; + bool bHaveSecureIM; } Options; diff --git a/plugins/MirOTR/src/utils.cpp b/plugins/MirOTR/src/utils.cpp index cde933ab73..53daeb5735 100644 --- a/plugins/MirOTR/src/utils.cpp +++ b/plugins/MirOTR/src/utils.cpp @@ -116,31 +116,10 @@ wchar_t* ProtoGetNickname(const char* proto) void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MCONTACT hContact) { - if (Miranda_IsTerminated()) return; - - if (!options.bHavePopups) { - wchar_t title[256]; - mir_snwprintf(title, L"%s Message", _A2W(MODULENAME)); - - if (line1 && line2) { - int size = int(mir_wstrlen(line1) + mir_wstrlen(line2) + 3); - wchar_t *message = new wchar_t[size]; // newline and null terminator - mir_snwprintf(message, size, L"%s\r\n%s", line1, line2); - MessageBox(nullptr, message, title, MB_OK | MB_ICONINFORMATION); - delete[] message; - } - else if (line1) { - MessageBox(nullptr, line1, title, MB_OK | MB_ICONINFORMATION); - } - else if (line2) { - MessageBox(nullptr, line2, title, MB_OK | MB_ICONINFORMATION); - } + if (Miranda_IsTerminated()) return; - } - - POPUPDATAW ppd = { 0 }; - //memset((void *)&ppd, 0, sizeof(POPUPDATAW)); + POPUPDATAW ppd = {}; ppd.lchContact = hContact; ppd.lchIcon = nullptr; @@ -154,26 +133,17 @@ void ShowPopup(const wchar_t* line1, const wchar_t* line2, int timeout, const MC wcsncpy(ppd.lpwzText, line2, MAX_SECONDLINE - 1); ppd.iSeconds = timeout; - ppd.PluginWindowProc = nullptr; ppd.PluginData = nullptr; - PUAddPopupW(&ppd); - } void ShowWarning(wchar_t *msg) { wchar_t buffer[512]; - ErrorDisplay disp = options.err_method; - // funny logic :) ... try to avoid message boxes - // if want popups but no popups, try baloons - if (disp == ED_POP && !options.bHavePopups) - disp = ED_BAL; - mir_snwprintf(buffer, L"%s Warning", _A2W(MODULENAME)); - switch (disp) { + switch (options.err_method) { case ED_POP: { int size = int(mir_wstrlen(msg) + 515); @@ -195,16 +165,10 @@ void ShowWarning(wchar_t *msg) void ShowError(wchar_t *msg) { wchar_t buffer[512]; - ErrorDisplay disp = options.err_method; - // funny logic :) ... try to avoid message boxes - // if want popups but no popups, try baloons - if (disp == ED_POP && !options.bHavePopups) - disp = ED_BAL; - mir_snwprintf(buffer, L"%s Error", _A2W(MODULENAME)); wchar_t *message; - switch (disp) { + switch (options.err_method) { case ED_POP: { int size = int(mir_wstrlen(msg) + 515); |