summaryrefslogtreecommitdiff
path: root/src/mir_app
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2017-12-05 18:28:41 +0300
committerGeorge Hazan <ghazan@miranda.im>2017-12-05 18:28:47 +0300
commit1b803834c3f1736e658477a042b51d1926e11e7b (patch)
tree358d9a49dc0d9754351d45ac55a2c8d79ef6bf69 /src/mir_app
parenta2734d21545621f9cf80a9bc4dc19b69c27d0a0f (diff)
StdAuth plugin merged back with mir_app.dll
Diffstat (limited to 'src/mir_app')
-rw-r--r--src/mir_app/res/resource.rc45
-rw-r--r--src/mir_app/src/auth.cpp104
-rw-r--r--src/mir_app/src/authdialogs.cpp286
-rw-r--r--src/mir_app/src/modules.cpp2
-rw-r--r--src/mir_app/src/newplugins.cpp32
5 files changed, 453 insertions, 16 deletions
diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc
index ba1f6d591c..992351183a 100644
--- a/src/mir_app/res/resource.rc
+++ b/src/mir_app/res/resource.rc
@@ -727,6 +727,36 @@ BEGIN
PUSHBUTTON "Insert separator",IDC_SEPARATOR,137,211,103,15,BS_MULTILINE
END
+IDD_AUTHREQ DIALOGEX 0, 0, 271, 197
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION
+EXSTYLE WS_EX_CONTROLPARENT
+CAPTION "Authorization request"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "",IDC_HEADERBAR,"MHeaderbarCtrl",0x0,0,0,271,25
+ DEFPUSHBUTTON "&Authorize",IDOK,17,176,50,14
+ PUSHBUTTON "&Deny",IDCANCEL,97,176,50,14
+ PUSHBUTTON "Decide &later",IDC_DECIDELATER,175,176,74,14
+ CONTROL "User &details",IDC_DETAILS,"MButtonClass",WS_TABSTOP,248,29,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ LTEXT "Reason:",IDC_STATIC,7,39,101,10,SS_CENTERIMAGE
+ EDITTEXT IDC_REASON,7,50,257,54,ES_MULTILINE | ES_READONLY | NOT WS_BORDER | WS_VSCROLL | WS_HSCROLL,WS_EX_STATICEDGE
+ LTEXT "Denial reason:",IDC_STATIC,7,111,89,10,SS_CENTERIMAGE | SS_REALSIZECONTROL
+ EDITTEXT IDC_DENYREASON,7,124,257,32,ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | NOT WS_BORDER,WS_EX_STATICEDGE
+ CONTROL "Add to contact list if authorized",IDC_ADDCHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,18,162,239,10
+END
+
+IDD_ADDED DIALOGEX 0, 0, 241, 70
+STYLE DS_SETFONT | DS_MODALFRAME | DS_SETFOREGROUND | DS_3DLOOK | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
+EXSTYLE WS_EX_CONTROLPARENT
+CAPTION "You were added"
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ CONTROL "",IDC_HEADERBAR,"MHeaderbarCtrl",0x0,0,0,241,25
+ PUSHBUTTON "&Close",IDCANCEL,90,51,60,14
+ CONTROL "User &details",IDC_DETAILS,"MButtonClass",WS_TABSTOP,217,29,16,14,WS_EX_NOACTIVATE | 0x10000000L
+ CONTROL "&Add",IDC_ADD,"MButtonClass",WS_TABSTOP,197,29,16,14,WS_EX_NOACTIVATE | 0x10000000L
+END
+
/////////////////////////////////////////////////////////////////////////////
//
// DESIGNINFO
@@ -998,6 +1028,21 @@ BEGIN
VERTGUIDE, 296
BOTTOMMARGIN, 186
END
+
+ IDD_AUTHREQ, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 264
+ BOTTOMMARGIN, 190
+ END
+
+ IDD_ADDED, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ RIGHTMARGIN, 233
+ TOPMARGIN, 3
+ BOTTOMMARGIN, 65
+ END
END
#endif // APSTUDIO_INVOKED
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp
new file mode 100644
index 0000000000..119b86e061
--- /dev/null
+++ b/src/mir_app/src/auth.cpp
@@ -0,0 +1,104 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (c) 2012-17 Miranda NG project (https://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+
+#define MS_AUTH_SHOWREQUEST "Auth/ShowRequest"
+#define MS_AUTH_SHOWADDED "Auth/ShowAdded"
+
+INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+
+INT_PTR ShowReqWindow(WPARAM, LPARAM lParam)
+{
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_AUTHREQ), NULL, DlgProcAuthReq, (LPARAM)((CLISTEVENT *)lParam)->hDbEvent);
+ return 0;
+}
+
+INT_PTR ShowAddedWindow(WPARAM, LPARAM lParam)
+{
+ CreateDialogParam(g_hInst, MAKEINTRESOURCE(IDD_ADDED), NULL, DlgProcAdded, (LPARAM)((CLISTEVENT *)lParam)->hDbEvent);
+ return 0;
+}
+
+static int AuthEventAdded(WPARAM, LPARAM lParam)
+{
+ wchar_t szTooltip[256];
+ MEVENT hDbEvent = (MEVENT)lParam;
+
+ DBEVENTINFO dbei = {};
+ db_event_get(lParam, &dbei);
+ if (dbei.flags & (DBEF_SENT | DBEF_READ) || (dbei.eventType != EVENTTYPE_AUTHREQUEST && dbei.eventType != EVENTTYPE_ADDED))
+ return 0;
+
+ dbei.cbBlob = db_event_getBlobSize(hDbEvent);
+ dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
+ db_event_get(hDbEvent, &dbei);
+
+ MCONTACT hContact = DbGetAuthEventContact(&dbei);
+
+ CLISTEVENT cle = {};
+ cle.hContact = hContact;
+ cle.szTooltip.w = szTooltip;
+ cle.flags = CLEF_UNICODE;
+ cle.lParam = lParam;
+ cle.hDbEvent = hDbEvent;
+
+ ptrW szUid(Contact_GetInfo(CNF_UNIQUEID, hContact));
+
+ if (dbei.eventType == EVENTTYPE_AUTHREQUEST) {
+ Skin_PlaySound("AuthRequest");
+ if (szUid)
+ mir_snwprintf(szTooltip, TranslateT("%s requests authorization"), szUid);
+ else
+ mir_snwprintf(szTooltip, TranslateT("%u requests authorization"), *(PDWORD)dbei.pBlob);
+
+ cle.hIcon = Skin_LoadIcon(SKINICON_AUTH_REQUEST);
+ cle.pszService = MS_AUTH_SHOWREQUEST;
+ cli.pfnAddEvent(&cle);
+ }
+ else if (dbei.eventType == EVENTTYPE_ADDED) {
+ Skin_PlaySound("AddedEvent");
+ if (szUid)
+ mir_snwprintf(szTooltip, TranslateT("%s added you to their contact list"), szUid);
+ else
+ mir_snwprintf(szTooltip, TranslateT("%u added you to their contact list"), *(PDWORD)dbei.pBlob);
+
+ cle.hIcon = Skin_LoadIcon(SKINICON_AUTH_ADD);
+ cle.pszService = MS_AUTH_SHOWADDED;
+ cli.pfnAddEvent(&cle);
+ }
+ return 0;
+}
+
+int LoadSendRecvAuthModule(void)
+{
+ CreateServiceFunction(MS_AUTH_SHOWREQUEST, ShowReqWindow);
+ CreateServiceFunction(MS_AUTH_SHOWADDED, ShowAddedWindow);
+ HookEvent(ME_DB_EVENT_ADDED, AuthEventAdded);
+
+ Skin_AddSound("AuthRequest", LPGENW("Alerts"), LPGENW("Authorization request"));
+ Skin_AddSound("AddedEvent", LPGENW("Alerts"), LPGENW("Added event"));
+ return 0;
+}
diff --git a/src/mir_app/src/authdialogs.cpp b/src/mir_app/src/authdialogs.cpp
new file mode 100644
index 0000000000..81ab47bfd3
--- /dev/null
+++ b/src/mir_app/src/authdialogs.cpp
@@ -0,0 +1,286 @@
+/*
+
+Miranda NG: the free IM client for Microsoft* Windows*
+
+Copyright (c) 2012-17 Miranda NG project (https://miranda-ng.org),
+Copyright (c) 2000-12 Miranda IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#include "stdafx.h"
+
+INT_PTR CALLBACK DlgProcAdded(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ MEVENT hDbEvent = (MEVENT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
+ Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list"));
+
+ hDbEvent = lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+ {
+ //blob is: uin(DWORD), hcontact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ)
+ DBEVENTINFO dbei = {};
+ dbei.cbBlob = db_event_getBlobSize(hDbEvent);
+ dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
+ db_event_get(hDbEvent, &dbei);
+
+ DWORD uin = *(PDWORD)dbei.pBlob;
+ MCONTACT hContact = DbGetAuthEventContact(&dbei);
+ char* nick = (char*)dbei.pBlob + sizeof(DWORD) * 2;
+ char* first = nick + mir_strlen(nick) + 1;
+ char* last = first + mir_strlen(first) + 1;
+ char* email = last + mir_strlen(last) + 1;
+
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+
+ PROTOACCOUNT* acc = Proto_GetAccount(dbei.szModule);
+
+ wchar_t* lastT = dbei.flags & DBEF_UTF ? Utf8DecodeW(last) : mir_a2u(last);
+ wchar_t* firstT = dbei.flags & DBEF_UTF ? Utf8DecodeW(first) : mir_a2u(first);
+ wchar_t* nickT = dbei.flags & DBEF_UTF ? Utf8DecodeW(nick) : mir_a2u(nick);
+ wchar_t* emailT = dbei.flags & DBEF_UTF ? Utf8DecodeW(email) : mir_a2u(email);
+
+ wchar_t name[128] = L"";
+ int off = 0;
+ if (firstT[0] && lastT[0])
+ off = mir_snwprintf(name, L"%s %s", firstT, lastT);
+ else if (firstT[0])
+ off = mir_snwprintf(name, L"%s", firstT);
+ else if (lastT[0])
+ off = mir_snwprintf(name, L"%s", lastT);
+ if (nickT[0]) {
+ if (off)
+ mir_snwprintf(name + off, _countof(name) - off, L" (%s)", nickT);
+ else
+ wcsncpy_s(name, nickT, _TRUNCATE);
+ }
+ if (!name[0])
+ wcsncpy_s(name, TranslateT("<Unknown>"), _TRUNCATE);
+
+ wchar_t hdr[256];
+ if (uin && emailT[0])
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%u (%s) on %s"), name, uin, emailT, acc->tszAccountName);
+ else if (uin)
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%u on %s"), name, uin, acc->tszAccountName);
+ else
+ mir_snwprintf(hdr, TranslateT("%s added you to the contact list\n%s on %s"), name, emailT[0] ? emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
+
+ mir_free(lastT);
+ mir_free(firstT);
+ mir_free(nickT);
+ mir_free(emailT);
+
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA, (LONG_PTR)hContact);
+
+ if (hContact == INVALID_CONTACT_ID || !db_get_b(hContact, "CList", "NotOnList", 0))
+ ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_ADD:
+ {
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.hDbEvent = hDbEvent;
+ acs.handleType = HANDLE_EVENT;
+ acs.szProto = "";
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+
+ MCONTACT hContact = (MCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA);
+ if ((hContact == INVALID_CONTACT_ID) || !db_get_b(hContact, "CList", "NotOnList", 0))
+ ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+ }
+ break;
+
+ case IDC_DETAILS:
+ {
+ MCONTACT hContact = (MCONTACT)GetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA);
+ CallService(MS_USERINFO_SHOWDIALOG, hContact, 0);
+ }
+ break;
+
+ case IDOK:
+ {
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.hDbEvent = hDbEvent;
+ acs.handleType = HANDLE_EVENT;
+ acs.szProto = "";
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+ }
+ //fall through
+ case IDCANCEL:
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ break;
+
+ case WM_DESTROY:
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS);
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
+ break;
+ }
+ return FALSE;
+}
+
+INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ MEVENT hDbEvent = (MEVENT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ Button_SetIcon_IcoLib(hwndDlg, IDC_DETAILS, SKINICON_OTHER_USERDETAILS, LPGEN("View user's details"));
+ Button_SetIcon_IcoLib(hwndDlg, IDC_ADD, SKINICON_OTHER_ADDCONTACT, LPGEN("Add contact permanently to list"));
+ {
+ hDbEvent = lParam;
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
+
+ //blob is: uin(DWORD), hcontact(DWORD), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
+ DBEVENTINFO dbei = {};
+ dbei.cbBlob = db_event_getBlobSize(hDbEvent);
+ dbei.pBlob = (PBYTE)alloca(dbei.cbBlob);
+ db_event_get(hDbEvent, &dbei);
+
+ DWORD uin = *(PDWORD)dbei.pBlob;
+ MCONTACT hContact = DbGetAuthEventContact(&dbei);
+ char *nick = (char*)dbei.pBlob + sizeof(DWORD) * 2;
+ char *first = nick + mir_strlen(nick) + 1;
+ char *last = first + mir_strlen(first) + 1;
+ char *email = last + mir_strlen(last) + 1;
+ char *reason = email + mir_strlen(email) + 1;
+
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_SMALL, 0));
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, CallProtoService(dbei.szModule, PS_LOADICON, PLI_PROTOCOL | PLIF_LARGE, 0));
+
+ PROTOACCOUNT *acc = Proto_GetAccount(dbei.szModule);
+
+ ptrW lastT(dbei.flags & DBEF_UTF ? Utf8DecodeW(last) : mir_a2u(last));
+ ptrW firstT(dbei.flags & DBEF_UTF ? Utf8DecodeW(first) : mir_a2u(first));
+ ptrW nickT(dbei.flags & DBEF_UTF ? Utf8DecodeW(nick) : mir_a2u(nick));
+ ptrW emailT(dbei.flags & DBEF_UTF ? Utf8DecodeW(email) : mir_a2u(email));
+ ptrW reasonT(dbei.flags & DBEF_UTF ? Utf8DecodeW(reason) : mir_a2u(reason));
+
+ wchar_t name[128] = L"";
+ int off = 0;
+ if (firstT[0] && lastT[0])
+ off = mir_snwprintf(name, L"%s %s", (wchar_t*)firstT, (wchar_t*)lastT);
+ else if (firstT[0])
+ off = mir_snwprintf(name, L"%s", (wchar_t*)firstT);
+ else if (lastT[0])
+ off = mir_snwprintf(name, L"%s", (wchar_t*)lastT);
+ if (mir_wstrlen(nickT)) {
+ if (off)
+ mir_snwprintf(name + off, _countof(name) - off, L" (%s)", (wchar_t*)nickT);
+ else
+ wcsncpy_s(name, nickT, _TRUNCATE);
+ }
+ if (!name[0])
+ wcsncpy_s(name, TranslateT("<Unknown>"), _TRUNCATE);
+
+ wchar_t hdr[256];
+ if (uin && emailT[0])
+ mir_snwprintf(hdr, TranslateT("%s requested authorization\n%u (%s) on %s"), name, uin, (wchar_t*)emailT, acc->tszAccountName);
+ else if (uin)
+ mir_snwprintf(hdr, TranslateT("%s requested authorization\n%u on %s"), name, uin, acc->tszAccountName);
+ else
+ mir_snwprintf(hdr, TranslateT("%s requested authorization\n%s on %s"), name, emailT[0] ? (wchar_t*)emailT : TranslateT("(Unknown)"), acc->tszAccountName);
+
+ SetDlgItemText(hwndDlg, IDC_HEADERBAR, hdr);
+ SetDlgItemText(hwndDlg, IDC_REASON, reasonT);
+
+ if (hContact == INVALID_CONTACT_ID || !db_get_b(hContact, "CList", "NotOnList", 0))
+ ShowWindow(GetDlgItem(hwndDlg, IDC_ADD), FALSE);
+
+ SendDlgItemMessage(hwndDlg, IDC_DENYREASON, EM_LIMITTEXT, 255, 0);
+ if (CallProtoService(dbei.szModule, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_NOAUTHDENYREASON) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_DENYREASON), FALSE);
+ SetDlgItemText(hwndDlg, IDC_DENYREASON, TranslateT("Feature is not supported by protocol"));
+ }
+ if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ADDCHECK), FALSE);
+ CheckDlgButton(hwndDlg, IDC_ADDCHECK, BST_UNCHECKED);
+ }
+ else CheckDlgButton(hwndDlg, IDC_ADDCHECK, BST_CHECKED);
+
+ SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_DETAILS), GWLP_USERDATA, (LONG_PTR)hContact);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_DETAILS:
+ CallService(MS_USERINFO_SHOWDIALOG, GetWindowLongPtr((HWND)lParam, GWLP_USERDATA), 0);
+ break;
+
+ case IDC_DECIDELATER:
+ DestroyWindow(hwndDlg);
+ break;
+
+ case IDOK:
+ {
+ DBEVENTINFO dbei = {};
+ db_event_get(hDbEvent, &dbei);
+ CallProtoService(dbei.szModule, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_ADDCHECK)) {
+ ADDCONTACTSTRUCT acs = { 0 };
+ acs.hDbEvent = hDbEvent;
+ acs.handleType = HANDLE_EVENT;
+ acs.szProto = "";
+ CallService(MS_ADDCONTACT_SHOW, (WPARAM)hwndDlg, (LPARAM)&acs);
+ }
+ }
+ DestroyWindow(hwndDlg);
+ break;
+
+ case IDCANCEL:
+ {
+ DBEVENTINFO dbei = {};
+ db_event_get(hDbEvent, &dbei);
+
+ if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) {
+ wchar_t tszReason[256];
+ GetDlgItemText(hwndDlg, IDC_DENYREASON, tszReason, _countof(tszReason));
+ CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, (LPARAM)tszReason);
+ }
+ else CallProtoService(dbei.szModule, PS_AUTHDENY, hDbEvent, 0);
+ }
+ DestroyWindow(hwndDlg);
+ break;
+ }
+ break;
+
+ case WM_DESTROY:
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_ADD);
+ Button_FreeIcon_IcoLib(hwndDlg, IDC_DETAILS);
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
+ DestroyIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
+ break;
+ }
+ return FALSE;
+}
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp
index 78f03c90a7..6795b63318 100644
--- a/src/mir_app/src/modules.cpp
+++ b/src/mir_app/src/modules.cpp
@@ -31,6 +31,7 @@ INT_PTR CheckRestart(); // core: IDD_WAITRESTART
int LoadSystemModule(void); // core: m_system.h services
int LoadNewPluginsModuleInfos(void); // core: preloading plugins
+int LoadSendRecvAuthModule(void); // core: auth dialogs
int LoadNewPluginsModule(void); // core: N.O. plugins
int LoadNetlibModule(void); // core: network
int LoadSslModule(void);
@@ -140,6 +141,7 @@ int LoadDefaultModules(void)
if (LoadFontserviceModule()) return 1;
if (LoadSrmmModule()) return 1;
if (LoadChatModule()) return 1;
+ if (LoadSendRecvAuthModule()) return 1;
if (LoadDescButtonModule()) return 1;
if (LoadOptionsModule()) return 1;
if (LoadNetlibModule()) return 1;
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp
index de3f0a685e..595a0a0be3 100644
--- a/src/mir_app/src/newplugins.cpp
+++ b/src/mir_app/src/newplugins.cpp
@@ -119,8 +119,9 @@ static const MUUID pluginBannedList[] =
{ 0x621f886b, 0xa7f6, 0x457f, { 0x9d, 0x62, 0x8e, 0xe8, 0x4c, 0x27, 0x59, 0x93 } }, // modernopt
{ 0x08B86253, 0xEC6E, 0x4d09, { 0xB7, 0xA9, 0x64, 0xAC, 0xDF, 0x06, 0x27, 0xB8 } }, // gtalkext
{ 0x4f1ff7fa, 0x4d75, 0x44b9, { 0x93, 0xb0, 0x2c, 0xed, 0x2e, 0x4f, 0x9e, 0x3e } }, // whatsapp
- { 0xb908773a, 0x86f7, 0x4a91, { 0x86, 0x74, 0x6a, 0x20, 0xba, 0xe, 0x67, 0xd1 } }, // dropbox (0xe isn't typo - it's from original plugin)
+ { 0xb908773a, 0x86f7, 0x4a91, { 0x86, 0x74, 0x6a, 0x20, 0xba, 0x0e, 0x67, 0xd1 } }, // dropbox
{ 0x748f8934, 0x781a, 0x528d, { 0x52, 0x08, 0x00, 0x12, 0x65, 0x40, 0x4a, 0xb3 } }, // tlen
+ { 0x8d0a046d, 0x8ea9, 0x4c55, { 0xb5, 0x68, 0x38, 0xda, 0x52, 0x05, 0x64, 0xfd } }, // stdauth
};
static bool isPluginBanned(const MUUID& u1)
@@ -137,18 +138,17 @@ static bool isPluginBanned(const MUUID& u1)
static MuuidReplacement pluginDefault[] =
{
- { MIID_UIUSERINFO, L"stduserinfo", nullptr }, // 0
- { MIID_SREMAIL, L"stdemail", nullptr }, // 1
- { MIID_SRAUTH, L"stdauth", nullptr }, // 2
- { MIID_SRFILE, L"stdfile", nullptr }, // 3
- { MIID_UIHELP, L"stdhelp", nullptr }, // 4
- { MIID_UIHISTORY, L"stduihist", nullptr }, // 5
- { MIID_IDLE, L"stdidle", nullptr }, // 6
- { MIID_AUTOAWAY, L"stdautoaway", nullptr }, // 7
- { MIID_USERONLINE, L"stduseronline", nullptr }, // 8
- { MIID_SRAWAY, L"stdaway", nullptr }, // 9
- { MIID_CLIST, L"stdclist", nullptr }, // 10
- { MIID_SRMM, L"stdmsg", nullptr } // 11
+ { MIID_CLIST, L"stdclist", nullptr }, // 0
+ { MIID_SRMM, L"stdmsg", nullptr }, // 1
+ { MIID_UIUSERINFO, L"stduserinfo", nullptr }, // 2
+ { MIID_SREMAIL, L"stdemail", nullptr }, // 3
+ { MIID_SRFILE, L"stdfile", nullptr }, // 4
+ { MIID_UIHELP, L"stdhelp", nullptr }, // 5
+ { MIID_UIHISTORY, L"stduihist", nullptr }, // 6
+ { MIID_IDLE, L"stdidle", nullptr }, // 7
+ { MIID_AUTOAWAY, L"stdautoaway", nullptr }, // 8
+ { MIID_USERONLINE, L"stduseronline", nullptr }, // 9
+ { MIID_SRAWAY, L"stdaway", nullptr }, // 10
};
int getDefaultPluginIdx(const MUUID &muuid)
@@ -170,7 +170,7 @@ int LoadStdPlugins()
return 1;
}
- if (pluginDefault[11].pImpl == nullptr)
+ if (pluginDefault[1].pImpl == nullptr)
MessageBox(nullptr, TranslateT("No messaging plugins loaded. Please install/enable one of the messaging plugins, for instance, \"StdMsg.dll\""), L"Miranda NG", MB_OK | MB_ICONWARNING);
return 0;
@@ -627,7 +627,7 @@ static bool loadClistModule(wchar_t* exe, pluginEntry *p)
if (bpi.clistlink() == 0) {
p->bpi = bpi;
p->pclass |= PCLASS_LOADED;
- pluginDefault[10].pImpl = p;
+ pluginDefault[0].pImpl = p;
LoadExtraIconsModule();
return true;
@@ -651,7 +651,7 @@ static pluginEntry* getCListModule(wchar_t *exe)
return p;
}
- MuuidReplacement& stdClist = pluginDefault[10];
+ MuuidReplacement& stdClist = pluginDefault[0];
if (LoadCorePlugin(stdClist)) {
mir_snwprintf(tszFullPath, L"%s\\Core\\%s.dll", exe, stdClist.stdplugname);
if (loadClistModule(tszFullPath, stdClist.pImpl))