diff options
Diffstat (limited to 'src/mir_app')
168 files changed, 2060 insertions, 2219 deletions
diff --git a/src/mir_app/mir_app.vcxproj b/src/mir_app/mir_app.vcxproj index 50cfd59262..b9afb141b1 100644 --- a/src/mir_app/mir_app.vcxproj +++ b/src/mir_app/mir_app.vcxproj @@ -56,7 +56,7 @@ <ClCompile Include="src\CMPluginBase.cpp" />
<ClCompile Include="src\colorchooser.cpp" />
<ClCompile Include="src\clccontact.cpp" />
- <ClCompile Include="src\contacts.cpp" />
+ <ClCompile Include="src\clistcontacts.cpp" />
<ClCompile Include="src\database.cpp" />
<ClCompile Include="src\db_events.cpp" />
<ClCompile Include="src\db_ini.cpp" />
@@ -64,8 +64,10 @@ <ClCompile Include="src\db_upgrade.cpp" />
<ClCompile Include="src\db_util.cpp" />
<ClCompile Include="src\descbutton.cpp" />
- <ClCompile Include="src\dll_sniffer.cpp" />
- <ClCompile Include="src\Docking.cpp" />
+ <ClCompile Include="src\dll_sniffer.cpp">
+ <ExceptionHandling>false</ExceptionHandling>
+ <DisableSpecificWarnings>4652;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ </ClCompile>
<ClCompile Include="src\ei_baseIcon.cpp" />
<ClCompile Include="src\ei_callbackIcon.cpp" />
<ClCompile Include="src\ei_defaulticons.cpp" />
@@ -172,6 +174,9 @@ <ClCompile Include="src\usedIcons.cpp" />
<ClCompile Include="src\utils.cpp" />
<ClCompile Include="src\userInfo.cpp" />
+ <ClInclude Include="..\..\include\m_clc.h" />
+ <ClInclude Include="..\..\include\m_clist.h" />
+ <ClInclude Include="..\..\include\m_clistint.h" />
<ClInclude Include="src\chat.h" />
<ClInclude Include="src\clc.h" />
<ClInclude Include="src\database.h" />
@@ -196,8 +201,8 @@ </ItemGroup>
<ItemDefinitionGroup>
<ClCompile>
- <PreprocessorDefinitions Condition="'$(Configuration)'=='Debug'">MIR_APP_EXPORTS;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <PreprocessorDefinitions Condition="'$(Configuration)'=='Release'">MIR_APP_EXPORTS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>MIR_APP_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <ExceptionHandling>Sync</ExceptionHandling>
</ClCompile>
<Link>
<ModuleDefinitionFile Condition="'$(Platform)'=='Win32'">src/mir_app.def</ModuleDefinitionFile>
diff --git a/src/mir_app/mir_app.vcxproj.filters b/src/mir_app/mir_app.vcxproj.filters index 89c02483c7..8a0de1ff64 100644 --- a/src/mir_app/mir_app.vcxproj.filters +++ b/src/mir_app/mir_app.vcxproj.filters @@ -11,9 +11,6 @@ <ClCompile Include="src\button.cpp">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\contacts.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\descbutton.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -368,9 +365,6 @@ <ClCompile Include="src\movetogroup.cpp">
<Filter>Source Files\Contact list</Filter>
</ClCompile>
- <ClCompile Include="src\Docking.cpp">
- <Filter>Source Files\Contact list</Filter>
- </ClCompile>
<ClCompile Include="src\CMPluginBase.cpp">
<Filter>Source Files\Plugins</Filter>
</ClCompile>
@@ -389,9 +383,6 @@ <ClCompile Include="src\clccontact.cpp">
<Filter>Source Files\Contact list</Filter>
</ClCompile>
- <ClCompile Include="src\clc.cpp">
- <Filter>Source Files\MetaContacts</Filter>
- </ClCompile>
<ClCompile Include="src\chat_loginfo.cpp">
<Filter>Source Files\Chats</Filter>
</ClCompile>
@@ -434,6 +425,12 @@ <ClCompile Include="src\searchresults.cpp">
<Filter>Source Files\FindAdd</Filter>
</ClCompile>
+ <ClCompile Include="src\clistcontacts.cpp">
+ <Filter>Source Files\Contact list</Filter>
+ </ClCompile>
+ <ClCompile Include="src\clc.cpp">
+ <Filter>Source Files\Contact list</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\filter.h">
@@ -499,6 +496,15 @@ <ClInclude Include="src\findadd.h">
<Filter>Source Files\FindAdd</Filter>
</ClInclude>
+ <ClInclude Include="..\..\include\m_clc.h">
+ <Filter>Source Files\Contact list</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\m_clist.h">
+ <Filter>Source Files\Contact list</Filter>
+ </ClInclude>
+ <ClInclude Include="..\..\include\m_clistint.h">
+ <Filter>Source Files\Contact list</Filter>
+ </ClInclude>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="res\resource.rc">
diff --git a/src/mir_app/res/cloud.ico b/src/mir_app/res/cloud.ico Binary files differnew file mode 100644 index 0000000000..d5349f353f --- /dev/null +++ b/src/mir_app/res/cloud.ico diff --git a/src/mir_app/res/resource.rc b/src/mir_app/res/resource.rc index 83ec6b8e1a..1227509edc 100644 --- a/src/mir_app/res/resource.rc +++ b/src/mir_app/res/resource.rc @@ -7,6 +7,7 @@ //
// Generated from the TEXTINCLUDE 2 resource.
//
+#define WINVER 0x0501
#include <winres.h>
#include "../../include/statusmodes.h"
@@ -298,6 +299,8 @@ BEGIN LTEXT "Messages",IDC_STATIC,28,178,70,8,SS_NOPREFIX | SS_CENTERIMAGE
ICON IDI_FILE,IDC_FILEICON,8,187,20,20,SS_CENTERIMAGE
LTEXT "Files",IDC_STATIC,28,193,70,8,SS_NOPREFIX | SS_CENTERIMAGE
+ ICON IDI_DATABASE,IDC_OFFLINEICON,8,202,20,20,SS_CENTERIMAGE
+ LTEXT "Cloud files",IDC_STATIC,28,208,70,8,SS_NOPREFIX | SS_CENTERIMAGE
ICON IDI_USERONLINE,IDC_ONLINEICON,96,172,20,20,SS_CENTERIMAGE
LTEXT "Online notification",IDC_STATIC,116,178,107,8,SS_NOPREFIX | SS_CENTERIMAGE
ICON IDI_MIRANDA,IDC_AUTHICON,96,187,20,20,SS_CENTERIMAGE
@@ -470,20 +473,19 @@ BEGIN GROUPBOX "Protocol menus",IDC_STATIC,5,81,140,41
CONTROL "Move to the main menu",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,11,95,128,8
CONTROL "Move to the status bar",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,11,107,130,8
- LTEXT "Warning!\r\nThis menu object not support user defined options.",IDC_NOTSUPPORTWARNING,10,124,136,32,NOT WS_VISIBLE
- PUSHBUTTON "Insert submenu",IDC_INSERTSUBMENU,39,147,97,14,WS_DISABLED
- PUSHBUTTON "Insert separator",IDC_INSERTSEPARATOR,39,164,97,14,WS_DISABLED
- LTEXT "Module:",IDC_STATIC,4,184,29,8
- EDITTEXT IDC_GENMENU_MODULE,36,183,108,14,ES_AUTOHSCROLL | ES_READONLY
- LTEXT "Service:",IDC_STATIC,4,201,29,8
- EDITTEXT IDC_GENMENU_SERVICE,36,199,108,14,ES_AUTOHSCROLL | ES_READONLY
- LTEXT "Name:",IDC_STATIC,4,218,29,8
- EDITTEXT IDC_GENMENU_CUSTOMNAME,36,215,108,14,ES_AUTOHSCROLL | WS_DISABLED
+ PUSHBUTTON "Insert separator",IDC_INSERTSEPARATOR,39,145,97,14,WS_DISABLED
+ LTEXT "Module:",IDC_STATIC,4,164,29,8
+ EDITTEXT IDC_GENMENU_MODULE,36,162,108,12,ES_AUTOHSCROLL | ES_READONLY
+ LTEXT "Service:",IDC_STATIC,4,180,29,8
+ EDITTEXT IDC_GENMENU_SERVICE,36,178,108,12,ES_AUTOHSCROLL | ES_READONLY
+ LTEXT "ID:",IDC_STATIC,4,196,29,8
+ EDITTEXT IDC_GENMENU_ID,36,194,108,12,ES_AUTOHSCROLL | ES_READONLY
+ LTEXT "Name:",IDC_STATIC,4,212,29,8
+ EDITTEXT IDC_GENMENU_CUSTOMNAME,36,210,108,12,ES_AUTOHSCROLL | WS_DISABLED
PUSHBUTTON "Default",IDC_GENMENU_DEFAULT,7,233,39,15,WS_DISABLED
PUSHBUTTON "Set",IDC_GENMENU_SET,50,233,45,15,WS_DISABLED
CONTROL "Enable icons",IDC_DISABLEMENUICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,156,234,91,10
PUSHBUTTON "Reset",IDC_RESETMENU,254,230,50,14
- PUSHBUTTON "Delete",IDC_GENMENU_DELETE,100,233,39,15,WS_DISABLED
END
IDD_OPT_PROTOCOLORDER DIALOGEX 0, 0, 315, 242
@@ -681,10 +683,11 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD EXSTYLE WS_EX_CONTROLPARENT
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- LTEXT "Choose needed logger from listed below:",IDC_STATIC,2,3,299,8
- LISTBOX IDC_LIST,0,16,305,189,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
- CONTROL "Enable custom loggers in group chats",IDC_ENABLE_CUSTOM,
- "Button",BS_AUTOCHECKBOX | WS_TABSTOP,5,210,297,12
+ GROUPBOX "Choose a log viewer",IDC_STATIC,7,5,292,76
+ LTEXT "For the private conversations",IDC_STATIC,20,18,272,8
+ LTEXT "For the group chats",IDC_STATIC,20,48,272,8
+ COMBOBOX IDC_LOGGER,20,29,222,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
+ COMBOBOX IDC_LOGGER_GC,20,60,222,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
END
IDD_OPT_LANGUAGES DIALOGEX 0, 0, 301, 191
@@ -752,7 +755,7 @@ BEGIN 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 | 0x40
+ 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
@@ -1064,9 +1067,8 @@ BEGIN ICON "",IDC_FILEICON,25,15,16,14,SS_CENTERIMAGE | SS_REALSIZEIMAGE
CONTROL "Transfer completed, open file(s).",IDC_TRANSFERCOMPLETED,
"Hyperlink",NOT WS_VISIBLE | WS_TABSTOP,42,17,173,10
- LTEXT "No data transferred",IDC_ALLTRANSFERRED,25,29,230,14,SS_NOPREFIX | SS_CENTERIMAGE
- RTEXT "",IDC_ALLSPEED,252,29,3,14,SS_NOPREFIX | SS_CENTERIMAGE
- LTEXT "",IDC_ALLPRECENTS,218,14,33,14,SS_CENTERIMAGE
+ LTEXT "No data transferred",IDC_ALLTRANSFERRED,25,29,130,14,SS_NOPREFIX | SS_CENTERIMAGE
+ RTEXT "",IDC_ALLSPEED,152,29,103,14,SS_NOPREFIX | SS_CENTERIMAGE
CONTROL "",IDC_FRAME,"Static",SS_ETCHEDHORZ,1,43,254,1
END
@@ -1457,6 +1459,7 @@ END 2 TEXTINCLUDE
BEGIN
+ "#define WINVER 0x0501\r\n"
"#include <winres.h>\r\n"
"#include ""../../include/statusmodes.h""\r\n"
"\0"
@@ -1616,6 +1619,8 @@ IDI_CHAT ICON "chat_channel.ico" IDI_CODE ICON "code.ico"
+IDI_CLOUD ICON "cloud.ico"
+
IDI_MALE ICON "male.ico"
IDI_FEMALE ICON "female.ico"
@@ -1796,6 +1801,11 @@ BEGIN 0
END
+IDD_OPT_GENMENU AFX_DIALOG_LAYOUT
+BEGIN
+ 0
+END
+
#endif // English (United States) resources
/////////////////////////////////////////////////////////////////////////////
diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index d1595c32b6..7a465e56b4 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/Docking.cpp b/src/mir_app/src/Docking.cpp deleted file mode 100644 index 699807ce13..0000000000 --- a/src/mir_app/src/Docking.cpp +++ /dev/null @@ -1,363 +0,0 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (C) 2012-24 Miranda NG team (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"
-#include "clc.h"
-
-#define WM_DOCKCALLBACK (WM_USER+121)
-#define EDGESENSITIVITY 3
-
-#define DOCKED_NONE 0
-#define DOCKED_LEFT 1
-#define DOCKED_RIGHT 2
-
-static int docked;
-static POINT dockPos;
-
-static void Docking_GetMonitorRectFromPoint(LPPOINT pt, LPRECT rc)
-{
- MONITORINFO monitorInfo;
- HMONITOR hMonitor = MonitorFromPoint(*pt, MONITOR_DEFAULTTONEAREST); // always returns a valid value
- monitorInfo.cbSize = sizeof(monitorInfo);
-
- if (GetMonitorInfo(hMonitor, &monitorInfo)) {
- *rc = monitorInfo.rcMonitor;
- return;
- }
-
- // "generic" win95/NT support, also serves as failsafe
- rc->left = 0;
- rc->top = 0;
- rc->bottom = GetSystemMetrics(SM_CYSCREEN);
- rc->right = GetSystemMetrics(SM_CXSCREEN);
-}
-
-static void Docking_RectToDock(LPRECT rc)
-{
- rc->right += dockPos.x - rc->left;
- rc->left = dockPos.x;
- rc->bottom += dockPos.y - rc->top;
- rc->top = dockPos.y;
-}
-
-static void Docking_PosCommand(HWND hwnd, LPRECT rc, bool query)
-{
- APPBARDATA abd = { 0 };
-
- abd.cbSize = sizeof(abd);
- abd.hWnd = hwnd;
- abd.uEdge = docked == DOCKED_LEFT ? ABE_LEFT : ABE_RIGHT;
- abd.rc = *rc;
- SHAppBarMessage(query ? ABM_QUERYPOS : ABM_SETPOS, &abd);
- *rc = abd.rc;
-}
-
-static UINT_PTR Docking_Command(HWND hwnd, int cmd)
-{
- APPBARDATA abd = { 0 };
-
- abd.cbSize = sizeof(abd);
- abd.hWnd = hwnd;
- abd.uCallbackMessage = WM_DOCKCALLBACK;
- return SHAppBarMessage(cmd, &abd);
-}
-
-static void Docking_AdjustPosition(HWND hwnd, LPRECT rcDisplay, LPRECT rc, bool query, bool move)
-{
- int cx = rc->right - rc->left;
-
- rc->top = rcDisplay->top;
- rc->bottom = rcDisplay->bottom;
- if (docked == DOCKED_LEFT) {
- rc->right = rcDisplay->left + (rc->right - rc->left);
- rc->left = rcDisplay->left;
- }
- else {
- rc->left = rcDisplay->right - (rc->right - rc->left);
- rc->right = rcDisplay->right;
- }
- Docking_PosCommand(hwnd, rc, true);
-
- if (docked == DOCKED_LEFT)
- rc->right = rc->left + cx;
- else
- rc->left = rc->right - cx;
-
- if (!query) {
- Docking_PosCommand(hwnd, rc, false);
- dockPos = *(LPPOINT)rc;
- }
-
- if (move)
- MoveWindow(hwnd, rc->left, rc->top, rc->right - rc->left, rc->bottom - rc->top, TRUE);
-}
-
-static void Docking_SetSize(HWND hwnd, LPRECT rc, bool query, bool move)
-{
- RECT rcMonitor;
- Docking_GetMonitorRectFromPoint(
- docked == DOCKED_LEFT && !query ? (LPPOINT)&rc->right : (LPPOINT)rc, &rcMonitor);
- Docking_AdjustPosition(hwnd, &rcMonitor, rc, query, move);
-}
-
-static bool Docking_IsWindowVisible(HWND hwnd)
-{
- LONG style = GetWindowLongPtr(hwnd, GWL_STYLE);
- return style & WS_VISIBLE && !(style & WS_MINIMIZE);
-}
-
-MIR_APP_DLL(BOOL) Clist_IsDocked()
-{
- return docked;
-}
-
-int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam)
-{
- static int draggingTitle;
- MSG *msg = (MSG *)wParam;
-
- if (msg->message == WM_DESTROY) {
- if (docked) {
- db_set_b(0, "CList", "Docked", (uint8_t)docked);
- db_set_dw(0, "CList", "DockX", (uint32_t)dockPos.x);
- db_set_dw(0, "CList", "DockY", (uint32_t)dockPos.y);
- }
- else {
- db_unset(0, "CList", "Docked");
- db_unset(0, "CList", "DockX");
- db_unset(0, "CList", "DockY");
- }
- }
-
- if (!docked && msg->message != WM_CREATE && msg->message != WM_MOVING)
- return 0;
-
- switch (msg->message) {
- case WM_CREATE:
- draggingTitle = 0;
- docked = db_get_b(0, "CLUI", "DockToSides", 1) ?
- (char)db_get_b(0, "CList", "Docked", 0) : 0;
- dockPos.x = (int)db_get_dw(0, "CList", "DockX", 0);
- dockPos.y = (int)db_get_dw(0, "CList", "DockY", 0);
- break;
-
- case WM_ACTIVATE:
- Docking_Command(msg->hwnd, ABM_ACTIVATE);
- break;
-
- case WM_WINDOWPOSCHANGING:
- {
- LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam;
-
- bool vis = Docking_IsWindowVisible(msg->hwnd);
- if (wp->flags & SWP_SHOWWINDOW)
- vis = !IsIconic(msg->hwnd);
- if (wp->flags & SWP_HIDEWINDOW)
- vis = false;
-
- if (vis) {
- if (!(wp->flags & (SWP_NOMOVE | SWP_NOSIZE))) {
- bool addbar = Docking_Command(msg->hwnd, ABM_NEW) != 0;
-
- RECT rc = { 0 };
- GetWindowRect(msg->hwnd, &rc);
-
- int cx = rc.right - rc.left;
- if (!(wp->flags & SWP_NOMOVE)) { rc.left = wp->x; rc.top = wp->y; }
-
- if (addbar)
- Docking_RectToDock(&rc);
-
- if (!(wp->flags & SWP_NOSIZE)) {
- rc.right = rc.left + wp->cx;
- rc.bottom = rc.top + wp->cy;
- addbar |= (cx != wp->cx);
- }
-
- Docking_SetSize(msg->hwnd, &rc, !addbar, false);
-
- if (!(wp->flags & SWP_NOMOVE)) { wp->x = rc.left; wp->y = rc.top; }
- if (!(wp->flags & SWP_NOSIZE)) wp->cy = rc.bottom - rc.top;
-
- *((LRESULT *)lParam) = TRUE;
- return TRUE;
- }
- else {
- if ((wp->flags & SWP_SHOWWINDOW) && Docking_Command(msg->hwnd, ABM_NEW)) {
- RECT rc = { 0 };
- GetWindowRect(msg->hwnd, &rc);
- Docking_RectToDock(&rc);
-
- Docking_SetSize(msg->hwnd, &rc, false, false);
-
- wp->x = rc.left;
- wp->y = rc.top;
- wp->cy = rc.bottom - rc.top;
- wp->cx = rc.right - rc.left;
- wp->flags &= ~(SWP_NOSIZE | SWP_NOMOVE);
- }
- }
- }
- }
- break;
-
- case WM_WINDOWPOSCHANGED:
- {
- LPWINDOWPOS wp = (LPWINDOWPOS)msg->lParam;
- bool vis = Docking_IsWindowVisible(msg->hwnd);
- if (wp->flags & SWP_SHOWWINDOW)
- vis = !IsIconic(msg->hwnd);
- if (wp->flags & SWP_HIDEWINDOW)
- vis = false;
-
- if (!vis)
- Docking_Command(msg->hwnd, ABM_REMOVE);
- else
- Docking_Command(msg->hwnd, ABM_WINDOWPOSCHANGED);
- }
- break;
-
- case WM_DISPLAYCHANGE:
- if (Docking_IsWindowVisible(msg->hwnd)) {
- RECT rc = { 0 };
- GetWindowRect(msg->hwnd, &rc);
- Docking_RectToDock(&rc);
- Docking_SetSize(msg->hwnd, &rc, false, true);
- }
- break;
-
- case WM_MOVING:
- if (!docked) {
- RECT rcMonitor;
- POINT ptCursor;
-
- // stop early
- if (GetAsyncKeyState(VK_CONTROL) & 0x8000)
- return 0;
-
- // GetMessagePos() is no good, position is always unsigned
- // GetCursorPos(&ptCursor);
- uint32_t pos = GetMessagePos();
- ptCursor.x = GET_X_LPARAM(pos);
- ptCursor.y = GET_Y_LPARAM(pos);
- Docking_GetMonitorRectFromPoint(&ptCursor, &rcMonitor);
-
- if (((ptCursor.x < rcMonitor.left + EDGESENSITIVITY) ||
- (ptCursor.x >= rcMonitor.right - EDGESENSITIVITY)) &&
- db_get_b(0, "CLUI", "DockToSides", 1)) {
- docked = (ptCursor.x < rcMonitor.left + EDGESENSITIVITY) ? DOCKED_LEFT : DOCKED_RIGHT;
- PostMessage(msg->hwnd, WM_LBUTTONUP, 0, MAKELPARAM(ptCursor.x, ptCursor.y));
-
- Docking_Command(msg->hwnd, ABM_NEW);
- Docking_AdjustPosition(msg->hwnd, &rcMonitor, (LPRECT)msg->lParam, false, true);
-
- *((LRESULT *)lParam) = TRUE;
- return TRUE;
- }
- }
- break;
-
- case WM_NCHITTEST:
- switch (DefWindowProc(msg->hwnd, WM_NCHITTEST, msg->wParam, msg->lParam)) {
- case HTSIZE: case HTTOP: case HTTOPLEFT: case HTTOPRIGHT:
- case HTBOTTOM: case HTBOTTOMRIGHT: case HTBOTTOMLEFT:
- *((LRESULT *)lParam) = HTCLIENT;
- return TRUE;
-
- case HTLEFT:
- if (docked == DOCKED_LEFT) {
- *((LRESULT *)lParam) = HTCLIENT;
- return TRUE;
- }
- break;
-
- case HTRIGHT:
- if (docked == DOCKED_RIGHT) {
- *((LRESULT *)lParam) = HTCLIENT;
- return TRUE;
- }
- break;
- }
- break;
-
- case WM_SYSCOMMAND:
- if ((msg->wParam & 0xFFF0) != SC_MOVE)
- return 0;
-
- SetActiveWindow(msg->hwnd);
- SetCapture(msg->hwnd);
- draggingTitle = 1;
- *((LRESULT *)lParam) = 0;
- return 1;
-
- case WM_MOUSEMOVE:
- if (draggingTitle) {
- RECT rc;
- POINT pt;
- GetClientRect(msg->hwnd, &rc);
- if ((docked == DOCKED_LEFT && (short)LOWORD(msg->lParam) > rc.right) ||
- (docked == DOCKED_RIGHT && (short)LOWORD(msg->lParam) < 0)) {
- ReleaseCapture();
- draggingTitle = 0;
- docked = 0;
- GetCursorPos(&pt);
- PostMessage(msg->hwnd, WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(pt.x, pt.y));
- SetWindowPos(msg->hwnd, nullptr, pt.x - rc.right / 2,
- pt.y - GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYSMCAPTION) / 2,
- db_get_dw(0, "CList", "Width", 0),
- db_get_dw(0, "CList", "Height", 0),
- SWP_NOZORDER);
- Docking_Command(msg->hwnd, ABM_REMOVE);
- }
- return 1;
- }
- break;
-
- case WM_LBUTTONUP:
- if (draggingTitle) {
- ReleaseCapture();
- draggingTitle = 0;
- }
- break;
-
- case WM_DOCKCALLBACK:
- switch (msg->wParam) {
- case ABN_WINDOWARRANGE:
- ShowWindow(msg->hwnd, msg->lParam ? SW_HIDE : SW_SHOW);
- break;
-
- case ABN_POSCHANGED:
- RECT rc = { 0 };
- GetWindowRect(msg->hwnd, &rc);
- Docking_SetSize(msg->hwnd, &rc, false, true);
- break;
- }
- return 1;
-
- case WM_DESTROY:
- Docking_Command(msg->hwnd, ABM_REMOVE);
- break;
- }
- return 0;
-}
diff --git a/src/mir_app/src/FontOptions.cpp b/src/mir_app/src/FontOptions.cpp index bf90f4e1c2..9945d0d986 100644 --- a/src/mir_app/src/FontOptions.cpp +++ b/src/mir_app/src/FontOptions.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/FontService.cpp b/src/mir_app/src/FontService.cpp index 2dad8a0d99..cd8b8ff3f2 100644 --- a/src/mir_app/src/FontService.cpp +++ b/src/mir_app/src/FontService.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/FontService.h b/src/mir_app/src/FontService.h index 61c9a450f1..b2e6c5a238 100644 --- a/src/mir_app/src/FontService.h +++ b/src/mir_app/src/FontService.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/IcoLib.h b/src/mir_app/src/IcoLib.h index 2d134e1ebb..fffbbbdc32 100644 --- a/src/mir_app/src/IcoLib.h +++ b/src/mir_app/src/IcoLib.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/MDatabaseCommon.cpp b/src/mir_app/src/MDatabaseCommon.cpp index b8416a8d94..c59d832629 100644 --- a/src/mir_app/src/MDatabaseCommon.cpp +++ b/src/mir_app/src/MDatabaseCommon.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -324,7 +324,7 @@ static bool ValidLookupName(const char *szModule, const char *szSetting) STDMETHODIMP_(int) MDatabaseCommon::GetContactSettingWorker(MCONTACT contactID, const char *szModule, const char *szSetting, DBVARIANT *dbv, int isStatic)
{
- if (szSetting == nullptr || szModule == nullptr)
+ if (szSetting == nullptr || szModule == nullptr || contactID == INVALID_CONTACT_ID)
return 1;
DBVARIANT *pCachedValue;
@@ -451,7 +451,7 @@ STDMETHODIMP_(BOOL) MDatabaseCommon::FreeVariant(DBVARIANT *dbv) STDMETHODIMP_(BOOL) MDatabaseCommon::WriteContactSetting(MCONTACT contactID, const char *szModule, const char *szSetting, DBVARIANT *dbv)
{
- if (dbv == nullptr || szSetting == nullptr || szModule == nullptr)
+ if (dbv == nullptr || szSetting == nullptr || szModule == nullptr || contactID == INVALID_CONTACT_ID)
return 1;
// the db format can't tolerate more than 255 bytes of space (incl. null) for settings+module name
@@ -553,6 +553,11 @@ STDMETHODIMP_(int) MDatabaseCommon::SetEventJson(MEVENT, const char *, DBVARIANT return 1;
}
+STDMETHODIMP_(int) MDatabaseCommon::SetEventJson(MEVENT, const char *)
+{
+ return 1;
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// Resident settings
diff --git a/src/mir_app/src/MDatabaseCommonCrypt.cpp b/src/mir_app/src/MDatabaseCommonCrypt.cpp index ea42bfeeff..a3b9efdbeb 100644 --- a/src/mir_app/src/MDatabaseCommonCrypt.cpp +++ b/src/mir_app/src/MDatabaseCommonCrypt.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -457,7 +457,7 @@ int MDatabaseCommon::InitCrypt() CEnterPasswordDialog dlg(this);
while (true) {
if (!dlg.DoModal())
- return 4;
+ throw -2;
pass_ptrA szPassword(mir_utf8encodeW(dlg.m_newPass));
if (m_crypto->setKey(szPassword, (const uint8_t*)key.data(), key.length())) {
diff --git a/src/mir_app/src/MDatabaseReadonly.cpp b/src/mir_app/src/MDatabaseReadonly.cpp index 015cb4e183..1a1a65c86a 100644 --- a/src/mir_app/src/MDatabaseReadonly.cpp +++ b/src/mir_app/src/MDatabaseReadonly.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/MHttpHeaders.cpp b/src/mir_app/src/MHttpHeaders.cpp index 4f985cb782..fdfa824356 100644 --- a/src/mir_app/src/MHttpHeaders.cpp +++ b/src/mir_app/src/MHttpHeaders.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team, +Copyright (C) 2012-25 Miranda NG team, all portions of this codebase are copyrighted to the people listed in contributors.txt. diff --git a/src/mir_app/src/MHttpRequest.cpp b/src/mir_app/src/MHttpRequest.cpp index d2ba1f0879..a95678e5e7 100644 --- a/src/mir_app/src/MHttpRequest.cpp +++ b/src/mir_app/src/MHttpRequest.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -63,6 +63,15 @@ MIR_APP_DLL(MHttpRequest*) operator<<(MHttpRequest *pReq, const INT64_PARAM &par return pReq;
}
+MIR_APP_DLL(MHttpRequest *) operator<<(MHttpRequest *pReq, const BOOL_PARAM ¶m)
+{
+ CMStringA &s = pReq->m_szParam;
+ if (!s.IsEmpty())
+ s.AppendChar('&');
+ s.AppendFormat("%s=%s", param.szName, param.bValue ? "true" : "false");
+ return pReq;
+}
+
MIR_APP_DLL(MHttpRequest*) operator<<(MHttpRequest *pReq, const CHAR_PARAM ¶m)
{
CMStringA &s = pReq->m_szParam;
diff --git a/src/mir_app/src/MHttpResponse.cpp b/src/mir_app/src/MHttpResponse.cpp index c28b2f8834..1b847ed6c6 100644 --- a/src/mir_app/src/MHttpResponse.cpp +++ b/src/mir_app/src/MHttpResponse.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team, +Copyright (C) 2012-25 Miranda NG team, all portions of this codebase are copyrighted to the people listed in contributors.txt. @@ -34,6 +34,29 @@ MHttpResponse::~MHttpResponse() } ///////////////////////////////////////////////////////////////////////////////////////// + +JsonReply::JsonReply(MHttpResponse *pReply) +{ + if (pReply == nullptr) { + m_errorCode = 500; + return; + } + + switch (m_errorCode = pReply->resultCode) { + case 200: case 201: case 204: + m_root = json_parse(pReply->body); + if (m_root == nullptr) + m_errorCode = 500; + break; + } +} + +JsonReply::~JsonReply() +{ + json_delete(m_root); +} + +///////////////////////////////////////////////////////////////////////////////////////// // MHttpResponse helpers for Pascal // declared only in m_netlib.inc diff --git a/src/mir_app/src/addcontact.cpp b/src/mir_app/src/addcontact.cpp index 06fe164d5c..9fe6bc75d5 100644 --- a/src/mir_app/src/addcontact.cpp +++ b/src/mir_app/src/addcontact.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp index 79f0f6657e..e11fa29d1f 100644 --- a/src/mir_app/src/auth.cpp +++ b/src/mir_app/src/auth.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/button.cpp b/src/mir_app/src/button.cpp index 7b27bf52f4..5e853c7b89 100644 --- a/src/mir_app/src/button.cpp +++ b/src/mir_app/src/button.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/chat.h b/src/mir_app/src/chat.h index 7334aae921..270a57ce32 100644 --- a/src/mir_app/src/chat.h +++ b/src/mir_app/src/chat.h @@ -100,8 +100,10 @@ BOOL SM_UserTyping(GCEVENT* gce); SESSION_INFO* SM_FindSessionByContact(MCONTACT hContact);
SESSION_INFO* SM_FindSessionByIndex(const char *pszModule, int iItem);
-STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszStatus, int *iCount);
-uint16_t TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus);
+STATUSINFO* TM_AddStatus(SESSION_INFO *si, const wchar_t *pszStatus);
+STATUSINFO* TM_FindStatus(SESSION_INFO *si, const wchar_t *pszStatus);
+uint16_t TM_StringToWord(SESSION_INFO *si, const wchar_t *pszStatus);
+wchar_t* TM_WordToString(SESSION_INFO *si, uint16_t Status);
USERINFO* UM_AddUser(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszNick, uint16_t wStatus);
BOOL UM_RemoveAll(SESSION_INFO *si);
@@ -151,6 +153,8 @@ CMStringW Chat_GetFolderName(SESSION_INFO *si = nullptr); void Chat_Serialize(SESSION_INFO *si);
bool Chat_Unserialize(SESSION_INFO *si);
+void CheckLogOptions(void);
+
EXTERN_C MIR_APP_DLL(HANDLE) Srmm_AddButton(const BBButton *bbdi, HPLUGIN _hLang);
#pragma comment(lib,"comctl32.lib")
diff --git a/src/mir_app/src/chat_clist.cpp b/src/mir_app/src/chat_clist.cpp index 6e90497932..8faf99d478 100644 --- a/src/mir_app/src/chat_clist.cpp +++ b/src/mir_app/src/chat_clist.cpp @@ -25,9 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static MCONTACT FindRoom(const char *pszModule, const wchar_t *pszRoom)
{
for (auto &hContact : Contacts(pszModule)) {
- if (!Contact::IsGroupChat(hContact, pszModule))
- continue;
-
ptrW roomid(Contact::GetInfo(CNF_UNIQUEID, hContact, pszModule));
if (roomid != nullptr && !mir_wstrcmpi(roomid, pszRoom))
return hContact;
@@ -49,36 +46,33 @@ MCONTACT AddRoom(const char *pszModule, const wchar_t *pszRoom, const wchar_t *p if (!mir_wstrlen(pwszOldGroup))
Clist_SetGroup(hContact, wszGroup);
}
-
- db_set_w(hContact, pszModule, "Status", ID_STATUS_OFFLINE);
- db_set_ws(hContact, pszModule, "Nick", pszDisplayName);
- return hContact;
}
+ else {
+ // here we create a new one since no one is to be found
+ if ((hContact = db_add_contact()) == 0)
+ return 0;
- // here we create a new one since no one is to be found
- if ((hContact = db_add_contact()) == 0)
- return 0;
-
- Proto_AddToContact(hContact, pszModule);
+ Proto_AddToContact(hContact, pszModule);
- // create the 'Chat rooms' group only if needed
- if (bNeedGroup) {
- MGROUP hGroup = Clist_GroupExists(wszGroup);
- if (hGroup == 0) {
- hGroup = Clist_GroupCreate(0, wszGroup);
- if (hGroup)
- Clist_GroupSetExpanded(hGroup, 1);
+ // create the 'Chat rooms' group only if needed
+ if (bNeedGroup) {
+ MGROUP hGroup = Clist_GroupExists(wszGroup);
+ if (hGroup == 0) {
+ hGroup = Clist_GroupCreate(0, wszGroup);
+ if (hGroup)
+ Clist_GroupSetExpanded(hGroup, 1);
+ }
+
+ Clist_SetGroup(hContact, wszGroup);
}
- Clist_SetGroup(hContact, wszGroup);
- }
-
- if (auto *pa = Proto_GetAccount(pszModule)) {
- if (MBaseProto *pd = g_arProtos.find((MBaseProto *)&pa->szProtoName)) {
- if (pd->iUniqueIdType == DBVT_DWORD)
- db_set_dw(hContact, pszModule, pd->szUniqueId, _wtoi(pszRoom));
- else
- db_set_ws(hContact, pszModule, pd->szUniqueId, pszRoom);
+ if (auto *pa = Proto_GetAccount(pszModule)) {
+ if (MBaseProto *pd = g_arProtos.find((MBaseProto *)&pa->szProtoName)) {
+ if (pd->iUniqueIdType == DBVT_DWORD)
+ db_set_dw(hContact, pszModule, pd->szUniqueId, _wtoi(pszRoom));
+ else
+ db_set_ws(hContact, pszModule, pd->szUniqueId, pszRoom);
+ }
}
}
diff --git a/src/mir_app/src/chat_loginfo.cpp b/src/mir_app/src/chat_loginfo.cpp index e46c2eedc7..6857917dfa 100644 --- a/src/mir_app/src/chat_loginfo.cpp +++ b/src/mir_app/src/chat_loginfo.cpp @@ -1,6 +1,6 @@ /* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org) +Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -126,7 +126,10 @@ void LOGINFO::write(RtfChatLogStreamData *streamData, bool simpleMode, CMStringA if (!streamData->bStripFormat) buf.Append(bEnable ? "\\ul" : "\\ul0"); } - else buf.AppendChar('['); + else { + buf.AppendChar('['); + line--; // it was moved ahead previously, remember? + } } else if (*line == '\t' && !streamData->bStripFormat) { buf.Append("\\tab "); diff --git a/src/mir_app/src/chat_manager.cpp b/src/mir_app/src/chat_manager.cpp index f53c615163..62fd919923 100644 --- a/src/mir_app/src/chat_manager.cpp +++ b/src/mir_app/src/chat_manager.cpp @@ -1,7 +1,7 @@ /*
Chat module plugin for Miranda IM
-Copyright 2000-12 Miranda IM, 2012-24 Miranda NG team,
+Copyright 2000-12 Miranda IM, 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -61,7 +61,8 @@ static int CompareEvents(const LOGINFO *p1, const LOGINFO *p2) SESSION_INFO::SESSION_INFO() :
arUsers(10, CompareUser),
- arEvents(10, CompareEvents)
+ arEvents(10, CompareEvents),
+ arStatuses(1)
{
iLastEvent = MAXINT/2;
}
@@ -136,8 +137,8 @@ void SM_FreeSession(SESSION_INFO *si) }
UM_RemoveAll(si);
- g_chatApi.TM_RemoveAll(&si->pStatuses);
+ si->arStatuses.destroy();
si->arEvents.destroy();
si->iStatusCount = 0;
@@ -358,7 +359,7 @@ static HICON SM_GetStatusIcon(SESSION_INFO *si, USERINFO *ui) if (!ui || !si)
return nullptr;
- STATUSINFO *ti = g_chatApi.TM_FindStatus(si->pStatuses, g_chatApi.TM_WordToString(si->pStatuses, ui->Status));
+ STATUSINFO *ti = TM_FindStatus(si, TM_WordToString(si, ui->Status));
if (ti != nullptr)
return g_chatApi.hStatusIcons[ti->iIconIndex];
@@ -429,7 +430,7 @@ BOOL SM_GiveStatus(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszSt if (si == nullptr)
return FALSE;
- USERINFO *ui = UM_GiveStatus(si, pszUID, TM_StringToWord(si->pStatuses, pszStatus));
+ USERINFO *ui = UM_GiveStatus(si, pszUID, TM_StringToWord(si, pszStatus));
if (ui && si->pDlg)
si->pDlg->UpdateNickList();
return TRUE;
@@ -438,7 +439,7 @@ BOOL SM_GiveStatus(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszSt BOOL SM_AssignStatus(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszStatus)
{
if (si != nullptr)
- if (USERINFO *ui = UM_SetStatus(si, pszUID, TM_StringToWord(si->pStatuses, pszStatus))) {
+ if (USERINFO *ui = UM_SetStatus(si, pszUID, TM_StringToWord(si, pszStatus))) {
if (si->pDlg)
si->pDlg->UpdateNickList();
return TRUE;
@@ -463,7 +464,7 @@ BOOL SM_TakeStatus(SESSION_INFO *si, const wchar_t *pszUID, const wchar_t *pszSt if (si == nullptr)
return FALSE;
- USERINFO *ui = g_chatApi.UM_TakeStatus(si, pszUID, TM_StringToWord(si->pStatuses, pszStatus));
+ USERINFO *ui = g_chatApi.UM_TakeStatus(si, pszUID, TM_StringToWord(si, pszStatus));
if (ui && si->pDlg)
si->pDlg->UpdateNickList();
return TRUE;
@@ -643,89 +644,78 @@ static BOOL MM_RemoveAll(void) // Status manager functions
// Necessary to keep track of what user statuses per window nicklist that is available
-STATUSINFO* TM_AddStatus(STATUSINFO **ppStatusList, const wchar_t *pszStatus, int *iCount)
+__inline OBJLIST<STATUSINFO>& getStatuses(SESSION_INFO *si)
{
- if (!ppStatusList || !pszStatus)
+ return (si->pParent) ? si->pParent->arStatuses : si->arStatuses;
+}
+
+STATUSINFO* TM_AddStatus(SESSION_INFO *si, const wchar_t *pszStatus)
+{
+ if (!si || !pszStatus)
return nullptr;
- if (!g_chatApi.TM_FindStatus(*ppStatusList, pszStatus)) {
- STATUSINFO *node = (STATUSINFO*)mir_calloc(sizeof(STATUSINFO));
- replaceStrW(node->pszGroup, pszStatus);
- node->iIconIndex = *iCount;
- while (node->iIconIndex > STATUSICONCOUNT - 1)
- node->iIconIndex--;
-
- if (*ppStatusList == nullptr) { // list is empty
- node->iStatus = 1;
- *ppStatusList = node;
- node->next = nullptr;
- }
- else {
- node->iStatus = ppStatusList[0]->iStatus * 2;
- node->next = *ppStatusList;
- *ppStatusList = node;
- }
- return node;
+ if (TM_FindStatus(si, pszStatus))
+ return nullptr;
- }
- return nullptr;
+ auto *node = new STATUSINFO();
+ node->pszGroup = mir_wstrdup(pszStatus);
+ node->iIconIndex = si->iStatusCount;
+ while (node->iIconIndex > STATUSICONCOUNT - 1)
+ node->iIconIndex--;
+
+ auto &pList = getStatuses(si);
+ if (pList.getCount() == 0) // list is empty
+ node->iStatus = 1;
+ else
+ node->iStatus = pList[pList.getCount()-1].iStatus * 2;
+
+ pList.insert(node);
+ si->bIsDirty = true;
+ si->iStatusCount++;
+ return node;
}
-static STATUSINFO* TM_FindStatus(STATUSINFO *pStatusList, const wchar_t *pszStatus)
+STATUSINFO* TM_FindStatus(SESSION_INFO *si, const wchar_t *pszStatus)
{
- if (!pStatusList || !pszStatus)
+ if (!si || !pszStatus)
return nullptr;
- for (STATUSINFO *pTemp = pStatusList; pTemp != nullptr; pTemp = pTemp->next)
- if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
- return pTemp;
+ for (auto &it: getStatuses(si))
+ if (mir_wstrcmpi(it->pszGroup, pszStatus) == 0)
+ return it;
return nullptr;
}
-uint16_t TM_StringToWord(STATUSINFO *pStatusList, const wchar_t *pszStatus)
+uint16_t TM_StringToWord(SESSION_INFO *si, const wchar_t *pszStatus)
{
- if (!pStatusList || !pszStatus)
+ if (!si || !pszStatus)
return 0;
- for (STATUSINFO *pTemp = pStatusList; pTemp != nullptr; pTemp = pTemp->next) {
- if (mir_wstrcmpi(pTemp->pszGroup, pszStatus) == 0)
- return pTemp->iStatus;
+ auto &pList = getStatuses(si);
+ for (auto &it : pList)
+ if (mir_wstrcmpi(it->pszGroup, pszStatus) == 0)
+ return it->iStatus;
+
+ if (pList.getCount())
+ return pList[pList.getCount()-1].iStatus;
- if (pTemp->next == nullptr)
- return pStatusList->iStatus;
- }
return 0;
}
-static wchar_t* TM_WordToString(STATUSINFO *pStatusList, uint16_t Status)
+wchar_t* TM_WordToString(SESSION_INFO *si, uint16_t Status)
{
- if (!pStatusList)
+ if (!si)
return nullptr;
- for (STATUSINFO *pTemp = pStatusList; pTemp != nullptr; pTemp = pTemp->next) {
- if (pTemp->iStatus & Status) {
- Status -= pTemp->iStatus;
+ for (auto &it : getStatuses(si))
+ if (it->iStatus & Status) {
+ Status -= it->iStatus;
if (Status == 0)
- return pTemp->pszGroup;
+ return it->pszGroup;
}
- }
- return nullptr;
-}
-static BOOL TM_RemoveAll(STATUSINFO **ppStatusList)
-{
- if (!ppStatusList)
- return FALSE;
-
- while (*ppStatusList != nullptr) {
- STATUSINFO *pLast = ppStatusList[0]->next;
- mir_free(ppStatusList[0]->pszGroup);
- mir_free(*ppStatusList);
- *ppStatusList = pLast;
- }
- *ppStatusList = nullptr;
- return TRUE;
+ return nullptr;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -769,10 +759,6 @@ static void ResetApi() g_chatApi.MM_IconsChanged = ::MM_IconsChanged;
g_chatApi.MM_RemoveAll = ::MM_RemoveAll;
- g_chatApi.TM_FindStatus = ::TM_FindStatus;
- g_chatApi.TM_WordToString = ::TM_WordToString;
- g_chatApi.TM_RemoveAll = ::TM_RemoveAll;
-
g_chatApi.UM_AddUser = ::UM_AddUser;
g_chatApi.UM_CompareItem = ::UM_CompareItem;
g_chatApi.UM_FindUser = ::UM_FindUser;
diff --git a/src/mir_app/src/chat_rtf.cpp b/src/mir_app/src/chat_rtf.cpp index 1ba9ed4995..3f3241f39f 100644 --- a/src/mir_app/src/chat_rtf.cpp +++ b/src/mir_app/src/chat_rtf.cpp @@ -1,7 +1,7 @@ /*
Chat module plugin for Miranda IM
-Copyright 2000-12 Miranda IM, 2012-24 Miranda NG team,
+Copyright 2000-12 Miranda IM, 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -71,8 +71,9 @@ bool CSrmmBaseDialog::DoRtfToTags(CMStringW &pszText) const }
else idx += 5;
- bool bInsideUl = false, bStart = true;
+ bool bBold = false, bItalic = false, bStrike = false, bUnderline = false, bStart = true;
CMStringW res;
+ CMStringA buis;
// iterate through all characters, if rtf control character found then take action
for (const wchar_t *p = pszText.GetString() + idx; *p;) {
@@ -137,27 +138,47 @@ bool CSrmmBaseDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\b", 2)) { //bold
// only allow bold if the font itself isn't a bold one, otherwise just strip it..
- if (lf.lfWeight != FW_BOLD && m_bSendFormat)
- res.Append((p[2] != '0') ? L"[b]" : L"[/b]");
+ if (lf.lfWeight != FW_BOLD && m_bSendFormat) {
+ bBold = (p[2] != '0');
+ res.Append(bBold ? L"[b]" : L"[/b]");
+ if (bBold)
+ buis.AppendChar('b');
+ else
+ buis.Replace("b", "");
+ }
}
else if (!wcsncmp(p, L"\\i", 2)) { // italics
- if (!lf.lfItalic && m_bSendFormat)
- res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
+ if (!lf.lfItalic && m_bSendFormat) {
+ bItalic = p[2] != '0';
+ res.Append(bItalic ? L"[i]" : L"[/i]");
+ if (bItalic)
+ buis.AppendChar('i');
+ else
+ buis.Replace("i", "");
+ }
}
else if (!wcsncmp(p, L"\\strike", 7)) { // strike-out
- if (!lf.lfStrikeOut && m_bSendFormat)
- res.Append((p[7] != '0') ? L"[s]" : L"[/s]");
+ if (!lf.lfStrikeOut && m_bSendFormat) {
+ bStrike = p[7] != '0';
+ res.Append(bStrike ? L"[s]" : L"[/s]");
+ if (bStrike)
+ buis.AppendChar('s');
+ else
+ buis.Replace("s", "");
+ }
}
else if (!wcsncmp(p, L"\\ul", 3)) { // underlined
if (!lf.lfUnderline && m_bSendFormat) {
if (p[3] == 0 || wcschr(tszRtfBreaks, p[3])) {
res.Append(L"[u]");
- bInsideUl = true;
+ bUnderline = true;
+ buis.AppendChar('u');
}
else if (!wcsncmp(p + 3, L"none", 4)) {
- if (bInsideUl)
+ if (bUnderline)
res.Append(L"[/u]");
- bInsideUl = false;
+ bUnderline = false;
+ buis.Replace("u", "");
}
}
}
@@ -202,8 +223,14 @@ bool CSrmmBaseDialog::DoRtfToTags(CMStringW &pszText) const }
}
- if (bInsideUl)
- res.Append(L"[/u]");
+ for (int i = buis.GetLength() - 1; i >= 0; i--) {
+ switch (buis[i]) {
+ case 'b': res.Append(L"[/b]"); break;
+ case 'i': res.Append(L"[/i]"); break;
+ case 's': res.Append(L"[/s]"); break;
+ case 'u': res.Append(L"[/u]"); break;
+ }
+ }
pszText = res;
return TRUE;
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp index 4e68112ff7..7f92ba37c8 100644 --- a/src/mir_app/src/chat_svc.cpp +++ b/src/mir_app/src/chat_svc.cpp @@ -1,7 +1,7 @@ /*
Chat module plugin for Miranda IM
-Copyright 2000-12 Miranda IM, 2012-24 Miranda NG team,
+Copyright 2000-12 Miranda IM, 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
CMOption<bool> Chat::bShowNicklist(CHAT_MODULE, "ShowNicklist", true);
+CMOption<bool> Chat::bShowFormatting(CHAT_MODULE, "ShowFormatting", false); // Hidden option
CMOption<bool> Chat::bFilterEnabled(CHAT_MODULE, "FilterEnabled", false);
CMOption<bool> Chat::bTopicOnClist(CHAT_MODULE, "TopicOnClist", false);
CMOption<bool> Chat::bPopupOnJoin(CHAT_MODULE, "PopupOnJoin", false);
@@ -31,7 +32,6 @@ CMOption<bool> Chat::bUseGroup(CHAT_MODULE, "UseGroup", true); CMOption<bool> Chat::bDoubleClick4Privat(CHAT_MODULE, "DoubleClick4Privat", false);
CMOption<bool> Chat::bShowContactStatus(CHAT_MODULE, "ShowContactStatus", true);
CMOption<bool> Chat::bContactStatusFirst(CHAT_MODULE, "ContactStatusFirst", false);
-CMOption<bool> Chat::bEnableCustomLogs(SRMM_MODULE, "EnableCustomLogs", false);
CMOption<bool> Chat::bFlashWindow(CHAT_MODULE, "FlashWindow", false);
CMOption<bool> Chat::bFlashWindowHighlight(CHAT_MODULE, "FlashWindowHighlight", false);
@@ -209,7 +209,7 @@ MIR_APP_DLL(SESSION_INFO*) Chat_NewSession( SESSION_INFO *si = Chat_Find(ptszID, pszModule);
if (si != nullptr) {
UM_RemoveAll(si);
- g_chatApi.TM_RemoveAll(&si->pStatuses);
+ si->arStatuses.destroy();
lck.unlock();
si->iStatusCount = 0;
@@ -292,9 +292,9 @@ static void SetInitDone(SESSION_INFO *si) return;
si->bInitDone = true;
- for (STATUSINFO *p = si->pStatuses; p; p = p->next)
- if (p->iIconIndex < STATUSICONCOUNT)
- p->iIconIndex = si->iStatusCount - p->iIconIndex - 1;
+ for (auto &it : si->arStatuses)
+ if (it->iIconIndex < STATUSICONCOUNT)
+ it->iIconIndex = si->iStatusCount - it->iIconIndex - 1;
}
static int RoomControlHandler(int iCommand, SESSION_INFO *si)
@@ -428,7 +428,7 @@ MIR_APP_DLL(int) Chat_Terminate(SESSION_INFO *si) static void AddUser(SESSION_INFO *si, GCEVENT &gce)
{
- uint16_t status = TM_StringToWord(si->pStatuses, gce.pszStatus.w);
+ uint16_t status = TM_StringToWord(si, gce.pszStatus.w);
USERINFO *ui = UM_AddUser(si, gce.pszUID.w, gce.pszNick.w, status);
if (ui == nullptr)
@@ -621,14 +621,10 @@ MIR_APP_DLL(int) Chat_AddGroup(SESSION_INFO *si, const wchar_t *wszText) return 0;
mir_cslock lck(csChat);
- STATUSINFO *ti = TM_AddStatus(&si->pStatuses, wszText, &si->iStatusCount);
- if (ti) {
- si->iStatusCount++;
- si->bIsDirty = true;
- }
-
- if (g_chatApi.OnAddStatus)
+ STATUSINFO *ti = TM_AddStatus(si, wszText);
+ if (ti && g_chatApi.OnAddStatus)
g_chatApi.OnAddStatus(si, ti);
+
return 0;
}
@@ -680,6 +676,11 @@ MIR_APP_DLL(int) Chat_ChangeUserId(SESSION_INFO *si, const wchar_t *wszOldId, co return 0;
}
+MIR_APP_DLL(STATUSINFO *) Chat_GetStatus(SESSION_INFO *si, const USERINFO *ui)
+{
+ return TM_FindStatus(si, TM_WordToString(si, ui->Status));
+}
+
MIR_APP_DLL(void*) Chat_GetUserInfo(SESSION_INFO *si)
{
return (si) ? si->pItemData : nullptr;
@@ -796,12 +797,18 @@ static HGENMENU hJoinMenuItem, hLeaveMenuItem, hMuteRootMenuItem, hMute0MenuItem static INT_PTR JoinChat(WPARAM hContact, LPARAM lParam)
{
if (hContact) {
- char *szProto = Proto_GetBaseAccountName(hContact);
- if (szProto) {
- if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE)
- CallProtoService(szProto, PS_JOINCHAT, hContact, lParam);
- else
- RoomDoubleclicked(hContact, 0);
+ if (char *szProto = Proto_GetBaseAccountName(hContact)) {
+ if (Proto_GetStatus(szProto) != ID_STATUS_OFFLINE) {
+ if (Contact::GetStatus(hContact, szProto) == ID_STATUS_OFFLINE)
+ CallProtoService(szProto, PS_JOINCHAT, hContact, lParam);
+ else
+ RoomDoubleclicked(hContact, 0);
+ }
+ else {
+ auto *pMM = MM_FindModule(szProto);
+ if (pMM->bDatabase)
+ CallService(MS_HISTORY_SHOWCONTACTHISTORY, hContact, 0);
+ }
}
}
@@ -851,7 +858,7 @@ static int OnContactDeleted(WPARAM hContact, LPARAM) if (auto *si = SM_FindSessionByContact(hContact))
_wremove(Chat_GetFolderName(si));
- if (Contact::GetStatus(hContact) != ID_STATUS_OFFLINE)
+ if (Contact::GetStatus(hContact, szProto) != ID_STATUS_OFFLINE)
CallProtoService(szProto, PS_LEAVECHAT, hContact);
}
return 0;
@@ -892,7 +899,7 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) bIsChat = true;
// still hide it for offline protos
if (Proto_GetStatus(szProto) != ID_STATUS_OFFLINE) {
- if (db_get_w(hContact, szProto, "Status", 0) == ID_STATUS_OFFLINE) {
+ if (Contact::GetStatus(hContact, szProto) == ID_STATUS_OFFLINE) {
if (ProtoServiceExists(szProto, PS_JOINCHAT)) {
bEnabledJoin = true;
Menu_ModifyItem(hJoinMenuItem, LPGENW("&Join chat"));
@@ -903,6 +910,12 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM) Menu_ModifyItem(hJoinMenuItem, LPGENW("&Open/close chat window"));
}
}
+ else if (auto *pMM = MM_FindModule(szProto))
+ if (pMM->bDatabase) {
+ bEnabledJoin = true;
+ Menu_ModifyItem(hJoinMenuItem, LPGENW("&History"));
+ }
+
bEnabledLeave = ProtoServiceExists(szProto, PS_LEAVECHAT) != 0;
}
}
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp index 6c1f17c8c8..ca602cda67 100644 --- a/src/mir_app/src/chat_tools.cpp +++ b/src/mir_app/src/chat_tools.cpp @@ -1,7 +1,7 @@ /*
Chat module plugin for Miranda IM
-Copyright 2000-12 Miranda IM, 2012-24 Miranda NG team,
+Copyright 2000-12 Miranda IM, 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -693,7 +693,7 @@ void Chat_EventToGC(SESSION_INFO *si, MEVENT hDbEvent) GCEVENT gce = { si, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_ADDTOLOG;
- if (dbei.markedRead())
+ if (dbei.bRead)
gce.dwFlags |= GCEF_NOTNOTIFY;
Utf2T wszUserId(dbei.szUserId);
@@ -704,7 +704,7 @@ void Chat_EventToGC(SESSION_INFO *si, MEVENT hDbEvent) else gce.pszNick.w = wszUserId;
gce.pszText.w = wszText;
- gce.time = dbei.timestamp;
+ gce.time = dbei.getUnixtime();
gce.hEvent = hDbEvent;
Chat_Event(&gce);
}
@@ -867,9 +867,9 @@ void Chat_Serialize(SESSION_INFO *si) return;
JSONNode pRoleList(JSON_ARRAY); pRoleList.set_name("roles");
- for (auto *p = si->pStatuses; p; p = p->next) {
+ for (auto &it: si->arStatuses) {
JSONNode role;
- role << JSONNode("id", p->iStatus) << JSONNode("name", p->pszGroup);
+ role << JSONNode("id", it->iStatus) << JSONNode("name", it->pszGroup.get());
pRoleList << role;
}
@@ -922,8 +922,7 @@ bool Chat_Unserialize(SESSION_INFO *si) auto &pRoles = root["roles"];
for (auto it = pRoles.rbegin(); it != pRoles.rend(); ++it)
- if (auto *pStatus = TM_AddStatus(&si->pStatuses, (*it)["name"].as_mstring(), &si->iStatusCount))
- si->iStatusCount++;
+ TM_AddStatus(si, (*it)["name"].as_mstring());
for (auto &it : root["users"]) {
int iStatus = it["role"].as_int();
@@ -937,7 +936,6 @@ bool Chat_Unserialize(SESSION_INFO *si) if (it["isMe"].as_bool())
si->pMe = ui;
ui->Status = iStatus;
- ui->Status |= si->pStatuses->iStatus;
if (g_chatApi.OnNewUser)
g_chatApi.OnNewUser(si, ui);
diff --git a/src/mir_app/src/chat_ui.cpp b/src/mir_app/src/chat_ui.cpp index 2032fd91d5..6c80c1c5b9 100644 --- a/src/mir_app/src/chat_ui.cpp +++ b/src/mir_app/src/chat_ui.cpp @@ -1,7 +1,7 @@ /*
Chat module plugin for Miranda IM
-Copyright 2000-12 Miranda IM, 2012-24 Miranda NG team,
+Copyright 2000-12 Miranda IM, 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/clc.cpp b/src/mir_app/src/clc.cpp index 7b6cce41e8..12a8013834 100644 --- a/src/mir_app/src/clc.cpp +++ b/src/mir_app/src/clc.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -70,6 +70,12 @@ static int ClcSettingChanged(WPARAM hContact, LPARAM lParam) {
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *)lParam;
+ if (!strcmp(cws->szModule, GROUPS_MODULE)) {
+ if (!g_bGroupsLocked)
+ Clist_Broadcast(INTM_GROUPSCHANGED, hContact, lParam);
+ return 0;
+ }
+
if (!strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "MyHandle")) {
g_clistApi.pfnInvalidateDisplayNameCacheEntry(hContact);
@@ -119,7 +125,7 @@ static int ClcProtoAck(WPARAM, LPARAM lParam) if (ack->type == ACKTYPE_STATUS) {
if (ack->result == ACKRESULT_SUCCESS) {
PROTOACCOUNT *pa = Proto_GetAccount(ack->szModule);
- if (pa)
+ if (pa && ack->lParam != ID_STATUS_IDLE)
pa->iRealStatus = ack->lParam;
}
@@ -375,12 +381,10 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam bool eq = !mir_wstrcmp(szFullName, pGroup->groupName);
if (eq && contact->group->bHideOffline == ((pGroup->flags & GROUPF_HIDEOFFLINE) != 0))
break; // only expanded has changed: no action reqd
-
- Clist_SaveStateAndRebuildList(hwnd, dat);
- break;
}
+ Clist_SaveStateAndRebuildList(hwnd, dat);
}
- Clist_InitAutoRebuild(hwnd);
+ else Clist_InitAutoRebuild(hwnd);
break;
case INTM_NAMEORDERCHANGED:
@@ -499,7 +503,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup))
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
else
dat->selection = -1;
}
@@ -699,7 +703,7 @@ LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT uMsg, WPARAM wParam case CLCIT_CONTACT:
if (group == &dat->list)
return 0;
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, -1);
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, group, -1);
goto LBL_MoveSelection;
}
}
@@ -891,9 +895,9 @@ LBL_MoveSelection: Clist_SetGroupExpand(hwnd, dat, contact->group, -1);
if (dat->selection != -1) {
dat->selection =
- g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
if (dat->selection == -1)
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, contact->group, -1);
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, contact->group, -1);
}
g_clistApi.pfnInvalidateRect(hwnd, nullptr, FALSE);
UpdateWindow(hwnd);
@@ -1154,16 +1158,17 @@ LBL_MoveSelection: break;
case WM_CONTEXTMENU:
- Clist_EndRename(dat, 1);
- Clist_HideInfoTip(dat);
- KillTimer(hwnd, TIMERID_RENAME);
- KillTimer(hwnd, TIMERID_INFOTIP);
- if (GetFocus() != hwnd)
- SetFocus(hwnd);
- dat->iHotTrack = -1;
- if (!dat->bFilterSearch)
- dat->szQuickSearch[0] = 0;
- {
+ if (hwnd == g_clistApi.hwndContactTree) {
+ Clist_EndRename(dat, 1);
+ Clist_HideInfoTip(dat);
+ KillTimer(hwnd, TIMERID_RENAME);
+ KillTimer(hwnd, TIMERID_INFOTIP);
+ if (GetFocus() != hwnd)
+ SetFocus(hwnd);
+ dat->iHotTrack = -1;
+ if (!dat->bFilterSearch)
+ dat->szQuickSearch[0] = 0;
+
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
if (pt.x == -1 && pt.y == -1) {
dat->selection = g_clistApi.pfnGetRowByIndex(dat, dat->selection, &contact, nullptr);
diff --git a/src/mir_app/src/clc.h b/src/mir_app/src/clc.h index 37a54fb0d6..3ca338e2f1 100644 --- a/src/mir_app/src/clc.h +++ b/src/mir_app/src/clc.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma once
#define MODULENAME "CList"
+#define GROUPS_MODULE "ClistGroups"
struct ClcContact : public ClcContactBase
{
@@ -47,7 +48,7 @@ extern OBJLIST<MenuProto> g_menuProtos; LRESULT CALLBACK fnContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
/* clcidents.c */
-int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex);
+int fnGetRowsPriorTo(ClcData *dat, ClcGroup *subgroup, int contactIndex);
int fnGetRowByIndex(ClcData *dat, int testindex, ClcContact **contact, ClcGroup **subgroup);
ClcContact* fnFindItem(uint32_t dwItem, ClcContact *contact);
@@ -97,7 +98,7 @@ int ClcOptInit(WPARAM, LPARAM); namespace Clist
{
- extern CMOption<bool> RemoveTempContacts, EnableIconBlink, EnableTrayFlash;
+ extern CMOption<bool> bRemoveTempContacts, bEnableIconBlink, bEnableTrayFlash;
};
/* clistmenus.c */
@@ -166,9 +167,6 @@ int LoadCLUIModule(void); /* contact.c */
int fnSetHideOffline(int iValue);
-/* docking.c */
-int fnDocking_ProcessWindowMessage(WPARAM wParam, LPARAM lParam);
-
// clistgroups.cpp
struct CGroupInternal
@@ -176,9 +174,31 @@ struct CGroupInternal CGroupInternal(int _id, const wchar_t *_name, int _flags);
~CGroupInternal();
- int groupId, oldId = -1, flags;
+ int groupId, oldId = -1;
+ union {
+ int flags; // combination of GROUPF_* constants
+ struct {
+ bool bUnused1 : 1;
+ bool bHidden : 1;
+ bool bExpanded : 1;
+ bool bHideOffline : 1;
+ bool bUnused2 : 1;
+ bool bUnused3 : 1;
+ bool bShowOffline : 1;
+ };
+ };
+
+ uint32_t ignore = 0;
bool bSaveExpanded;
wchar_t *groupName;
+ void remove();
void save();
};
+
+void Clist_RebuildGroups(HWND hwnd, ClcData *dat);
+
+uint32_t Clist_GroupGetIgnore(MGROUP hGroup, bool *bHidden);
+void Clist_GroupSetIgnore(MGROUP hGroup, uint32_t mask, bool bHidden);
+
+CGroupInternal* FindGroup(const wchar_t *ptszGroupName);
diff --git a/src/mir_app/src/clccontact.cpp b/src/mir_app/src/clccontact.cpp index bb1704600b..973316efa4 100644 --- a/src/mir_app/src/clccontact.cpp +++ b/src/mir_app/src/clccontact.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -29,7 +29,7 @@ extern HANDLE hGroupChangeEvent; MIR_APP_DLL(void) Clist_LoadContactTree(void)
{
- bool hideOffline = Clist::HideOffline;
+ bool hideOffline = Clist::bHideOffline;
for (auto &hContact : Contacts()) {
int status = Contact::GetStatus(hContact);
if ((!hideOffline || status != ID_STATUS_OFFLINE) && !Contact::IsHidden(hContact))
@@ -56,12 +56,12 @@ MIR_APP_DLL(int) Clist_ContactChangeGroup(MCONTACT hContact, MGROUP hGroup) int fnSetHideOffline(int iValue)
{
if (iValue == -1) // invert the current value
- iValue = !Clist::HideOffline;
+ iValue = !Clist::bHideOffline;
switch (iValue) {
case 0:
case 1:
- Clist::HideOffline = iValue;
+ Clist::bHideOffline = iValue;
break;
default:
diff --git a/src/mir_app/src/clcfiledrop.cpp b/src/mir_app/src/clcfiledrop.cpp index 4e708e2b40..cf1b769e2d 100644 --- a/src/mir_app/src/clcfiledrop.cpp +++ b/src/mir_app/src/clcfiledrop.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/clcidents.cpp b/src/mir_app/src/clcidents.cpp index e5d56bde6e..bb9345fc6a 100644 --- a/src/mir_app/src/clcidents.cpp +++ b/src/mir_app/src/clcidents.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -42,10 +42,11 @@ contains routines to convert between them. 2->1: GetRowByIndex()
*/
-int fnGetRowsPriorTo(ClcGroup *group, ClcGroup *subgroup, int contactIndex)
+int fnGetRowsPriorTo(ClcData *dat, ClcGroup *subgroup, int contactIndex)
{
int count = 0;
+ auto *group = &dat->list;
group->scanIndex = 0;
for (;;) {
if (group->scanIndex == group->cl.getCount()) {
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index a37efdeefe..9678c5e87e 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -351,13 +351,7 @@ void fnRebuildEntireList(HWND hwnd, ClcData *dat) dat->list.totalMembers = 0;
dat->selection = -1;
- for (int i = 1;; i++) {
- uint32_t groupFlags;
- wchar_t *szGroupName = Clist_GroupGetName(i, &groupFlags);
- if (szGroupName == nullptr)
- break;
- g_clistApi.pfnAddGroup(hwnd, dat, szGroupName, groupFlags, i, 0);
- }
+ Clist_RebuildGroups(hwnd, dat);
for (auto &hContact : Contacts()) {
int nHiddenStatus = g_clistApi.pfnGetContactHiddenStatus(hContact, nullptr, dat);
@@ -580,7 +574,7 @@ void fnSortCLC(HWND hwnd, ClcData *dat, int useInsertionSort) if (hSelItem) {
ClcGroup *selgroup;
if (Clist_FindItem(hwnd, dat, hSelItem, &selcontact, &selgroup))
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, selgroup, selgroup->cl.indexOf(selcontact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, selgroup, selgroup->cl.indexOf(selcontact));
}
g_clistApi.pfnRecalcScrollBar(hwnd, dat);
diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 9a454a417e..762ca67596 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -101,7 +101,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
Clist_SetGroupExpand(hwnd, dat, tgroup, 1);
- Clist_EnsureVisible(hwnd, dat, g_clistApi.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact)), 0);
+ Clist_EnsureVisible(hwnd, dat, g_clistApi.pfnGetRowsPriorTo(dat, group, group->cl.indexOf(contact)), 0);
break;
case CLM_EXPAND:
@@ -141,7 +141,11 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar case CLM_GETCHECKMARK:
if (!Clist_FindItem(hwnd, dat, wParam, &contact))
return 0;
- return (contact->flags & CONTACTF_CHECKED) != 0;
+
+ if (contact->flags & CONTACTF_CHECKED)
+ return 1;
+
+ return (contact->flags & CONTACTF_HASMEMBERS) ? 2 : 0;
case CLM_GETCOUNT:
return g_clistApi.pfnGetGroupContentsCount(&dat->list, 0);
@@ -312,7 +316,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar for (ClcGroup *tgroup = group; tgroup; tgroup = tgroup->parent)
Clist_SetGroupExpand(hwnd, dat, tgroup, 1);
- dat->selection = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, group->cl.indexOf(contact));
+ dat->selection = g_clistApi.pfnGetRowsPriorTo(dat, group, group->cl.indexOf(contact));
Clist_EnsureVisible(hwnd, dat, dat->selection, 0);
break;
@@ -382,11 +386,17 @@ LRESULT fnProcessExternalMessages(HWND hwnd, ClcData *dat, UINT msg, WPARAM wPar break;
case CLM_SETHIDEEMPTYGROUPS:
- if (wParam)
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS);
- else
- SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
- Clist_InitAutoRebuild(hwnd);
+ {
+ BOOL oldVal = ((GetWindowLongPtr(hwnd, GWL_STYLE) & CLS_HIDEEMPTYGROUPS) != 0);
+ BOOL newVal = (wParam != 0);
+ if (newVal)
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) | CLS_HIDEEMPTYGROUPS);
+ else
+ SetWindowLongPtr(hwnd, GWL_STYLE, GetWindowLongPtr(hwnd, GWL_STYLE) & ~CLS_HIDEEMPTYGROUPS);
+
+ if (newVal != oldVal)
+ Clist_InitAutoRebuild(hwnd);
+ }
break;
case CLM_SETHIDEOFFLINEROOT:
diff --git a/src/mir_app/src/clcutils.cpp b/src/mir_app/src/clcutils.cpp index aa9da379ad..b38c72f2dd 100644 --- a/src/mir_app/src/clcutils.cpp +++ b/src/mir_app/src/clcutils.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -301,7 +301,7 @@ MIR_APP_DLL(void) Clist_SetGroupExpand(HWND hwnd, ClcData *dat, ClcGroup *group, g_clistApi.pfnInvalidateRect(hwnd, nullptr, FALSE);
int contentCount = g_clistApi.pfnGetGroupContentsCount(group, 1);
- int groupy = g_clistApi.pfnGetRowsPriorTo(&dat->list, group, -1);
+ int groupy = g_clistApi.pfnGetRowsPriorTo(dat, group, -1);
if (dat->selection > groupy && dat->selection < groupy + contentCount)
dat->selection = groupy;
@@ -377,7 +377,7 @@ int fnFindRowByText(HWND hwnd, ClcData *dat, const wchar_t *text, int prefixOk) int contactScanIndex = group->scanIndex;
for (; group; group = group->parent)
Clist_SetGroupExpand(hwnd, dat, group, 1);
- return g_clistApi.pfnGetRowsPriorTo(&dat->list, contactGroup, contactScanIndex);
+ return g_clistApi.pfnGetRowsPriorTo(dat, contactGroup, contactScanIndex);
}
if (cc->type == CLCIT_GROUP) {
if (!(dat->exStyle & CLS_EX_QUICKSEARCHVISONLY) || cc->group->bExpanded) {
@@ -609,6 +609,7 @@ MIR_APP_DLL(int) Clist_ClcStatusToPf2(int status) case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
case ID_STATUS_FREECHAT: return PF2_FREECHAT;
case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
+ case ID_STATUS_IDLE: return PF2_IDLE;
case ID_STATUS_OFFLINE: return MODEF_OFFLINE;
}
return 0;
@@ -728,7 +729,7 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst) dat->gammaCorrection = db_get_b(0, "CLC", "GammaCorrect", CLCDEFAULT_GAMMACORRECT);
dat->bShowIdle = db_get_b(0, "CLC", "ShowIdle", CLCDEFAULT_SHOWIDLE) != 0;
dat->bNoVScrollbar = db_get_b(0, "CLC", "NoVScrollBar", false) != 0;
- dat->bFilterSearch = Clist::FilterSearch;
+ dat->bFilterSearch = Clist::bFilterSearch;
SendMessage(hwnd, INTM_SCROLLBARCHANGED, 0, 0);
dat->greyoutFlags = db_get_dw(0, "CLC", "GreyoutFlags", CLCDEFAULT_GREYOUTFLAGS);
@@ -779,40 +780,43 @@ void fnLoadClcOptions(HWND hwnd, ClcData *dat, BOOL bFirst) SendMessage(hwnd, WM_SIZE, 0, 0);
}
-#define GSIF_HASMEMBERS 0x80000000
-#define GSIF_ALLCHECKED 0x40000000
-#define GSIF_INDEXMASK 0x3FFFFFFF
+///////////////////////////////////////////////////////////////////////////////
+// contact checkboxes processing
-MIR_APP_DLL(void) Clist_RecalculateGroupCheckboxes(ClcData *dat)
+static int GroupHasCheck(ClcGroup *group)
{
- ClcGroup *group = &dat->list;
- group->scanIndex = GSIF_ALLCHECKED;
- for (;;) {
- if ((group->scanIndex & GSIF_INDEXMASK) == group->cl.getCount()) {
- int check = (group->scanIndex & (GSIF_HASMEMBERS | GSIF_ALLCHECKED)) == (GSIF_HASMEMBERS | GSIF_ALLCHECKED);
- if (group->parent == nullptr)
- break;
- group->parent->scanIndex |= group->scanIndex & GSIF_HASMEMBERS;
- group = group->parent;
- if (check)
- group->cl[(group->scanIndex & GSIF_INDEXMASK)]->flags |= CONTACTF_CHECKED;
+ bool bAllChecked = true, bHasMembers = false;
+
+ for (auto &cc: group->cl) {
+ if (cc->type == CLCIT_GROUP) {
+ int res = GroupHasCheck(cc->group);
+ if (res == 3)
+ cc->flags |= CONTACTF_CHECKED;
else {
- group->cl[(group->scanIndex & GSIF_INDEXMASK)]->flags &= ~CONTACTF_CHECKED;
- group->scanIndex &= ~GSIF_ALLCHECKED;
+ cc->flags &= ~CONTACTF_CHECKED;
+ bAllChecked = false;
}
+
+ if (res & 1) {
+ cc->flags |= CONTACTF_HASMEMBERS;
+ bHasMembers = true;
+ }
+ else cc->flags &= ~CONTACTF_HASMEMBERS;
}
- else if (group->cl[(group->scanIndex & GSIF_INDEXMASK)]->type == CLCIT_GROUP) {
- group = group->cl[(group->scanIndex & GSIF_INDEXMASK)]->group;
- group->scanIndex = GSIF_ALLCHECKED;
- continue;
- }
- else if (group->cl[(group->scanIndex & GSIF_INDEXMASK)]->type == CLCIT_CONTACT) {
- group->scanIndex |= GSIF_HASMEMBERS;
- if (!(group->cl[(group->scanIndex & GSIF_INDEXMASK)]->flags & CONTACTF_CHECKED))
- group->scanIndex &= ~GSIF_ALLCHECKED;
+ else if (cc->type == CLCIT_CONTACT) {
+ if (cc->flags & CONTACTF_CHECKED)
+ bHasMembers = true;
+ else
+ bAllChecked = false;
}
- group->scanIndex++;
}
+
+ return (bAllChecked ? 2 : 0) + (bHasMembers ? 1 : 0);
+}
+
+MIR_APP_DLL(void) Clist_RecalculateGroupCheckboxes(ClcData *dat)
+{
+ GroupHasCheck(&dat->list);
}
void fnSetContactCheckboxes(ClcContact *cc, int checked)
diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/clistcontacts.cpp index 5f0d19585f..5caa21315c 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/clistcontacts.cpp @@ -1,438 +1,466 @@ -/*
-
-Miranda NG: the free IM client for Microsoft* Windows*
-
-Copyright (C) 2012-24 Miranda NG team (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"
-
-static wchar_t* nameOrderDescr[] =
-{
- LPGENW("My custom name (not movable)"),
- LPGENW("Nick"),
- LPGENW("FirstName"),
- LPGENW("E-mail"),
- LPGENW("LastName"),
- LPGENW("Username"),
- LPGENW("FirstName LastName"),
- LPGENW("LastName FirstName"),
- LPGENW("'(Unknown contact)' (not movable)")
-};
-
-uint8_t nameOrder[_countof(nameOrderDescr)];
-
-static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto, const char *szSetting)
-{
- wchar_t *ret = db_get_wsa(hContact, szProto, szSetting);
- if (ret)
- return ret;
-
- DBVARIANT dbv;
- if (db_get(hContact, szProto, szSetting, &dbv))
- return nullptr;
-
- wchar_t buf[40];
- switch (dbv.type) {
- case DBVT_BYTE:
- ret = _itow(dbv.bVal, buf, 10);
- break;
- case DBVT_WORD:
- ret = _itow(dbv.wVal, buf, 10);
- break;
- case DBVT_DWORD:
- ret = _itow(dbv.dVal, buf, 10);
- break;
- case DBVT_BLOB:
- if (dbv.cpbVal == 8)
- ret = _i64tow(*(__int64*)dbv.pbVal, buf, 10);
- else
- ret = bin2hexW(dbv.pbVal, min(int(dbv.cpbVal), 19), buf);
- break;
- }
-
- db_free(&dbv);
- return mir_wstrdup(ret);
-}
-
-MIR_APP_DLL(wchar_t*) Contact::GetInfo(int type, MCONTACT hContact, const char *szProto)
-{
- if (hContact == 0 && szProto == nullptr)
- return nullptr;
-
- if (szProto == nullptr)
- if (auto *pa = Proto_GetContactAccount(hContact))
- szProto = pa->szModuleName;
-
- if (szProto == nullptr)
- return nullptr;
-
- wchar_t *res;
- DBVARIANT dbv;
- switch (type) {
- case CNF_FIRSTNAME: return ProcessDatabaseValueDefault(hContact, szProto, "FirstName");
- case CNF_LASTNAME: return ProcessDatabaseValueDefault(hContact, szProto, "LastName");
- case CNF_NICK: return ProcessDatabaseValueDefault(hContact, szProto, "Nick");
- case CNF_EMAIL: return ProcessDatabaseValueDefault(hContact, szProto, "e-mail");
- case CNF_CITY: return ProcessDatabaseValueDefault(hContact, szProto, "City");
- case CNF_STATE: return ProcessDatabaseValueDefault(hContact, szProto, "State");
- case CNF_PHONE: return ProcessDatabaseValueDefault(hContact, szProto, "Phone");
- case CNF_HOMEPAGE: return ProcessDatabaseValueDefault(hContact, szProto, "Homepage");
- case CNF_ABOUT: return ProcessDatabaseValueDefault(hContact, szProto, "About");
- case CNF_AGE: return ProcessDatabaseValueDefault(hContact, szProto, "Age");
- case CNF_GENDER: return ProcessDatabaseValueDefault(hContact, szProto, "Gender");
- case CNF_FAX: return ProcessDatabaseValueDefault(hContact, szProto, "Fax");
- case CNF_CELLULAR: return ProcessDatabaseValueDefault(hContact, szProto, "Cellular");
- case CNF_BIRTHDAY: return ProcessDatabaseValueDefault(hContact, szProto, "BirthDay");
- case CNF_BIRTHMONTH: return ProcessDatabaseValueDefault(hContact, szProto, "BirthMonth");
- case CNF_BIRTHYEAR: return ProcessDatabaseValueDefault(hContact, szProto, "BirthYear");
- case CNF_STREET: return ProcessDatabaseValueDefault(hContact, szProto, "Street");
- case CNF_ZIP: return ProcessDatabaseValueDefault(hContact, szProto, "ZIP");
- case CNF_LANGUAGE1: return ProcessDatabaseValueDefault(hContact, szProto, "Language1");
- case CNF_LANGUAGE2: return ProcessDatabaseValueDefault(hContact, szProto, "Language2");
- case CNF_LANGUAGE3: return ProcessDatabaseValueDefault(hContact, szProto, "Language3");
- case CNF_CONAME: return ProcessDatabaseValueDefault(hContact, szProto, "Company");
- case CNF_CODEPT: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyDepartment");
- case CNF_COPOSITION: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyPosition");
- case CNF_COSTREET: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyStreet");
- case CNF_COCITY: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyCity");
- case CNF_COSTATE: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyState");
- case CNF_COZIP: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyZIP");
- case CNF_COHOMEPAGE: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyHomepage");
- case CNF_CUSTOMNICK:
- if (hContact)
- return ProcessDatabaseValueDefault(hContact, "CList", "MyHandle");
- return ProcessDatabaseValueDefault(0, szProto, "MyHandle");
-
- case CNF_COUNTRY:
- case CNF_COCOUNTRY:
- if (!db_get_ws(hContact, szProto, type == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv))
- return dbv.pwszVal;
-
- if (!db_get(hContact, szProto, type == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) {
- if (dbv.type == DBVT_WORD) {
- int countryCount;
- struct CountryListEntry *countries;
- CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries);
- for (int i = 0; i < countryCount; i++)
- if (countries[i].id == dbv.wVal)
- return mir_a2u(countries[i].szName);
- }
- else {
- db_free(&dbv);
- return ProcessDatabaseValueDefault(hContact, szProto, type == CNF_COUNTRY ? "Country" : "CompanyCountry");
- }
- }
- break;
-
- case CNF_FIRSTLAST:
- if (!db_get_ws(hContact, szProto, "FirstName", &dbv)) {
- DBVARIANT dbv2;
- if (!db_get_ws(hContact, szProto, "LastName", &dbv2)) {
- size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2;
- wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t)*len);
- if (buf != nullptr)
- mir_wstrcat(mir_wstrcat(mir_wstrcpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal);
- db_free(&dbv);
- db_free(&dbv2);
- return buf;
- }
- db_free(&dbv);
- }
- break;
-
- case CNF_UNIQUEID:
- if (db_mc_isMeta(hContact)) {
- wchar_t buf[40];
- _itow(hContact, buf, 10);
- return mir_wstrdup(buf);
- }
-
- if (auto *uid = Proto_GetUniqueId(szProto))
- return ProcessDatabaseValueDefault(hContact, szProto, uid);
- break;
-
- case CNF_DISPLAYUID:
- if (res = ProcessDatabaseValueDefault(hContact, szProto, "display_uid"))
- return res;
-
- if (auto *uid = Proto_GetUniqueId(szProto))
- return ProcessDatabaseValueDefault(hContact, szProto, uid);
- break;
-
- case CNF_DISPLAYNC:
- case CNF_DISPLAY:
- for (auto &it : nameOrder) {
- switch (it) {
- case 0: // custom name
- // make sure we aren't in CNF_DISPLAYNC mode
- // don't get custom name for nullptr contact
- if (type == CNF_DISPLAY)
- if (res = ProcessDatabaseValueDefault(hContact, (hContact != 0) ? "CList" : szProto, "MyHandle"))
- return res;
- break;
-
- case 1:
- if (res = ProcessDatabaseValueDefault(hContact, szProto, "Nick")) // nick
- return res;
- break;
- case 2:
- if (res = ProcessDatabaseValueDefault(hContact, szProto, "FirstName")) // First Name
- return res;
- break;
- case 3:
- if (res = ProcessDatabaseValueDefault(hContact, szProto, "e-mail")) // E-mail
- return res;
- break;
- case 4:
- if (res = ProcessDatabaseValueDefault(hContact, szProto, "LastName")) // Last Name
- return res;
- break;
-
- case 5: // Unique id
- // protocol must define a PFLAG_UNIQUEIDSETTING
- if (auto *uid = Proto_GetUniqueId(szProto)) {
- if (!db_get_ws(hContact, szProto, uid, &dbv)) {
- if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) {
- long value = (dbv.type == DBVT_BYTE) ? dbv.bVal : (dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal);
- wchar_t buf[40];
- _ltow(value, buf, 10);
- return mir_wstrdup(buf);
- }
- return dbv.pwszVal;
- }
- }
- break;
-
- case 6: // first + last name
- case 7: // last + first name
- if (!db_get_ws(hContact, szProto, it == 6 ? "FirstName" : "LastName", &dbv)) {
- DBVARIANT dbv2;
- if (!db_get_ws(hContact, szProto, it == 6 ? "LastName" : "FirstName", &dbv2)) {
- size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2;
- wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t)*len);
- if (buf != nullptr)
- mir_wstrcat(mir_wstrcat(mir_wstrcpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal);
-
- db_free(&dbv);
- db_free(&dbv2);
- return buf;
- }
- db_free(&dbv);
- }
- break;
-
- case 8:
- return mir_wstrdup(TranslateT("'(Unknown contact)'"));
- }
- }
- break;
-
- case CNF_MYNOTES:
- return ProcessDatabaseValueDefault(hContact, "UserInfo", "MyNotes");
-
- case CNF_TIMEZONE:
- HANDLE hTz = TimeZone_CreateByContact(hContact, nullptr, TZF_KNOWNONLY);
- if (hTz) {
- LPTIME_ZONE_INFORMATION tzi = TimeZone_GetInfo(hTz);
- int offset = tzi->Bias + tzi->StandardBias;
-
- char str[80];
- mir_snprintf(str, offset ? "UTC%+d:%02d" : "UTC", offset / -60, abs(offset % 60));
- return mir_a2u(str);
- }
- break;
- }
-
- return nullptr;
-}
-
-MIR_APP_DLL(int) Contact::GetStatus(MCONTACT hContact)
-{
- if (hContact == 0)
- return ID_STATUS_OFFLINE;
-
- const char *szProto = Proto_GetBaseAccountName(hContact);
- if (szProto == nullptr)
- return ID_STATUS_OFFLINE;
-
- return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-MIR_APP_DLL(bool) Contact::IsGroupChat(MCONTACT hContact, const char *szProto)
-{
- if (szProto == nullptr) {
- szProto = Proto_GetBaseAccountName(hContact);
- if (szProto == nullptr)
- return false;
- }
-
- return db_get_b(hContact, szProto, "ChatRoom") != 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-MIR_APP_DLL(bool) Contact::IsHidden(MCONTACT hContact)
-{
- return db_get_b(hContact, "CList", "Hidden") != 0;
-}
-
-MIR_APP_DLL(void) Contact::Hide(MCONTACT hContact, bool bHidden)
-{
- if (bHidden)
- db_set_b(hContact, "CList", "Hidden", 1);
- else
- db_unset(hContact, "CList", "Hidden");
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-MIR_APP_DLL(bool) Contact::IsReadonly(MCONTACT hContact)
-{
- return db_get_b(hContact, "CList", "ReadOnly") != 0;
-}
-
-MIR_APP_DLL(void) Contact::Readonly(MCONTACT hContact, bool bReadOnly)
-{
- if (bReadOnly)
- db_set_b(hContact, "CList", "ReadOnly", 1);
- else
- db_unset(hContact, "CList", "ReadOnly");
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-MIR_APP_DLL(bool) Contact::OnList(MCONTACT hContact)
-{
- return db_get_b(hContact, "CList", "NotOnList", 0) == 0;
-}
-
-MIR_APP_DLL(void) Contact::PutOnList(MCONTACT hContact)
-{
- db_unset(hContact, "CList", "NotOnList");
-}
-
-MIR_APP_DLL(void) Contact::RemoveFromList(MCONTACT hContact)
-{
- db_set_b(hContact, "CList", "NotOnList", 1);
-}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-// Options dialog
-
-class CContactOptsDlg : public CDlgBase
-{
- CCtrlTreeView m_nameOrder;
-
-public:
- CContactOptsDlg() :
- CDlgBase(g_plugin, IDD_OPT_CONTACT),
- m_nameOrder(this, IDC_NAMEORDER)
- {
- m_nameOrder.SetFlags(MTREE_DND);
- m_nameOrder.OnBeginDrag = BCallback(this, &CContactOptsDlg::OnBeginDrag);
- m_nameOrder.OnEndDrag = BCallback(this, &CContactOptsDlg::OnEndDrag);
- }
-
- bool OnInitDialog() override
- {
- TVINSERTSTRUCT tvis;
- tvis.hParent = nullptr;
- tvis.hInsertAfter = TVI_LAST;
- tvis.item.mask = TVIF_TEXT | TVIF_PARAM;
- for (int i = 0; i < _countof(nameOrderDescr); i++) {
- tvis.item.lParam = nameOrder[i];
- tvis.item.pszText = TranslateW(nameOrderDescr[nameOrder[i]]);
- m_nameOrder.InsertItem(&tvis);
- }
- return true;
- }
-
- bool OnApply() override
- {
- TVITEMEX tvi;
- tvi.hItem = m_nameOrder.GetRoot();
- int i = 0;
- while (tvi.hItem != nullptr) {
- tvi.mask = TVIF_PARAM | TVIF_HANDLE;
- m_nameOrder.GetItem(&tvi);
- nameOrder[i++] = (uint8_t)tvi.lParam;
- tvi.hItem = m_nameOrder.GetNextSibling(tvi.hItem);
- }
- db_set_blob(0, "Contact", "NameOrder", nameOrder, _countof(nameOrderDescr));
- g_clistApi.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID);
- return true;
- }
-
- bool OnBeginDrag(CCtrlTreeView::TEventInfo *evt)
- {
- LPNMTREEVIEW pNotify = evt->nmtv;
- return (pNotify->itemNew.lParam != 0 && pNotify->itemNew.lParam != _countof(nameOrderDescr)-1);
- }
-
- bool OnEndDrag(CCtrlTreeView::TEventInfo *evt)
- {
- auto &hti = *evt->ntvhi;
-
- // do not allow to move selection over the first item
- if (hti.flags & TVHT_ABOVE)
- return false;
-
- // do not allow to move selection below the last item either
- TVITEMEX tvi;
- tvi.mask = TVIF_HANDLE | TVIF_PARAM;
- tvi.hItem = hti.hItem;
- m_nameOrder.GetItem(&tvi);
- if (tvi.lParam == _countof(nameOrderDescr) - 1)
- return false;
-
- return true;
- }
-};
-
-static int ContactOptInit(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = {};
- odp.position = -1000000000;
- odp.szGroup.a = LPGEN("Contact list");
- odp.szTitle.a = LPGEN("Contact names");
- odp.pDialog = new CContactOptsDlg();
- odp.flags = ODPF_BOLDGROUPS;
- g_plugin.addOptions(wParam, &odp);
-
- return PopupOptionsInit(wParam);
-}
-
-int LoadContactsModule(void)
-{
- for (uint8_t i = 0; i < _countof(nameOrder); i++)
- nameOrder[i] = i;
-
- DBVARIANT dbv;
- if (!db_get(0, "Contact", "NameOrder", &dbv)) {
- memcpy(nameOrder, dbv.pbVal, dbv.cpbVal);
- db_free(&dbv);
- }
-
- HookEvent(ME_OPT_INITIALISE, ContactOptInit);
- return 0;
-}
+/* + +Miranda NG: the free IM client for Microsoft* Windows* + +Copyright (C) 2012-25 Miranda NG team (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" + +static wchar_t* nameOrderDescr[] = +{ + LPGENW("My custom name (not movable)"), + LPGENW("Nick"), + LPGENW("FirstName"), + LPGENW("E-mail"), + LPGENW("LastName"), + LPGENW("Username"), + LPGENW("FirstName LastName"), + LPGENW("LastName FirstName"), + LPGENW("'(Unknown contact)' (not movable)") +}; + +uint8_t nameOrder[_countof(nameOrderDescr)]; + +static wchar_t* ProcessDatabaseValueDefault(MCONTACT hContact, const char *szProto, const char *szSetting) +{ + DBVARIANT dbv; + if (db_get(hContact, szProto, szSetting, &dbv)) + return nullptr; + + wchar_t *ret; + wchar_t buf[40]; + switch (dbv.type) { + case DBVT_BYTE: + ret = _itow(dbv.bVal, buf, 10); + break; + case DBVT_WORD: + ret = _itow(dbv.wVal, buf, 10); + break; + case DBVT_DWORD: + ret = _itow(dbv.dVal, buf, 10); + break; + case DBVT_BLOB: + if (dbv.cpbVal == 8) + ret = _i64tow(*(__int64*)dbv.pbVal, buf, 10); + else + ret = bin2hexW(dbv.pbVal, min(int(dbv.cpbVal), 19), buf); + break; + case DBVT_ASCIIZ: + ret = mir_a2u(dbv.pszVal); + break; + case DBVT_UTF8: + ret = mir_utf8decodeW(dbv.pszVal); + break; + case DBVT_WCHAR: + return dbv.pwszVal; // no need to free dbv + default: + ret = nullptr; + } + + db_free(&dbv); + return mir_wstrdup(ret); +} + +MIR_APP_DLL(wchar_t*) Contact::GetInfo(int type, MCONTACT hContact, const char *szProto) +{ + if (hContact == 0 && szProto == nullptr) + return nullptr; + + if (szProto == nullptr) + if (auto *pa = Proto_GetContactAccount(hContact)) + szProto = pa->szModuleName; + + if (szProto == nullptr) + return nullptr; + + wchar_t *res; + DBVARIANT dbv; + switch (type) { + case CNF_FIRSTNAME: return ProcessDatabaseValueDefault(hContact, szProto, "FirstName"); + case CNF_LASTNAME: return ProcessDatabaseValueDefault(hContact, szProto, "LastName"); + case CNF_NICK: return ProcessDatabaseValueDefault(hContact, szProto, "Nick"); + case CNF_EMAIL: return ProcessDatabaseValueDefault(hContact, szProto, "e-mail"); + case CNF_CITY: return ProcessDatabaseValueDefault(hContact, szProto, "City"); + case CNF_STATE: return ProcessDatabaseValueDefault(hContact, szProto, "State"); + case CNF_PHONE: return ProcessDatabaseValueDefault(hContact, szProto, "Phone"); + case CNF_HOMEPAGE: return ProcessDatabaseValueDefault(hContact, szProto, "Homepage"); + case CNF_ABOUT: return ProcessDatabaseValueDefault(hContact, szProto, "About"); + case CNF_AGE: return ProcessDatabaseValueDefault(hContact, szProto, "Age"); + case CNF_GENDER: return ProcessDatabaseValueDefault(hContact, szProto, "Gender"); + case CNF_FAX: return ProcessDatabaseValueDefault(hContact, szProto, "Fax"); + case CNF_CELLULAR: return ProcessDatabaseValueDefault(hContact, szProto, "Cellular"); + case CNF_BIRTHDAY: return ProcessDatabaseValueDefault(hContact, szProto, "BirthDay"); + case CNF_BIRTHMONTH: return ProcessDatabaseValueDefault(hContact, szProto, "BirthMonth"); + case CNF_BIRTHYEAR: return ProcessDatabaseValueDefault(hContact, szProto, "BirthYear"); + case CNF_STREET: return ProcessDatabaseValueDefault(hContact, szProto, "Street"); + case CNF_ZIP: return ProcessDatabaseValueDefault(hContact, szProto, "ZIP"); + case CNF_LANGUAGE1: return ProcessDatabaseValueDefault(hContact, szProto, "Language1"); + case CNF_LANGUAGE2: return ProcessDatabaseValueDefault(hContact, szProto, "Language2"); + case CNF_LANGUAGE3: return ProcessDatabaseValueDefault(hContact, szProto, "Language3"); + case CNF_CONAME: return ProcessDatabaseValueDefault(hContact, szProto, "Company"); + case CNF_CODEPT: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyDepartment"); + case CNF_COPOSITION: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyPosition"); + case CNF_COSTREET: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyStreet"); + case CNF_COCITY: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyCity"); + case CNF_COSTATE: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyState"); + case CNF_COZIP: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyZIP"); + case CNF_COHOMEPAGE: return ProcessDatabaseValueDefault(hContact, szProto, "CompanyHomepage"); + case CNF_CUSTOMNICK: + if (hContact) + return ProcessDatabaseValueDefault(hContact, "CList", "MyHandle"); + return ProcessDatabaseValueDefault(0, szProto, "MyHandle"); + + case CNF_COUNTRY: + case CNF_COCOUNTRY: + if (!db_get_ws(hContact, szProto, type == CNF_COUNTRY ? "CountryName" : "CompanyCountryName", &dbv)) + return dbv.pwszVal; + + if (!db_get(hContact, szProto, type == CNF_COUNTRY ? "Country" : "CompanyCountry", &dbv)) { + if (dbv.type == DBVT_WORD) { + int countryCount; + struct CountryListEntry *countries; + CallService(MS_UTILS_GETCOUNTRYLIST, (WPARAM)&countryCount, (LPARAM)&countries); + for (int i = 0; i < countryCount; i++) + if (countries[i].id == dbv.wVal) + return mir_a2u(countries[i].szName); + } + else { + db_free(&dbv); + return ProcessDatabaseValueDefault(hContact, szProto, type == CNF_COUNTRY ? "Country" : "CompanyCountry"); + } + } + break; + + case CNF_FIRSTLAST: + if (!db_get_ws(hContact, szProto, "FirstName", &dbv)) { + DBVARIANT dbv2; + if (!db_get_ws(hContact, szProto, "LastName", &dbv2)) { + size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2; + wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t)*len); + if (buf != nullptr) + mir_wstrcat(mir_wstrcat(mir_wstrcpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal); + db_free(&dbv); + db_free(&dbv2); + return buf; + } + return dbv.pwszVal; + } + break; + + case CNF_UNIQUEID: + if (db_mc_isMeta(hContact)) { + wchar_t buf[40]; + _itow(hContact, buf, 10); + return mir_wstrdup(buf); + } + + if (auto *uid = Proto_GetUniqueId(szProto)) + return ProcessDatabaseValueDefault(hContact, szProto, uid); + break; + + case CNF_DISPLAYUID: + if (res = ProcessDatabaseValueDefault(hContact, szProto, "display_uid")) + return res; + + if (auto *uid = Proto_GetUniqueId(szProto)) + return ProcessDatabaseValueDefault(hContact, szProto, uid); + break; + + case CNF_DISPLAYNC: + case CNF_DISPLAY: + for (auto &it : nameOrder) { + switch (it) { + case 0: // custom name + // make sure we aren't in CNF_DISPLAYNC mode + // don't get custom name for nullptr contact + if (type == CNF_DISPLAY) + if (res = ProcessDatabaseValueDefault(hContact, (hContact != 0) ? "CList" : szProto, "MyHandle")) + return res; + break; + + case 1: + if (res = ProcessDatabaseValueDefault(hContact, szProto, "Nick")) // nick + return res; + break; + case 2: + if (res = ProcessDatabaseValueDefault(hContact, szProto, "FirstName")) // First Name + return res; + break; + case 3: + if (res = ProcessDatabaseValueDefault(hContact, szProto, "e-mail")) // E-mail + return res; + break; + case 4: + if (res = ProcessDatabaseValueDefault(hContact, szProto, "LastName")) // Last Name + return res; + break; + + case 5: // Unique id + // protocol must define a PFLAG_UNIQUEIDSETTING + if (auto *uid = Proto_GetUniqueId(szProto)) { + if (!db_get_ws(hContact, szProto, uid, &dbv)) { + if (dbv.type == DBVT_BYTE || dbv.type == DBVT_WORD || dbv.type == DBVT_DWORD) { + long value = (dbv.type == DBVT_BYTE) ? dbv.bVal : (dbv.type == DBVT_WORD ? dbv.wVal : dbv.dVal); + wchar_t buf[40]; + _ltow(value, buf, 10); + return mir_wstrdup(buf); + } + return dbv.pwszVal; + } + } + break; + + case 6: // first + last name + case 7: // last + first name + if (!db_get_ws(hContact, szProto, it == 6 ? "FirstName" : "LastName", &dbv)) { + DBVARIANT dbv2; + if (!db_get_ws(hContact, szProto, it == 6 ? "LastName" : "FirstName", &dbv2)) { + size_t len = mir_wstrlen(dbv.pwszVal) + mir_wstrlen(dbv2.pwszVal) + 2; + wchar_t *buf = (wchar_t*)mir_alloc(sizeof(wchar_t)*len); + if (buf != nullptr) + mir_wstrcat(mir_wstrcat(mir_wstrcpy(buf, dbv.pwszVal), L" "), dbv2.pwszVal); + + db_free(&dbv); + db_free(&dbv2); + return buf; + } + db_free(&dbv); + } + break; + + case 8: + return mir_wstrdup(TranslateT("'(Unknown contact)'")); + } + } + break; + + case CNF_MYNOTES: + return ProcessDatabaseValueDefault(hContact, "UserInfo", "MyNotes"); + + case CNF_TIMEZONE: + HANDLE hTz = TimeZone_CreateByContact(hContact, nullptr, TZF_KNOWNONLY); + if (hTz) { + LPTIME_ZONE_INFORMATION tzi = TimeZone_GetInfo(hTz); + int offset = tzi->Bias + tzi->StandardBias; + + char str[80]; + mir_snprintf(str, offset ? "UTC%+d:%02d" : "UTC", offset / -60, abs(offset % 60)); + return mir_a2u(str); + } + break; + } + + return nullptr; +} + +MIR_APP_DLL(int) Contact::GetStatus(MCONTACT hContact, const char *szProto) +{ + if (hContact == 0) + return ID_STATUS_OFFLINE; + + if (szProto == nullptr) + szProto = Proto_GetBaseAccountName(hContact); + if (szProto == nullptr) + return ID_STATUS_OFFLINE; + + return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); +} + +/////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(int) Contact::IsGroupChat(MCONTACT hContact, const char *szProto) +{ + if (szProto == nullptr) { + szProto = Proto_GetBaseAccountName(hContact); + if (szProto == nullptr) + return false; + } + + return db_get_b(hContact, szProto, "ChatRoom"); +} + +MIR_APP_DLL(void) Contact::SetBirthday(MCONTACT hContact, int dd, int mm, int yy) +{ + if (auto *szProto = Proto_GetBaseAccountName(hContact)) { + db_set_w(hContact, szProto, "BirthMonth", mm); + db_set_w(hContact, szProto, "BirthDay", dd); + + if (yy) { + db_set_w(hContact, szProto, "BirthYear", yy); + + SYSTEMTIME sToday = {}; + GetLocalTime(&sToday); + int nAge = sToday.wYear - yy; + if (sToday.wMonth < mm || (sToday.wMonth == mm && sToday.wDay < dd)) + nAge--; + if (nAge) + db_set_w(hContact, szProto, "Age", nAge); + } + } +} + +/////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(bool) Contact::IsHidden(MCONTACT hContact) +{ + return db_get_b(hContact, "CList", "Hidden") != 0; +} + +MIR_APP_DLL(void) Contact::Hide(MCONTACT hContact, bool bHidden) +{ + if (bHidden) + db_set_b(hContact, "CList", "Hidden", 1); + else + db_unset(hContact, "CList", "Hidden"); +} + +/////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(bool) Contact::IsReadonly(MCONTACT hContact) +{ + return db_get_b(hContact, "CList", "ReadOnly") != 0; +} + +MIR_APP_DLL(void) Contact::Readonly(MCONTACT hContact, bool bReadOnly) +{ + if (bReadOnly) + db_set_b(hContact, "CList", "ReadOnly", 1); + else + db_unset(hContact, "CList", "ReadOnly"); +} + +/////////////////////////////////////////////////////////////////////////////// + +MIR_APP_DLL(bool) Contact::OnList(MCONTACT hContact) +{ + return db_get_b(hContact, "CList", "NotOnList", 0) == 0; +} + +MIR_APP_DLL(void) Contact::PutOnList(MCONTACT hContact) +{ + db_unset(hContact, "CList", "NotOnList"); +} + +MIR_APP_DLL(void) Contact::RemoveFromList(MCONTACT hContact) +{ + db_set_b(hContact, "CList", "NotOnList", 1); +} + +///////////////////////////////////////////////////////////////////////////////////////// +// Options dialog + +class CContactOptsDlg : public CDlgBase +{ + CCtrlTreeView m_nameOrder; + +public: + CContactOptsDlg() : + CDlgBase(g_plugin, IDD_OPT_CONTACT), + m_nameOrder(this, IDC_NAMEORDER) + { + m_nameOrder.SetFlags(MTREE_DND); + m_nameOrder.OnBeginDrag = BCallback(this, &CContactOptsDlg::OnBeginDrag); + m_nameOrder.OnEndDrag = BCallback(this, &CContactOptsDlg::OnEndDrag); + } + + bool OnInitDialog() override + { + TVINSERTSTRUCT tvis; + tvis.hParent = nullptr; + tvis.hInsertAfter = TVI_LAST; + tvis.item.mask = TVIF_TEXT | TVIF_PARAM; + for (int i = 0; i < _countof(nameOrderDescr); i++) { + tvis.item.lParam = nameOrder[i]; + tvis.item.pszText = TranslateW(nameOrderDescr[nameOrder[i]]); + m_nameOrder.InsertItem(&tvis); + } + return true; + } + + bool OnApply() override + { + TVITEMEX tvi; + tvi.hItem = m_nameOrder.GetRoot(); + int i = 0; + while (tvi.hItem != nullptr) { + tvi.mask = TVIF_PARAM | TVIF_HANDLE; + m_nameOrder.GetItem(&tvi); + nameOrder[i++] = (uint8_t)tvi.lParam; + tvi.hItem = m_nameOrder.GetNextSibling(tvi.hItem); + } + db_set_blob(0, "Contact", "NameOrder", nameOrder, _countof(nameOrderDescr)); + g_clistApi.pfnInvalidateDisplayNameCacheEntry(INVALID_CONTACT_ID); + return true; + } + + bool OnBeginDrag(CCtrlTreeView::TEventInfo *evt) + { + LPNMTREEVIEW pNotify = evt->nmtv; + return (pNotify->itemNew.lParam != 0 && pNotify->itemNew.lParam != _countof(nameOrderDescr)-1); + } + + bool OnEndDrag(CCtrlTreeView::TEventInfo *evt) + { + auto &hti = *evt->ntvhi; + + // do not allow to move selection over the first item + if (hti.flags & TVHT_ABOVE) + return false; + + // do not allow to move selection below the last item either + TVITEMEX tvi; + tvi.mask = TVIF_HANDLE | TVIF_PARAM; + tvi.hItem = hti.hItem; + m_nameOrder.GetItem(&tvi); + if (tvi.lParam == _countof(nameOrderDescr) - 1) + return false; + + return true; + } +}; + +static int ContactOptInit(WPARAM wParam, LPARAM) +{ + OPTIONSDIALOGPAGE odp = {}; + odp.position = -1000000000; + odp.szGroup.a = LPGEN("Contact list"); + odp.szTitle.a = LPGEN("Contact names"); + odp.pDialog = new CContactOptsDlg(); + odp.flags = ODPF_BOLDGROUPS; + g_plugin.addOptions(wParam, &odp); + + return PopupOptionsInit(wParam); +} + +int LoadContactsModule(void) +{ + for (uint8_t i = 0; i < _countof(nameOrder); i++) + nameOrder[i] = i; + + DBVARIANT dbv; + if (!db_get(0, "Contact", "NameOrder", &dbv)) { + memcpy(nameOrder, dbv.pbVal, dbv.cpbVal); + db_free(&dbv); + } + + HookEvent(ME_OPT_INITIALISE, ContactOptInit); + return 0; +} diff --git a/src/mir_app/src/clistcore.cpp b/src/mir_app/src/clistcore.cpp index dd396d1b25..22d1a35825 100644 --- a/src/mir_app/src/clistcore.cpp +++ b/src/mir_app/src/clistcore.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -123,8 +123,6 @@ void InitClistCore() g_clistApi.pfnSetHideOffline = fnSetHideOffline;
- g_clistApi.pfnDocking_ProcessWindowMessage = fnDocking_ProcessWindowMessage;
-
g_clistApi.pfnGetIconFromStatusMode = fnGetIconFromStatusMode;
g_clistApi.pfnGetWindowVisibleState = fnGetWindowVisibleState;
g_clistApi.pfnIconFromStatusMode = fnIconFromStatusMode;
diff --git a/src/mir_app/src/clistevents.cpp b/src/mir_app/src/clistevents.cpp index 3d38008d19..7933408654 100644 --- a/src/mir_app/src/clistevents.cpp +++ b/src/mir_app/src/clistevents.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -302,13 +302,11 @@ MIR_APP_DLL(CListEvent *) Clist_GetEvent(MCONTACT hContact, int idx) int EventsProcessContactDoubleClick(MCONTACT hContact)
{
if (auto *pEvent = Clist_GetEvent(hContact, 0)) {
- if (CallService(pEvent->pszService, 0, (LPARAM)pEvent) == CALLSERVICE_NOTFOUND)
- return 1;
-
- // if the event is still alive, free it
- if (g_cliEvents.indexOf(pEvent))
- g_clistApi.pfnFreeEvent(pEvent);
- return 0;
+ MEVENT hEvent = pEvent->hDbEvent;
+ if (CallService(pEvent->pszService, 0, (LPARAM)pEvent) != CALLSERVICE_NOTFOUND) {
+ Clist_RemoveEvent(hContact, hEvent);
+ return 0;
+ }
}
return 1;
@@ -406,17 +404,17 @@ static int CListEventSettingsChanged(WPARAM hContact, LPARAM lParam) int InitCListEvents(void)
{
if (db_get_b(0, MODULENAME, "DisableTrayFlash")) {
- Clist::EnableTrayFlash = false;
+ Clist::bEnableTrayFlash = false;
db_unset(0, MODULENAME, "DisableTrayFlash");
}
if (db_get_b(0, MODULENAME, "DisableIconBlink")) {
- Clist::EnableIconBlink = false;
+ Clist::bEnableIconBlink = false;
db_unset(0, MODULENAME, "DisableIconBlink");
}
- g_bEnableTrayFlash = Clist::EnableTrayFlash;
- g_bEnableIconFlash = Clist::EnableIconBlink;
+ g_bEnableTrayFlash = Clist::bEnableTrayFlash;
+ g_bEnableIconFlash = Clist::bEnableIconBlink;
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, CListEventSettingsChanged);
HookEvent(ME_DB_EVENT_MARKED_READ, CListEventMarkedRead);
diff --git a/src/mir_app/src/clistgroups.cpp b/src/mir_app/src/clistgroups.cpp index 185f4ce2da..ea90dea424 100644 --- a/src/mir_app/src/clistgroups.cpp +++ b/src/mir_app/src/clistgroups.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -39,10 +39,7 @@ static int CompareGrpByName(const CGroupInternal *p1, const CGroupInternal *p2) }
static LIST<CGroupInternal> arByName(20, CompareGrpByName);
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-LIST<CGroupInternal> arByIds(20, NumericKeySortT);
+static LIST<CGroupInternal> arByIds(20, NumericKeySortT);
static CGroupInternal* FindGroup(int key)
{
@@ -50,28 +47,6 @@ static CGroupInternal* FindGroup(int key) }
/////////////////////////////////////////////////////////////////////////////////////////
-
-static CTimer *g_pTimer;
-
-struct CGroupImpl
-{
- void OnTimer(CTimer *)
- {
- g_pTimer->Stop();
-
- JSONNode root(JSON_ARRAY);
- for (auto &it : arByIds) {
- JSONNode grp;
- grp << INT_PARAM("id", it->groupId) << WCHAR_PARAM("name", it->groupName) << INT_PARAM("flags", it->flags);
- root << grp;
- }
-
- json2file(root, VARSW(L"%miranda_userdata%\\groups.json"));
- }
-}
-g_impl;
-
-/////////////////////////////////////////////////////////////////////////////////////////
// CGroupInternal members
CGroupInternal::CGroupInternal(int _id, const wchar_t *_name, int _flags) :
@@ -79,7 +54,7 @@ CGroupInternal::CGroupInternal(int _id, const wchar_t *_name, int _flags) : groupId(_id),
groupName(mir_wstrdup(_name))
{
- bSaveExpanded = (_flags & GROUPF_EXPANDED) != 0;
+ bSaveExpanded = bExpanded;
}
CGroupInternal::~CGroupInternal()
@@ -87,31 +62,70 @@ CGroupInternal::~CGroupInternal() mir_free(groupName);
}
+void CGroupInternal::remove()
+{
+ char szSetting[40];
+ itoa(groupId, szSetting, 10);
+ db_unset(0, GROUPS_MODULE, szSetting);
+}
+
void CGroupInternal::save()
{
Clist_BroadcastAsync(INTM_GROUPSCHANGED, 0, LPARAM(this));
- if (g_pTimer)
- g_pTimer->Start(1000);
+ JSONNode grp;
+ grp << WCHAR_PARAM("name", groupName) << INT_PARAM("flags", flags) << INT_PARAM("ignore", ignore);
+
+ char szSetting[40];
+ itoa(groupId, szSetting, 10);
+ db_set_utf(0, GROUPS_MODULE, szSetting, grp.write().c_str());
}
/////////////////////////////////////////////////////////////////////////////////////////
-static int GroupNameExists(const wchar_t *ptszGroupName, int skipGroup)
+CGroupInternal* FindGroup(const wchar_t *ptszGroupName)
{
if (ptszGroupName == nullptr)
return 0;
- CGroupInternal *tmp = (CGroupInternal*)_alloca(sizeof(CGroupInternal));
- tmp->groupName = (wchar_t*)ptszGroupName;
- if (tmp = arByName.find(tmp))
- return (skipGroup == tmp->groupId) ? 0 : tmp->groupId + 1;
+ CGroupInternal *tmp = (CGroupInternal *)_alloca(sizeof(CGroupInternal));
+ tmp->groupName = (wchar_t *)ptszGroupName;
+ return arByName.find(tmp);
+}
+
+static int GroupNameExists(const wchar_t *ptszGroupName)
+{
+ if (auto *tmp = FindGroup(ptszGroupName))
+ return tmp->groupId + 1;
return 0;
}
MIR_APP_DLL(MGROUP) Clist_GroupExists(LPCTSTR ptszGroupName)
{
- return GroupNameExists(ptszGroupName, -1);
+ return GroupNameExists(ptszGroupName);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void Clist_RebuildGroups(HWND hwnd, ClcData *dat)
+{
+ for (auto &it: arByIds)
+ if (hwnd != g_clistApi.hwndContactTree || !it->bHidden)
+ g_clistApi.pfnAddGroup(hwnd, dat, it->groupName, it->flags, it->groupId+1, 0);
+}
+
+void Clist_GroupAdded(MGROUP hGroup)
+{
+ // CLC does this automatically unless it's a new group
+ HWND hwndFocus = GetFocus();
+
+ wchar_t szFocusClass[64];
+ GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass));
+ if (!mir_wstrcmp(szFocusClass, CLISTCONTROL_CLASSW)) {
+ HANDLE hItem = (HANDLE)SendMessage(hwndFocus, CLM_FINDGROUP, hGroup, 0);
+ if (hItem)
+ SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM)hItem, 0);
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -132,12 +146,12 @@ static INT_PTR CreateGroupInternal(MGROUP hParent, const wchar_t *ptszName) mir_wstrncpy(newName, newBaseName, _countof(newName) - 1);
if (ptszName) {
- int id = GroupNameExists(newBaseName, -1);
+ int id = GroupNameExists(newBaseName);
if (id)
return id;
}
else {
- for (int idCopy = 1; GroupNameExists(newName, -1); idCopy++)
+ for (int idCopy = 1; GroupNameExists(newName); idCopy++)
mir_snwprintf(newName, L"%s (%d)", newBaseName, idCopy);
}
@@ -211,7 +225,7 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup, bool bSilent) if (pGroup == nullptr)
return 1;
- if (!bSilent && Clist::ConfirmDelete) {
+ if (!bSilent && Clist::bConfirmDelete) {
wchar_t szQuestion[256 + 100];
mir_snwprintf(szQuestion, TranslateT("Are you sure you want to delete group '%s'? This operation cannot be undone."), pGroup->groupName);
if (MessageBoxW(g_clistApi.hwndContactList, szQuestion, TranslateT("Delete group"), MB_YESNO | MB_ICONQUESTION) == IDNO)
@@ -262,6 +276,12 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup, bool bSilent) it->save();
}
+ for (int i = 0; i < iGap; i++) {
+ char idstr[33];
+ _itoa(arByIds.getCount() + i, idstr, 10);
+ db_unset(0, GROUPS_MODULE, idstr);
+ }
+
SetCursor(LoadCursor(nullptr, IDC_ARROW));
Clist_LoadContactTree();
Clist_BroadcastAsync(INTM_GROUPSCHANGED, 0, 0);
@@ -269,7 +289,6 @@ MIR_APP_DLL(int) Clist_GroupDelete(MGROUP hGroup, bool bSilent) const CLISTGROUPCHANGE grpChg = { wszOldName, nullptr };
NotifyEventHooks(hGroupChangeEvent, 0, (LPARAM)&grpChg);
- delete pGroup;
return 0;
}
@@ -332,7 +351,8 @@ MIR_APP_DLL(int) Clist_GroupMoveBefore(MGROUP hGroup, MGROUP hGroupBefore) static int RenameGroupWithMove(int groupId, const wchar_t *szName, int move)
{
- if (GroupNameExists(szName, groupId)) {
+ auto existingId = GroupNameExists(szName);
+ if (existingId && existingId != groupId) {
MessageBoxW(nullptr, TranslateT("You already have a group with that name. Please enter a unique name for the group."), TranslateT("Rename group"), MB_ICONERROR | MB_OK);
return 1;
}
@@ -407,41 +427,50 @@ MIR_APP_DLL(int) Clist_GroupRename(MGROUP hGroup, const wchar_t *ptszNewName) MIR_APP_DLL(void) Clist_GroupSaveExpanded()
{
for (auto &it : arByIds)
- it->bSaveExpanded = (it->flags & GROUPF_EXPANDED) != 0;
+ it->bSaveExpanded = it->bExpanded;
}
MIR_APP_DLL(void) Clist_GroupRestoreExpanded()
{
- for (auto &it : arByIds) {
- if (it->bSaveExpanded)
- it->flags |= GROUPF_EXPANDED;
- else
- it->flags &= ~GROUPF_EXPANDED;
- it->save();
+ for (auto &it : arByIds)
+ it->bExpanded = it->bSaveExpanded;
+}
+
+MIR_APP_DLL(int) Clist_GroupSetExpanded(MGROUP hGroup, int iNewState)
+{
+ if (auto *pGroup = FindGroup(hGroup - 1)) {
+ pGroup->bExpanded = iNewState != 0;
+ return 0;
}
+
+ return 1;
}
/////////////////////////////////////////////////////////////////////////////////////////
-MIR_APP_DLL(int) Clist_GroupSetExpanded(MGROUP hGroup, int iNewState)
+uint32_t Clist_GroupGetIgnore(MGROUP hGroup, bool *bHidden)
{
- CGroupInternal *pGroup = FindGroup(hGroup-1);
- if (pGroup == nullptr)
- return 1;
-
- if (iNewState)
- pGroup->flags |= GROUPF_EXPANDED;
- else
- pGroup->flags &= ~GROUPF_EXPANDED;
- pGroup->save();
+ if (auto *pGroup = FindGroup(hGroup - 1)) {
+ *bHidden = pGroup->bHidden;
+ return pGroup->ignore;
+ }
return 0;
}
+void Clist_GroupSetIgnore(MGROUP hGroup, uint32_t mask, bool bHidden)
+{
+ if (auto *pGroup = FindGroup(hGroup - 1)) {
+ pGroup->ignore = mask;
+ pGroup->bHidden = bHidden;
+ pGroup->save();
+ }
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
MIR_APP_DLL(int) Clist_GroupSetFlags(MGROUP hGroup, LPARAM iNewFlags)
{
- CGroupInternal *pGroup = FindGroup(hGroup-1);
+ auto *pGroup = FindGroup(hGroup-1);
if (pGroup == nullptr)
return 1;
@@ -560,11 +589,26 @@ MIR_APP_DLL(HMENU) Clist_GroupBuildMenu(int startId) /////////////////////////////////////////////////////////////////////////////////////////
// Module entry point
-int InitGroupServices(void)
+static int enumGroups(const char *szSetting, void *)
{
- g_pTimer = new CTimer(Miranda_GetSystemWindow(), UINT_PTR(&g_pTimer));
- g_pTimer->OnEvent = Callback(&g_impl, &CGroupImpl::OnTimer);
+ DBVARIANT dbv = {};
+ if (!db_get_s(0, GROUPS_MODULE, szSetting, &dbv, 0)) {
+ if (dbv.pszVal && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8)) {
+ JSONNode node(JSONNode::parse(dbv.pszVal));
+ if (node) {
+ CGroupInternal *p = new CGroupInternal(atoi(szSetting), node["name"].as_mstring(), node["flags"].as_int());
+ p->ignore = node["ignore"].as_int();
+ arByIds.insert(p);
+ arByName.insert(p);
+ }
+ }
+ }
+
+ return 0;
+}
+int InitGroupServices(void)
+{
if (!db_get_b(0, "Compatibility", "Groups")) {
char str[32];
for (int i = 0;; i++) {
@@ -582,13 +626,17 @@ int InitGroupServices(void) }
else {
JSONNode cache;
- if (file2json(VARSW(L"%miranda_userdata%\\groups.json"), cache)) {
+ VARSW wszJson(L"%miranda_userdata%\\groups.json");
+ if (file2json(wszJson, cache)) {
for (auto &it : cache) {
CGroupInternal *p = new CGroupInternal(it["id"].as_int(), it["name"].as_mstring(), it["flags"].as_int());
arByIds.insert(p);
arByName.insert(p);
+ p->save();
}
+ DeleteFileW(wszJson);
}
+ else db_enum_settings(0, &enumGroups, GROUPS_MODULE);
}
hGroupChangeEvent = CreateHookableEvent(ME_CLIST_GROUPCHANGE);
@@ -597,11 +645,10 @@ int InitGroupServices(void) void UninitGroupServices(void)
{
- g_pTimer->OnTimer();
- delete g_pTimer;
-
- for (auto &p : arByIds)
+ for (auto &p : arByIds) {
+ p->save();
delete p;
+ }
arByIds.destroy();
arByName.destroy();
diff --git a/src/mir_app/src/clistmod.cpp b/src/mir_app/src/clistmod.cpp index a4fcb8d241..ef5d2611d3 100644 --- a/src/mir_app/src/clistmod.cpp +++ b/src/mir_app/src/clistmod.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -284,9 +284,6 @@ int fnGetWindowVisibleState(HWND hWnd, int iStepX, int iStepY) if (IsIconic(hWnd) || !IsWindowVisible(hWnd))
return GWVS_HIDDEN;
- if (Clist_IsDocked())
- return GWVS_VISIBLE;
-
GetWindowRect(hWnd, &rcWin);
SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea, FALSE);
@@ -336,7 +333,7 @@ int fnShowHide() switch (iVisibleState) {
case GWVS_PARTIALLY_COVERED:
//If we don't want to bring it to top, we can use a simple break. This goes against readability ;-) but the comment explains it.
- if (!db_get_b(0, "CList", "BringToFront", SETTING_BRINGTOFRONT_DEFAULT))
+ if (!Clist::bBringToFront)
break;
case GWVS_COVERED: //Fall through (and we're already falling)
case GWVS_HIDDEN:
@@ -351,7 +348,7 @@ int fnShowHide() if (bShow == TRUE) {
ShowWindow(g_clistApi.hwndContactList, SW_RESTORE);
- if (!db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT))
+ if (!Clist::bOnTop)
SetWindowPos(g_clistApi.hwndContactList, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
else
SetWindowPos(g_clistApi.hwndContactList, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
@@ -366,8 +363,7 @@ int fnShowHide() MoveWindow(g_clistApi.hwndContactList, rcWindow.left, rcWindow.top, rcWindow.right - rcWindow.left, rcWindow.bottom - rcWindow.top, TRUE);
}
else { // It needs to be hidden
- if (db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ||
- db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
+ if (Clist::bToolWindow || Clist::bMinimizeToTray) {
ShowWindow(g_clistApi.hwndContactList, SW_HIDE);
db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
}
@@ -433,7 +429,7 @@ void UnloadContactListModule() return;
// remove transitory contacts
- if (Clist::RemoveTempContacts) {
+ if (Clist::bRemoveTempContacts) {
for (MCONTACT hContact = db_find_first(); hContact != 0; ) {
MCONTACT hNext = db_find_next(hContact);
if (!Contact::OnList(hContact))
diff --git a/src/mir_app/src/clistopts.cpp b/src/mir_app/src/clistopts.cpp index 6f114f0767..58ad08a214 100644 --- a/src/mir_app/src/clistopts.cpp +++ b/src/mir_app/src/clistopts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -25,21 +25,43 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "clc.h"
-CMOption<bool> Clist::UseGroups(MODULENAME, "UseGroups", true);
-CMOption<bool> Clist::HideOffline(MODULENAME, "HideOffline", false);
-CMOption<bool> Clist::ConfirmDelete(MODULENAME, "ConfirmDelete", true);
-CMOption<bool> Clist::EnableIconBlink(MODULENAME, "EnableIconBlink", true);
-CMOption<bool> Clist::EnableTrayFlash(MODULENAME, "EnableTrayFlash", true);
-CMOption<bool> Clist::HideEmptyGroups(MODULENAME, "HideEmptyGroups", false);
-CMOption<bool> Clist::RemoveTempContacts(MODULENAME, "RemoveTempContacts", true);
+// Clist
+CMOption<bool> Clist::bOnTop(MODULENAME, "OnTop", true);
+CMOption<bool> Clist::bAutoHide(MODULENAME, "AutoHide", false);
+CMOption<bool> Clist::bUseGroups(MODULENAME, "UseGroups", true);
+CMOption<bool> Clist::bToolWindow(MODULENAME, "ToolWindow", true);
+CMOption<bool> Clist::bTransparent(MODULENAME, "Transparent", false);
+CMOption<bool> Clist::bAlwaysMulti(MODULENAME, "AlwaysMulti", false);
+CMOption<bool> Clist::bHideOffline(MODULENAME, "HideOffline", false);
+CMOption<bool> Clist::bBringToFront(MODULENAME, "BringToFront", false);
+CMOption<bool> Clist::bConfirmDelete(MODULENAME, "ConfirmDelete", true);
+CMOption<bool> Clist::bMinimizeToTray(MODULENAME, "Min2Tray", true);
+CMOption<bool> Clist::bEnableIconBlink(MODULENAME, "EnableIconBlink", true);
+CMOption<bool> Clist::bEnableTrayFlash(MODULENAME, "EnableTrayFlash", true);
+CMOption<bool> Clist::bHideEmptyGroups(MODULENAME, "HideEmptyGroups", false);
+CMOption<bool> Clist::bRemoveTempContacts(MODULENAME, "RemoveTempContacts", true);
+
+CMOption<bool> Clist::bTray1Click(MODULENAME, "Tray1Click", IsWinVer7Plus());
+CMOption<bool> Clist::bTrayAlwaysStatus(MODULENAME, "AlwaysStatus", false);
+
+CMOption<uint8_t> Clist::iTrayIcon(MODULENAME, "TrayIcon", SETTING_TRAYICON_SINGLE);
+CMOption<uint8_t> Clist::iAlpha(MODULENAME, "Alpha", 200);
+CMOption<uint8_t> Clist::iAutoAlpha(MODULENAME, "AutoAlpha", 150);
+
+CMOption<uint16_t> Clist::iHideTime(MODULENAME, "HideTime", 30);
+CMOption<uint16_t> Clist::iCycleTime(MODULENAME, "CycleTime", 4);
-CMOption<bool> Clist::Tray1Click(MODULENAME, "Tray1Click", IsWinVer7Plus());
-CMOption<bool> Clist::TrayAlwaysStatus(MODULENAME, "AlwaysStatus", false);
CMOption<uint32_t> Clist::IconFlashTime(MODULENAME, "IconFlashTime", 550);
-CMOption<bool> Clist::FilterSearch("CLC", "FilterSearch", false);
+// CLC
+CMOption<bool> Clist::bFilterSearch("CLC", "FilterSearch", false);
CMOption<uint32_t> Clist::OfflineModes("CLC", "OfflineModes", MODEF_OFFLINE);
+// CLUI
+CMOption<bool> Clist::bShowCaption("CLUI", "ShowCaption", true);
+CMOption<bool> Clist::bShowMainMenu("CLUI", "ShowMainMenu", true);
+CMOption<bool> Clist::bClientAreaDrag("CLUI", "ClientAreaDrag", true);
+
struct
{
uint32_t style;
@@ -54,7 +76,8 @@ static const offlineValues[] = { PF2_LIGHTDND, LPGENW("Occupied") },
{ PF2_HEAVYDND, LPGENW("Do not disturb") },
{ PF2_FREECHAT, LPGENW("Free for chat") },
- { PF2_INVISIBLE, LPGENW("Invisible") }
+ { PF2_INVISIBLE, LPGENW("Invisible") },
+ { PF2_IDLE, LPGENW("Idle") }
};
/////////////////////////////////////////////////////////////////////////////////////////
@@ -85,16 +108,16 @@ public: chkEnableTrayBlink.OnChange = Callback(this, &ClistCommonOptsDlg::onChange_TrayBlink);
CreateLink(spinBlink, Clist::IconFlashTime);
- CreateLink(chkOneClick, Clist::Tray1Click);
- CreateLink(chkUseGroups, Clist::UseGroups);
- CreateLink(chkHideOffline, Clist::HideOffline);
- CreateLink(chkFilterSearch, Clist::FilterSearch);
- CreateLink(chkAlwaysStatus, Clist::TrayAlwaysStatus);
- CreateLink(chkConfirmDelete, Clist::ConfirmDelete);
- CreateLink(chkHideEmptyGroups, Clist::HideEmptyGroups);
- CreateLink(chkEnableIconBlink, Clist::EnableIconBlink);
- CreateLink(chkEnableTrayBlink, Clist::EnableTrayFlash);
- CreateLink(chkRemoveTempContacts, Clist::RemoveTempContacts);
+ CreateLink(chkOneClick, Clist::bTray1Click);
+ CreateLink(chkUseGroups, Clist::bUseGroups);
+ CreateLink(chkHideOffline, Clist::bHideOffline);
+ CreateLink(chkFilterSearch, Clist::bFilterSearch);
+ CreateLink(chkAlwaysStatus, Clist::bTrayAlwaysStatus);
+ CreateLink(chkConfirmDelete, Clist::bConfirmDelete);
+ CreateLink(chkHideEmptyGroups, Clist::bHideEmptyGroups);
+ CreateLink(chkEnableIconBlink, Clist::bEnableIconBlink);
+ CreateLink(chkEnableTrayBlink, Clist::bEnableTrayFlash);
+ CreateLink(chkRemoveTempContacts, Clist::bRemoveTempContacts);
}
bool OnInitDialog() override
diff --git a/src/mir_app/src/clistsettings.cpp b/src/mir_app/src/clistsettings.cpp index ce36b1786d..022f07d642 100644 --- a/src/mir_app/src/clistsettings.cpp +++ b/src/mir_app/src/clistsettings.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/clisttray.cpp b/src/mir_app/src/clisttray.cpp index 263cc05f02..60fe2bfae7 100644 --- a/src/mir_app/src/clisttray.cpp +++ b/src/mir_app/src/clisttray.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -88,7 +88,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c CMStringW tszTip;
if (szPrefix && szPrefix[0]) {
- if (!Clist::TrayAlwaysStatus) {
+ if (!Clist::bTrayAlwaysStatus) {
wcsncpy_s(g_clistApi.szTip, MAX_TIP_SIZE, szPrefix, _TRUNCATE);
return g_clistApi.szTip;
}
@@ -131,7 +131,7 @@ MIR_APP_DLL(wchar_t*) Clist_TrayIconMakeTooltip(const wchar_t *szPrefix, const c ptrW ProtoXStatus(sttGetXStatus(szProto));
wchar_t *szStatus = Clist_GetStatusModeDescription(pa->iRealStatus, 0);
if (szPrefix && szPrefix[0]) {
- if (Clist::TrayAlwaysStatus) {
+ if (Clist::bTrayAlwaysStatus) {
if (hasTips()) {
if (ProtoXStatus != nullptr)
mir_snwprintf(g_clistApi.szTip, MAX_TIP_SIZE, L"%s%s<b>%-12.12s</b>\t%s%s%-24.24s", szPrefix, szSeparator, pa->tszAccountName, szStatus, szSeparator, ProtoXStatus.get());
@@ -235,8 +235,7 @@ int fnTrayIconInit(HWND hwnd) if (netProtoCount) {
g_clistApi.trayIcon = (trayIconInfo_t*)mir_calloc(sizeof(trayIconInfo_t) * g_arAccounts.getCount());
- int trayIconSetting = db_get_b(0, MODULENAME, "TrayIcon", SETTING_TRAYICON_DEFAULT);
- if (trayIconSetting == SETTING_TRAYICON_SINGLE) {
+ if (Clist::iTrayIcon == SETTING_TRAYICON_SINGLE) {
DBVARIANT dbv = { DBVT_DELETED };
char *szProto;
if (!db_get_s(0, MODULENAME, "PrimaryStatus", &dbv) && (averageMode < 0 || db_get_b(0, MODULENAME, "AlwaysPrimary", 0)))
@@ -247,7 +246,7 @@ int fnTrayIconInit(HWND hwnd) Clist_TrayIconAdd(hwnd, nullptr, szProto, szProto ? Proto_GetStatus(szProto) : CallService(MS_CLIST_GETSTATUSMODE, 0, 0));
db_free(&dbv);
}
- else if (trayIconSetting == SETTING_TRAYICON_MULTI && (averageMode < 0 || db_get_b(0, MODULENAME, "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))) {
+ else if (Clist::iTrayIcon == SETTING_TRAYICON_MULTI && (averageMode < 0 || Clist::bAlwaysMulti)) {
g_clistApi.trayIconCount = netProtoCount;
for (int i = 0; i < g_arAccounts.getCount(); i++) {
int j = Clist_GetAccountIndex(i);
@@ -261,7 +260,7 @@ int fnTrayIconInit(HWND hwnd) else {
Clist_TrayIconAdd(hwnd, nullptr, nullptr, averageMode);
- if (trayIconSetting == SETTING_TRAYICON_CYCLE && averageMode < 0)
+ if (Clist::iTrayIcon == SETTING_TRAYICON_CYCLE && averageMode < 0)
Clist_TraySetTimer();
}
}
@@ -368,8 +367,8 @@ int TrayIconUpdate(HICON hNewIcon, const wchar_t *szNewTip, const char *szPrefer SetTaskBarIcon(nullptr, nullptr);
g_clistApi.trayIcon[i].isBase = isBase;
- if (db_get_b(0, MODULENAME, "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) {
- uint32_t time1 = db_get_w(0, MODULENAME, "CycleTime", SETTING_CYCLETIME_DEFAULT) * 200;
+ if (Clist::iTrayIcon == SETTING_TRAYICON_MULTI) {
+ uint32_t time1 = Clist::iCycleTime * 200;
uint32_t time2 = Clist::IconFlashTime + 1000;
uint32_t time = max(max(uint32_t(2000), time1), time2);
if (RefreshTimerId)
@@ -408,8 +407,7 @@ MIR_APP_DLL(int) Clist_TrayIconSetBaseInfo(HICON hIcon, const char *szPreferredP }
if ((Clist_GetProtocolVisibility(szPreferredProto)) &&
(Proto_GetAverageStatus(nullptr) == -1) &&
- (db_get_b(0, MODULENAME, "TrayIcon", SETTING_TRAYICON_DEFAULT) == SETTING_TRAYICON_MULTI) &&
- !(db_get_b(0, MODULENAME, "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT)))
+ (Clist::iTrayIcon == SETTING_TRAYICON_MULTI) && !Clist::bAlwaysMulti)
goto LBL_Error;
}
@@ -457,7 +455,7 @@ static VOID CALLBACK TrayCycleTimerProc(HWND, UINT, UINT_PTR, DWORD) MIR_APP_DLL(void) Clist_TraySetTimer()
{
- CycleTimerId = SetTimer(nullptr, CycleTimerId, db_get_w(0, MODULENAME, "CycleTime", SETTING_CYCLETIME_DEFAULT) * 1000, TrayCycleTimerProc);
+ CycleTimerId = SetTimer(nullptr, CycleTimerId, Clist::iCycleTime * 1000, TrayCycleTimerProc);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -491,13 +489,11 @@ int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoC if (netProtoCount == 0)
return Clist_TrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, g_clistApi.pfnIconFromStatusMode(nullptr, averageMode, 0), ILD_NORMAL), nullptr);
- int trayIconSetting = db_get_b(0, MODULENAME, "TrayIcon", SETTING_TRAYICON_DEFAULT);
-
if (averageMode > 0) {
- if (trayIconSetting != SETTING_TRAYICON_MULTI)
+ if (Clist::iTrayIcon != SETTING_TRAYICON_MULTI)
return Clist_TrayIconSetBaseInfo(g_clistApi.pfnGetIconFromStatusMode(0, nullptr, averageMode), nullptr);
- if (db_get_b(0, MODULENAME, "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
+ if (Clist::bAlwaysMulti)
return Clist_TrayIconSetBaseInfo(g_clistApi.pfnGetIconFromStatusMode(0, szChangedProto, Proto_GetStatus(szChangedProto)), (char*)szChangedProto);
if (g_clistApi.trayIcon == nullptr || g_clistApi.trayIcon[0].szProto == nullptr)
@@ -507,7 +503,7 @@ int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoC g_clistApi.pfnTrayIconInit(g_clistApi.hwndContactList);
}
else {
- switch (trayIconSetting) {
+ switch (Clist::iTrayIcon) {
case SETTING_TRAYICON_CYCLE:
Clist_TraySetTimer();
return Clist_TrayIconSetBaseInfo(ImageList_GetIcon(hCListImages, g_clistApi.pfnIconFromStatusMode(szChangedProto, Proto_GetStatus(szChangedProto), 0), ILD_NORMAL), nullptr);
@@ -515,7 +511,7 @@ int fnTrayCalcChanged(const char *szChangedProto, int averageMode, int netProtoC case SETTING_TRAYICON_MULTI:
if (!g_clistApi.trayIcon)
Clist_TrayIconRemove(nullptr, nullptr);
- else if ((g_clistApi.trayIconCount > 1 || netProtoCount == 1) || db_get_b(0, MODULENAME, "AlwaysMulti", SETTING_ALWAYSMULTI_DEFAULT))
+ else if ((g_clistApi.trayIconCount > 1 || netProtoCount == 1) || Clist::bAlwaysMulti)
return Clist_TrayIconSetBaseInfo(g_clistApi.pfnGetIconFromStatusMode(0, szChangedProto, Proto_GetStatus(szChangedProto)), (char*)szChangedProto);
else {
Clist_TrayIconDestroy(g_clistApi.hwndContactList);
@@ -585,10 +581,10 @@ int fnTrayIconPauseAutoHide(WPARAM, LPARAM) initcheck 0;
mir_cslock lck(trayLockCS);
- if (db_get_b(0, MODULENAME, "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
+ if (Clist::bAutoHide) {
if (GetActiveWindow() != g_clistApi.hwndContactList) {
KillTimer(nullptr, autoHideTimerId);
- autoHideTimerId = SetTimer(nullptr, 0, 1000 * db_get_w(0, MODULENAME, "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
+ autoHideTimerId = SetTimer(nullptr, 0, 1000 * Clist::iHideTime, TrayIconAutoHideTimer);
}
}
return 0;
@@ -659,9 +655,9 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) break;
case WM_ACTIVATE:
- if (db_get_b(0, MODULENAME, "AutoHide", SETTING_AUTOHIDE_DEFAULT)) {
+ if (Clist::bAutoHide) {
if (LOWORD(msg->wParam) == WA_INACTIVE)
- autoHideTimerId = SetTimer(nullptr, 0, 1000 * db_get_w(0, MODULENAME, "HideTime", SETTING_HIDETIME_DEFAULT), TrayIconAutoHideTimer);
+ autoHideTimerId = SetTimer(nullptr, 0, 1000 * Clist::iHideTime, TrayIconAutoHideTimer);
else
KillTimer(nullptr, autoHideTimerId);
}
@@ -683,7 +679,7 @@ INT_PTR fnTrayIconProcessMessage(WPARAM wParam, LPARAM lParam) if (msg->lParam == WM_MBUTTONUP)
g_clistApi.pfnShowHide();
- else if (msg->lParam == (Clist::Tray1Click ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
+ else if (msg->lParam == (Clist::bTray1Click ? WM_LBUTTONUP : WM_LBUTTONDBLCLK)) {
if ((GetAsyncKeyState(VK_CONTROL) & 0x8000)) {
POINT pt;
HMENU hMenu = Menu_GetStatusMenu();
diff --git a/src/mir_app/src/clui.cpp b/src/mir_app/src/clui.cpp index c0bd2bc1d2..707b8800cf 100644 --- a/src/mir_app/src/clui.cpp +++ b/src/mir_app/src/clui.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -32,7 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. extern HANDLE hEventExtraClick;
-static HMODULE hUserDll;
static HANDLE hContactDraggingEvent, hContactDroppedEvent, hContactDragStopEvent;
static int transparentFocus = 1;
UINT uMsgProcessProfile;
@@ -54,8 +53,8 @@ void fnLoadCluiGlobalOpts() {
cluiopt.showsbar = db_get_b(0, "CLUI", "ShowSBar", 1);
cluiopt.showgrip = db_get_b(0, "CLUI", "ShowGrip", 1);
- cluiopt.transparent = db_get_b(0, "CList", "Transparent", SETTING_TRANSPARENT_DEFAULT);
- cluiopt.alpha = db_get_b(0, "CList", "Alpha", SETTING_ALPHA_DEFAULT);
+ cluiopt.transparent = Clist::bTransparent;
+ cluiopt.alpha = Clist::iAlpha;
}
// Disconnect all protocols.
@@ -206,7 +205,7 @@ static INT_PTR MenuItem_DeleteContact(WPARAM hContact, LPARAM lParam) return 0;
int action;
- if (Clist::ConfirmDelete && !(GetKeyState(VK_SHIFT) & 0x8000)) {
+ if (Clist::bConfirmDelete && !(GetKeyState(VK_SHIFT) & 0x8000)) {
// Ask user for confirmation, and if the contact should be archived (hidden, not deleted)
dlg.SetParent((HWND)lParam);
action = dlg.DoModal();
@@ -265,8 +264,6 @@ LRESULT CALLBACK ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM l m.message = msg;
m.wParam = wParam;
m.lParam = lParam;
- if (g_clistApi.pfnDocking_ProcessWindowMessage((WPARAM)&m, (LPARAM)&result))
- return result;
if (g_clistApi.pfnTrayIconProcessMessage((WPARAM)&m, (LPARAM)&result))
return result;
@@ -325,21 +322,14 @@ int LoadCLUIModule(void) Utils_AssertInsideScreen(&pos);
g_clistApi.hwndContactList = CreateWindowEx(
- (db_get_b(0, "CList", "ToolWindow", SETTING_TOOLWINDOW_DEFAULT) ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW),
+ (Clist::bToolWindow ? WS_EX_TOOLWINDOW : WS_EX_APPWINDOW),
_A2W(MIRANDACLASS),
titleText,
WS_POPUPWINDOW | WS_THICKFRAME | WS_CLIPCHILDREN |
- (db_get_b(0, "CLUI", "ShowCaption", SETTING_SHOWCAPTION_DEFAULT) ? WS_CAPTION | WS_SYSMENU |
- (db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT) ? 0 : WS_MINIMIZEBOX) : 0),
+ (Clist::bShowCaption ? WS_CAPTION | WS_SYSMENU | (Clist::bMinimizeToTray ? 0 : WS_MINIMIZEBOX) : 0),
pos.left, pos.top, pos.right - pos.left, pos.bottom - pos.top,
nullptr, nullptr, g_clistApi.hInst, nullptr);
- if (db_get_b(0, "CList", "OnDesktop", 0)) {
- HWND hProgMan = FindWindow(L"Progman", nullptr);
- if (IsWindow(hProgMan))
- SetParent(g_clistApi.hwndContactList, hProgMan);
- }
-
HookEvent(ME_LANGPACK_CHANGED, CluiLangpackChanged);
CluiLangpackChanged(0, 0);
@@ -351,7 +341,7 @@ int LoadCLUIModule(void) int state = db_get_b(0, "CList", "State", SETTING_STATE_NORMAL);
- if (!db_get_b(0, "CLUI", "ShowMainMenu", SETTING_SHOWMAINMENU_DEFAULT))
+ if (!Clist::bShowMainMenu)
SetMenu(g_clistApi.hwndContactList, nullptr);
if (state == SETTING_STATE_NORMAL)
@@ -359,9 +349,7 @@ int LoadCLUIModule(void) else if (state == SETTING_STATE_MINIMIZED)
ShowWindow(g_clistApi.hwndContactList, SW_SHOWMINIMIZED);
- SetWindowPos(g_clistApi.hwndContactList,
- db_get_b(0, "CList", "OnTop", SETTING_ONTOP_DEFAULT) ? HWND_TOPMOST : HWND_NOTOPMOST,
- 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
+ SetWindowPos(g_clistApi.hwndContactList, Clist::bOnTop ? HWND_TOPMOST : HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE);
CMenuItem mi(&g_plugin);
@@ -488,7 +476,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case M_CREATECLC:
g_clistApi.hwndContactTree = CreateWindow(CLISTCONTROL_CLASSW, L"",
- WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | CLS_CONTACTLIST | (Clist::UseGroups ? CLS_USEGROUPS : 0) | (Clist::HideOffline ? CLS_HIDEOFFLINE : 0) | (Clist::HideEmptyGroups ? CLS_HIDEEMPTYGROUPS : 0),
+ WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | CLS_CONTACTLIST | (Clist::bUseGroups ? CLS_USEGROUPS : 0) | (Clist::bHideOffline ? CLS_HIDEOFFLINE : 0) | (Clist::bHideEmptyGroups ? CLS_HIDEEMPTYGROUPS : 0),
0, 0, 0, 0, hwnd, nullptr, g_clistApi.hInst, nullptr);
SendMessage(hwnd, WM_SIZE, 0, 0);
break;
@@ -542,7 +530,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM SetWindowPos(g_clistApi.hwndContactTree, nullptr, 0, 0, rect.right, rect.bottom - (rcStatus.bottom - rcStatus.top), SWP_NOZORDER);
}
if (wParam == SIZE_MINIMIZED) {
- if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) || db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
+ if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) || Clist::bMinimizeToTray) {
ShowWindow(hwnd, SW_HIDE);
db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
}
@@ -551,18 +539,15 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (db_get_b(0, "CList", "DisableWorkingSet", 1))
SetProcessWorkingSetSize(GetCurrentProcess(), -1, -1);
}
- // drop thru
+ __fallthrough;
+
case WM_MOVE:
if (!IsIconic(hwnd)) {
RECT rc;
GetWindowRect(hwnd, &rc);
-
- //if docked, dont remember pos (except for width)
- if (!Clist_IsDocked()) {
- db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top));
- db_set_dw(0, "CList", "x", (uint32_t)rc.left);
- db_set_dw(0, "CList", "y", (uint32_t)rc.top);
- }
+ db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top));
+ db_set_dw(0, "CList", "x", (uint32_t)rc.left);
+ db_set_dw(0, "CList", "y", (uint32_t)rc.top);
db_set_dw(0, "CList", "Width", (uint32_t)(rc.right - rc.left));
}
return FALSE;
@@ -629,7 +614,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (transparentFocus)
SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (uint8_t)cluiopt.alpha, LWA_ALPHA);
else
- SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), (uint8_t)db_get_b(0, "CList", "AutoAlpha", SETTING_AUTOALPHA_DEFAULT), LWA_ALPHA);
+ SetLayeredWindowAttributes(hwnd, RGB(0, 0, 0), Clist::iAutoAlpha, LWA_ALPHA);
}
if (!transparentFocus)
KillTimer(hwnd, TM_AUTOALPHA);
@@ -692,8 +677,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM case SC_MINIMIZE:
case SC_CLOSE:
- if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) ||
- db_get_b(0, "CList", "Min2Tray", SETTING_MIN2TRAY_DEFAULT)) {
+ if ((GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) || Clist::bMinimizeToTray) {
ShowWindow(hwnd, SW_HIDE);
db_set_b(0, "CList", "State", SETTING_STATE_HIDDEN);
@@ -730,7 +714,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return 0;
case WM_SETTINGCHANGE:
- if (wParam == SPI_SETWORKAREA && (GetWindowLongPtr(hwnd, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE && !Clist_IsDocked()) {
+ if (wParam == SPI_SETWORKAREA && (GetWindowLongPtr(hwnd, GWL_STYLE) & (WS_VISIBLE | WS_MINIMIZE)) == WS_VISIBLE) {
RECT rc;
GetWindowRect(hwnd, &rc);
if (Utils_AssertInsideScreen(&rc) == 1)
@@ -788,15 +772,10 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM return Clist_MenuProcessHotkey(((NMKEY*)lParam)->nVKey);
case CLN_LISTSIZECHANGE:
- {
- RECT rcWindow, rcTree, rcWorkArea;
- int maxHeight, newHeight;
+ if (db_get_b(0, "CLUI", "AutoSize", 0)) {
+ int maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", 75);
- if (!db_get_b(0, "CLUI", "AutoSize", 0))
- break;
- if (Clist_IsDocked())
- break;
- maxHeight = db_get_b(0, "CLUI", "MaxSizeHeight", 75);
+ RECT rcWindow, rcTree, rcWorkArea;
GetWindowRect(hwnd, &rcWindow);
GetWindowRect(g_clistApi.hwndContactTree, &rcTree);
@@ -807,7 +786,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (GetMonitorInfo(hMon, &mi))
rcWorkArea = mi.rcWork;
- newHeight = max(nmc->pt.y, LONG(9)) + 1 + (rcWindow.bottom - rcWindow.top) - (rcTree.bottom - rcTree.top);
+ int newHeight = max(nmc->pt.y, LONG(9)) + 1 + (rcWindow.bottom - rcWindow.top) - (rcTree.bottom - rcTree.top);
if (newHeight > (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100)
newHeight = (rcWorkArea.bottom - rcWorkArea.top) * maxHeight / 100;
if (db_get_b(0, "CLUI", "AutoSizeUpward", 0)) {
@@ -841,7 +820,7 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if ((hitFlags & (CLCHT_NOWHERE | CLCHT_INLEFTMARGIN | CLCHT_BELOWITEMS)) == 0)
break;
- if (db_get_b(0, "CLUI", "ClientAreaDrag", SETTING_CLIENTDRAG_DEFAULT)) {
+ if (Clist::bClientAreaDrag) {
POINT pt = nmc->pt;
ClientToScreen(g_clistApi.hwndContactTree, &pt);
return SendMessage(hwnd, WM_SYSCOMMAND, SC_MOVE | HTCAPTION, MAKELPARAM(pt.x, pt.y));
@@ -1017,13 +996,9 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM if (!IsIconic(hwnd)) {
RECT rc;
GetWindowRect(hwnd, &rc);
-
- //if docked, dont remember pos (except for width)
- if (!Clist_IsDocked()) {
- db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top));
- db_set_dw(0, "CList", "x", (uint32_t)rc.left);
- db_set_dw(0, "CList", "y", (uint32_t)rc.top);
- }
+ db_set_dw(0, "CList", "Height", (uint32_t)(rc.bottom - rc.top));
+ db_set_dw(0, "CList", "x", (uint32_t)rc.left);
+ db_set_dw(0, "CList", "y", (uint32_t)rc.top);
db_set_dw(0, "CList", "Width", (uint32_t)(rc.right - rc.left));
}
@@ -1042,7 +1017,6 @@ LRESULT CALLBACK fnContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ShowWindow(hwnd, SW_HIDE);
DestroyWindow(g_clistApi.hwndContactTree);
- FreeLibrary(hUserDll);
PostQuitMessage(0);
default:
diff --git a/src/mir_app/src/cluiservices.cpp b/src/mir_app/src/cluiservices.cpp index 2e8ec6f640..8fc47b516e 100644 --- a/src/mir_app/src/cluiservices.cpp +++ b/src/mir_app/src/cluiservices.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -25,20 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "clc.h"
-EXTERN_C MIR_APP_DLL(void) Clist_GroupAdded(MGROUP hGroup)
-{
- // CLC does this automatically unless it's a new group
- HWND hwndFocus = GetFocus();
-
- wchar_t szFocusClass[64];
- GetClassName(hwndFocus, szFocusClass, _countof(szFocusClass));
- if (!mir_wstrcmp(szFocusClass, CLISTCONTROL_CLASSW)) {
- HANDLE hItem = (HANDLE)SendMessage(hwndFocus, CLM_FINDGROUP, hGroup, 0);
- if (hItem)
- SendMessage(hwndFocus, CLM_EDITLABEL, (WPARAM)hItem, 0);
- }
-}
-
EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void)
{
if (g_clistApi.hwndContactTree == nullptr)
@@ -48,24 +34,24 @@ EXTERN_C MIR_APP_DLL(void) Clist_EndRebuild(void) LONG_PTR dwStyle = GetWindowLongPtr(g_clistApi.hwndContactTree, GWL_STYLE);
// CLC does this automatically, but we need to force it if hideoffline or hideempty has changed
- if ((Clist::HideOffline == 0) != ((dwStyle & CLS_HIDEOFFLINE) == 0)) {
- if (Clist::HideOffline)
+ if ((Clist::bHideOffline == 0) != ((dwStyle & CLS_HIDEOFFLINE) == 0)) {
+ if (Clist::bHideOffline)
dwStyle |= CLS_HIDEOFFLINE;
else
dwStyle &= ~CLS_HIDEOFFLINE;
bRebuild = true;
}
- if ((Clist::HideEmptyGroups == 0) != ((dwStyle & CLS_HIDEEMPTYGROUPS) == 0)) {
- if (Clist::HideEmptyGroups)
+ if ((Clist::bHideEmptyGroups == 0) != ((dwStyle & CLS_HIDEEMPTYGROUPS) == 0)) {
+ if (Clist::bHideEmptyGroups)
dwStyle |= CLS_HIDEEMPTYGROUPS;
else
dwStyle &= ~CLS_HIDEEMPTYGROUPS;
bRebuild = true;
}
- if ((Clist::UseGroups == 0) != ((dwStyle & CLS_USEGROUPS) == 0)) {
- if (Clist::UseGroups)
+ if ((Clist::bUseGroups == 0) != ((dwStyle & CLS_USEGROUPS) == 0)) {
+ if (Clist::bUseGroups)
dwStyle |= CLS_USEGROUPS;
else
dwStyle &= ~CLS_USEGROUPS;
diff --git a/src/mir_app/src/colorchooser.cpp b/src/mir_app/src/colorchooser.cpp index aaddcac6d0..f55db920ca 100644 --- a/src/mir_app/src/colorchooser.cpp +++ b/src/mir_app/src/colorchooser.cpp @@ -1,7 +1,7 @@ /*
Chat module plugin for Miranda IM
-Copyright 2000-12 Miranda IM, 2012-24 Miranda NG team,
+Copyright 2000-12 Miranda IM, 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/copyright.h b/src/mir_app/src/copyright.h index eec69ed9b4..fd5036aa51 100644 --- a/src/mir_app/src/copyright.h +++ b/src/mir_app/src/copyright.h @@ -1,2 +1,2 @@ -#define LEGAL_COPYRIGHT "Copyright © 2000-11 Miranda IM, 2012-24 Miranda NG team. This software is released under the terms of the GNU General Public License.\0"
+#define LEGAL_COPYRIGHT "Copyright © 2000-11 Miranda IM, 2012-25 Miranda NG team. This software is released under the terms of the GNU General Public License.\0"
diff --git a/src/mir_app/src/database.cpp b/src/mir_app/src/database.cpp index 8d42892e3e..40bc14ccb9 100644 --- a/src/mir_app/src/database.cpp +++ b/src/mir_app/src/database.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -527,39 +527,47 @@ int LoadDatabaseModule(void) }
// find a driver to support the given profile
- bool retry;
+LBL_Restart:
int rc;
- do {
- retry = false;
+ try {
if (!szProfile.isExist() && shouldAutoCreate(szProfile))
rc = tryCreateDatabase(szProfile);
else
rc = tryOpenDatabase(szProfile);
+ }
+ catch (int errorCode) {
+ rc = errorCode;
+ }
+
+ switch (rc) {
+ case 0:
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ g_plugin.registerIcon(LPGEN("Database"), iconList, "database");
+ break;
+
+ // there were no suitable driver installed
+ case -1:
+ MessageBoxW(nullptr,
+ CMStringW(FORMAT, TranslateW(tszNoSuitableDriver), ptszFileName),
+ TranslateT("Miranda can't open that profile"), MB_OK | MB_ICONERROR);
+ break;
- // there were no suitable driver installed
- if (rc == -1) {
+ default:
+ if (rc < 0) // smth strange happened, exit silently
+ break;
+
+ if (fileExist(szProfile)) {
+ // file isn't locked, just no driver could open it.
MessageBoxW(nullptr,
- CMStringW(FORMAT, TranslateW(tszNoSuitableDriver), ptszFileName),
- TranslateT("Miranda can't open that profile"), MB_OK | MB_ICONERROR);
+ CMStringW(FORMAT, TranslateW(tszUnknownFormat), ptszFileName),
+ TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR);
}
- else if (rc > 0) {
- if (fileExist(szProfile)) {
- // file isn't locked, just no driver could open it.
- MessageBoxW(nullptr,
- CMStringW(FORMAT, TranslateW(tszUnknownFormat), ptszFileName),
- TranslateT("Miranda can't understand that profile"), MB_OK | MB_ICONERROR);
- }
- else
- retry = IDRETRY == MessageBoxW(nullptr,
- CMStringW(FORMAT, TranslateW(tszProfileLocked), ptszFileName),
- TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR);
+ else {
+ CMStringW wszTitle(FORMAT, TranslateW(tszProfileLocked), ptszFileName);
+ if (IDRETRY == MessageBoxW(nullptr, wszTitle, TranslateT("Miranda can't open that profile"), MB_RETRYCANCEL | MB_ICONERROR))
+ goto LBL_Restart;
}
}
- while (retry);
-
- if (rc == 0)
- HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
- g_plugin.registerIcon(LPGEN("Database"), iconList, "database");
return rc;
}
diff --git a/src/mir_app/src/database.h b/src/mir_app/src/database.h index 6815b17c8d..7c3b9e68f5 100644 --- a/src/mir_app/src/database.h +++ b/src/mir_app/src/database.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright 2012-24 Miranda NG team,
+Copyright 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -52,3 +52,5 @@ protected: STDMETHODIMP_(void) SetCachedVariant(DBVARIANT *s, DBVARIANT *d);
STDMETHODIMP_(DBVARIANT*) GetCachedValuePtr(MCONTACT contactID, char *szSetting, int bAllocate);
};
+
+extern HANDLE g_hevEventReaction;
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index cadc794090..facd663864 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "stdafx.h"
+
+#include "database.h"
#include "profilemanager.h"
static int CompareEventTypes(const DBEVENTTYPEDESCR *p1, const DBEVENTTYPEDESCR *p2)
@@ -194,7 +196,7 @@ void DB::EventInfo::wipeNotify() if (!m_bValid)
return;
- if (!markedRead())
+ if (!bRead)
db_event_markRead(hContact, m_hEvent);
Clist_RemoveEvent(-1, m_hEvent);
}
@@ -386,6 +388,10 @@ void DB::EventInfo::addReaction(const char *emoji) (*it) = JSONNode(emoji, (*it).as_int() + 1);
flushJson();
+ db_event_setJson(getEvent(), pBlob);
+
+ DBEventReaction ev = { hContact, TRUE, emoji };
+ NotifyEventHooks(g_hevEventReaction, WPARAM(this), LPARAM(&ev));
}
void DB::EventInfo::delReaction(const char *emoji)
@@ -404,9 +410,35 @@ void DB::EventInfo::delReaction(const char *emoji) reactions.erase(it);
flushJson();
+ db_event_setJson(getEvent(), pBlob);
+
+ DBEventReaction ev = { hContact, FALSE, emoji };
+ NotifyEventHooks(g_hevEventReaction, WPARAM(this), LPARAM(&ev));
}
}
+void DB::EventInfo::setReactions(class JSONNode &pNode)
+{
+ CMStringA szReactions;
+ for (auto &it : pNode)
+ szReactions.AppendFormat("%s ", it.name());
+ szReactions.Trim();
+
+ auto &json = setJson();
+ auto it = json.find("r");
+ if (it != json.end())
+ json.erase(it);
+
+ pNode.set_name("r");
+ json << pNode;
+ flushJson();
+
+ db_event_setJson(getEvent(), pBlob);
+
+ DBEventReaction ev = { hContact, TRUE, szReactions };
+ NotifyEventHooks(g_hevEventReaction, WPARAM(this), LPARAM(&ev));
+}
+
/////////////////////////////////////////////////////////////////////////////////////////
// File blob helper
@@ -537,10 +569,10 @@ MIR_APP_DLL(bool) DB::IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO &dbei) DBEVENTINFO dbeiExisting = {};
db_event_get(hExistingDbEvent, &dbeiExisting);
- uint32_t dwEventTimeStamp = dbeiExisting.timestamp;
+ uint32_t dwEventTimeStamp = dbeiExisting.getUnixtime();
// compare with last timestamp
- if (dbei.timestamp > dwEventTimeStamp) {
+ if (dbei.getUnixtime() > dwEventTimeStamp) {
// remember event
hPreviousDbEvent = hExistingDbEvent;
dwPreviousTimeStamp = dwEventTimeStamp;
@@ -559,21 +591,21 @@ MIR_APP_DLL(bool) DB::IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO &dbei) memset(&dbeiExisting, 0, sizeof(dbeiExisting));
db_event_get(hExistingDbEvent, &dbeiExisting);
- dwEventTimeStamp = dbeiExisting.timestamp;
+ dwEventTimeStamp = dbeiExisting.getUnixtime();
// compare with first timestamp
- if (dbei.timestamp <= dwEventTimeStamp) {
+ if (dbei.getUnixtime() <= dwEventTimeStamp) {
// remember event
dwPreviousTimeStamp = dwEventTimeStamp;
hPreviousDbEvent = hExistingDbEvent;
- if (dbei.timestamp != dwEventTimeStamp)
+ if (dbei.getUnixtime() != dwEventTimeStamp)
return false;
}
}
// check for equal timestamps
- if (dbei.timestamp == dwPreviousTimeStamp) {
+ if (dbei.iTimestamp == dwPreviousTimeStamp) {
memset(&dbeiExisting, 0, sizeof(dbeiExisting));
db_event_get(hPreviousDbEvent, &dbeiExisting);
@@ -586,10 +618,10 @@ MIR_APP_DLL(bool) DB::IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO &dbei) memset(&dbeiExisting, 0, sizeof(dbeiExisting));
db_event_get(hExistingDbEvent, &dbeiExisting);
- if (dbeiExisting.timestamp != dwPreviousTimeStamp) {
+ if (dbeiExisting.getUnixtime() != dwPreviousTimeStamp) {
// use found event
hPreviousDbEvent = hExistingDbEvent;
- dwPreviousTimeStamp = dbeiExisting.timestamp;
+ dwPreviousTimeStamp = dbeiExisting.getUnixtime();
break;
}
@@ -600,16 +632,16 @@ MIR_APP_DLL(bool) DB::IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO &dbei) hExistingDbEvent = hPreviousDbEvent;
- if (dbei.timestamp <= dwPreviousTimeStamp) {
+ if (dbei.getUnixtime() <= dwPreviousTimeStamp) {
// look back
while (hExistingDbEvent != 0) {
memset(&dbeiExisting, 0, sizeof(dbeiExisting));
db_event_get(hExistingDbEvent, &dbeiExisting);
- if (dbei.timestamp > dbeiExisting.timestamp) {
+ if (dbei.getUnixtime() > dbeiExisting.getUnixtime()) {
// remember event
hPreviousDbEvent = hExistingDbEvent;
- dwPreviousTimeStamp = dbeiExisting.timestamp;
+ dwPreviousTimeStamp = dbeiExisting.getUnixtime();
return false;
}
@@ -617,7 +649,7 @@ MIR_APP_DLL(bool) DB::IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO &dbei) if (dbei == dbeiExisting) {
// remember event
hPreviousDbEvent = hExistingDbEvent;
- dwPreviousTimeStamp = dbeiExisting.timestamp;
+ dwPreviousTimeStamp = dbeiExisting.getUnixtime();
return true;
}
@@ -631,10 +663,10 @@ MIR_APP_DLL(bool) DB::IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO &dbei) memset(&dbeiExisting, 0, sizeof(dbeiExisting));
db_event_get(hExistingDbEvent, &dbeiExisting);
- if (dbei.timestamp < dbeiExisting.timestamp) {
+ if (dbei.getUnixtime() < dbeiExisting.getUnixtime()) {
// remember event
hPreviousDbEvent = hExistingDbEvent;
- dwPreviousTimeStamp = dbeiExisting.timestamp;
+ dwPreviousTimeStamp = dbeiExisting.getUnixtime();
return false;
}
@@ -642,7 +674,7 @@ MIR_APP_DLL(bool) DB::IsDuplicateEvent(MCONTACT hContact, DBEVENTINFO &dbei) if (dbei == dbeiExisting) {
// remember event
hPreviousDbEvent = hExistingDbEvent;
- dwPreviousTimeStamp = dbeiExisting.timestamp;
+ dwPreviousTimeStamp = dbeiExisting.getUnixtime();
return true;
}
diff --git a/src/mir_app/src/db_ini.cpp b/src/mir_app/src/db_ini.cpp index a0db59f362..5b624fd237 100644 --- a/src/mir_app/src/db_ini.cpp +++ b/src/mir_app/src/db_ini.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -515,7 +515,7 @@ static void DoAutoExec(void) Profile_GetSetting(L"AutoExec/Safe", buf, L"CLC Icons CLUI CList SkinSounds");
ptrA szSafeSections(mir_u2a(buf));
- Profile_GetSetting(L"AutoExec/Unsafe", buf, L"Facebook GG IRC JABBER SKYPE TWITTER VKontakte");
+ Profile_GetSetting(L"AutoExec/Unsafe", buf, L"Facebook GG IRC JABBER TWITTER VKontakte");
ptrA szUnsafeSections(mir_u2a(buf));
Profile_GetSetting(L"AutoExec/Warn", szSecurity, L"notsafe");
diff --git a/src/mir_app/src/db_intf.cpp b/src/mir_app/src/db_intf.cpp index 082eea3fe6..8dd71bc23f 100644 --- a/src/mir_app/src/db_intf.cpp +++ b/src/mir_app/src/db_intf.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -76,6 +76,8 @@ MIR_APP_EXPORT HANDLE g_hevEventDelivered, // ME_DB_EVENT_DELIVERED
g_hevEventFiltered;
+HANDLE g_hevEventReaction; // ME_DB_EVENT_REACTION
+
int LoadDbintfModule()
{
// create events once, they will be inherited by all database plugins
@@ -89,6 +91,7 @@ int LoadDbintfModule() g_hevEventDeleted = CreateHookableEvent(ME_DB_EVENT_DELETED);
g_hevEventSetJson = CreateHookableEvent(ME_DB_EVENT_SETJSON);
g_hevEventDelivered = CreateHookableEvent(ME_DB_EVENT_DELIVERED);
+ g_hevEventReaction = CreateHookableEvent(ME_DB_EVENT_REACTION);
g_hevEventFiltered = CreateHookableEvent(ME_DB_EVENT_FILTER_ADD);
while (!_waccess(L"libmdbx.mir", 0)) {
diff --git a/src/mir_app/src/db_upgrade.cpp b/src/mir_app/src/db_upgrade.cpp index 35c221a932..d36ad8b1b7 100644 --- a/src/mir_app/src/db_upgrade.cpp +++ b/src/mir_app/src/db_upgrade.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/db_util.cpp b/src/mir_app/src/db_util.cpp index 81992bb75b..ca8271bbb6 100644 --- a/src/mir_app/src/db_util.cpp +++ b/src/mir_app/src/db_util.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/descbutton.cpp b/src/mir_app/src/descbutton.cpp index 352bb89b75..54538bfa82 100644 --- a/src/mir_app/src/descbutton.cpp +++ b/src/mir_app/src/descbutton.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
Copyright (c) 2007 Artem Shpynov
all portions of this codebase are copyrighted to the people
diff --git a/src/mir_app/src/dll_sniffer.cpp b/src/mir_app/src/dll_sniffer.cpp index 80ad66a598..22974d57df 100644 --- a/src/mir_app/src/dll_sniffer.cpp +++ b/src/mir_app/src/dll_sniffer.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/ei_baseIcon.cpp b/src/mir_app/src/ei_baseIcon.cpp index 4cd49d7876..5ffded25f6 100644 --- a/src/mir_app/src/ei_baseIcon.cpp +++ b/src/mir_app/src/ei_baseIcon.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/ei_callbackIcon.cpp b/src/mir_app/src/ei_callbackIcon.cpp index c8326bb453..bc0ed3a81d 100644 --- a/src/mir_app/src/ei_callbackIcon.cpp +++ b/src/mir_app/src/ei_callbackIcon.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/ei_defaulticons.cpp b/src/mir_app/src/ei_defaulticons.cpp index 6f503644f5..ecd422a8bf 100644 --- a/src/mir_app/src/ei_defaulticons.cpp +++ b/src/mir_app/src/ei_defaulticons.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/ei_extraIcon.cpp b/src/mir_app/src/ei_extraIcon.cpp index 2e087d7fec..33d685eb09 100644 --- a/src/mir_app/src/ei_extraIcon.cpp +++ b/src/mir_app/src/ei_extraIcon.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/ei_groupIcon.cpp b/src/mir_app/src/ei_groupIcon.cpp index c83dc90b71..c4028a75d2 100644 --- a/src/mir_app/src/ei_groupIcon.cpp +++ b/src/mir_app/src/ei_groupIcon.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/ei_icolibIcon.cpp b/src/mir_app/src/ei_icolibIcon.cpp index bef8fcdaf0..dfcaaa9633 100644 --- a/src/mir_app/src/ei_icolibIcon.cpp +++ b/src/mir_app/src/ei_icolibIcon.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/ei_options.cpp b/src/mir_app/src/ei_options.cpp index 065a1d70cf..1b6ea51e06 100644 --- a/src/mir_app/src/ei_options.cpp +++ b/src/mir_app/src/ei_options.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/ei_services.cpp b/src/mir_app/src/ei_services.cpp index e13cd514e1..f53c659e82 100644 --- a/src/mir_app/src/ei_services.cpp +++ b/src/mir_app/src/ei_services.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
@@ -468,6 +468,7 @@ static IconItem iconList[] = { LPGEN("Database"), "database", IDI_DATABASE },
{ LPGEN("Attach"), "attach", IDI_ATTACH },
{ LPGEN("Code"), "code", IDI_CODE },
+ { LPGEN("Cloud file"), "cloud", IDI_CLOUD },
};
void LoadExtraIconsModule()
diff --git a/src/mir_app/src/encrypt.cpp b/src/mir_app/src/encrypt.cpp index 1b741f9cff..113697f6ff 100644 --- a/src/mir_app/src/encrypt.cpp +++ b/src/mir_app/src/encrypt.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/encrypt.h b/src/mir_app/src/encrypt.h index b38330250a..faddd79740 100644 --- a/src/mir_app/src/encrypt.h +++ b/src/mir_app/src/encrypt.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright 2012-24 Miranda NG team,
+Copyright 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/enterstring.cpp b/src/mir_app/src/enterstring.cpp index ad39b75350..968faa0186 100644 --- a/src/mir_app/src/enterstring.cpp +++ b/src/mir_app/src/enterstring.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/extracticon.cpp b/src/mir_app/src/extracticon.cpp index 0650fe098e..fe84aa2dfd 100644 --- a/src/mir_app/src/extracticon.cpp +++ b/src/mir_app/src/extracticon.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/extraicons.h b/src/mir_app/src/extraicons.h index b28c065447..9ce38c6cdc 100644 --- a/src/mir_app/src/extraicons.h +++ b/src/mir_app/src/extraicons.h @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/file.cpp b/src/mir_app/src/file.cpp index 8d8fa81cbd..f56021d109 100644 --- a/src/mir_app/src/file.cpp +++ b/src/mir_app/src/file.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. @@ -173,8 +173,8 @@ static int SRFileEventDeleted(WPARAM hContact, LPARAM hDbEvent) wchar_t wszReceiveFolder[MAX_PATH]; GetContactSentFilesDir(hContact, wszReceiveFolder, _countof(wszReceiveFolder)); - // we don't remove sent files, located outside Miranda's folder for sent offline files - if ((dbei.flags & DBEF_SENT) == 0 || !wcsnicmp(pwszName, wszReceiveFolder, wcslen(wszReceiveFolder))) + // we don't remove sent files, located outside Miranda's folder for sent cloud files + if (!dbei.bSent || !wcsnicmp(pwszName, wszReceiveFolder, wcslen(wszReceiveFolder))) DeleteFileW(pwszName); } } @@ -209,9 +209,9 @@ INT_PTR openRecDir(WPARAM, LPARAM) MEVENT Proto_RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::EventInfo &dbei) { - bool bSilent = (dbei.flags & DBEF_TEMPORARY) != 0; - bool bSent = (dbei.flags & DBEF_SENT) != 0; - bool bRead = (dbei.flags & DBEF_READ) != 0; + bool bSilent = dbei.bTemporary; + bool bSent = dbei.bSent; + bool bRead = dbei.bRead; dbei.szModule = Proto_GetBaseAccountName(hContact); dbei.eventType = EVENTTYPE_FILE; @@ -238,7 +238,7 @@ MEVENT Proto_RecvFile(MCONTACT hContact, DB::FILE_BLOB &blob, DB::EventInfo &dbe else { // load cloud files always (if OfflineSize = 0) // or if they are less than a limit (if a transfer has specified file size) - if (bSilent && File::bOfflineAuto) + if (bSilent && File::bOfflineAuto && !Ignore_IsIgnored(hContact, IGNOREEVENT_OFFLINEFILE)) if (File::iOfflineSize == 0 || (blob.getSize() > 0 && blob.getSize() < File::iOfflineSize * 1024)) DownloadOfflineFile(hContact, hdbe, dbei, false, new OFD_Download()); diff --git a/src/mir_app/src/file.h b/src/mir_app/src/file.h index c2a451e022..6f22ae2e27 100644 --- a/src/mir_app/src/file.h +++ b/src/mir_app/src/file.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. @@ -112,9 +112,8 @@ extern MWindowList g_hFileWindows; namespace File { extern CMOption<bool> bAutoMin, bAutoClear, bAutoClose, bAutoAccept, bReverseOrder; - extern CMOption<bool> bWarnBeforeOpening, bOfflineAuto, bOfflineDelete; + extern CMOption<bool> bWarnBeforeOpening, bOfflineDelete; extern CMOption<uint8_t> iIfExists, iUseScanner; - extern CMOption<uint32_t> iOfflineSize; extern CMOption<wchar_t*> wszSaveDir, wszScanCmdLine; }; diff --git a/src/mir_app/src/fileexistsdlg.cpp b/src/mir_app/src/fileexistsdlg.cpp index 623e610268..9d593f61ca 100644 --- a/src/mir_app/src/fileexistsdlg.cpp +++ b/src/mir_app/src/fileexistsdlg.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. diff --git a/src/mir_app/src/fileopts.cpp b/src/mir_app/src/fileopts.cpp index 9d550c9f67..5834363fd7 100644 --- a/src/mir_app/src/fileopts.cpp +++ b/src/mir_app/src/fileopts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. diff --git a/src/mir_app/src/filerecvdlg.cpp b/src/mir_app/src/filerecvdlg.cpp index 1ed429623c..46dac31cca 100644 --- a/src/mir_app/src/filerecvdlg.cpp +++ b/src/mir_app/src/filerecvdlg.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. @@ -253,7 +253,7 @@ public: SetDlgItemText(m_hwnd, IDC_MSG, blob.getDescr()); wchar_t datetimestr[64]; - TimeZone_PrintTimeStamp(NULL, dbei.timestamp, L"t d", datetimestr, _countof(datetimestr), 0); + TimeZone_PrintTimeStamp(NULL, dbei.getUnixtime(), L"t d", datetimestr, _countof(datetimestr), 0); SetDlgItemText(m_hwnd, IDC_DATE, datetimestr); ptrW info(Contact::GetInfo(CNF_UNIQUEID, dat->hContact)); diff --git a/src/mir_app/src/filesenddlg.cpp b/src/mir_app/src/filesenddlg.cpp index 2da4ec2edb..992ba5e27d 100644 --- a/src/mir_app/src/filesenddlg.cpp +++ b/src/mir_app/src/filesenddlg.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. diff --git a/src/mir_app/src/fileutils.cpp b/src/mir_app/src/fileutils.cpp index ba4dab4970..122c1480c1 100644 --- a/src/mir_app/src/fileutils.cpp +++ b/src/mir_app/src/fileutils.cpp @@ -1,6 +1,6 @@ /* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org) +Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License diff --git a/src/mir_app/src/filexferdlg.cpp b/src/mir_app/src/filexferdlg.cpp index 3f76244d9e..e02aeaacde 100644 --- a/src/mir_app/src/filexferdlg.cpp +++ b/src/mir_app/src/filexferdlg.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. @@ -135,54 +135,31 @@ static void SetFtStatus(HWND hwndDlg, wchar_t *text, int mode) static void HideProgressControls(HWND hwndDlg) { - RECT rc; char buf[64]; - - GetWindowRect(GetDlgItem(hwndDlg, IDC_ALLPRECENTS), &rc); - MapWindowPoints(nullptr, hwndDlg, (LPPOINT)&rc, 2); - SetWindowPos(hwndDlg, nullptr, 0, 0, 100, rc.bottom + 3, SWP_NOMOVE | SWP_NOZORDER); - ShowWindow(GetDlgItem(hwndDlg, IDC_ALLTRANSFERRED), SW_HIDE); - ShowWindow(GetDlgItem(hwndDlg, IDC_ALLSPEED), SW_HIDE); - _strtime(buf); - SetDlgItemTextA(hwndDlg, IDC_ALLPRECENTS, buf); + SetDlgItemTextA(hwndDlg, IDC_ALLSPEED, buf); PostMessage(GetParent(hwndDlg), WM_FT_RESIZE, 0, (LPARAM)hwndDlg); } -static int FileTransferDlgResizer(HWND, LPARAM param, UTILRESIZECONTROL *urc) +static int FileTransferDlgResizer(HWND, LPARAM, UTILRESIZECONTROL *urc) { - auto *dat = (FileDlgData *)param; - switch (urc->wId) { case IDC_CONTACTNAME: case IDC_STATUS: + case IDC_ALLTRANSFERRED: case IDC_ALLFILESPROGRESS: case IDC_TRANSFERCOMPLETED: return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP; case IDC_FRAME: return RD_ANCHORX_WIDTH | RD_ANCHORY_BOTTOM; - case IDC_ALLPRECENTS: + case IDCANCEL: + case IDC_ALLSPEED: case IDC_OPENFILE: case IDC_OPENFOLDER: return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP; - - case IDC_ALLTRANSFERRED: - if (dat->waitingForAcceptance) - return RD_ANCHORX_WIDTH | RD_ANCHORY_TOP; - - urc->rcItem.right = urc->rcItem.left + (urc->rcItem.right - urc->rcItem.left - urc->dlgOriginalSize.cx + urc->dlgNewSize.cx) / 3; - return RD_ANCHORX_CUSTOM | RD_ANCHORY_TOP; - - case IDC_ALLSPEED: - if (dat->waitingForAcceptance) - return RD_ANCHORX_RIGHT | RD_ANCHORY_TOP; - - urc->rcItem.right = urc->rcItem.right - urc->dlgOriginalSize.cx + urc->dlgNewSize.cx; - urc->rcItem.left = urc->rcItem.left + (urc->rcItem.right - urc->rcItem.left) / 3; - return RD_ANCHORX_CUSTOM | RD_ANCHORY_TOP; } return RD_ANCHORX_LEFT | RD_ANCHORY_TOP; } @@ -550,7 +527,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR if (lastPos != nextPos || firstTime) { SendDlgItemMessage(hwndDlg, IDC_ALLFILESPROGRESS, PBM_SETPOS, nextPos, 0); mir_snwprintf(str, L"%u%%", nextPos); - SetDlgItemText(hwndDlg, IDC_ALLPRECENTS, str); + SetDlgItemText(hwndDlg, IDC_ALLSPEED, str); } int units; @@ -595,8 +572,8 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR DB::EventInfo dbei; dbei.szModule = Proto_GetBaseAccountName(dat->hContact); dbei.eventType = EVENTTYPE_FILE; - dbei.flags = DBEF_SENT | DBEF_UTF; - dbei.timestamp = time(0); + dbei.flags = DBEF_SENT | DBEF_READ | DBEF_UTF; + dbei.iTimestamp = time(0); DB::FILE_BLOB blob(dat->szFilenames, dat->szMsg); if (auto *pa = Proto_GetAccount(ack->szModule)) diff --git a/src/mir_app/src/filter.cpp b/src/mir_app/src/filter.cpp index 72ce46c822..8d66d21c5d 100644 --- a/src/mir_app/src/filter.cpp +++ b/src/mir_app/src/filter.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/filter.h b/src/mir_app/src/filter.h index d50e431b39..961cbc67ab 100644 --- a/src/mir_app/src/filter.h +++ b/src/mir_app/src/filter.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/findadd.cpp b/src/mir_app/src/findadd.cpp index a7d49e656f..e7a54d1eee 100644 --- a/src/mir_app/src/findadd.cpp +++ b/src/mir_app/src/findadd.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/findadd.h b/src/mir_app/src/findadd.h index d91f1d89ec..bd35b2f9e9 100644 --- a/src/mir_app/src/findadd.h +++ b/src/mir_app/src/findadd.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/ftmanager.cpp b/src/mir_app/src/ftmanager.cpp index 47394a0b44..b2dd369b2f 100644 --- a/src/mir_app/src/ftmanager.cpp +++ b/src/mir_app/src/ftmanager.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org), +Copyright (C) 2012-25 Miranda NG team (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. diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index 735828e8df..13288e210a 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -27,6 +27,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. /* genmenu structs */
+#define MS_CLIST_MAIN_MENU "MainMenu/Command"
+#define MS_CLIST_STATUS_MENU "GlobalStatus/Command"
+
#define MENUITEM_SIGNATURE 0xDEADBEEF
struct TIntMenuObject;
@@ -94,10 +97,6 @@ struct TIntMenuObject : public MZeroedObject //WPARAM wParam;//menuitemhandle
char *FreeService;//callback service used to free ownerdata for menuitems
- //LPARAM lParam;//MENUITEMINFO filled with all needed data
- //WPARAM wParam;//menuitemhandle
- char *onAddService;//called just before add MENUITEMINFO to hMenu
-
TMO_LinkedList m_items;
HIMAGELIST m_hMenuIcons;
bool m_bUseUserDefinedItems;
@@ -106,6 +105,7 @@ struct TIntMenuObject : public MZeroedObject };
extern LIST<TIntMenuObject> g_menus;
+extern bool g_bMenuIconsEnabled;
#define SEPARATORPOSITIONINTERVAL 100000
diff --git a/src/mir_app/src/headerbar.cpp b/src/mir_app/src/headerbar.cpp index 8a17be016c..50b01e7995 100644 --- a/src/mir_app/src/headerbar.cpp +++ b/src/mir_app/src/headerbar.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
Copyright (c) 2007 Artem Shpynov
all portions of this codebase are copyrighted to the people
diff --git a/src/mir_app/src/help.cpp b/src/mir_app/src/help.cpp index d402d921fa..bd6b66c708 100644 --- a/src/mir_app/src/help.cpp +++ b/src/mir_app/src/help.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/hotkey_opts.cpp b/src/mir_app/src/hotkey_opts.cpp index 541af6af9e..cce8ebf634 100644 --- a/src/mir_app/src/hotkey_opts.cpp +++ b/src/mir_app/src/hotkey_opts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp index 6a43e30399..75ca15adc3 100644 --- a/src/mir_app/src/hotkeys.cpp +++ b/src/mir_app/src/hotkeys.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/icolib.cpp b/src/mir_app/src/icolib.cpp index 4ddd48f7f4..4146b12b37 100644 --- a/src/mir_app/src/icolib.cpp +++ b/src/mir_app/src/icolib.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/idle.cpp b/src/mir_app/src/idle.cpp index 36c69266f5..566e4e2fc6 100644 --- a/src/mir_app/src/idle.cpp +++ b/src/mir_app/src/idle.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/ignore.cpp b/src/mir_app/src/ignore.cpp index 83d0bfb0e0..8f629e4bce 100644 --- a/src/mir_app/src/ignore.cpp +++ b/src/mir_app/src/ignore.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -23,318 +23,319 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "stdafx.h"
+#include "clc.h"
-#define IGNOREEVENT_MAX 5
+#define IGNOREEVENT_MAX 6
-static int masks[IGNOREEVENT_MAX] = { 0x0001, 0x0004, 0x0008, 0x0010, 0x0040 };
+static int masks[IGNOREEVENT_MAX] = { 0x0001, 0x0020, 0x0004, 0x0008, 0x0010, 0x0040 };
-static uint32_t ignoreIdToPf1[IGNOREEVENT_MAX] = { PF1_IMRECV, PF1_FILERECV, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
-static uint32_t ignoreIdToPf4[IGNOREEVENT_MAX] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, PF4_SUPPORTTYPING };
+static uint32_t ignoreIdToPf1[IGNOREEVENT_MAX] = { PF1_IMRECV, 0xFFFFFFFF, PF1_FILERECV, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+static uint32_t ignoreIdToPf4[IGNOREEVENT_MAX] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, PF4_SUPPORTTYPING };
static uint32_t GetMask(MCONTACT hContact)
{
uint32_t mask = db_get_dw(hContact, "Ignore", "Mask1", (uint32_t)-1);
- if (mask == (uint32_t)-1) {
- if (hContact == 0)
- mask = 0;
- else {
- if ((Contact::IsHidden(hContact) && !db_mc_isSub(hContact)) || !Contact::OnList(hContact))
- mask = db_get_dw(0, "Ignore", "Mask1", 0);
+ if (mask != (uint32_t)-1)
+ return mask;
+
+ if (hContact == 0)
+ return 0;
+
+ ptrW pwszGroup(Clist_GetGroup(hContact));
+ if (pwszGroup) {
+ while (true) {
+ if (auto *pGroup = FindGroup(pwszGroup))
+ if (pGroup->ignore)
+ return pGroup->ignore;
+
+ auto *p = wcsrchr(pwszGroup, '\\');
+ if (p)
+ *p = 0;
else
- mask = db_get_dw(0, "Ignore", "Default1", 0);
+ break;
}
}
- return mask;
+
+ if ((Contact::IsHidden(hContact) && !db_mc_isSub(hContact)) || !Contact::OnList(hContact))
+ return db_get_dw(0, "Ignore", "Mask1", 0);
+ return db_get_dw(0, "Ignore", "Default1", 0);
}
-static void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount)
+static void SaveItemValue(MCONTACT hContact, const char *pszSetting, uint32_t dwValue)
{
- int iconOn[IGNOREEVENT_MAX] = { 1, 1, 1, 1, 1 };
- int childCount[IGNOREEVENT_MAX] = { 0, 0, 0, 0, 0 };
- HANDLE hItem, hChildItem;
+ db_set_dw(hContact, "Ignore", pszSetting, dwValue);
- int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
-
- // check groups
- if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while (hItem) {
- hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem)
- SetListGroupIcons(hwndList, hChildItem, hItem, childCount);
-
- for (int i = 0; i < _countof(iconOn); i++)
- if (iconOn[i] && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i) == 0)
- iconOn[i] = 0;
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
- }
-
- // check contacts
- if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while (hItem) {
- for (int i = 0; i < _countof(iconOn); i++) {
- int iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, i);
- if (iconOn[i] && iImage == 0) iconOn[i] = 0;
- if (iImage != EMPTY_EXTRA_ICON)
- childCount[i]++;
- }
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
- }
-
- // set icons
- for (int i = 0; i < _countof(iconOn); i++) {
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(i, childCount[i] ? (iconOn[i] ? i + 3 : 0) : EMPTY_EXTRA_ICON));
- if (groupChildCount)
- groupChildCount[i] += childCount[i];
- }
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(IGNOREEVENT_MAX, 1));
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hParentItem, MAKELPARAM(IGNOREEVENT_MAX + 1, 2));
+ // assign the same value to all subs, if any
+ for (int i = db_mc_getSubCount(hContact) - 1; i >= 0; i--)
+ db_set_dw(db_mc_getSub(hContact, i), "Ignore", pszSetting, dwValue);
}
-static void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage)
+class IgnoreOptsDlg : public CDlgBase
{
- HANDLE hItem;
-
- int typeOfFirst = SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hFirstItem, 0);
-
- // check groups
- if (typeOfFirst == CLCIT_GROUP) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hFirstItem);
- while (hItem) {
- HANDLE hChildItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hChildItem)
- SetAllChildIcons(hwndList, hChildItem, iColumn, iImage);
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTGROUP, (LPARAM)hItem);
- }
+ HICON hIcons[IGNOREEVENT_MAX + 2];
+ HANDLE hItemAll, hItemUnknown;
- // check contacts
- if (typeOfFirst == CLCIT_CONTACT) hItem = hFirstItem;
- else hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hFirstItem);
- while (hItem) {
- int iOldIcon = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
- if (iOldIcon != EMPTY_EXTRA_ICON && iOldIcon != iImage)
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage));
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_NEXTCONTACT, (LPARAM)hItem);
- }
-}
+ CCtrlClc m_clist;
-static void ResetListOptions(HWND hwndList)
-{
- SendMessage(hwndList, CLM_SETHIDEEMPTYGROUPS, 1, 0);
-}
+ void SaveGroupValue(HANDLE hFirstItem)
+ {
+ int typeOfFirst = m_clist.GetItemType(hFirstItem);
-static void SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int iColumn, int iImage)
-{
- switch (SendMessage(hwndList, CLM_GETITEMTYPE, (WPARAM)hItem, 0)) {
- case CLCIT_INFO:
- if (hItem == hItemAll)
- SetAllChildIcons(hwndList, hItem, iColumn, iImage);
- else
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage)); //hItemUnknown
- break;
-
- case CLCIT_GROUP:
- hItem = (HANDLE)SendMessage(hwndList, CLM_GETNEXTITEM, CLGN_CHILD, (LPARAM)hItem);
- if (hItem)
- SetAllChildIcons(hwndList, hItem, iColumn, iImage);
- break;
-
- case CLCIT_CONTACT:
- int oldiImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, iColumn);
- if (oldiImage != EMPTY_EXTRA_ICON && oldiImage != iImage)
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(iColumn, iImage));
- break;
+ HANDLE hItem = (typeOfFirst == CLCIT_GROUP) ? hFirstItem : m_clist.GetNextItem(hFirstItem, CLGN_NEXTGROUP);
+ while (hItem) {
+ if (HANDLE hChildItem = m_clist.GetNextItem(hItem, CLGN_CHILD))
+ SaveGroupValue(hChildItem);
+
+ MGROUP hGroup = UINT_PTR(hItem) & ~HCONTACT_ISGROUP;
+ Clist_GroupSetIgnore(hGroup, GetItemMask(hItem), !m_clist.GetCheck(hItem));
+
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTGROUP);
+ }
}
-}
-static void InitialiseItem(HWND hwndList, MCONTACT hContact, HANDLE hItem, uint32_t proto1Caps, uint32_t proto4Caps)
-{
- uint32_t mask = GetMask(hContact);
- for (int i = 0; i < IGNOREEVENT_MAX; i++)
- if ((ignoreIdToPf1[i] == 0xFFFFFFFF && ignoreIdToPf4[i] == 0xFFFFFFFF) || (proto1Caps & ignoreIdToPf1[i] || proto4Caps & ignoreIdToPf4[i]))
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, (mask & masks[i]) ? i + 3 : 0));
+ void SetListGroupIcons(HANDLE hFirstItem, HANDLE hParentItem)
+ {
+ int typeOfFirst = m_clist.GetItemType(hFirstItem);
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 1));
- SendMessage(hwndList, CLM_SETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX + 1, 2));
-}
+ // check groups
+ HANDLE hItem = (typeOfFirst == CLCIT_GROUP) ? hFirstItem : m_clist.GetNextItem(hFirstItem, CLGN_NEXTGROUP);
+ while (hItem) {
+ if (HANDLE hChildItem = m_clist.GetNextItem(hItem, CLGN_CHILD))
+ SetListGroupIcons(hChildItem, hItem);
-static void SaveItemValue(MCONTACT hContact, const char *pszSetting, uint32_t dwValue)
-{
- db_set_dw(hContact, "Ignore", pszSetting, dwValue);
+ bool isChecked;
+ MGROUP hGroup = UINT_PTR(hItem) & ~HCONTACT_ISGROUP;
+ InitialiseItem(Clist_GroupGetIgnore(hGroup, &isChecked), hItem, 0xFFFFFFFF, 0xFFFFFFFF);
- // assign the same value to all subs, if any
- for (int i = db_mc_getSubCount(hContact) - 1; i >= 0; i--)
- db_set_dw(db_mc_getSub(hContact, i), "Ignore", pszSetting, dwValue);
-}
+ m_clist.SetCheck(hItem, isChecked);
-static void SaveItemMask(HWND hwndList, MCONTACT hContact, HANDLE hItem, const char *pszSetting)
-{
- uint32_t mask = 0;
- for (int i = 0; i < IGNOREEVENT_MAX; i++) {
- int iImage = SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(i, 0));
- if (iImage && iImage != EMPTY_EXTRA_ICON)
- mask |= masks[i];
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTGROUP);
+ }
+ m_clist.SetExtraImage(hParentItem, IGNOREEVENT_MAX, 1);
+ m_clist.SetExtraImage(hParentItem, IGNOREEVENT_MAX + 1, 2);
}
- SaveItemValue(hContact, pszSetting, mask);
-}
-static void SetAllContactIcons(HWND hwndList)
-{
- for (auto &hContact : Contacts()) {
- HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, hContact, 0);
- if (hItem && SendMessage(hwndList, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(IGNOREEVENT_MAX, 0)) == EMPTY_EXTRA_ICON) {
- uint32_t proto1Caps, proto4Caps;
- char *szProto = Proto_GetBaseAccountName(hContact);
- if (szProto) {
- proto1Caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1);
- proto4Caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4);
- }
- else proto1Caps = proto4Caps = 0;
- InitialiseItem(hwndList, hContact, hItem, proto1Caps, proto4Caps);
- if (!Contact::IsHidden(hContact))
- SendMessage(hwndList, CLM_SETCHECKMARK, (WPARAM)hItem, 1);
+ void SetAllChildIcons(HANDLE hFirstItem, int iColumn, int iImage)
+ {
+ int typeOfFirst = m_clist.GetItemType(hFirstItem);
+
+ // check groups
+ HANDLE hItem = (typeOfFirst == CLCIT_GROUP) ? hFirstItem : m_clist.GetNextItem(hFirstItem, CLGN_NEXTGROUP);
+ while (hItem) {
+ if (HANDLE hChildItem = m_clist.GetNextItem(hItem, CLGN_CHILD))
+ SetAllChildIcons(hChildItem, iColumn, iImage);
+
+ int iOldIcon = m_clist.GetExtraImage(hItem, iColumn);
+ if (iOldIcon != EMPTY_EXTRA_ICON && iOldIcon != iImage)
+ m_clist.SetExtraImage(hItem, iColumn, iImage);
+
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTGROUP);
+ }
+
+ // check contacts
+ hItem = (typeOfFirst == CLCIT_CONTACT) ? hFirstItem : m_clist.GetNextItem(hFirstItem, CLGN_NEXTCONTACT);
+ while (hItem) {
+ int iOldIcon = m_clist.GetExtraImage(hItem, iColumn);
+ if (iOldIcon != EMPTY_EXTRA_ICON && iOldIcon != iImage)
+ m_clist.SetExtraImage(hItem, iColumn, iImage);
+ hItem = m_clist.GetNextItem(hItem, CLGN_NEXTCONTACT);
}
}
-}
-static INT_PTR CALLBACK DlgProcIgnoreOpts(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam)
-{
- static HICON hIcons[IGNOREEVENT_MAX + 2];
- static HANDLE hItemAll, hItemUnknown;
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- HIMAGELIST hIml = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 3 + IGNOREEVENT_MAX, 3 + IGNOREEVENT_MAX);
- ImageList_AddSkinIcon(hIml, SKINICON_OTHER_SMALLDOT);
- ImageList_AddSkinIcon(hIml, SKINICON_OTHER_FILLEDBLOB);
- ImageList_AddSkinIcon(hIml, SKINICON_OTHER_EMPTYBLOB);
- ImageList_AddSkinIcon(hIml, SKINICON_EVENT_MESSAGE);
- ImageList_AddSkinIcon(hIml, SKINICON_EVENT_FILE);
- ImageList_AddSkinIcon(hIml, SKINICON_OTHER_USERONLINE);
- ImageList_AddSkinIcon(hIml, SKINICON_AUTH_REQUEST);
- ImageList_AddSkinIcon(hIml, SKINICON_OTHER_TYPING);
-
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml);
- for (int i = 0; i < _countof(hIcons); i++)
- hIcons[i] = ImageList_GetIcon(hIml, 1 + i, ILD_NORMAL);
+ void ResetListOptions()
+ {
+ m_clist.SetHideEmptyGroups(true);
+ }
+
+ void SetIconsForColumn(HANDLE hItem, int iColumn, int iImage)
+ {
+ switch (m_clist.GetItemType(hItem)) {
+ case CLCIT_INFO:
+ if (hItem == hItemAll)
+ SetAllChildIcons(hItem, iColumn, iImage);
+ m_clist.SetExtraImage(hItem, iColumn, iImage); // hItemUnknown
+ break;
+
+ case CLCIT_GROUP:
+ if (HANDLE hChild = m_clist.GetNextItem(hItem, CLGN_CHILD))
+ SetAllChildIcons(hChild, iColumn, iImage);
+ __fallthrough;
+
+ case CLCIT_CONTACT:
+ int oldiImage = m_clist.GetExtraImage(hItem, iColumn);
+ if (oldiImage != EMPTY_EXTRA_ICON && oldiImage != iImage)
+ m_clist.SetExtraImage(hItem, iColumn, iImage);
+ break;
}
+ }
+
+ void InitialiseItem(uint32_t mask, HANDLE hItem, uint32_t proto1Caps, uint32_t proto4Caps)
+ {
+ for (int i = 0; i < IGNOREEVENT_MAX; i++)
+ if ((ignoreIdToPf1[i] == 0xFFFFFFFF && ignoreIdToPf4[i] == 0xFFFFFFFF) || (proto1Caps & ignoreIdToPf1[i] || proto4Caps & ignoreIdToPf4[i]))
+ m_clist.SetExtraImage(hItem, i, (mask & masks[i]) ? i + 3 : 0);
- SendDlgItemMessage(hwndDlg, IDC_ALLICON, STM_SETICON, (WPARAM)hIcons[0], 0);
- SendDlgItemMessage(hwndDlg, IDC_NONEICON, STM_SETICON, (WPARAM)hIcons[1], 0);
- SendDlgItemMessage(hwndDlg, IDC_MSGICON, STM_SETICON, (WPARAM)hIcons[2], 0);
- SendDlgItemMessage(hwndDlg, IDC_FILEICON, STM_SETICON, (WPARAM)hIcons[3], 0);
- SendDlgItemMessage(hwndDlg, IDC_ONLINEICON, STM_SETICON, (WPARAM)hIcons[4], 0);
- SendDlgItemMessage(hwndDlg, IDC_AUTHICON, STM_SETICON, (WPARAM)hIcons[5], 0);
- SendDlgItemMessage(hwndDlg, IDC_TYPINGICON, STM_SETICON, (WPARAM)hIcons[6], 0);
-
- ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
- SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_SETEXTRACOLUMNS, IGNOREEVENT_MAX + 2, 0);
- {
- CLCINFOITEM cii = { sizeof(cii) };
- cii.flags = CLCIIF_GROUPFONT;
- cii.pszText = TranslateT("** All contacts **");
- hItemAll = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
-
- cii.pszText = TranslateT("** Unknown contacts **");
- hItemUnknown = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_ADDINFOITEM, 0, (LPARAM)&cii);
- InitialiseItem(GetDlgItem(hwndDlg, IDC_LIST), 0, hItemUnknown, 0xFFFFFFFF, 0xFFFFFFFF);
+ m_clist.SetExtraImage(hItem, IGNOREEVENT_MAX, 1);
+ m_clist.SetExtraImage(hItem, IGNOREEVENT_MAX + 1, 2);
+ }
+
+ uint32_t GetItemMask(HANDLE hItem)
+ {
+ uint32_t mask = 0;
+ for (int i = 0; i < IGNOREEVENT_MAX; i++) {
+ int iImage = m_clist.GetExtraImage(hItem, i);
+ if (iImage && iImage != EMPTY_EXTRA_ICON)
+ mask |= masks[i];
}
+ return mask;
+ }
- SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
- return TRUE;
-
- case WM_SETFOCUS:
- SetFocus(GetDlgItem(hwndDlg, IDC_LIST));
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->idFrom) {
- case IDC_LIST:
- switch (((LPNMHDR)lParam)->code) {
- case CLN_NEWCONTACT:
- case CLN_LISTREBUILT:
- SetAllContactIcons(GetDlgItem(hwndDlg, IDC_LIST));
- __fallthrough;
- case CLN_CONTACTMOVED:
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
- break;
- case CLN_OPTIONSCHANGED:
- ResetListOptions(GetDlgItem(hwndDlg, IDC_LIST));
- break;
- case CLN_CHECKCHANGED:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- case NM_CLICK:
- NMCLISTCONTROL *nm = (NMCLISTCONTROL*)lParam;
- if (nm->iColumn == -1)
- break;
-
- uint32_t hitFlags;
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_HITTEST, (WPARAM)&hitFlags, MAKELPARAM(nm->pt.x, nm->pt.y));
- if (hItem == nullptr || !(hitFlags & CLCHT_ONITEMEXTRA))
- break;
-
- if (nm->iColumn == IGNOREEVENT_MAX) { // ignore all
- for (int iImage = 0; iImage < IGNOREEVENT_MAX; iImage++)
- SetIconsForColumn(GetDlgItem(hwndDlg, IDC_LIST), hItem, hItemAll, iImage, iImage + 3);
+ void SetAllContactIcons()
+ {
+ for (auto &hContact : Contacts()) {
+ HANDLE hItem = m_clist.FindContact(hContact);
+ if (hItem && m_clist.GetExtraImage(hItem, IGNOREEVENT_MAX) == EMPTY_EXTRA_ICON) {
+ uint32_t proto1Caps, proto4Caps;
+ char *szProto = Proto_GetBaseAccountName(hContact);
+ if (szProto) {
+ proto1Caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1);
+ proto4Caps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4);
}
- else if (nm->iColumn == IGNOREEVENT_MAX + 1) { // ignore none
- for (int iImage = 0; iImage < IGNOREEVENT_MAX; iImage++)
- SetIconsForColumn(GetDlgItem(hwndDlg, IDC_LIST), hItem, hItemAll, iImage, 0);
- }
- else {
- int iImage = SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGE, (WPARAM)hItem, MAKELPARAM(nm->iColumn, 0));
- if (iImage == 0)
- iImage = nm->iColumn + 3;
- else if (iImage != EMPTY_EXTRA_ICON)
- iImage = 0;
- SetIconsForColumn(GetDlgItem(hwndDlg, IDC_LIST), hItem, hItemAll, nm->iColumn, iImage);
- }
- SetListGroupIcons(GetDlgItem(hwndDlg, IDC_LIST), (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETNEXTITEM, CLGN_ROOT, 0), hItemAll, nullptr);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ else proto1Caps = proto4Caps = 0;
+ InitialiseItem(GetMask(hContact), hItem, proto1Caps, proto4Caps);
+ if (!Contact::IsHidden(hContact))
+ m_clist.SetCheck(hItem, 1);
}
- break;
+ }
+ }
- case 0:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- for (auto &hContact : Contacts()) {
- HANDLE hItem = (HANDLE)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_FINDCONTACT, hContact, 0);
- if (hItem)
- SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), hContact, hItem, "Mask1");
- Contact::Hide(hContact, !SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETCHECKMARK, (WPARAM)hItem, 0));
- }
+public:
+ IgnoreOptsDlg() :
+ CDlgBase(g_plugin, IDD_OPT_IGNORE),
+ m_clist(this, IDC_LIST)
+ {
+ m_clist.OnClick = Callback(this, &IgnoreOptsDlg::onClistClicked);
+ m_clist.OnOptionsChanged = Callback(this, &IgnoreOptsDlg::onClistOptionsChanged);
+ m_clist.OnListRebuilt = m_clist.OnNewContact = Callback(this, &IgnoreOptsDlg::onClistRebuilt);
+ }
- SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), 0, hItemAll, "Default1");
- SaveItemMask(GetDlgItem(hwndDlg, IDC_LIST), 0, hItemUnknown, "Mask1");
- return TRUE;
- }
+ bool OnInitDialog() override
+ {
+ HIMAGELIST hIml = ImageList_Create(g_iIconSX, g_iIconSY, ILC_COLOR32 | ILC_MASK, 3 + IGNOREEVENT_MAX, 3 + IGNOREEVENT_MAX);
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_SMALLDOT);
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_FILLEDBLOB);
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_EMPTYBLOB);
+ ImageList_AddSkinIcon(hIml, SKINICON_EVENT_MESSAGE);
+ ImageList_AddSkinIcon(hIml, SKINICON_EVENT_FILE);
+ ImageList_AddIcon(hIml, g_plugin.getIcon(IDI_CLOUD));
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_USERONLINE);
+ ImageList_AddSkinIcon(hIml, SKINICON_AUTH_REQUEST);
+ ImageList_AddSkinIcon(hIml, SKINICON_OTHER_TYPING);
+
+ m_clist.SetExtraImageList(hIml);
+ for (int i = 0; i < _countof(hIcons); i++)
+ hIcons[i] = ImageList_GetIcon(hIml, 1 + i, ILD_NORMAL);
+
+ SendDlgItemMessage(m_hwnd, IDC_ALLICON, STM_SETICON, (WPARAM)hIcons[0], 0);
+ SendDlgItemMessage(m_hwnd, IDC_NONEICON, STM_SETICON, (WPARAM)hIcons[1], 0);
+ SendDlgItemMessage(m_hwnd, IDC_MSGICON, STM_SETICON, (WPARAM)hIcons[2], 0);
+ SendDlgItemMessage(m_hwnd, IDC_FILEICON, STM_SETICON, (WPARAM)hIcons[3], 0);
+ SendDlgItemMessage(m_hwnd, IDC_OFFLINEICON, STM_SETICON, (WPARAM)hIcons[4], 0);
+ SendDlgItemMessage(m_hwnd, IDC_ONLINEICON, STM_SETICON, (WPARAM)hIcons[5], 0);
+ SendDlgItemMessage(m_hwnd, IDC_AUTHICON, STM_SETICON, (WPARAM)hIcons[6], 0);
+ SendDlgItemMessage(m_hwnd, IDC_TYPINGICON, STM_SETICON, (WPARAM)hIcons[7], 0);
+
+ ResetListOptions();
+ m_clist.SetExtraColumns(IGNOREEVENT_MAX + 2);
+
+ CLCINFOITEM cii = { sizeof(cii) };
+ cii.flags = CLCIIF_GROUPFONT;
+ cii.pszText = TranslateT("** All contacts **");
+ hItemAll = m_clist.AddInfoItem(&cii);
+ InitialiseItem(0, hItemAll, 0xFFFFFFFF, 0xFFFFFFFF);
+
+ cii.pszText = TranslateT("** Unknown contacts **");
+ hItemUnknown = m_clist.AddInfoItem(&cii);
+ InitialiseItem(GetMask(0), hItemUnknown, 0xFFFFFFFF, 0xFFFFFFFF);
+
+ SetFocus(m_clist.GetHwnd());
+ SetAllContactIcons();
+ SetListGroupIcons(m_clist.GetNextItem(0, CLGN_ROOT), hItemAll);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ for (auto &hContact : Contacts()) {
+ HANDLE hItem = m_clist.FindContact(hContact);
+ if (hItem)
+ SaveItemValue(hContact, "Mask1", GetItemMask(hItem));
+ Contact::Hide(hContact, !m_clist.GetCheck(hItem));
}
- break;
- case WM_DESTROY:
+ SaveGroupValue(m_clist.GetNextItem(0, CLGN_ROOT));
+
+ SaveItemValue(0, "Default1", GetItemMask(hItemAll));
+ SaveItemValue(0, "Mask1", GetItemMask(hItemUnknown));
+ return true;
+ }
+
+ void OnDestroy() override
+ {
for (auto &it : hIcons)
DestroyIcon(it);
- HIMAGELIST hIml = (HIMAGELIST)SendDlgItemMessage(hwndDlg, IDC_LIST, CLM_GETEXTRAIMAGELIST, 0, 0);
- ImageList_Destroy(hIml);
- break;
+ ImageList_Destroy(m_clist.GetExtraImageList());
}
- return FALSE;
-}
+
+ void onClistRebuilt(CCtrlClc *)
+ {
+ SetAllContactIcons();
+ SetListGroupIcons(m_clist.GetNextItem(0, CLGN_ROOT), hItemAll);
+ }
+
+ void onClistOptionsChanged(CCtrlClc *)
+ {
+ ResetListOptions();
+ }
+
+ void onClistClicked(CCtrlClc::TEventInfo *ev)
+ {
+ auto *nm = ev->info;
+
+ uint32_t hitFlags;
+ HANDLE hItem = m_clist.HitTest(nm->pt.x, nm->pt.y, &hitFlags);
+ if (hItem == nullptr || !(hitFlags & CLCHT_ONITEMEXTRA))
+ return;
+
+ if (nm->iColumn == IGNOREEVENT_MAX) { // ignore all
+ for (int iImage = 0; iImage < IGNOREEVENT_MAX; iImage++)
+ SetIconsForColumn(hItem, iImage, iImage + 3);
+ }
+ else if (nm->iColumn == IGNOREEVENT_MAX + 1) { // ignore none
+ for (int iImage = 0; iImage < IGNOREEVENT_MAX; iImage++)
+ SetIconsForColumn(hItem, iImage, 0);
+ }
+ else {
+ int iImage = m_clist.GetExtraImage(hItem, nm->iColumn);
+ if (iImage == 0)
+ iImage = nm->iColumn + 3;
+ else if (iImage != EMPTY_EXTRA_ICON)
+ iImage = 0;
+ SetIconsForColumn(hItem, nm->iColumn, iImage);
+ }
+
+ NotifyChange();
+ }
+};
static int IgnoreOptInitialise(WPARAM wParam, LPARAM)
{
OPTIONSDIALOGPAGE odp = {};
odp.position = 900000000;
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_IGNORE);
odp.szTitle.a = LPGEN("Ignore");
odp.szGroup.a = LPGEN("Contacts");
- odp.pfnDlgProc = DlgProcIgnoreOpts;
+ odp.pDialog = new IgnoreOptsDlg();
odp.flags = ODPF_BOLDGROUPS;
g_plugin.addOptions(wParam, &odp);
return 0;
diff --git a/src/mir_app/src/keyboard.cpp b/src/mir_app/src/keyboard.cpp index 91d35a1655..a2057841ac 100644 --- a/src/mir_app/src/keyboard.cpp +++ b/src/mir_app/src/keyboard.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/langpack.h b/src/mir_app/src/langpack.h index 96be92a359..7996f970b4 100644 --- a/src/mir_app/src/langpack.h +++ b/src/mir_app/src/langpack.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/lpopts.cpp b/src/mir_app/src/lpopts.cpp index dc09995d09..9a86fbfebf 100644 --- a/src/mir_app/src/lpopts.cpp +++ b/src/mir_app/src/lpopts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/mdatabasecache.cpp b/src/mir_app/src/mdatabasecache.cpp index 0efe9ca5e5..ecdaf14c18 100644 --- a/src/mir_app/src/mdatabasecache.cpp +++ b/src/mir_app/src/mdatabasecache.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/menu_clist.cpp b/src/mir_app/src/menu_clist.cpp index 2bdcc8df49..a547644a07 100644 --- a/src/mir_app/src/menu_clist.cpp +++ b/src/mir_app/src/menu_clist.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -54,7 +54,7 @@ bool prochotkey; HANDLE hPreBuildMainMenuEvent, hStatusModeChangeEvent, hPreBuildContactMenuEvent, hPreBuildStatusMenuEvent;
-HMENU hMainMenu, hStatusMenu;
+HMENU g_hMainMenu, g_hStatusMenu;
MStatus g_statuses[MAX_STATUS_COUNT] =
{
@@ -103,23 +103,29 @@ struct MainMenuExecParam MIR_APP_DLL(HMENU) Menu_GetMainMenu(void)
{
- RecursiveDeleteMenu(hMainMenu);
+ RecursiveDeleteMenu(g_hMainMenu);
NotifyEventHooks(hPreBuildMainMenuEvent, 0, 0);
- Menu_Build(hMainMenu, hMainMenuObject);
+ Menu_Build(g_hMainMenu, hMainMenuObject);
DrawMenuBar(g_clistApi.hwndContactList);
- return hMainMenu;
+ return g_hMainMenu;
}
-MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi)
+MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi, const char *pszProto)
{
MainMenuExecParam *mmep = (MainMenuExecParam*)mir_alloc(sizeof(MainMenuExecParam));
if (mmep == nullptr)
return nullptr;
- //we need just one parametr.
- mmep->szServiceName = mir_strdup(pmi->pszService);
+ CMStringA szService;
+ if (pszProto)
+ szService.Format("%s%s", pszProto, pmi->pszService);
+ else
+ szService = pmi->pszService;
+
+ // we need just one parametr.
+ mmep->szServiceName = mir_strdup(szService);
mmep->szMenuName = pmi->name.w;
TMO_IntMenuItem *pimi = Menu_AddItem(hMainMenuObject, pmi, mmep);
@@ -132,7 +138,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddMainMenuItem(TMO_MenuItem *pmi) bool needFree = false;
if (pmi->pszService)
- name = pmi->pszService;
+ name = mmep->szServiceName;
else if (pmi->flags & CMIF_UNICODE) {
name = mir_u2a(pmi->name.w);
needFree = true;
@@ -344,10 +350,10 @@ MIR_APP_DLL(HGENMENU) Menu_AddStatusMenuItem(TMO_MenuItem *pmi, const char *pszP MIR_APP_DLL(HMENU) Menu_GetStatusMenu()
{
- RecursiveDeleteMenu(hStatusMenu);
+ RecursiveDeleteMenu(g_hStatusMenu);
- Menu_Build(hStatusMenu, hStatusMenuObject);
- return hStatusMenu;
+ Menu_Build(g_hStatusMenu, hStatusMenuObject);
+ return g_hStatusMenu;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -429,14 +435,14 @@ static INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM) timiParent = MO_GetIntMenuItem(pimi->mi.root);
MenuItemData it = {};
- if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
+ if (FindMenuHandleByGlobalID(g_hStatusMenu, timiParent, &it)) {
wchar_t d[100];
- GetMenuString(it.OwnerMenu, it.position, d, _countof(d), MF_BYPOSITION);
+ GetMenuStringW(it.OwnerMenu, it.position, d, _countof(d), MF_BYPOSITION);
MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_STRING | MIIM_STATE;
- if (pimi->iconId != -1) {
+ if (pimi->iconId != -1 && g_bMenuIconsEnabled) {
mii.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && IsThemeActive()) {
if (pimi->hBmp == nullptr)
@@ -679,14 +685,14 @@ MIR_APP_DLL(int) Clist_GetAccountIndex(int Pos) void RebuildMenuOrder(void)
{
// clear statusmenu
- RecursiveDeleteMenu(hStatusMenu);
+ RecursiveDeleteMenu(g_hStatusMenu);
// status menu
if (hStatusMenuObject != 0)
Menu_RemoveObject(hStatusMenuObject);
hStatusMenuObject = Menu_AddObject("StatusMenu", LPGEN("Status menu"), "StatusMenuCheckService", "StatusMenuExecService");
- Menu_ConfigureObject(hStatusMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataStatusMenu");
+ Menu_ConfigureObject(hStatusMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUS/FreeOwnerDataStatusMenu");
g_menuProtos.destroy();
@@ -1019,8 +1025,8 @@ void InitCustomMenus(void) HookEvent(ME_PROTO_ACK, MenuProtoAck);
- hMainMenu = CreatePopupMenu();
- hStatusMenu = CreatePopupMenu();
+ g_hMainMenu = CreatePopupMenu();
+ g_hStatusMenu = CreatePopupMenu();
// new menu sys
InitGenMenu();
@@ -1028,12 +1034,12 @@ void InitCustomMenus(void) // main menu
hMainMenuObject = Menu_AddObject("MainMenu", LPGEN("Main menu"), nullptr, "MainMenuExecService");
Menu_ConfigureObject(hMainMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
- Menu_ConfigureObject(hMainMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataMainMenu");
+ Menu_ConfigureObject(hMainMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUS/FreeOwnerDataMainMenu");
// contact menu
hContactMenuObject = Menu_AddObject("ContactMenu", LPGEN("Contact menu"), "ContactMenuCheckService", "ContactMenuExecService");
Menu_ConfigureObject(hContactMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
- Menu_ConfigureObject(hContactMenuObject, MCO_OPT_FREE_SERVICE, (INT_PTR)"CLISTMENUS/FreeOwnerDataContactMenu");
+ Menu_ConfigureObject(hContactMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUS/FreeOwnerDataContactMenu");
// other menus
InitGroupMenus();
@@ -1090,6 +1096,6 @@ void UninitCustomMenus(void) g_menuProtos.destroy();
- DestroyMenu(hMainMenu);
- DestroyMenu(hStatusMenu);
+ DestroyMenu(g_hMainMenu);
+ DestroyMenu(g_hStatusMenu);
}
diff --git a/src/mir_app/src/menu_frames.cpp b/src/mir_app/src/menu_frames.cpp index 236c3d553d..b2d6fc1759 100644 --- a/src/mir_app/src/menu_frames.cpp +++ b/src/mir_app/src/menu_frames.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/menu_groups.cpp b/src/mir_app/src/menu_groups.cpp index 4e51811916..83dfb3d584 100644 --- a/src/mir_app/src/menu_groups.cpp +++ b/src/mir_app/src/menu_groups.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-08 Miranda ICQ/IM project,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -120,7 +120,7 @@ static INT_PTR HideGroupsHelper(WPARAM, LPARAM) static INT_PTR UseGroupsHelper(WPARAM, LPARAM)
{
int newVal = !(GetWindowLongPtr(g_clistApi.hwndContactTree, GWL_STYLE) & CLS_USEGROUPS);
- Clist::UseGroups = newVal;
+ Clist::bUseGroups = newVal;
SendMessage(g_clistApi.hwndContactTree, CLM_SETUSEGROUPS, newVal, 0);
return newVal;
}
@@ -178,7 +178,7 @@ static INT_PTR DeleteGroupHelper(WPARAM wParam, LPARAM) static int OnBuildGroupMenu(WPARAM wParam, LPARAM)
{
- bool bChecked = Clist::HideOffline;
+ bool bChecked = Clist::bHideOffline;
Menu_SetChecked(hmiHideOfflineUsers, bChecked);
bChecked = SendMessage(g_clistApi.hwndContactTree, CLM_GETHIDEOFFLINEROOT, 0, 0) != 0;
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 030cca645d..ff29930a9e 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define STR_SEPARATOR L"-----------------------------------"
-extern bool bIconsDisabled;
extern int DefaultImageListColorDepth;
void RebuildProtoMenus();
@@ -89,7 +88,7 @@ class CGenMenuOptionsPage : public CDlgBase tvi.mask = TVIF_TEXT | TVIF_PARAM | TVIF_HANDLE | TVIF_STATE;
tvi.pszText = idstr;
- int count = 0, customOrder = 0;
+ int count = 0;
int runtimepos = 100;
char pszParent[33];
@@ -116,9 +115,6 @@ class CGenMenuOptionsPage : public CDlgBase CMStringW tszValue(FORMAT, L"%d;%d;%S;%s", bChecked, runtimepos, pszParent, ptszCustomName);
db_set_ws(0, szModule, menuItemName, tszValue);
-
- if (pimi->mi.flags & CMIF_CUSTOM)
- db_set_s(0, szModule, CMStringA(FORMAT, "Custom%d", customOrder++), menuItemName);
}
HTREEITEM hChild = m_menuItems.GetChild(tvi.hItem);
@@ -255,15 +251,11 @@ class CGenMenuOptionsPage : public CDlgBase m_menuItems.SetDraw(false);
m_menuItems.DeleteAllItems();
-
BuildTreeInternal(szModule, bReread, pmo->m_items, nullptr);
-
m_menuItems.SetDraw(true);
- m_warning.Show(!pmo->m_bUseUserDefinedItems);
m_menuItems.Enable(pmo->m_bUseUserDefinedItems);
m_btnInsSeparator.Enable(pmo->m_bUseUserDefinedItems);
- m_btnInsMenu.Enable(pmo->m_bUseUserDefinedItems);
return 1;
}
@@ -280,9 +272,8 @@ class CGenMenuOptionsPage : public CDlgBase CCtrlListBox m_menuObjects;
CCtrlTreeView m_menuItems;
CCtrlCheck m_radio1, m_radio2, m_enableIcons;
- CCtrlEdit m_customName, m_service, m_module;
- CCtrlButton m_btnInsSeparator, m_btnInsMenu, m_btnReset, m_btnSet, m_btnDefault, m_btnDelete;
- CCtrlBase m_warning;
+ CCtrlEdit m_customName, m_service, m_module, m_id;
+ CCtrlButton m_btnInsSeparator, m_btnReset, m_btnSet, m_btnDefault;
public:
CGenMenuOptionsPage() :
@@ -294,22 +285,18 @@ public: m_radio2(this, IDC_RADIO2),
m_enableIcons(this, IDC_DISABLEMENUICONS),
m_btnInsSeparator(this, IDC_INSERTSEPARATOR),
- m_btnInsMenu(this, IDC_INSERTSUBMENU),
m_btnReset(this, IDC_RESETMENU),
m_btnSet(this, IDC_GENMENU_SET),
- m_btnDelete(this, IDC_GENMENU_DELETE),
m_btnDefault(this, IDC_GENMENU_DEFAULT),
+ m_id(this, IDC_GENMENU_ID),
m_customName(this, IDC_GENMENU_CUSTOMNAME),
m_service(this, IDC_GENMENU_SERVICE),
- m_module(this, IDC_GENMENU_MODULE),
- m_warning(this, IDC_NOTSUPPORTWARNING)
+ m_module(this, IDC_GENMENU_MODULE)
{
m_btnSet.OnClick = Callback(this, &CGenMenuOptionsPage::btnSet_Clicked);
m_btnReset.OnClick = Callback(this, &CGenMenuOptionsPage::btnReset_Clicked);
m_btnInsSeparator.OnClick = Callback(this, &CGenMenuOptionsPage::btnInsSep_Clicked);
- m_btnInsMenu.OnClick = Callback(this, &CGenMenuOptionsPage::btnInsMenu_Clicked);
m_btnDefault.OnClick = Callback(this, &CGenMenuOptionsPage::btnDefault_Clicked);
- m_btnDelete.OnClick = Callback(this, &CGenMenuOptionsPage::btnDelete_Clicked);
m_menuObjects.OnSelChange = Callback(this, &CGenMenuOptionsPage::onMenuObjectChanged);
@@ -331,7 +318,7 @@ public: else
m_radio1.SetState(true);
- m_enableIcons.SetState(!bIconsDisabled);
+ m_enableIcons.SetState(g_bMenuIconsEnabled);
//---- init menu object list --------------------------------------
for (auto &p : g_menus)
@@ -345,8 +332,14 @@ public: bool OnApply() override
{
- bIconsDisabled = !m_enableIcons.IsChecked();
- db_set_b(0, "CList", "DisableMenuIcons", bIconsDisabled);
+ if (g_bMenuIconsEnabled != m_enableIcons.IsChecked()) {
+ g_bMenuIconsEnabled = m_enableIcons.IsChecked();
+ db_set_b(0, "CList", "DisableMenuIcons", !g_bMenuIconsEnabled);
+
+ Menu_GetMainMenu();
+ Menu_GetStatusMenu();
+ Menu_ReloadProtoMenus();
+ }
if (m_customName.IsChanged())
btnSet_Clicked(0);
@@ -402,45 +395,6 @@ public: NotifyChange();
}
- void btnInsMenu_Clicked(CCtrlButton*)
- {
- HTREEITEM hti = m_menuItems.GetSelection();
- if (hti == nullptr)
- return;
-
- TVITEMEX tvi = { 0 };
- tvi.mask = TVIF_HANDLE | TVIF_PARAM | TVIF_TEXT;
- tvi.hItem = hti;
- if (!m_menuItems.GetItem(&tvi))
- return;
-
- MenuItemOptData *curData = (MenuItemOptData*)tvi.lParam;
-
- TMO_MenuItem mi = {};
- UuidCreate((UUID*)&mi.uid);
- mi.flags = CMIF_CUSTOM;
- mi.name.a = LPGEN("New submenu");
- mi.position = curData->pos - 1;
- TMO_IntMenuItem *pimi = Menu_AddItem(curData->pimi->parent->id, &mi, nullptr);
-
- MenuItemOptData *PD = new MenuItemOptData();
- PD->id = -1;
- PD->name = mir_wstrdup(TranslateW(pimi->mi.name.w));
- PD->pos = pimi->mi.position;
- PD->pimi = pimi;
-
- TVINSERTSTRUCT tvis = {};
- tvis.item.mask = TVIF_PARAM | TVIF_TEXT | TVIF_STATE;
- tvis.item.lParam = (LPARAM)PD;
- tvis.item.pszText = PD->name;
- tvis.hInsertAfter = hti;
- tvis.item.state = INDEXTOSTATEIMAGEMASK(2);
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- m_menuItems.InsertItem(&tvis);
-
- NotifyChange();
- }
-
void btnReset_Clicked(CCtrlButton*)
{
int MenuObjectID;
@@ -497,29 +451,6 @@ public: NotifyChange();
}
- void btnDelete_Clicked(CCtrlButton *)
- {
- HTREEITEM hti = m_menuItems.GetSelection();
- if (hti == nullptr)
- return;
-
- TVITEMEX tvi;
- tvi.mask = TVIF_PARAM;
- tvi.hItem = hti;
- m_menuItems.GetItem(&tvi);
-
- MenuItemOptData *iod = (MenuItemOptData *)tvi.lParam;
- if (!(iod->pimi->mi.flags & CMIF_CUSTOM))
- return;
-
- if (IDYES == MessageBoxW(m_hwnd, TranslateT("Do you really want to delete this menu item?"), TranslateT("Miranda"), MB_YESNO | MB_ICONQUESTION)) {
- m_arDeleted.insert(iod->pimi);
- m_menuItems.DeleteItem(hti);
- delete iod;
- NotifyChange();
- }
- }
-
void onMenuObjectChanged(void*)
{
m_bInitialized = false;
@@ -532,11 +463,10 @@ public: m_customName.SetTextA("");
m_service.SetTextA("");
m_module.SetTextA("");
+ m_id.SetTextA("");
- m_btnInsMenu.Disable();
m_btnDefault.Disable();
m_btnSet.Disable();
- m_btnDelete.Disable();
m_customName.Disable();
HTREEITEM hti = m_menuItems.GetSelection();
@@ -557,17 +487,20 @@ public: m_customName.SetText(iod->name);
if (iod->pimi->mi.uid != miid_last) {
+ auto &id = iod->pimi->mi.uid;
char szText[100];
- bin2hex(&iod->pimi->mi.uid, sizeof(iod->pimi->mi.uid), szText);
- m_service.SetTextA(szText);
+ mir_snprintf(szText, "%08x-%04x-%04x-", id.a, id.b, id.c);
+ bin2hex(&iod->pimi->mi.uid.d, sizeof(iod->pimi->mi.uid.d), szText + strlen(szText));
+ m_id.SetTextA(szText);
}
- const CMPluginBase *pPlugin = iod->pimi->mi.pPlugin;
- m_module.SetTextA(pPlugin == nullptr ? "" : pPlugin->getInfo().shortName);
+ if (iod->pimi->mi.pszService)
+ m_service.SetTextA(iod->pimi->mi.pszService);
+
+ auto *pPlugin = iod->pimi->mi.pPlugin;
+ m_module.SetTextA(pPlugin ? pPlugin->getInfo().shortName : "");
- m_btnInsMenu.Enable(iod->pimi->mi.root == nullptr);
m_btnDefault.Enable(mir_wstrcmp(iod->name, iod->defname) != 0);
- m_btnDelete.Enable(iod->pimi->mi.flags & CMIF_CUSTOM);
m_btnSet.Enable(true);
m_customName.Enable(true);
}
diff --git a/src/mir_app/src/menu_tray.cpp b/src/mir_app/src/menu_tray.cpp index 210ccd3e6f..0f9f2b5b2d 100644 --- a/src/mir_app/src/menu_tray.cpp +++ b/src/mir_app/src/menu_tray.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -54,7 +54,7 @@ MIR_APP_DLL(void) Menu_DestroyNestedMenu(HMENU hMenu) int cnt = GetMenuItemCount(hMenu);
for (int i = 0; i < cnt; ++i) {
HMENU hSubMenu = GetSubMenu(hMenu, i);
- if (hSubMenu && ((hSubMenu == hStatusMenu) || (hSubMenu == hMainMenu)))
+ if (hSubMenu && ((hSubMenu == g_hStatusMenu) || (hSubMenu == g_hMainMenu)))
RemoveMenu(hMenu, i--, MF_BYPOSITION);
}
DestroyMenu(hMenu);
@@ -77,25 +77,6 @@ static INT_PTR FreeOwnerDataTrayMenu(WPARAM, LPARAM lParam) return 0;
}
-static INT_PTR TrayMenuOnAddService(WPARAM wParam, LPARAM lParam)
-{
- MENUITEMINFO *mii = (MENUITEMINFO*)wParam;
- if (mii == nullptr)
- return 0;
-
- if (hTrayMainMenuItemProxy == (HGENMENU)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = hMainMenu = Menu_GetMainMenu();
- }
-
- if (hTrayStatusMenuItemProxy == (HGENMENU)lParam) {
- mii->fMask |= MIIM_SUBMENU;
- mii->hSubMenu = hStatusMenu = Menu_GetStatusMenu();
- }
-
- return TRUE;
-}
-
static INT_PTR ShowHideStub(WPARAM, LPARAM)
{
return g_clistApi.pfnShowHide();
@@ -105,7 +86,6 @@ void InitTrayMenus(void) {
CreateServiceFunction("CLISTMENUSTRAY/ExecService", TrayMenuExecService);
CreateServiceFunction("CLISTMENUSTRAY/FreeOwnerDataTrayMenu", FreeOwnerDataTrayMenu);
- CreateServiceFunction("CLISTMENUSTRAY/TrayMenuOnAddService", TrayMenuOnAddService);
hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU);
@@ -113,7 +93,6 @@ void InitTrayMenus(void) hTrayMenuObject = Menu_AddObject("TrayMenu", LPGEN("Tray menu"), nullptr, "CLISTMENUSTRAY/ExecService");
Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_USERDEFINEDITEMS, TRUE);
Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_FREE_SERVICE, "CLISTMENUSTRAY/FreeOwnerDataTrayMenu");
- Menu_ConfigureObject(hTrayMenuObject, MCO_OPT_ONADD_SERVICE, "CLISTMENUSTRAY/TrayMenuOnAddService");
// add exit command to menu
CMenuItem mi(&g_plugin);
@@ -138,14 +117,14 @@ void InitTrayMenus(void) SET_UID(mi, 0xb6d861bc, 0x9c3f, 0x40d9, 0xaf, 0x58, 0x53, 0x9f, 0x22, 0xe4, 0x77, 0x98);
mi.position = 300000;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_MAINMENU); // eternity #004
- mi.pszService = "MainMenu/Command";
+ mi.pszService = MS_CLIST_MAIN_MENU;
mi.name.a = LPGEN("&Main menu");
hTrayMainMenuItemProxy = Menu_AddTrayMenuItem(&mi);
SET_UID(mi, 0xbafb2db6, 0x8994, 0x40f5, 0x8f, 0x34, 0x4, 0xde, 0x67, 0x8e, 0x6e, 0x70);
mi.position = 300100;
mi.hIcolibItem = Skin_GetIconHandle(SKINICON_OTHER_STATUS); // eternity #004
- mi.pszService = "GlobalStatus/Command";
+ mi.pszService = MS_CLIST_STATUS_MENU;
mi.name.a = LPGEN("&Status");
hTrayStatusMenuItemProxy = Menu_AddTrayMenuItem(&mi);
diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index c30aa0d6b4..382e06136f 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "plugins.h"
static bool bIsGenMenuInited, bMenuLoaded = false;
-bool bIconsDisabled;
+bool g_bMenuIconsEnabled;
static mir_cs csMenuHook;
static int NextObjectId = 0x100, NextObjectMenuItemId = CLISTMENUIDMIN;
@@ -97,7 +97,7 @@ HBITMAP ConvertIconToBitmap(HIMAGELIST hIml, int iconId) endBufferedPaint = (pfnEndBufferedPaint)GetProcAddress(hThemeAPI, "EndBufferedPaint");
}
- BITMAPINFO bmi = { 0 };
+ BITMAPINFO bmi = {};
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biCompression = BI_RGB;
@@ -110,7 +110,7 @@ HBITMAP ConvertIconToBitmap(HIMAGELIST hIml, int iconId) HBITMAP hbmpOld = (HBITMAP)SelectObject(hdc, hbmp);
BLENDFUNCTION bfAlpha = { AC_SRC_OVER, 0, 255, AC_SRC_ALPHA };
- BP_PAINTPARAMS paintParams = { 0 };
+ BP_PAINTPARAMS paintParams = {};
paintParams.cbSize = sizeof(paintParams);
paintParams.dwFlags = BPPF_ERASE;
paintParams.pBlendFunction = &bfAlpha;
@@ -151,7 +151,7 @@ TMO_IntMenuItem* MO_RecursiveWalkMenu(const TMO_LinkedList &pList, pfnWalkFunc f MIR_APP_DLL(BOOL) Menu_MeasureItem(LPARAM lParam)
{
- if (!bIsGenMenuInited)
+ if (!bIsGenMenuInited || !g_bMenuIconsEnabled)
return FALSE;
MEASUREITEMSTRUCT *mis = (MEASUREITEMSTRUCT *)lParam;
@@ -174,7 +174,7 @@ MIR_APP_DLL(BOOL) Menu_MeasureItem(LPARAM lParam) MIR_APP_DLL(BOOL) Menu_DrawItem(LPARAM lParam)
{
- if (!bIsGenMenuInited)
+ if (!bIsGenMenuInited || !g_bMenuIconsEnabled)
return FALSE;
DRAWITEMSTRUCT *dis = (DRAWITEMSTRUCT *)lParam;
@@ -397,7 +397,7 @@ MIR_APP_DLL(int) Menu_ModifyItem(HGENMENU hMenuItem, const wchar_t *ptszName, HA pimi->mi.flags = (iFlags & 0x07) | oldflags;
}
- if (hIcolib != INVALID_HANDLE_VALUE && !bIconsDisabled) {
+ if (hIcolib != INVALID_HANDLE_VALUE && g_bMenuIconsEnabled) {
HANDLE hIcolibItem = IcoLib_IsManaged((HICON)hIcolib);
if (hIcolibItem) {
HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
@@ -563,10 +563,6 @@ MIR_APP_DLL(int) Menu_ConfigureObject(int hMenuObject, int setting, INT_PTR valu TIntMenuObject *pmo = GetMenuObjbyId(hMenuObject);
if (pmo != nullptr) {
switch (setting) {
- case MCO_OPT_ONADD_SERVICE:
- replaceStr(pmo->onAddService, (char*)value);
- return true;
-
case MCO_OPT_FREE_SERVICE:
replaceStr(pmo->FreeService, (char*)value);
return true;
@@ -860,7 +856,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs else
p->mi.name.w = mir_a2u(pmi->name.a);
- if (pmi->hIcon != nullptr && !bIconsDisabled) {
+ if (pmi->hIcon != nullptr && g_bMenuIconsEnabled) {
HANDLE hIcolibItem = IcoLib_IsManaged(pmi->hIcon);
if (hIcolibItem != nullptr) {
HICON hIcon = IcoLib_GetIconByHandle(hIcolibItem, false);
@@ -905,7 +901,7 @@ MIR_APP_DLL(HGENMENU) Menu_AddItem(int hMenuObject, TMO_MenuItem *pmi, void *pUs static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi)
{
- MENUITEMINFO mii = { 0 };
+ MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
for (int i = GetMenuItemCount(hMenu) - 1; i >= 0; i--) {
@@ -925,7 +921,7 @@ static int WhereToPlace(HMENU hMenu, TMO_MenuItem *mi) static uint32_t GetMenuItemType(HMENU hMenu, int uItem)
{
- MENUITEMINFO mii = { 0 };
+ MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_TYPE;
GetMenuItemInfo(hMenu, uItem, TRUE, &mii);
@@ -934,7 +930,7 @@ static uint32_t GetMenuItemType(HMENU hMenu, int uItem) static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, TMO_IntMenuItem *&p)
{
- MENUITEMINFO mii = { 0 };
+ MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_DATA | MIIM_TYPE;
GetMenuItemInfo(hMenu, uItem, TRUE, &mii);
@@ -944,7 +940,7 @@ static UINT GetMenuItemTypeData(HMENU hMenu, int uItem, TMO_IntMenuItem *&p) static void InsertSeparator(HMENU hMenu, int uItem)
{
- MENUITEMINFO mii = { 0 };
+ MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
mii.fMask = MIIM_TYPE;
mii.fType = MFT_SEPARATOR;
@@ -1073,24 +1069,8 @@ static void CALLBACK sttUpdateMenuService() db_set_b(0, szModule, "MenuFormat", true);
MO_RecursiveWalkMenu(pmo->m_items, sttDumpItem, szModule);
}
- else { // yes, menu is already converted, simply load its data
- for (int j = 0;; j++) {
- char szSetting[100];
- mir_snprintf(szSetting, "Custom%d", j);
- ptrA szCustomMenu(db_get_sa(0, szModule, szSetting));
- if (mir_strlen(szCustomMenu) != 32)
- break;
-
- TMO_MenuItem mi = {};
- mi.flags = CMIF_CUSTOM;
- mi.name.a = LPGEN("New submenu");
- mi.position = 500050000;
- hex2bin(szCustomMenu, &mi.uid, sizeof(MUUID));
- Menu_AddItem(pmo->id, &mi, nullptr);
- }
-
+ else // yes, menu is already converted, simply load its data
Menu_LoadAllFromDatabase(pmo->m_items, szModule);
- }
}
bMenuLoaded = true;
@@ -1127,13 +1107,13 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, const TMO_LinkedList &pList, WPARAM int i = WhereToPlace(hMenu, mi);
- MENUITEMINFO mii = { 0 };
+ MENUITEMINFO mii = {};
mii.cbSize = sizeof(mii);
mii.dwItemData = (LPARAM)pmi;
- mii.fMask = MIIM_DATA | MIIM_ID | MIIM_STRING;
- if (pmi->iconId != -1) {
+ mii.fMask = MIIM_DATA | MIIM_ID | MIIM_STRING | MIIM_STATE;
+ if (pmi->iconId != -1 && g_bMenuIconsEnabled) {
mii.fMask |= MIIM_BITMAP;
- if (IsWinVerVistaPlus() && IsThemeActive()) {
+ if (IsWinVerVistaPlus() && IsThemeActive() && !IsWine()) {
if (pmi->hBmp == nullptr)
pmi->hBmp = ConvertIconToBitmap(pmi->parent->m_hMenuIcons, pmi->iconId);
mii.hbmpItem = pmi->hBmp;
@@ -1141,7 +1121,6 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, const TMO_LinkedList &pList, WPARAM else mii.hbmpItem = HBMMENU_CALLBACK;
}
- mii.fMask |= MIIM_STATE;
mii.fState = ((pmi->mi.flags & CMIF_GRAYED) ? MFS_GRAYED : MFS_ENABLED);
mii.fState |= ((pmi->mi.flags & CMIF_CHECKED) ? MFS_CHECKED : MFS_UNCHECKED);
if (pmi->mi.flags & CMIF_DEFAULT)
@@ -1157,7 +1136,7 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, const TMO_LinkedList &pList, WPARAM #ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
wchar_t str[256];
- mir_snwprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
+ mir_snwprintf(str, L"%s (%d, id %x)", mi->name.w, mi->position, (int)mii.dwItemData);
mii.dwTypeData = str;
}
#endif
@@ -1171,14 +1150,20 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, const TMO_LinkedList &pList, WPARAM #ifdef PUTPOSITIONSONMENU
if (GetKeyState(VK_CONTROL) & 0x8000) {
wchar_t str[256];
- mir_snwprintf(str, L"%s (%d, id %x)", mi->name.a, mi->position, mii.dwItemData);
+ mir_snwprintf(str, L"%s (%d, id %x)", mi->name.w, mi->position, (int)mii.dwItemData);
mii.dwTypeData = str;
}
#endif
- if (pmo->onAddService != nullptr)
- if (CallService(pmo->onAddService, (WPARAM)&mii, (LPARAM)pmi) == FALSE)
- continue;
+ if (!mir_strcmp(pmi->mi.pszService, MS_CLIST_MAIN_MENU)) {
+ mii.fMask |= MIIM_SUBMENU;
+ mii.hSubMenu = Menu_GetMainMenu();
+ }
+
+ if (!mir_strcmp(pmi->mi.pszService, MS_CLIST_STATUS_MENU)) {
+ mii.fMask |= MIIM_SUBMENU;
+ mii.hSubMenu = Menu_GetStatusMenu();
+ }
InsertMenuItemWithSeparators(hMenu, i, &mii);
}
@@ -1231,8 +1216,8 @@ static int MO_ReloadIcon(TMO_IntMenuItem *pmi, const void *) int OnIconLibChanges(WPARAM, LPARAM)
{
- {
- mir_cslock lck(csMenuHook);
+ { mir_cslock lck(csMenuHook);
+
for (auto &p : g_menus)
if (hStatusMenuObject != p->id) //skip status menu
MO_RecursiveWalkMenu(p->m_items, MO_ReloadIcon);
@@ -1306,7 +1291,7 @@ static void CALLBACK RegisterAllIconsInIconLib() int InitGenMenu()
{
- bIconsDisabled = db_get_b(0, "CList", "DisableMenuIcons", 0) != 0;
+ g_bMenuIconsEnabled = !db_get_b(0, "CList", "DisableMenuIcons");
bIsGenMenuInited = true;
HookEvent(ME_OPT_INITIALISE, GenMenuOptInit);
@@ -1336,7 +1321,6 @@ TIntMenuObject::~TIntMenuObject() m_items.destroy();
mir_free(FreeService);
- mir_free(onAddService);
mir_free(CheckService);
mir_free(ExecService);
mir_free(ptszDisplayName);
diff --git a/src/mir_app/src/meta_addto.cpp b/src/mir_app/src/meta_addto.cpp index f6b2fc3db7..28fcaab294 100644 --- a/src/mir_app/src/meta_addto.cpp +++ b/src/mir_app/src/meta_addto.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/meta_api.cpp b/src/mir_app/src/meta_api.cpp index 0267e7ae2b..4221aebc0a 100644 --- a/src/mir_app/src/meta_api.cpp +++ b/src/mir_app/src/meta_api.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/meta_edit.cpp b/src/mir_app/src/meta_edit.cpp index 391bea02df..0c8bd3b760 100644 --- a/src/mir_app/src/meta_edit.cpp +++ b/src/mir_app/src/meta_edit.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/meta_main.cpp b/src/mir_app/src/meta_main.cpp index 509f1b10a8..2ec6936b94 100644 --- a/src/mir_app/src/meta_main.cpp +++ b/src/mir_app/src/meta_main.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/meta_menu.cpp b/src/mir_app/src/meta_menu.cpp index d9c085901b..b5ddf71562 100644 --- a/src/mir_app/src/meta_menu.cpp +++ b/src/mir_app/src/meta_menu.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/meta_options.cpp b/src/mir_app/src/meta_options.cpp index cabca5c8c1..d7f9ecb77d 100644 --- a/src/mir_app/src/meta_options.cpp +++ b/src/mir_app/src/meta_options.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/meta_services.cpp b/src/mir_app/src/meta_services.cpp index 7500ed6bdb..f05962311f 100644 --- a/src/mir_app/src/meta_services.cpp +++ b/src/mir_app/src/meta_services.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/meta_utils.cpp b/src/mir_app/src/meta_utils.cpp index c4baef1221..c6192a902e 100644 --- a/src/mir_app/src/meta_utils.cpp +++ b/src/mir_app/src/meta_utils.cpp @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/metacontacts.h b/src/mir_app/src/metacontacts.h index c5545b4e12..d3cdfd2794 100644 --- a/src/mir_app/src/metacontacts.h +++ b/src/mir_app/src/metacontacts.h @@ -1,7 +1,7 @@ /*
former MetaContacts Plugin for Miranda IM.
-Copyright © 2014-24 Miranda NG team
+Copyright © 2014-25 Miranda NG team
Copyright © 2004-07 Scott Ellis
Copyright © 2004 Universite Louis PASTEUR, STRASBOURG.
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index 215a4fa344..97535d048c 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -177,7 +177,6 @@ Clist_GroupSetFlags @256 Clist_GroupGetName @257
Clist_GroupRename @258
Clist_EndRebuild @259
-Clist_GroupAdded @260
?GetInfo@Contact@@YGPA_WHIPBD@Z @261 NONAME
Clist_ContactToHItem @262 NONAME
Clist_ContactToItemHandle @263
@@ -186,7 +185,6 @@ Window_SetIcon_IcoLib @265 Clist_Broadcast @266 NONAME
Clist_BroadcastAsync @267 NONAME
Clist_MenuProcessCommand @268
-Clist_IsDocked @269
Clist_MenuProcessHotkey @270
Clist_ContactChangeGroup @271
Clist_ContactCompare @272
@@ -268,7 +266,6 @@ Netlib_AddressToString @369 Netlib_StringToAddress @370
Netlib_Select @371
Netlib_SelectEx @372
-Netlib_SetStickyHeaders @374
Netlib_GetSocket @376
Netlib_StartSsl @377
Netlib_GetConnectionInfo @378
@@ -316,13 +313,15 @@ Chat_UpdateOptions @418 NONAME ?OnInitDialog@CSrmmBaseDialog@@MAE_NXZ @423 NONAME
?AddLog@CSrmmBaseDialog@@UAEXABULOGINFO@@@Z @425 NONAME
?UpdateNickList@CSrmmBaseDialog@@QAEXXZ @426 NONAME
-?onClick_BIU@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @430 NONAME
-?onClick_BkColor@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @431 NONAME
-?onClick_Color@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @432 NONAME
-?RefreshButtonStatus@CSrmmBaseDialog@@IAEXXZ @433 NONAME
-?ProcessHotkeys@CSrmmBaseDialog@@IAE_NH_N00@Z @434 NONAME
-?onClick_History@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @435 NONAME
-?onClick_ChanMgr@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @436 NONAME
+?onClick_BIU@CSrmmBaseDialog@@AAEXPAVCCtrlButton@@@Z @427 NONAME
+?onClick_BkColor@CSrmmBaseDialog@@AAEXPAVCCtrlButton@@@Z @428 NONAME
+?onClick_Color@CSrmmBaseDialog@@AAEXPAVCCtrlButton@@@Z @429 NONAME
+?onClick_ChanMgr@CSrmmBaseDialog@@AAEXPAVCCtrlButton@@@Z @430 NONAME
+?onClick_CloseQuote@CSrmmBaseDialog@@AAEXPAVCCtrlButton@@@Z @431 NONAME
+?onClick_Filter@CSrmmBaseDialog@@AAEXPAVCCtrlButton@@@Z @432 NONAME
+?onClick_History@CSrmmBaseDialog@@AAEXPAVCCtrlButton@@@Z @433 NONAME
+?RefreshButtonStatus@CSrmmBaseDialog@@IAEXXZ @436 NONAME
+?ProcessHotkeys@CSrmmBaseDialog@@IAE_NH_N00@Z @437 NONAME
?WndProc_Message@CSrmmBaseDialog@@UAEJIIJ@Z @438 NONAME
?WndProc_Nicklist@CSrmmBaseDialog@@UAEJIIJ@Z @439 NONAME
?onDblClick_List@CSrmmBaseDialog@@IAEXPAVCCtrlListBox@@@Z @440 NONAME
@@ -379,7 +378,7 @@ Srmm_GetColorTable @496 ?AddBySearch@Contact@@YGXPBDPAUPROTOSEARCHRESULT@@PAUHWND__@@@Z @499 NONAME
?setAllContactStatuses@PROTO_INTERFACE@@QAEXH_N@Z @500 NONAME
??0PROTO_INTERFACE@@QAE@PBDPB_W@Z @501 NONAME
-??1PROTO_INTERFACE@@QAE@XZ @502 NONAME
+??1PROTO_INTERFACE@@UAE@XZ @502 NONAME
Proto_AuthRecv @503
Image_Load @504
Image_LoadFromMem @505
@@ -485,7 +484,7 @@ Proto_GetStatus @601 ?IsReadyToExit@PROTO_INTERFACE@@UAE_NXZ @606 NONAME
?OnModulesLoaded@PROTO_INTERFACE@@UAEXXZ @607 NONAME
?OnShutdown@PROTO_INTERFACE@@UAEXXZ @608 NONAME
-?GetStatus@Contact@@YGHI@Z @609 NONAME
+?GetStatus@Contact@@YGHIPBD@Z @609 NONAME
?OnContactDeleted@PROTO_INTERFACE@@UAE_NII@Z @610 NONAME
?OnBuildProtoMenu@PROTO_INTERFACE@@UAEXXZ @611 NONAME
?OnErase@PROTO_INTERFACE@@UAEXXZ @612 NONAME
@@ -682,10 +681,10 @@ Netlib_Dump @812 NONAME ?ProtoBroadcastAsync@PROTO_INTERFACE@@QAEXIHHPAXJ@Z @813 NONAME
ProtoBroadcastAsync @814 NONAME
?ProcessFileDrop@CSrmmBaseDialog@@IAE_NPAUHDROP__@@I@Z @815 NONAME
-?ConfirmDelete@Clist@@3V?$CMOption@_N@@A @816 NONAME
-?HideEmptyGroups@Clist@@3V?$CMOption@_N@@A @817 NONAME
-?HideOffline@Clist@@3V?$CMOption@_N@@A @818 NONAME
-?UseGroups@Clist@@3V?$CMOption@_N@@A @819 NONAME
+?bConfirmDelete@Clist@@3V?$CMOption@_N@@A @816 NONAME
+?bHideEmptyGroups@Clist@@3V?$CMOption@_N@@A @817 NONAME
+?bHideOffline@Clist@@3V?$CMOption@_N@@A @818 NONAME
+?bUseGroups@Clist@@3V?$CMOption@_N@@A @819 NONAME
?OfflineModes@Clist@@3V?$CMOption@I@@A @820 NONAME
?getChat@CSrmmBaseDialog@@QBEPAUSESSION_INFO@@XZ @821 NONAME
?EventCursor@MDatabaseCommon@@UAGPAV0DB@@II@Z @822 NONAME
@@ -707,7 +706,7 @@ _Netlib_GetTlsUnique@12 @831 NONAME ?SafeDeleteDirectory@PU@@YGHPB_W@Z @838 NONAME
?SafeDeleteFile@PU@@YGHPB_W@Z @839 NONAME
?SafeMoveFile@PU@@YGHPB_W0@Z @840 NONAME
-?FilterSearch@Clist@@3V?$CMOption@_N@@A @841 NONAME
+?bFilterSearch@Clist@@3V?$CMOption@_N@@A @841 NONAME
?FillContactSettings@MDatabaseCommon@@IAEXXZ @842 NONAME
?GetContactSettingWorker@MDatabaseCommon@@MAGHIPBD0PAUDBVARIANT@@H@Z @843 NONAME
?WriteContactSetting@MDatabaseCommon@@UAGHIPBD0PAUDBVARIANT@@@Z @844 NONAME
@@ -726,8 +725,8 @@ _Netlib_GetTlsUnique@12 @831 NONAME ?usesPassword@MDatabaseCommon@@QBE_NXZ @857 NONAME
?SetPassword@MDatabaseCommon@@QAEXPB_W@Z @858 NONAME
?EnableEncryption@MDatabaseReadonly@@UAGHH@Z @859 NONAME
-?Tray1Click@Clist@@3V?$CMOption@_N@@A @860 NONAME
-?TrayAlwaysStatus@Clist@@3V?$CMOption@_N@@A @861 NONAME
+?bTray1Click@Clist@@3V?$CMOption@_N@@A @860 NONAME
+?bTrayAlwaysStatus@Clist@@3V?$CMOption@_N@@A @861 NONAME
?Flush@MDatabaseCommon@@UAGHXZ @862 NONAME
?getIcon@CHAT_MANAGER@@QBGPAUHICON__@@H@Z @863 NONAME
?getSoundName@SESSION_INFO@@QBEPBDH@Z @864 NONAME
@@ -760,7 +759,7 @@ Srmm_CreateHotkey @886 NONAME ??_7CUserInfoPageDlg@@6B@ @891 NONAME
?OnRefresh@CUserInfoPageDlg@@UAE_NXZ @892 NONAME
?SetContact@CUserInfoPageDlg@@QAEXI@Z @893 NONAME
-?IsGroupChat@Contact@@YG_NIPBD@Z @894 NONAME
+?IsGroupChat@Contact@@YGHIPBD@Z @894 NONAME
?IsEmpty@CUserInfoPageDlg@@UBE_NXZ @895 NONAME
?bContactStatusFirst@Chat@@3V?$CMOption@_N@@A @896 NONAME
?bDoubleClick4Privat@Chat@@3V?$CMOption@_N@@A @897 NONAME
@@ -885,7 +884,6 @@ Clist_GroupSaveExpanded @1003 NONAME ??0MAsyncObject@@QAE@XZ @1016 NONAME
??1MAsyncObject@@UAE@XZ @1017 NONAME
??_7MAsyncObject@@6B@ @1018 NONAME
-?bEnableCustomLogs@Chat@@3V?$CMOption@_N@@A @1019 NONAME
?Srmm_IsCustomLogUsed@@YG_N_N@Z @1020 NONAME
?IconFlashTime@Clist@@3V?$CMOption@I@@A @1021 NONAME
?Srmm_Quote@@YG?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PB_WH@Z @1022 NONAME
@@ -893,14 +891,13 @@ Clist_GroupSaveExpanded @1003 NONAME ?GetInput@CSrmmBaseDialog@@QBEPAUHWND__@@XZ @1024 NONAME
?Srmm_ApplyOptions@@YGXXZ @1025 NONAME
?OnOptionsApplied@CSrmmBaseDialog@@UAEXXZ @1026 NONAME
-?Srmm_GetWindowClass@@YGPAUSrmmLogWindowClass@@PAVCMsgDialog@@@Z @1027 NONAME
+?Srmm_GetWindowClass@@YGPAUSrmmLogWindowClass@@_NI@Z @1027 NONAME
?addColor@CMPluginBase@@QAEHPBD0PB_W1K@Z @1028 NONAME
?addFont@CMPluginBase@@QAEHPBD0PB_W111HHPAUtagLOGFONTW@@K@Z @1029 NONAME
?IsReadonly@Contact@@YG_NI@Z @1030 NONAME
?Readonly@Contact@@YGXI_N@Z @1031 NONAME
?addButton@CMPluginBase@@QAEPAXPBUBBButton@@@Z @1032 NONAME
?SetQuoteEvent@CSrmmBaseDialog@@QAEXI@Z @1033 NONAME
-?onClick_CloseQuote@CSrmmBaseDialog@@IAEXPAVCCtrlButton@@@Z @1034 NONAME
?fetch@EventInfo@DB@@QAE_N_N@Z @1035 NONAME
?unload@EventInfo@DB@@QAEXXZ @1036 NONAME
?isAlertable@EventInfo@DB@@QBE_NXZ @1037 NONAME
@@ -995,3 +992,33 @@ Proto_CanDeleteHistory @1118 NONAME ?RemakeLog@CSrmmBaseDialog@@UAEXXZ @1126 NONAME
?ProcessToolbarHotkey@CSrmmBaseDialog@@AAEXH@Z @1127 NONAME
?iHistoryMode@Srmm@@3V?$CMOption@E@@A @1128 NONAME
+?getConn@MWebSocket@@QBEPAUNetlibConnection@@XZ @1129 NONAME
+?Chat_GetStatus@@YGPAUSTATUSINFO@@PAUSESSION_INFO@@PBUUSERINFO@@@Z @1130 NONAME
+?SetBirthday@Contact@@YGXIHHH@Z @1131 NONAME
+??0JsonReply@@QAE@PAUMHttpResponse@@@Z @1132 NONAME
+??1JsonReply@@QAE@XZ @1133 NONAME
+?data@JsonReply@@QBEAAVJSONNode@@XZ @1134 NONAME
+?error@JsonReply@@QBEHXZ @1135 NONAME
+??BJsonReply@@QBE_NXZ @1136 NONAME
+??6@YGPAUMHttpRequest@@PAU0@ABUBOOL_PARAM@@@Z @1137 NONAME
+?bShowFormatting@Chat@@3V?$CMOption@_N@@A @1138 NONAME
+?setDescr@FILE_BLOB@DB@@QAEXPB_W@Z @1139 NONAME
+?bShowMainMenu@Clist@@3V?$CMOption@_N@@A @1140 NONAME
+?bShowCaption@Clist@@3V?$CMOption@_N@@A @1141 NONAME
+?bToolWindow@Clist@@3V?$CMOption@_N@@A @1142 NONAME
+?bClientAreaDrag@Clist@@3V?$CMOption@_N@@A @1143 NONAME
+?bOnTop@Clist@@3V?$CMOption@_N@@A @1144 NONAME
+?bAlwaysMulti@Clist@@3V?$CMOption@_N@@A @1145 NONAME
+?bAutoHide@Clist@@3V?$CMOption@_N@@A @1146 NONAME
+?bMinimizeToTray@Clist@@3V?$CMOption@_N@@A @1147 NONAME
+?bTransparent@Clist@@3V?$CMOption@_N@@A @1148 NONAME
+?iTrayIcon@Clist@@3V?$CMOption@E@@A @1149 NONAME
+?bBringToFront@Clist@@3V?$CMOption@_N@@A @1150 NONAME
+?iCycleTime@Clist@@3V?$CMOption@G@@A @1151 NONAME
+?iHideTime@Clist@@3V?$CMOption@G@@A @1152 NONAME
+?iAlpha@Clist@@3V?$CMOption@E@@A @1153 NONAME
+?iAutoAlpha@Clist@@3V?$CMOption@E@@A @1154 NONAME
+?SetEventJson@MDatabaseCommon@@UAGHIPBD@Z @1155 NONAME
+?setReactions@EventInfo@DB@@QAEXAAVJSONNode@@@Z @1156 NONAME
+?bOfflineAuto@File@@3V?$CMOption@_N@@A @1157 NONAME
+?iOfflineSize@File@@3V?$CMOption@I@@A @1158 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index 7e0ae68dec..6a088195e9 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -177,7 +177,6 @@ Clist_GroupSetFlags @256 Clist_GroupGetName @257
Clist_GroupRename @258
Clist_EndRebuild @259
-Clist_GroupAdded @260
?GetInfo@Contact@@YAPEA_WHIPEBD@Z @261 NONAME
Clist_ContactToHItem @262 NONAME
Clist_ContactToItemHandle @263 NONAME
@@ -186,7 +185,6 @@ Window_SetIcon_IcoLib @265 Clist_Broadcast @266 NONAME
Clist_BroadcastAsync @267 NONAME
Clist_MenuProcessCommand @268
-Clist_IsDocked @269
Clist_MenuProcessHotkey @270
Clist_ContactChangeGroup @271
Clist_ContactCompare @272
@@ -268,7 +266,6 @@ Netlib_AddressToString @369 Netlib_StringToAddress @370
Netlib_Select @371
Netlib_SelectEx @372
-Netlib_SetStickyHeaders @374
Netlib_GetSocket @376
Netlib_StartSsl @377
Netlib_GetConnectionInfo @378
@@ -316,13 +313,15 @@ Chat_UpdateOptions @418 NONAME ?OnInitDialog@CSrmmBaseDialog@@MEAA_NXZ @423 NONAME
?AddLog@CSrmmBaseDialog@@UEAAXAEBULOGINFO@@@Z @425 NONAME
?UpdateNickList@CSrmmBaseDialog@@QEAAXXZ @426 NONAME
-?onClick_BIU@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @430 NONAME
-?onClick_BkColor@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @431 NONAME
-?onClick_Color@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @432 NONAME
-?RefreshButtonStatus@CSrmmBaseDialog@@IEAAXXZ @433 NONAME
-?ProcessHotkeys@CSrmmBaseDialog@@IEAA_NH_N00@Z @434 NONAME
-?onClick_History@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @435 NONAME
-?onClick_ChanMgr@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @436 NONAME
+?onClick_BIU@CSrmmBaseDialog@@AEAAXPEAVCCtrlButton@@@Z @427 NONAME
+?onClick_BkColor@CSrmmBaseDialog@@AEAAXPEAVCCtrlButton@@@Z @428 NONAME
+?onClick_ChanMgr@CSrmmBaseDialog@@AEAAXPEAVCCtrlButton@@@Z @429 NONAME
+?onClick_CloseQuote@CSrmmBaseDialog@@AEAAXPEAVCCtrlButton@@@Z @430 NONAME
+?onClick_Color@CSrmmBaseDialog@@AEAAXPEAVCCtrlButton@@@Z @431 NONAME
+?onClick_Filter@CSrmmBaseDialog@@AEAAXPEAVCCtrlButton@@@Z @432 NONAME
+?onClick_History@CSrmmBaseDialog@@AEAAXPEAVCCtrlButton@@@Z @433 NONAME
+?RefreshButtonStatus@CSrmmBaseDialog@@IEAAXXZ @436 NONAME
+?ProcessHotkeys@CSrmmBaseDialog@@IEAA_NH_N00@Z @437 NONAME
?WndProc_Message@CSrmmBaseDialog@@UEAA_JI_K_J@Z @438 NONAME
?WndProc_Nicklist@CSrmmBaseDialog@@UEAA_JI_K_J@Z @439 NONAME
?onDblClick_List@CSrmmBaseDialog@@IEAAXPEAVCCtrlListBox@@@Z @440 NONAME
@@ -379,7 +378,7 @@ Srmm_GetColorTable @496 ?AddBySearch@Contact@@YAXPEBDPEAUPROTOSEARCHRESULT@@PEAUHWND__@@@Z @499 NONAME
?setAllContactStatuses@PROTO_INTERFACE@@QEAAXH_N@Z @500 NONAME
??0PROTO_INTERFACE@@QEAA@PEBDPEB_W@Z @501 NONAME
-??1PROTO_INTERFACE@@QEAA@XZ @502 NONAME
+??1PROTO_INTERFACE@@UEAA@XZ @502 NONAME
Proto_AuthRecv @503
Image_Load @504
Image_LoadFromMem @505
@@ -485,7 +484,7 @@ Proto_GetStatus @601 ?IsReadyToExit@PROTO_INTERFACE@@UEAA_NXZ @606 NONAME
?OnModulesLoaded@PROTO_INTERFACE@@UEAAXXZ @607 NONAME
?OnShutdown@PROTO_INTERFACE@@UEAAXXZ @608 NONAME
-?GetStatus@Contact@@YAHI@Z @609 NONAME
+?GetStatus@Contact@@YAHIPEBD@Z @609 NONAME
?OnContactDeleted@PROTO_INTERFACE@@UEAA_NII@Z @610 NONAME
?OnBuildProtoMenu@PROTO_INTERFACE@@UEAAXXZ @611 NONAME
?OnErase@PROTO_INTERFACE@@UEAAXXZ @612 NONAME
@@ -682,10 +681,10 @@ Netlib_Dump @812 NONAME ?ProtoBroadcastAsync@PROTO_INTERFACE@@QEAAXIHHPEAX_J@Z @813 NONAME
ProtoBroadcastAsync @814 NONAME
?ProcessFileDrop@CSrmmBaseDialog@@IEAA_NPEAUHDROP__@@I@Z @815 NONAME
-?ConfirmDelete@Clist@@3V?$CMOption@_N@@A @816 NONAME
-?HideEmptyGroups@Clist@@3V?$CMOption@_N@@A @817 NONAME
-?HideOffline@Clist@@3V?$CMOption@_N@@A @818 NONAME
-?UseGroups@Clist@@3V?$CMOption@_N@@A @819 NONAME
+?bConfirmDelete@Clist@@3V?$CMOption@_N@@A @816 NONAME
+?bHideEmptyGroups@Clist@@3V?$CMOption@_N@@A @817 NONAME
+?bHideOffline@Clist@@3V?$CMOption@_N@@A @818 NONAME
+?bUseGroups@Clist@@3V?$CMOption@_N@@A @819 NONAME
?OfflineModes@Clist@@3V?$CMOption@I@@A @820 NONAME
?getChat@CSrmmBaseDialog@@QEBAPEAUSESSION_INFO@@XZ @821 NONAME
?EventCursor@MDatabaseCommon@@UEAAPEAV0DB@@II@Z @822 NONAME
@@ -707,7 +706,7 @@ Netlib_GetTlsUnique @831 NONAME ?SafeDeleteDirectory@PU@@YAHPEB_W@Z @838 NONAME
?SafeDeleteFile@PU@@YAHPEB_W@Z @839 NONAME
?SafeMoveFile@PU@@YAHPEB_W0@Z @840 NONAME
-?FilterSearch@Clist@@3V?$CMOption@_N@@A @841 NONAME
+?bFilterSearch@Clist@@3V?$CMOption@_N@@A @841 NONAME
?FillContactSettings@MDatabaseCommon@@IEAAXXZ @842 NONAME
?GetContactSettingWorker@MDatabaseCommon@@MEAAHIPEBD0PEAUDBVARIANT@@H@Z @843 NONAME
?WriteContactSetting@MDatabaseCommon@@UEAAHIPEBD0PEAUDBVARIANT@@@Z @844 NONAME
@@ -726,8 +725,8 @@ Netlib_GetTlsUnique @831 NONAME ?usesPassword@MDatabaseCommon@@QEBA_NXZ @857 NONAME
?SetPassword@MDatabaseCommon@@QEAAXPEB_W@Z @858 NONAME
?EnableEncryption@MDatabaseReadonly@@UEAAHH@Z @859 NONAME
-?Tray1Click@Clist@@3V?$CMOption@_N@@A @860 NONAME
-?TrayAlwaysStatus@Clist@@3V?$CMOption@_N@@A @861 NONAME
+?bTray1Click@Clist@@3V?$CMOption@_N@@A @860 NONAME
+?bTrayAlwaysStatus@Clist@@3V?$CMOption@_N@@A @861 NONAME
?Flush@MDatabaseCommon@@UEAAHXZ @862 NONAME
?getIcon@CHAT_MANAGER@@QEBAPEAUHICON__@@H@Z @863 NONAME
?getSoundName@SESSION_INFO@@QEBAPEBDH@Z @864 NONAME
@@ -760,7 +759,7 @@ Srmm_CreateHotkey @886 NONAME ??_7CUserInfoPageDlg@@6B@ @891 NONAME
?OnRefresh@CUserInfoPageDlg@@UEAA_NXZ @892 NONAME
?SetContact@CUserInfoPageDlg@@QEAAXI@Z @893 NONAME
-?IsGroupChat@Contact@@YA_NIPEBD@Z @894 NONAME
+?IsGroupChat@Contact@@YAHIPEBD@Z @894 NONAME
?IsEmpty@CUserInfoPageDlg@@UEBA_NXZ @895 NONAME
?bContactStatusFirst@Chat@@3V?$CMOption@_N@@A @896 NONAME
?bDoubleClick4Privat@Chat@@3V?$CMOption@_N@@A @897 NONAME
@@ -885,7 +884,6 @@ Clist_GroupSaveExpanded @1003 NONAME ??0MAsyncObject@@QEAA@XZ @1016 NONAME
??1MAsyncObject@@UEAA@XZ @1017 NONAME
??_7MAsyncObject@@6B@ @1018 NONAME
-?bEnableCustomLogs@Chat@@3V?$CMOption@_N@@A @1019 NONAME
?Srmm_IsCustomLogUsed@@YA_N_N@Z @1020 NONAME
?IconFlashTime@Clist@@3V?$CMOption@I@@A @1021 NONAME
?Srmm_Quote@@YA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PEB_WH@Z @1022 NONAME
@@ -893,14 +891,13 @@ Clist_GroupSaveExpanded @1003 NONAME ?GetInput@CSrmmBaseDialog@@QEBAPEAUHWND__@@XZ @1024 NONAME
?Srmm_ApplyOptions@@YAXXZ @1025 NONAME
?OnOptionsApplied@CSrmmBaseDialog@@UEAAXXZ @1026 NONAME
-?Srmm_GetWindowClass@@YAPEAUSrmmLogWindowClass@@PEAVCMsgDialog@@@Z @1027 NONAME
+?Srmm_GetWindowClass@@YAPEAUSrmmLogWindowClass@@_NI@Z @1027 NONAME
?addColor@CMPluginBase@@QEAAHPEBD0PEB_W1K@Z @1028 NONAME
?addFont@CMPluginBase@@QEAAHPEBD0PEB_W111HHPEAUtagLOGFONTW@@K@Z @1029 NONAME
?IsReadonly@Contact@@YA_NI@Z @1030 NONAME
?Readonly@Contact@@YAXI_N@Z @1031 NONAME
?addButton@CMPluginBase@@QEAAPEAXPEBUBBButton@@@Z @1032 NONAME
?SetQuoteEvent@CSrmmBaseDialog@@QEAAXI@Z @1033 NONAME
-?onClick_CloseQuote@CSrmmBaseDialog@@IEAAXPEAVCCtrlButton@@@Z @1034 NONAME
?fetch@EventInfo@DB@@QEAA_N_N@Z @1035 NONAME
?unload@EventInfo@DB@@QEAAXXZ @1036 NONAME
?isAlertable@EventInfo@DB@@QEBA_NXZ @1037 NONAME
@@ -995,3 +992,33 @@ Proto_CanDeleteHistory @1118 NONAME ?RemakeLog@CSrmmBaseDialog@@UEAAXXZ @1126 NONAME
?ProcessToolbarHotkey@CSrmmBaseDialog@@AEAAX_J@Z @1127 NONAME
?iHistoryMode@Srmm@@3V?$CMOption@E@@A @1128 NONAME
+?getConn@MWebSocket@@QEBAPEAUNetlibConnection@@XZ @1129 NONAME
+?Chat_GetStatus@@YAPEAUSTATUSINFO@@PEAUSESSION_INFO@@PEBUUSERINFO@@@Z @1130 NONAME
+?SetBirthday@Contact@@YAXIHHH@Z @1131 NONAME
+??0JsonReply@@QEAA@PEAUMHttpResponse@@@Z @1132 NONAME
+??1JsonReply@@QEAA@XZ @1133 NONAME
+?data@JsonReply@@QEBAAEAVJSONNode@@XZ @1134 NONAME
+?error@JsonReply@@QEBAHXZ @1135 NONAME
+??BJsonReply@@QEBA_NXZ @1136 NONAME
+??6@YAPEAUMHttpRequest@@PEAU0@AEBUBOOL_PARAM@@@Z @1137 NONAME
+?bShowFormatting@Chat@@3V?$CMOption@_N@@A @1138 NONAME
+?setDescr@FILE_BLOB@DB@@QEAAXPEB_W@Z @1139 NONAME
+?bShowMainMenu@Clist@@3V?$CMOption@_N@@A @1140 NONAME
+?bShowCaption@Clist@@3V?$CMOption@_N@@A @1141 NONAME
+?bToolWindow@Clist@@3V?$CMOption@_N@@A @1142 NONAME
+?bClientAreaDrag@Clist@@3V?$CMOption@_N@@A @1143 NONAME
+?bOnTop@Clist@@3V?$CMOption@_N@@A @1144 NONAME
+?bAlwaysMulti@Clist@@3V?$CMOption@_N@@A @1145 NONAME
+?bAutoHide@Clist@@3V?$CMOption@_N@@A @1146 NONAME
+?bMinimizeToTray@Clist@@3V?$CMOption@_N@@A @1147 NONAME
+?bTransparent@Clist@@3V?$CMOption@_N@@A @1148 NONAME
+?iTrayIcon@Clist@@3V?$CMOption@E@@A @1149 NONAME
+?bBringToFront@Clist@@3V?$CMOption@_N@@A @1150 NONAME
+?iCycleTime@Clist@@3V?$CMOption@G@@A @1151 NONAME
+?iHideTime@Clist@@3V?$CMOption@G@@A @1152 NONAME
+?iAlpha@Clist@@3V?$CMOption@E@@A @1153 NONAME
+?iAutoAlpha@Clist@@3V?$CMOption@E@@A @1154 NONAME
+?SetEventJson@MDatabaseCommon@@UEAAHIPEBD@Z @1155 NONAME
+?setReactions@EventInfo@DB@@QEAAXAEAVJSONNode@@@Z @1156 NONAME
+?bOfflineAuto@File@@3V?$CMOption@_N@@A @1157 NONAME
+?iOfflineSize@File@@3V?$CMOption@I@@A @1158 NONAME
diff --git a/src/mir_app/src/miranda.cpp b/src/mir_app/src/miranda.cpp index 70578d752a..e12931cb53 100644 --- a/src/mir_app/src/miranda.cpp +++ b/src/mir_app/src/miranda.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index 98cb552ef7..099f40736c 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -115,7 +115,7 @@ void Clist_RemoveContactEvent(MCONTACT hContact); extern int hMainMenuObject, hContactMenuObject, hStatusMenuObject;
extern HANDLE hPreBuildMainMenuEvent, hPreBuildContactMenuEvent;
-extern HMENU hMainMenu, hStatusMenu;
+extern HMENU g_hMainMenu, g_hStatusMenu;
struct MStatus
{
diff --git a/src/mir_app/src/modules.cpp b/src/mir_app/src/modules.cpp index 9f34f27781..bc5103103d 100644 --- a/src/mir_app/src/modules.cpp +++ b/src/mir_app/src/modules.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/movetogroup.cpp b/src/mir_app/src/movetogroup.cpp index fb44db7ef2..bc47eb2103 100644 --- a/src/mir_app/src/movetogroup.cpp +++ b/src/mir_app/src/movetogroup.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -74,8 +74,6 @@ static HGENMENU AddGroupItem(HGENMENU hRoot, wchar_t* name, int pos, WPARAM para // wparam - hcontact
// lparam .popupposition from TMO_MenuItem
-extern LIST<CGroupInternal> arByIds;
-
static int OnContactMenuBuild(WPARAM wParam, LPARAM)
{
for (auto &p : lphGroupsItems)
@@ -91,8 +89,12 @@ static int OnContactMenuBuild(WPARAM wParam, LPARAM) pos += 100000; // Separator
OBJLIST<GroupItemSort> groups(10, GroupItemSort::compare);
- for (auto &it : arByIds)
- groups.insert(new GroupItemSort(it->groupName, it->groupId+1));
+ for (MGROUP hGroup = 1;; hGroup++) {
+ if (auto *pwszGroupName = Clist_GroupGetName(hGroup))
+ groups.insert(new GroupItemSort(pwszGroupName, hGroup));
+ else
+ break;
+ }
for (auto &p : groups) {
bool checked = szContactGroup && !mir_wstrcmp(szContactGroup, p->name);
diff --git a/src/mir_app/src/netlib.cpp b/src/mir_app/src/netlib.cpp index 954503ec51..ae598ef1f8 100644 --- a/src/mir_app/src/netlib.cpp +++ b/src/mir_app/src/netlib.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -299,7 +299,6 @@ MIR_APP_DLL(int) Netlib_CloseHandle(HANDLE hNetlib) NetlibFreeUserSettingsStruct(&nlu->settings);
mir_free(nlu->user.szSettingsModule);
mir_free(nlu->user.szDescriptiveName.a);
- mir_free(nlu->szStickyHeaders);
}
break;
diff --git a/src/mir_app/src/netlib.h b/src/mir_app/src/netlib.h index 26e82a91c8..7bca928da3 100644 --- a/src/mir_app/src/netlib.h +++ b/src/mir_app/src/netlib.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -38,7 +38,6 @@ struct NetlibUser int handleType;
NETLIBUSER user;
NETLIBUSERSETTINGS settings;
- char *szStickyHeaders;
int toLog;
int inportnum;
int outportnum;
@@ -206,7 +205,7 @@ bool BindSocketToPort(const char *szPorts, SOCKET s, SOCKET s6, int* portn); void NetlibHttpSetLastErrorUsingHttpResult(int result);
int Netlib_SendHttpRequest(HNETLIBCONN hConnection, MHttpRequest *pRec, MChunkHandler &pHandler);
-MHttpResponse* NetlibHttpRecv(NetlibConnection *nlc, uint32_t hflags, uint32_t dflags, MChunkHandler &pHandler, bool isConnect = false);
+MHttpResponse* NetlibHttpRecv(NetlibConnection *nlc, MChunkHandler &pHandler, int flags, bool isConnect = false);
// netliblog.cpp
void NetlibLogShowOptions(void);
diff --git a/src/mir_app/src/netlib_autoproxy.cpp b/src/mir_app/src/netlib_autoproxy.cpp index e20577b02d..dd86848be8 100644 --- a/src/mir_app/src/netlib_autoproxy.cpp +++ b/src/mir_app/src/netlib_autoproxy.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/netlib_bind.cpp b/src/mir_app/src/netlib_bind.cpp index 079d55df64..703ecb2200 100644 --- a/src/mir_app/src/netlib_bind.cpp +++ b/src/mir_app/src/netlib_bind.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/netlib_http.cpp b/src/mir_app/src/netlib_http.cpp index 27f7d17687..50e3cf6bc2 100644 --- a/src/mir_app/src/netlib_http.cpp +++ b/src/mir_app/src/netlib_http.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -95,10 +95,64 @@ EXTERN_C MIR_APP_DLL(bool) Netlib_FreeHttpRequest(MHttpResponse *nlhr) /////////////////////////////////////////////////////////////////////////////////////////
+static const char *secureWords[] = { "token", "password" };
+
+static bool isSecureStr(const char *str)
+{
+ for (auto &it : secureWords)
+ if (StrStrIA(str, it))
+ return true;
+
+ return false;
+}
+
+static void DumpHttpHeaders(HNETLIBCONN nlc, MHttpHeaders *nlhr, int flags, const char *pszInitStr)
+{
+ int dumpflags = (flags & NLHRF_DUMPASTEXT) ? MSG_DUMPASTEXT : 0;
+
+ int blockMask = NLHRF_NODUMP | NLHRF_NODUMPHEADERS | (pszInitStr ? NLHRF_NODUMPSEND : 0);
+ if (flags & blockMask)
+ dumpflags |= MSG_NODUMP;
+ else if (flags & NLHRF_DUMPPROXY)
+ dumpflags |= MSG_DUMPPROXY;
+ else if (flags & NLHRF_NOPROXY)
+ dumpflags |= MSG_RAW;
+
+ CMStringA str(pszInitStr ? pszInitStr : "");
+ for (auto &it: *nlhr) {
+ if (it->szValue == nullptr)
+ continue;
+
+ if (!mir_strcmp(it->szName, "Authorization") || isSecureStr(it->szName) || isSecureStr(it->szValue))
+ str.AppendFormat("%s: %s\r\n", it->szName.get(), "<secure>");
+ else
+ str.AppendFormat("%s: %s\r\n", it->szName.get(), it->szValue.get());
+ }
+ str.Append("\r\n");
+
+ Netlib_Dump(nlc, str, str.GetLength(), pszInitStr != 0, dumpflags);
+}
+
+static void DumpHttpBody(HNETLIBCONN nlc, const CMStringA &body, int flags, bool bSend)
+{
+ int dumpflags = MSG_NOTITLE | ((flags & NLHRF_DUMPASTEXT) ? MSG_DUMPASTEXT : 0);
+
+ if (flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND))
+ dumpflags |= MSG_NODUMP;
+ else if (flags & NLHRF_DUMPPROXY)
+ dumpflags |= MSG_DUMPPROXY;
+ else if (flags & NLHRF_NOPROXY)
+ dumpflags |= MSG_RAW;
+
+ Netlib_Dump(nlc, body, body.GetLength(), bSend, dumpflags);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static int RecvWithTimeoutTime(NetlibConnection *nlc, uint32_t dwTimeoutTime, char *buf, int len, int flags)
{
if (!nlc->foreBuf.isEmpty() || Netlib_SslPending(nlc->hSsl))
- return Netlib_Recv(nlc, buf, len, flags);
+ return Netlib_Recv(nlc, buf, len, flags | MSG_NODUMP);
uint32_t dwTimeNow;
while ((dwTimeNow = GetTickCount()) < dwTimeoutTime) {
@@ -110,7 +164,7 @@ static int RecvWithTimeoutTime(NetlibConnection *nlc, uint32_t dwTimeoutTime, ch return SOCKET_ERROR;
case 1:
- return Netlib_Recv(nlc, buf, len, flags);
+ return Netlib_Recv(nlc, buf, len, flags | MSG_NODUMP);
}
if (nlc->termRequested || Miranda_IsTerminated())
@@ -275,13 +329,13 @@ struct HttpSecurityContext }
};
-static int HttpPeekFirstResponseLine(NetlibConnection *nlc, uint32_t dwTimeoutTime, uint32_t recvFlags, int *resultCode, char **ppszResultDescr, int *length)
+static int HttpPeekFirstResponseLine(NetlibConnection *nlc, uint32_t dwTimeoutTime, int *resultCode, char **ppszResultDescr, int *length)
{
int bytesPeeked;
char buffer[2048], *peol;
while (true) {
- bytesPeeked = RecvWithTimeoutTime(nlc, dwTimeoutTime, buffer, _countof(buffer) - 1, MSG_PEEK | recvFlags);
+ bytesPeeked = RecvWithTimeoutTime(nlc, dwTimeoutTime, buffer, _countof(buffer) - 1, MSG_PEEK);
if (bytesPeeked == 0) {
SetLastError(ERROR_HANDLE_EOF);
return 0;
@@ -340,35 +394,6 @@ static int HttpPeekFirstResponseLine(NetlibConnection *nlc, uint32_t dwTimeoutTi return 1;
}
-static int SendHttpRequestAndData(NetlibConnection *nlc, CMStringA &httpRequest, MHttpRequest *nlhr, int sendContentLengthHeader)
-{
- bool sendData = (nlhr->requestType == REQUEST_POST || nlhr->requestType == REQUEST_PUT || nlhr->requestType == REQUEST_PATCH);
-
- if (sendContentLengthHeader && sendData)
- httpRequest.AppendFormat("Content-Length: %d\r\n\r\n", nlhr->m_szParam.GetLength());
- else
- httpRequest.AppendFormat("\r\n");
-
- uint32_t hflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
- (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND | NLHRF_NODUMPHEADERS) ?
- MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
- (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
-
- int bytesSent = Netlib_Send(nlc, httpRequest, httpRequest.GetLength(), hflags);
- if (bytesSent != SOCKET_ERROR && sendData && nlhr->m_szParam.GetLength()) {
- uint32_t sflags = MSG_NOTITLE | (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
- (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND) ?
- MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
- (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
-
- int sendResult = Netlib_Send(nlc, nlhr->m_szParam, nlhr->m_szParam.GetLength(), sflags);
-
- bytesSent = sendResult != SOCKET_ERROR ? bytesSent + sendResult : SOCKET_ERROR;
- }
-
- return bytesSent;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// Receives HTTP headers
//
@@ -398,26 +423,28 @@ static MHttpResponse* Netlib_RecvHttpHeaders(NetlibConnection *nlc, int flags) nlhr->nlc = nlc; // Needed to id connection in the protocol HTTP gateway wrapper functions
int firstLineLength = 0;
- if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, flags | MSG_PEEK, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) {
+ if (!HttpPeekFirstResponseLine(nlc, dwRequestTimeoutTime, &nlhr->resultCode, &nlhr->szResultDescr, &firstLineLength)) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
return nullptr;
}
char *buffer = (char *)_alloca(NHRV_BUF_SIZE + 1);
- int bytesPeeked = Netlib_Recv(nlc, buffer, min(firstLineLength, NHRV_BUF_SIZE), flags | MSG_DUMPASTEXT);
+ int bytesPeeked = Netlib_Recv(nlc, buffer, min(firstLineLength, NHRV_BUF_SIZE), MSG_NODUMP);
if (bytesPeeked != firstLineLength) {
NetlibLeaveNestedCS(&nlc->ncsRecv);
if (bytesPeeked != SOCKET_ERROR)
SetLastError(ERROR_HANDLE_EOF);
return nullptr;
}
+
+ CMStringA szFirstLine(buffer, firstLineLength);
// Make sure all headers arrived
MBinBuffer buf;
int headersCount = 0;
bytesPeeked = 0;
for (bool headersCompleted = false; !headersCompleted;) {
- bytesPeeked = RecvWithTimeoutTime(nlc, dwRequestTimeoutTime, buffer, NHRV_BUF_SIZE, flags | MSG_DUMPASTEXT | MSG_NOTITLE);
+ bytesPeeked = RecvWithTimeoutTime(nlc, dwRequestTimeoutTime, buffer, NHRV_BUF_SIZE, 0);
if (bytesPeeked == 0)
break;
@@ -465,6 +492,8 @@ static MHttpResponse* Netlib_RecvHttpHeaders(NetlibConnection *nlc, int flags) pbuffer = peol + 1;
}
+ DumpHttpHeaders(nlc, nlhr.get(), flags, szFirstLine);
+
// remove processed data
buf.remove(bytesPeeked);
nlc->foreBuf.appendBefore(buf.data(), buf.length());
@@ -594,6 +623,7 @@ int Netlib_SendHttpRequest(HNETLIBCONN nlc, MHttpRequest *nlhr, MChunkHandler &p CMStringA httpRequest(FORMAT, "%s %s HTTP/1.%d\r\n", pszRequest, pszUrl, (nlhr->flags & NLHRF_HTTP11) != 0);
// HTTP headers
+ bool bSendData = (nlhr->requestType == REQUEST_POST || nlhr->requestType == REQUEST_PUT || nlhr->requestType == REQUEST_PATCH);
bool doneHostHeader = false, doneContentLengthHeader = false, doneProxyAuthHeader = false, doneAuthHeader = false, doneConnection = false;
for (auto &it : *nlhr) {
if (!mir_strcmpi(it->szName, "Host")) doneHostHeader = true;
@@ -601,25 +631,38 @@ int Netlib_SendHttpRequest(HNETLIBCONN nlc, MHttpRequest *nlhr, MChunkHandler &p else if (!mir_strcmpi(it->szName, "Proxy-Authorization")) doneProxyAuthHeader = true;
else if (!mir_strcmpi(it->szName, "Authorization")) doneAuthHeader = true;
else if (!mir_strcmpi(it->szName, "Connection")) doneConnection = true;
- if (it->szValue == nullptr) continue;
- httpRequest.AppendFormat("%s: %s\r\n", it->szName.get(), it->szValue.get());
}
if (szHost && !doneHostHeader)
- httpRequest.AppendFormat("%s: %s\r\n", "Host", szHost);
+ nlhr->AddHeader("Host", szHost);
if (pszProxyAuthHdr && !doneProxyAuthHeader)
- httpRequest.AppendFormat("%s: %s\r\n", "Proxy-Authorization", pszProxyAuthHdr);
+ nlhr->AddHeader("Proxy-Authorization", pszProxyAuthHdr);
if (pszAuthHdr && !doneAuthHeader)
- httpRequest.AppendFormat("%s: %s\r\n", "Authorization", pszAuthHdr);
+ nlhr->AddHeader("Authorization", pszAuthHdr);
+ if (bSendData && !doneContentLengthHeader) {
+ char buf[100];
+ itoa(nlhr->m_szParam.GetLength(), buf, 10);
+ nlhr->AddHeader("Content-Length", buf);
+ }
if (!doneConnection)
- httpRequest.AppendFormat("%s: %s\r\n", "Connection", "Keep-Alive");
- httpRequest.AppendFormat("%s: %s\r\n", "Proxy-Connection", "Keep-Alive");
+ nlhr->AddHeader("Connection", "Keep-Alive");
+ nlhr->AddHeader("Proxy-Connection", "Keep-Alive");
- // Add Sticky Headers
- if (nlu->szStickyHeaders != nullptr)
- httpRequest.AppendFormat("%s\r\n", nlu->szStickyHeaders);
+ DumpHttpHeaders(nlc, nlhr, nlhr->flags, httpRequest);
+
+ for (auto &it : *nlhr)
+ if (it->szValue)
+ httpRequest.AppendFormat("%s: %s\r\n", it->szName.get(), it->szValue.get());
+
+ httpRequest.Append("\r\n");
// send it
- bytesSent = SendHttpRequestAndData(nlc, httpRequest, nlhr, !doneContentLengthHeader);
+ bytesSent = Netlib_Send(nlc, httpRequest, httpRequest.GetLength(), MSG_NODUMP);
+ if (bytesSent != SOCKET_ERROR && bSendData && nlhr->m_szParam.GetLength()) {
+ DumpHttpBody(nlc, nlhr->m_szParam, nlhr->flags, true);
+ int sendResult = Netlib_Send(nlc, nlhr->m_szParam, nlhr->m_szParam.GetLength(), MSG_NODUMP);
+
+ bytesSent = sendResult != SOCKET_ERROR ? bytesSent + sendResult : SOCKET_ERROR;
+ }
if (bytesSent == SOCKET_ERROR)
break;
@@ -628,9 +671,8 @@ int Netlib_SendHttpRequest(HNETLIBCONN nlc, MHttpRequest *nlhr, MChunkHandler &p break;
int resultCode;
- uint32_t fflags = MSG_PEEK | MSG_NODUMP | ((nlhr->flags & NLHRF_NOPROXY) ? MSG_RAW : 0);
uint32_t dwTimeOutTime = hdrTimeout < 0 ? -1 : GetTickCount() + hdrTimeout;
- if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, fflags, &resultCode, nullptr, nullptr)) {
+ if (!HttpPeekFirstResponseLine(nlc, dwTimeOutTime, &resultCode, nullptr, nullptr)) {
uint32_t err = GetLastError();
Netlib_Logf(nlu, "%s %d: %s Failed (%u %u)", __FILE__, __LINE__, "HttpPeekFirstResponseLine", err, count);
@@ -651,23 +693,16 @@ int Netlib_SendHttpRequest(HNETLIBCONN nlc, MHttpRequest *nlhr, MChunkHandler &p lastFirstLineFail = false;
- uint32_t hflags = (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPHEADERS | NLHRF_NODUMPSEND) ?
- MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
- (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
-
- uint32_t dflags = (nlhr->flags & (NLHRF_NODUMP | NLHRF_NODUMPSEND) ? MSG_NODUMP : MSG_DUMPASTEXT | MSG_DUMPPROXY) |
- (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0) | MSG_NODUMP;
-
if (resultCode == 100)
- nlhrReply = Netlib_RecvHttpHeaders(nlc, hflags);
+ nlhrReply = Netlib_RecvHttpHeaders(nlc, nlhr->flags);
else if (resultCode == 307 || ((resultCode == 301 || resultCode == 302) && (nlhr->flags & NLHRF_REDIRECT))) { // redirect
pszUrl = nullptr;
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = Netlib_RecvHttpHeaders(nlc, hflags);
+ nlhrReply = Netlib_RecvHttpHeaders(nlc, nlhr->flags);
else
- nlhrReply = NetlibHttpRecv(nlc, hflags, dflags, pHandler);
+ nlhrReply = NetlibHttpRecv(nlc, pHandler, nlhr->flags);
if (nlhrReply) {
auto *tmpUrl = nlhrReply->FindHeader("Location");
@@ -707,9 +742,9 @@ int Netlib_SendHttpRequest(HNETLIBCONN nlc, MHttpRequest *nlhr, MChunkHandler &p }
else if (resultCode == 401 && !doneAuthHeader) { //auth required
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = Netlib_RecvHttpHeaders(nlc, hflags);
+ nlhrReply = Netlib_RecvHttpHeaders(nlc, nlhr->flags);
else
- nlhrReply = NetlibHttpRecv(nlc, hflags, dflags, pHandler);
+ nlhrReply = NetlibHttpRecv(nlc, pHandler, nlhr->flags);
replaceStr(pszAuthHdr, nullptr);
if (nlhrReply) {
@@ -741,9 +776,9 @@ int Netlib_SendHttpRequest(HNETLIBCONN nlc, MHttpRequest *nlhr, MChunkHandler &p }
else if (resultCode == 407 && !doneProxyAuthHeader) { //proxy auth required
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = Netlib_RecvHttpHeaders(nlc, hflags);
+ nlhrReply = Netlib_RecvHttpHeaders(nlc, nlhr->flags);
else
- nlhrReply = NetlibHttpRecv(nlc, hflags, dflags, pHandler);
+ nlhrReply = NetlibHttpRecv(nlc, pHandler, nlhr->flags);
mir_free(pszProxyAuthHdr); pszProxyAuthHdr = nullptr;
if (nlhrReply) {
@@ -787,7 +822,8 @@ int Netlib_SendHttpRequest(HNETLIBCONN nlc, MHttpRequest *nlhr, MChunkHandler &p }
}
- if (count == 0) bytesSent = SOCKET_ERROR;
+ if (count == 0)
+ bytesSent = SOCKET_ERROR;
delete nlhrReply;
@@ -866,13 +902,13 @@ static char* gzip_decode(char *gzip_data, int &len_ptr, int window) return output_data;
}
-static int NetlibHttpRecvChunkHeader(NetlibConnection *nlc, bool first, uint32_t flags)
+static int NetlibHttpRecvChunkHeader(NetlibConnection *nlc, bool first)
{
MBinBuffer buf;
while (true) {
char data[1000];
- int recvResult = Netlib_Recv(nlc, data, _countof(data) - 1, MSG_RAW | flags);
+ int recvResult = Netlib_Recv(nlc, data, _countof(data) - 1, MSG_NODUMP);
if (recvResult <= 0 || recvResult >= _countof(data))
return SOCKET_ERROR;
@@ -902,14 +938,14 @@ static int NetlibHttpRecvChunkHeader(NetlibConnection *nlc, bool first, uint32_t }
}
-MHttpResponse* NetlibHttpRecv(NetlibConnection *nlc, uint32_t hflags, uint32_t dflags, MChunkHandler &pHandler, bool isConnect)
+MHttpResponse* NetlibHttpRecv(NetlibConnection *nlc, MChunkHandler &pHandler, int flags, bool isConnect)
{
int dataLen = -1;
bool chunked = false;
int cenc = 0, cenctype = 0, close = 0;
next:
- std::unique_ptr<MHttpResponse> nlhrReply(Netlib_RecvHttpHeaders(nlc, hflags));
+ std::unique_ptr<MHttpResponse> nlhrReply(Netlib_RecvHttpHeaders(nlc, flags));
if (nlhrReply == nullptr)
return nullptr;
@@ -942,7 +978,7 @@ next: if (nlhrReply->resultCode >= 200 && (dataLen > 0 || (!isConnect && dataLen < 0))) {
if (chunked)
- dataLen = NetlibHttpRecvChunkHeader(nlc, true, dflags | (cenctype ? MSG_NODUMP : 0));
+ dataLen = NetlibHttpRecvChunkHeader(nlc, true);
if (dataLen == SOCKET_ERROR)
return nullptr;
@@ -950,10 +986,9 @@ next: while (dataLen != 0) {
// fetching one chunk
while (true) {
- int recvResult = RecvWithTimeoutTime(nlc, GetTickCount() + HTTPRECVDATATIMEOUT,
- tmpBuf, 65536, dflags | (cenctype ? MSG_NODUMP : 0));
-
- if (recvResult == 0) break;
+ int recvResult = RecvWithTimeoutTime(nlc, GetTickCount() + HTTPRECVDATATIMEOUT, tmpBuf, 65536, 0);
+ if (recvResult == 0)
+ break;
if (recvResult == SOCKET_ERROR)
return nullptr;
@@ -979,7 +1014,7 @@ next: if (!chunked)
break;
- dataLen = NetlibHttpRecvChunkHeader(nlc, false, dflags | MSG_NODUMP);
+ dataLen = NetlibHttpRecvChunkHeader(nlc, false);
if (dataLen == SOCKET_ERROR)
return nullptr;
}
@@ -1009,7 +1044,6 @@ next: }
if (bufsz > 0) {
- Netlib_Dump(nlc, (uint8_t*)szData, bufsz, false, dflags | MSG_NOTITLE);
nlhrReply->body.Truncate(bufsz + 1);
memcpy(nlhrReply->body.GetBuffer(), szData, bufsz);
nlhrReply->body.SetAt(bufsz, 0);
@@ -1020,6 +1054,9 @@ next: nlhrReply->body.Empty();
}
+ if (!nlhrReply->body.IsEmpty())
+ DumpHttpBody(nlc, nlhrReply->body, flags, true);
+
if (close &&
(nlc->proxyType != PROXYTYPE_HTTP || nlc->url.flags & NLOCF_SSL) &&
(!isConnect || nlhrReply->resultCode != 200))
@@ -1078,19 +1115,11 @@ static MHttpResponse* HttpTransactionWorker(HNETLIBUSER nlu, MHttpRequest *nlhr, return nullptr;
}
- uint32_t dflags = (nlhr->flags & NLHRF_DUMPASTEXT ? MSG_DUMPASTEXT : 0) |
- (nlhr->flags & NLHRF_NODUMP ? MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
- (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
-
- uint32_t hflags =
- (nlhr->flags & NLHRF_NODUMP ? MSG_NODUMP : (nlhr->flags & NLHRF_DUMPPROXY ? MSG_DUMPPROXY : 0)) |
- (nlhr->flags & NLHRF_NOPROXY ? MSG_RAW : 0);
-
MHttpResponse *nlhrReply;
if (nlhr->requestType == REQUEST_HEAD)
- nlhrReply = Netlib_RecvHttpHeaders(nlc, 0);
+ nlhrReply = Netlib_RecvHttpHeaders(nlc, nlhr->flags);
else
- nlhrReply = NetlibHttpRecv(nlc, hflags, dflags, pHandler);
+ nlhrReply = NetlibHttpRecv(nlc, pHandler, nlhr->flags);
if (nlhrReply) {
nlhrReply->szUrl = nlc->szNewUrl;
diff --git a/src/mir_app/src/netlib_httpproxy.cpp b/src/mir_app/src/netlib_httpproxy.cpp index 6d246e9fc5..0254989cb7 100644 --- a/src/mir_app/src/netlib_httpproxy.cpp +++ b/src/mir_app/src/netlib_httpproxy.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -60,14 +60,3 @@ MIR_APP_DLL(int) Netlib_SetHttpProxyInfo(HNETLIBCONN nlc, const NETLIBHTTPPROXYI nlc->nlhpi.szHttpPostUrl = mir_strdup(nlc->nlhpi.szHttpPostUrl);
return 1;
}
-
-/////////////////////////////////////////////////////////////////////////////////////////
-
-MIR_APP_DLL(int) Netlib_SetStickyHeaders(HNETLIBUSER nlu, const char *szHeaders)
-{
- if (GetNetlibHandleType(nlu) != NLH_USER)
- return ERROR_INVALID_PARAMETER;
-
- replaceStr(nlu->szStickyHeaders, szHeaders); // pointer is ours
- return 0;
-}
diff --git a/src/mir_app/src/netlib_log.cpp b/src/mir_app/src/netlib_log.cpp index 0ca8ad6256..d04718b978 100644 --- a/src/mir_app/src/netlib_log.cpp +++ b/src/mir_app/src/netlib_log.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/netlib_openconn.cpp b/src/mir_app/src/netlib_openconn.cpp index 31878d4c24..79df680e7a 100644 --- a/src/mir_app/src/netlib_openconn.cpp +++ b/src/mir_app/src/netlib_openconn.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -316,7 +316,7 @@ static bool NetlibInitHttpsConnection(NetlibConnection *nlc) if (Netlib_SendHttpRequest(nlc, &nlhrSend, storage) == SOCKET_ERROR)
return false;
- NLHR_PTR nlhrReply(NetlibHttpRecv(nlc, MSG_DUMPPROXY | MSG_RAW, MSG_DUMPPROXY | MSG_RAW, storage, true));
+ NLHR_PTR nlhrReply(NetlibHttpRecv(nlc, storage, nlhrSend.flags, true));
if (nlhrReply == nullptr)
return false;
@@ -596,7 +596,7 @@ bool NetlibDoConnect(NetlibConnection *nlc) }
}
- Netlib_Logf(nlu, "(%d) Connected to %s:%d", nlc->s, nlc->url.szHost.c_str(), nlc->url.port);
+ Netlib_Logf(nlu, "(%d) Connected to %s:%d", int(nlc->s), nlc->url.szHost.c_str(), nlc->url.port);
if (GetSubscribersCount((THook*)hEventConnected)) {
NETLIBCONNECTIONEVENTINFO ncei = {};
diff --git a/src/mir_app/src/netlib_opts.cpp b/src/mir_app/src/netlib_opts.cpp index b5ab93fa6b..2f1ccbb487 100644 --- a/src/mir_app/src/netlib_opts.cpp +++ b/src/mir_app/src/netlib_opts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -87,7 +87,7 @@ static void EnableMultipleControls(HWND hwndDlg, const UINT *controls, int cCont static void AddProxyTypeItem(HWND hwndDlg, int type, int selectType)
{
- int i = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_ADDSTRING, 0, (LPARAM)(type == 0 ? TranslateW(szProxyTypes[type]) : szProxyTypes[type]));
+ int i = SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_ADDSTRING, 0, (LPARAM)TranslateW(szProxyTypes[type]));
SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_SETITEMDATA, i, type);
if (type == selectType)
SendDlgItemMessage(hwndDlg, IDC_PROXYTYPE, CB_SETCURSEL, i, 0);
diff --git a/src/mir_app/src/netlib_pktrecver.cpp b/src/mir_app/src/netlib_pktrecver.cpp index 49d4ddf639..8ed9a5b790 100644 --- a/src/mir_app/src/netlib_pktrecver.cpp +++ b/src/mir_app/src/netlib_pktrecver.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/netlib_security.cpp b/src/mir_app/src/netlib_security.cpp index 873e083ee4..2327c4846d 100644 --- a/src/mir_app/src/netlib_security.cpp +++ b/src/mir_app/src/netlib_security.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/netlib_sock.cpp b/src/mir_app/src/netlib_sock.cpp index a1350afc8f..45b6a04edc 100644 --- a/src/mir_app/src/netlib_sock.cpp +++ b/src/mir_app/src/netlib_sock.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -34,8 +34,9 @@ MIR_APP_DLL(int) Netlib_Send(HNETLIBCONN nlc, const char *buf, int len, int flag if (!NetlibEnterNestedCS(nlc, NLNCS_SEND))
return SOCKET_ERROR;
+ Netlib_Dump(nlc, (uint8_t *)buf, len, true, flags);
+
int result;
- Netlib_Dump(nlc, (uint8_t*)buf, len, true, flags);
if (nlc->hSsl)
result = Netlib_SslWrite(nlc->hSsl, buf, len);
else
diff --git a/src/mir_app/src/netlib_ssl.cpp b/src/mir_app/src/netlib_ssl.cpp index 5e9d3ef6a8..193a06c438 100644 --- a/src/mir_app/src/netlib_ssl.cpp +++ b/src/mir_app/src/netlib_ssl.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/netlib_upnp.cpp b/src/mir_app/src/netlib_upnp.cpp index 65cd4d85f2..63dc17b6d3 100644 --- a/src/mir_app/src/netlib_upnp.cpp +++ b/src/mir_app/src/netlib_upnp.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/netlib_websocket.cpp b/src/mir_app/src/netlib_websocket.cpp index 05392afe8e..5e9316b2d5 100644 --- a/src/mir_app/src/netlib_websocket.cpp +++ b/src/mir_app/src/netlib_websocket.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -93,6 +93,7 @@ MWebSocket::~MWebSocket() MHttpResponse* MWebSocket::connect(HANDLE nlu, const char *szHost, const MHttpHeaders *pHeaders)
{
m_nlu = (HNETLIBUSER)nlu;
+ m_bTerminated = false;
CMStringA tmpHost(szHost);
@@ -186,6 +187,8 @@ static void WebSocket_Send(HNETLIBCONN nlc, const void *pData, int64_t dataLen, void MWebSocket::sendText(const char *pData)
{
if (m_hConn && pData) {
+ Netlib_Dump(m_hConn, pData, strlen(pData), true, 0);
+
mir_cslock lck(m_cs);
WebSocket_Send(m_hConn, pData, strlen(pData), 1);
}
@@ -205,8 +208,10 @@ void MWebSocket::terminate() {
m_bTerminated = true;
- if (m_hConn)
+ if (m_hConn) {
Netlib_Shutdown(m_hConn);
+ m_hConn = nullptr;
+ }
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -221,11 +226,11 @@ void MWebSocket::run() int bufSize = Netlib_Recv(m_hConn, (char *)buf + offset, _countof(buf) - offset, MSG_NODUMP);
if (bufSize == 0) {
Netlib_Log(m_nlu, "Websocket connection gracefully closed");
- break;
+ return;
}
if (bufSize < 0) {
Netlib_Log(m_nlu, "Websocket connection error, exiting");
- break;
+ return;
}
WSHeader hdr;
@@ -243,11 +248,11 @@ void MWebSocket::run() int result = Netlib_Recv(m_hConn, (char *)buf, _countof(buf), MSG_NODUMP);
if (result == 0) {
Netlib_Log(m_nlu, "Websocket connection gracefully closed");
- break;
+ return;
}
if (result < 0) {
Netlib_Log(m_nlu, "Websocket connection error, exiting");
- break;
+ return;
}
currPacketSize += result;
netbuf.append(buf, result);
@@ -273,8 +278,9 @@ void MWebSocket::run() break;
case 9: // ping
- Netlib_Log(m_nlu, "ping received");
- Netlib_Send(m_hConn, (char *)buf + hdr.headerSize, bufSize - int(hdr.headerSize), 0);
+ Netlib_Logf(m_nlu, "ping received: %d bytes", int(hdr.payloadSize));
+ if (hdr.payloadSize)
+ Netlib_Send(m_hConn, (char *)buf + hdr.headerSize, (int)hdr.payloadSize, MSG_NODUMP);
break;
}
diff --git a/src/mir_app/src/newplugins.cpp b/src/mir_app/src/newplugins.cpp index 2783e4bd3c..b6eada4b91 100644 --- a/src/mir_app/src/newplugins.cpp +++ b/src/mir_app/src/newplugins.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -136,6 +136,8 @@ static const MUUID pluginBannedList[] = { 0x9e1d9244, 0x606c, 0x4ef4, { 0x99, 0xa0, 0x1d, 0x7d, 0x23, 0xcb, 0x76, 0x01 } }, // omegle
{ 0x14331048, 0x5a73, 0x4fdb, { 0xb9, 0x09, 0x2d, 0x7e, 0x18, 0x25, 0xa0, 0x12 } }, // spamotron
{ 0xEFB2355B, 0x82B3, 0x4759, { 0xb7, 0xd8, 0x95, 0xf8, 0xe9, 0x50, 0x62, 0x91 } }, // icq-wim
+ { 0x57e90ac6, 0x1067, 0x423b, { 0x8c, 0xa3, 0x70, 0xa3, 0x9d, 0x20, 0x0d, 0x4f } }, // skypeweb
+ { 0x2925520b, 0x6677, 0x4658, { 0x8b, 0xad, 0x56, 0x61, 0xd1, 0x3e, 0x46, 0x92 } }, // SkypeStatusChange
};
bool isPluginBanned(const MUUID &u1)
diff --git a/src/mir_app/src/options.cpp b/src/mir_app/src/options.cpp index 93e70fbfa4..9824e84126 100644 --- a/src/mir_app/src/options.cpp +++ b/src/mir_app/src/options.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org),
Copyright (c) 2000-12 Miranda IM project,
Copyright (c) 2007 Artem Shpynov
all portions of this codebase are copyrighted to the people
diff --git a/src/mir_app/src/path.cpp b/src/mir_app/src/path.cpp index 43eae9b5b6..d4ae6ff6c0 100644 --- a/src/mir_app/src/path.cpp +++ b/src/mir_app/src/path.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/pluginopts.cpp b/src/mir_app/src/pluginopts.cpp index 632fdbe190..7649ddf247 100644 --- a/src/mir_app/src/pluginopts.cpp +++ b/src/mir_app/src/pluginopts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/popupOption.cpp b/src/mir_app/src/popupOption.cpp index d9bf4de035..22c03b7bd1 100644 --- a/src/mir_app/src/popupOption.cpp +++ b/src/mir_app/src/popupOption.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/popups.cpp b/src/mir_app/src/popups.cpp index 77116cb905..23096f95d0 100644 --- a/src/mir_app/src/popups.cpp +++ b/src/mir_app/src/popups.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/profilemanager.cpp b/src/mir_app/src/profilemanager.cpp index d89363706c..b4aa509429 100644 --- a/src/mir_app/src/profilemanager.cpp +++ b/src/mir_app/src/profilemanager.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/profilemanager.h b/src/mir_app/src/profilemanager.h index 94fd091b3e..a924b3a366 100644 --- a/src/mir_app/src/profilemanager.h +++ b/src/mir_app/src/profilemanager.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/proto_accs.cpp b/src/mir_app/src/proto_accs.cpp index f82ca53dae..f2ae36b7b2 100644 --- a/src/mir_app/src/proto_accs.cpp +++ b/src/mir_app/src/proto_accs.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/proto_chains.cpp b/src/mir_app/src/proto_chains.cpp index cd937f23fc..99362d19c8 100644 --- a/src/mir_app/src/proto_chains.cpp +++ b/src/mir_app/src/proto_chains.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp index 77413693dd..0e6636bef1 100644 --- a/src/mir_app/src/proto_interface.cpp +++ b/src/mir_app/src/proto_interface.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp index d10b3262c2..4b305bfafe 100644 --- a/src/mir_app/src/proto_internal.cpp +++ b/src/mir_app/src/proto_internal.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/proto_opts.cpp b/src/mir_app/src/proto_opts.cpp index ab86295d9e..0127fd1285 100644 --- a/src/mir_app/src/proto_opts.cpp +++ b/src/mir_app/src/proto_opts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -906,32 +906,43 @@ bool CAccountFormDlg::OnApply() }
}
- if (m_action == PRAC_UPGRADED) {
- BOOL oldProto = m_pa->bOldProto;
- wchar_t szPlugin[MAX_PATH];
- mir_snwprintf(szPlugin, L"%S.dll", m_pa->szProtoName);
- int idx = g_arAccounts.getIndex(m_pa);
- UnloadAccount(m_pa, 0);
- g_arAccounts.remove(idx);
- if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) {
- wchar_t szNewName[MAX_PATH];
- mir_snwprintf(szNewName, L"%s~", szPlugin);
- MoveFileW(szPlugin, szNewName);
+ switch (m_action) {
+ case PRAC_UPGRADED:
+ {
+ // save values from m_pa before it got destroyed
+ bool oldProto = m_pa->bOldProto;
+ wchar_t szPlugin[MAX_PATH];
+ mir_snwprintf(szPlugin, L"%S.dll", m_pa->szProtoName);
+ db_set_s(0, m_pa->szModuleName, "AM_PrevProto", m_pa->szProtoName);
+
+ // remove old account
+ int idx = g_arAccounts.getIndex(m_pa);
+ UnloadAccount(m_pa, 0);
+ g_arAccounts.remove(idx);
+
+ // also rename the protocol dll for old accounts
+ if (oldProto && UnloadPlugin(szPlugin, _countof(szPlugin))) {
+ wchar_t szNewName[MAX_PATH];
+ mir_snwprintf(szNewName, L"%s~", szPlugin);
+ MoveFileW(szPlugin, szNewName);
+ }
}
- m_action = PRAC_ADDED;
- }
+ __fallthrough;
- if (m_action == PRAC_ADDED) {
+ case PRAC_ADDED:
char buf[200];
GetDlgItemTextA(m_hwnd, IDC_PROTOTYPECOMBO, buf, _countof(buf));
- char *szBaseProto = NEWSTR_ALLOCA(buf);
-
- m_internalName.GetTextA(buf, _countof(buf));
- rtrim(buf);
+ {
+ char *szBaseProto = NEWSTR_ALLOCA(buf);
+ m_internalName.GetTextA(buf, _countof(buf));
- m_pa = Proto_CreateAccount(buf, szBaseProto, wszAccName);
- }
- else {
+ rtrim(buf);
+ m_pa = Proto_CreateAccount(buf, szBaseProto, wszAccName);
+ }
+ break;
+
+ default:
+ // just change the account name and write it down
replaceStrW(m_pa->tszAccountName, wszAccName);
WriteDbAccounts();
diff --git a/src/mir_app/src/proto_order.cpp b/src/mir_app/src/proto_order.cpp index 0199f2465f..c46733feac 100644 --- a/src/mir_app/src/proto_order.cpp +++ b/src/mir_app/src/proto_order.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -25,12 +25,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "clc.h"
-struct ProtocolData
-{
- char *RealName;
- int enabled;
-};
-
bool CheckProtocolOrder(void)
{
bool changed = false;
@@ -127,15 +121,13 @@ class CProtocolOrderOpts : public CDlgBase if (!ProtoToInclude(pa))
continue;
- ProtocolData *PD = (ProtocolData*)mir_alloc(sizeof(ProtocolData));
- PD->RealName = pa->szModuleName;
- PD->enabled = pa->IsEnabled() && isProtoSuitable(pa->ppro);
-
- tvis.item.lParam = (LPARAM)PD;
- tvis.item.pszText = pa->tszAccountName;
- tvis.item.stateMask = TVIS_STATEIMAGEMASK;
- tvis.item.state = INDEXTOSTATEIMAGEMASK((PD->enabled) ? (pa->bIsVisible ? 2 : 1) : 3);
- m_order.InsertItem(&tvis);
+ if (pa->IsEnabled() && isProtoSuitable(pa->ppro)) {
+ tvis.item.lParam = (LPARAM)pa->szModuleName;
+ tvis.item.pszText = pa->tszAccountName;
+ tvis.item.stateMask = TVIS_STATEIMAGEMASK;
+ tvis.item.state = INDEXTOSTATEIMAGEMASK(pa->bIsVisible ? 2 : 1);
+ m_order.InsertItem(&tvis);
+ }
}
}
@@ -151,7 +143,6 @@ public: m_btnReset.OnClick = Callback(this, &CProtocolOrderOpts::onReset_Click);
m_order.SetFlags(MTREE_CHECKBOX | MTREE_DND);
- m_order.OnDeleteItem = Callback(this, &CProtocolOrderOpts::onOrder_DeleteItem);
}
bool OnInitDialog() override
@@ -176,12 +167,10 @@ public: m_order.GetItem(&tvi);
if (tvi.lParam != 0) {
- ProtocolData *ppd = (ProtocolData*)tvi.lParam;
- PROTOACCOUNT *pa = Proto_GetAccount(ppd->RealName);
+ PROTOACCOUNT *pa = Proto_GetAccount((char *)tvi.lParam);
if (pa != nullptr) {
pa->iOrder = idx++;
- if (ppd->enabled)
- pa->bIsVisible = m_order.GetCheckState(tvi.hItem) != 0;
+ pa->bIsVisible = m_order.GetCheckState(tvi.hItem) != 0;
}
}
@@ -209,13 +198,6 @@ public: FillTree();
NotifyChange();
}
-
- void onOrder_DeleteItem(CCtrlTreeView::TEventInfo *env)
- {
- NMTREEVIEW *pnmtv = env->nmtv;
- if (pnmtv)
- mir_free((ProtocolData*)pnmtv->itemOld.lParam);
- }
};
int ProtocolOrderOptInit(WPARAM wParam, LPARAM)
diff --git a/src/mir_app/src/proto_ui.cpp b/src/mir_app/src/proto_ui.cpp index dc959a0679..0d293cffb4 100644 --- a/src/mir_app/src/proto_ui.cpp +++ b/src/mir_app/src/proto_ui.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/proto_utils.cpp b/src/mir_app/src/proto_utils.cpp index 903355a6c2..32a9c300e0 100644 --- a/src/mir_app/src/proto_utils.cpp +++ b/src/mir_app/src/proto_utils.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp index 132f33ac8d..430eac27a4 100644 --- a/src/mir_app/src/protocols.cpp +++ b/src/mir_app/src/protocols.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/pu_utils.cpp b/src/mir_app/src/pu_utils.cpp index d79b3dca65..019b9136d7 100644 --- a/src/mir_app/src/pu_utils.cpp +++ b/src/mir_app/src/pu_utils.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -247,8 +247,10 @@ MIR_APP_DLL(int) PU::SafeMoveFile(const wchar_t *pSrc, const wchar_t *pDst) if (g_hPipe == nullptr) {
if (!DeleteFileW(pDst)) {
uint32_t dwError = GetLastError();
- if (dwError != ERROR_ACCESS_DENIED && dwError != ERROR_FILE_NOT_FOUND)
+ if (dwError != ERROR_ACCESS_DENIED && dwError != ERROR_FILE_NOT_FOUND) {
+ Netlib_LogfW(0, L"Unable to delete dest file %s during move, error %d", pDst, dwError);
return dwError;
+ }
}
if (!MoveFileW(pSrc, pDst)) { // use copy on error
@@ -262,11 +264,17 @@ MIR_APP_DLL(int) PU::SafeMoveFile(const wchar_t *pSrc, const wchar_t *pDst) case ERROR_LOCK_VIOLATION:
// use copy routine if a move operation isn't available
// for example, when files are on different disks
- if (!CopyFileW(pSrc, pDst, FALSE))
- return GetLastError();
-
- if (!DeleteFileW(pSrc))
- return GetLastError();
+ if (!CopyFileW(pSrc, pDst, FALSE)) {
+ dwError = GetLastError();
+ Netlib_LogfW(0, L"Unable to copy file %s to %s during move, error %d", pSrc, pDst, dwError);
+ return dwError;
+ }
+
+ if (!DeleteFileW(pSrc)) {
+ dwError = GetLastError();
+ Netlib_LogfW(0, L"Unable to delete source file %s during move, error %d", pSrc, dwError);
+ return dwError;
+ }
break;
default:
diff --git a/src/mir_app/src/resource.h b/src/mir_app/src/resource.h index 40da83b5af..8d5bdde14d 100644 --- a/src/mir_app/src/resource.h +++ b/src/mir_app/src/resource.h @@ -47,6 +47,7 @@ #define IDI_URL 138
#define IDI_ATTACH 139
#define IDI_CODE 140
+#define IDI_CLOUD 141
#define IDI_MCMENUOFF 144
#define IDI_MCMENU 145
#define IDI_MCCONVERT 146
@@ -296,9 +297,9 @@ #define IDC_GENMENU_CUSTOMNAME 1086
#define IDC_GENMENU_SET 1087
#define IDC_REVERSE_ORDER 1088
+#define IDC_GENMENU_ID 1088
#define IDC_GENMENU_DEFAULT 1089
#define IDC_ICON1 1090
-#define IDC_GENMENU_DELETE 1090
#define IDC_ICON2 1091
#define IDC_ICON3 1092
#define IDC_ICON4 1093
@@ -361,6 +362,7 @@ #define IDC_ALLICON 1208
#define IDC_NONEICON 1209
#define IDC_TYPINGICON 1210
+#define IDC_OFFLINEICON 1211
#define IDC_FILEDIR 1213
#define IDC_TRANSFERCOMPLETED 1214
#define IDC_LANG 1215
@@ -375,7 +377,6 @@ #define IDC_DOBMONTH 1227
#define IDC_WEBPAGE 1228
#define IDC_DOBYEAR 1229
-#define IDC_INSERTSUBMENU 1230
#define IDC_UPDATING 1231
#define IDC_NAMEORDER 1234
#define IDC_RECONNECTREQD 1239
@@ -572,7 +573,6 @@ #define IDC_TXT_INFO 1722
#define IDC_CONTACTNAME 1724
#define IDC_FRAME 1725
-#define IDC_ALLPRECENTS 1727
#define IDC_ENABLE_KEYWORDFILTERING 1729
#define IDC_BKGCOLOUR_STATIC 1730
#define IDC_LST_ERRORS 1731
@@ -584,7 +584,6 @@ #define IDC_RADIO1 1740
#define IDC_RADIO2 1741
#define IDC_ADDCHECK 1742
-#define IDC_ENABLE_CUSTOM 1743
#define IDC_GETMOREPLUGINS 1744
#define IDC_DISABLEMENUICONS 1745
#define IDC_SM_ENABLED 1746
@@ -603,6 +602,8 @@ #define IDC_OFFLINE_AUTOSIZE_SPIN 1758
#define IDC_OFFLINE_DELETE 1759
#define IDC_SHOWPASSWORD 1760
+#define IDC_LOGGER 1761
+#define IDC_LOGGER_GC 1762
#define IDC_EFFECT_COLOUR_TEXT1 1853
#define IDC_EFFECT_COLOUR_SPIN1 1854
#define IDC_EXTRAORDER 1889
@@ -695,9 +696,9 @@ //
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 340
+#define _APS_NEXT_RESOURCE_VALUE 342
#define _APS_NEXT_COMMAND_VALUE 40018
-#define _APS_NEXT_CONTROL_VALUE 1761
+#define _APS_NEXT_CONTROL_VALUE 1762
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/src/mir_app/src/searchresults.cpp b/src/mir_app/src/searchresults.cpp index 72033c3f18..ac8e8969be 100644 --- a/src/mir_app/src/searchresults.cpp +++ b/src/mir_app/src/searchresults.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/skin.h b/src/mir_app/src/skin.h index 63705084af..49e47d7154 100644 --- a/src/mir_app/src/skin.h +++ b/src/mir_app/src/skin.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/skin2opts.cpp b/src/mir_app/src/skin2opts.cpp index 288ef2a5da..efb78be3a8 100644 --- a/src/mir_app/src/skin2opts.cpp +++ b/src/mir_app/src/skin2opts.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/skinicons.cpp b/src/mir_app/src/skinicons.cpp index ed74917d67..fccecc8a56 100644 --- a/src/mir_app/src/skinicons.cpp +++ b/src/mir_app/src/skinicons.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index ec92915dc9..aca2207baa 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/srmm_base.cpp b/src/mir_app/src/srmm_base.cpp index 013147b447..ebf192491d 100644 --- a/src/mir_app/src/srmm_base.cpp +++ b/src/mir_app/src/srmm_base.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -44,8 +44,8 @@ CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, MCONTACT h m_btnColor(this, IDC_SRMM_COLOR),
m_btnBkColor(this, IDC_SRMM_BKGCOLOR),
- m_btnBold(this, IDC_SRMM_BOLD),
+ m_btnBold(this, IDC_SRMM_BOLD),
m_btnItalic(this, IDC_SRMM_ITALICS),
m_btnUnderline(this, IDC_SRMM_UNDERLINE),
m_btnStrikeout(this, IDC_SRMM_STRIKEOUT),
@@ -61,6 +61,7 @@ CSrmmBaseDialog::CSrmmBaseDialog(CMPluginBase &pPlugin, int idDialog, MCONTACT h m_btnBkColor.OnClick = Callback(this, &CSrmmBaseDialog::onClick_BkColor);
m_btnBold.OnClick = m_btnItalic.OnClick = m_btnUnderline.OnClick = m_btnStrikeout.OnClick = Callback(this, &CSrmmBaseDialog::onClick_BIU);
+ m_btnFilter.OnClick = Callback(this, &CSrmmBaseDialog::onClick_Filter);
m_btnHistory.OnClick = Callback(this, &CSrmmBaseDialog::onClick_History);
m_btnChannelMgr.OnClick = Callback(this, &CSrmmBaseDialog::onClick_ChanMgr);
@@ -313,7 +314,7 @@ static void ProcessNickListHovering(const CCtrlListBox &listBox, int hoveredItem wszBuf.Format(L"%s: %s\r\n%s: %s\r\n%s: %s",
TranslateT("Nickname"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
- TranslateT("Status"), g_chatApi.TM_WordToString(si->pStatuses, ui->Status));
+ TranslateT("Status"), TM_WordToString(si, ui->Status));
ti.lpszText = wszBuf.GetBuffer();
}
@@ -339,7 +340,7 @@ void CSrmmBaseDialog::OnNickListTimer(CTimer *pTimer) wszBuf.Format(L"<b>%s:</b>\t%s\n<b>%s:</b>\t%s\n<b>%s:</b>\t%s",
TranslateT("Nick"), ui->pszNick,
TranslateT("Unique ID"), ui->pszUID,
- TranslateT("Status"), g_chatApi.TM_WordToString(m_si->pStatuses, ui->Status));
+ TranslateT("Status"), TM_WordToString(m_si, ui->Status));
CLCINFOTIP ti = { sizeof(ti) };
Tipper_ShowTip(wszBuf, &ti);
@@ -515,7 +516,7 @@ bool CSrmmBaseDialog::OnInitDialog() m_message.Hide();
auto *pDlg = (CMsgDialog *)this;
- if (auto *pLogWindowClass = Srmm_GetWindowClass(pDlg)) {
+ if (auto *pLogWindowClass = Srmm_GetWindowClass(pDlg->isChat(), pDlg->m_hContact)) {
m_pLog = pLogWindowClass->pfnBuilder(*pDlg);
m_pLog->Attach();
if (m_pLog->GetType() != 0) { // custom log type
@@ -546,7 +547,10 @@ bool CSrmmBaseDialog::OnInitDialog() // three buttons below are initiated inside this call, so button creation must precede subclassing
Srmm_CreateToolbarIcons(this, isChat() ? BBBF_ISCHATBUTTON : BBBF_ISIMBUTTON);
- m_bSendFormat = ((CallContactService(m_hContact, PS_GETCAPS, PFLAGNUM_4) & PF4_SERVERFORMATTING) != 0);
+ if (Chat::bShowFormatting)
+ m_bSendFormat = true;
+ else
+ m_bSendFormat = ((CallContactService(m_hContact, PS_GETCAPS, PFLAGNUM_4) & PF4_SERVERFORMATTING) != 0);
if (!m_bSendFormat) {
m_btnBold.Disable();
m_btnItalic.Disable();
@@ -758,13 +762,11 @@ bool CSrmmBaseDialog::IsSuitableEvent(const LOGINFO &lin) const void CSrmmBaseDialog::MarkEventRead(const DB::EventInfo &dbei)
{
- if (dbei.markedRead())
- return;
-
- if (m_bActive)
- doMarkEventRead(m_hContact, dbei.getEvent());
- else {
- m_arDisplayedEvents.push_back(dbei.getEvent());
+ if (!dbei.bRead) {
+ if (m_bActive)
+ doMarkEventRead(m_hContact, dbei.getEvent());
+ else
+ m_arDisplayedEvents.push_back(dbei.getEvent());
}
}
@@ -826,19 +828,23 @@ void CSrmmBaseDialog::ScheduleRedrawLog() void CSrmmBaseDialog::UpdateChatLog()
{
- if (!m_si->pMI->bDatabase || m_si->bHistoryInit)
+ if (!m_si->pMI->bDatabase)
return;
m_pLog->Clear();
GetFirstEvent();
+ for (auto &it : m_si->arEvents.rev_iter())
+ if (it->hEvent)
+ m_si->arEvents.removeItem(&it);
+
int iHistoryMode = Srmm::iHistoryMode;
auto *szProto = Proto_GetBaseAccountName(m_hContact);
for (MEVENT hDbEvent = m_hDbEventFirst; hDbEvent; hDbEvent = db_event_next(m_hContact, hDbEvent)) {
DB::EventInfo dbei(hDbEvent);
- if (dbei && !mir_strcmp(szProto, dbei.szModule) && g_chatApi.DbEventIsShown(dbei) && dbei.szUserId) {
- if (iHistoryMode == LOADHISTORY_UNREAD && (dbei.flags & DBEF_READ) != 0)
+ if (dbei && !mir_strcmp(szProto, dbei.szModule) && g_chatApi.DbEventIsShown(dbei)) {
+ if (iHistoryMode == LOADHISTORY_UNREAD && dbei.bRead)
continue;
Utf2T wszUserId(dbei.szUserId);
@@ -848,10 +854,12 @@ void CSrmmBaseDialog::UpdateChatLog() gce.dwFlags = GCEF_ADDTOLOG;
gce.pszUserInfo.w = wszUserId;
gce.pszText.w = wszText;
- gce.time = dbei.timestamp;
+ gce.time = dbei.getUnixtime();
gce.hEvent = hDbEvent;
- if (USERINFO *ui = g_chatApi.UM_FindUser(m_si, wszUserId))
+ if (dbei.szUserId == nullptr)
+ gce.bIsMe = true;
+ else if (USERINFO *ui = g_chatApi.UM_FindUser(m_si, wszUserId))
gce.pszNick.w = ui->pszNick;
else
gce.pszNick.w = wszUserId;
@@ -859,7 +867,6 @@ void CSrmmBaseDialog::UpdateChatLog() }
}
- m_si->bHistoryInit = true;
m_pLog->LogChatEvents(nullptr);
}
@@ -979,6 +986,24 @@ void CSrmmBaseDialog::onClick_BIU(CCtrlButton *pButton) m_message.SendMsg(EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf);
}
+void CSrmmBaseDialog::onClick_Filter(CCtrlButton *pButton)
+{
+ if (!pButton->Enabled())
+ return;
+
+ m_bFilterEnabled = !m_bFilterEnabled;
+ UpdateFilterButton();
+
+ if (m_bFilterEnabled && !g_chatApi.bRightClickFilter)
+ ShowFilterMenu();
+ else {
+ if (m_hwndFilter)
+ SendMessage(m_hwndFilter, WM_CLOSE, 0, 0);
+
+ RedrawLog();
+ }
+}
+
void CSrmmBaseDialog::onClick_History(CCtrlButton *pButton)
{
if (!pButton->Enabled())
@@ -1072,8 +1097,8 @@ bool CSrmmBaseDialog::ProcessFileDrop(HDROP hDrop, MCONTACT hContact) bool CSrmmBaseDialog::PasteFilesAsURL(HDROP hDrop)
{
- bool isShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0;
- if (db_get_b(0, CHAT_MODULE, "ShiftDropFilePasteURL", 1) == 0 || !isShift) // hidden setting: Chat/ShiftDropFilePasteURL
+ bool isShift = (GetKeyState(VK_SHIFT) & 0x8000) != 0, isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) != 0;
+ if (db_get_b(0, CHAT_MODULE, "ShiftDropFilePasteURL", 1) == 0 || !(isShift && !isCtrl)) // hidden setting: Chat/ShiftDropFilePasteURL
return false;
int fileCount = DragQueryFileW(hDrop, -1, nullptr, 0);
diff --git a/src/mir_app/src/srmm_log.cpp b/src/mir_app/src/srmm_log.cpp index aaf466264b..a2d094ce1a 100644 --- a/src/mir_app/src/srmm_log.cpp +++ b/src/mir_app/src/srmm_log.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -30,21 +30,26 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. static OBJLIST<SrmmLogWindowClass> g_arLogClasses(1, PtrKeySortT);
static CMOption<char *> g_logger(SRMM_MODULE, "Logger", "built-in");
+static CMOption<char *> g_loggerGC(SRMM_MODULE, "LoggerGC", "built-in");
+
+void CheckLogOptions()
+{
+ if (db_get_b(0, SRMM_MODULE, "EnableCustomLogs")) {
+ g_loggerGC = (char*)g_logger;
+ db_unset(0, SRMM_MODULE, "EnableCustomLogs");
+ }
+}
/////////////////////////////////////////////////////////////////////////////////////////
-static bool sttEnableCustomLogs(CMsgDialog *pDlg)
+static bool sttEnableCustomLogs(MCONTACT hContact)
{
// always enable custom log viewers for private chats
- if (!pDlg || !pDlg->isChat())
+ if (hContact == INVALID_CONTACT_ID)
return true;
- // if custom log viewers are disable, use build-in one
- if (!Chat::bEnableCustomLogs)
- return false;
-
// check if custom viewers are forbidden for this particular account
- auto *szProto = Proto_GetBaseAccountName(pDlg->m_hContact);
+ auto *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
// hidden setting !!!!!!!!
CMStringA szProtoList(db_get_sm(0, SRMM_MODULE, "DisableCustomLogsForProto"));
@@ -64,14 +69,12 @@ static bool sttEnableCustomLogs(CMsgDialog *pDlg) return true;
}
-MIR_APP_DLL(SrmmLogWindowClass *) Srmm_GetWindowClass(CMsgDialog *pDlg)
+MIR_APP_DLL(SrmmLogWindowClass *) Srmm_GetWindowClass(bool bGC, MCONTACT hContact)
{
- if (sttEnableCustomLogs(pDlg)) {
- CMStringA szViewerName;
- if (pDlg != nullptr)
- szViewerName = db_get_sm(pDlg->m_hContact, SRMSGMOD, "Logger");
+ if (sttEnableCustomLogs(hContact)) {
+ CMStringA szViewerName(db_get_sm(hContact, SRMSGMOD, bGC ? "LoggerGC" : "Logger"));
if (szViewerName.IsEmpty())
- szViewerName = g_logger;
+ szViewerName = bGC ? g_loggerGC : g_logger;
for (auto &it : g_arLogClasses)
if (szViewerName == it->szShortName)
@@ -87,8 +90,8 @@ MIR_APP_DLL(SrmmLogWindowClass *) Srmm_GetWindowClass(CMsgDialog *pDlg) MIR_APP_DLL(bool) Srmm_IsCustomLogUsed(bool forGroupChats)
{
- if (forGroupChats && !Chat::bEnableCustomLogs)
- return false;
+ if (forGroupChats)
+ return mir_strcmp(g_loggerGC, "built-in") != 0;
return mir_strcmp(g_logger, "built-in") != 0;
}
@@ -113,42 +116,46 @@ static class CSrmmLogOptionsDlg *pDialog = nullptr; class CSrmmLogOptionsDlg : public CDlgBase
{
- CCtrlListBox m_list;
- CCtrlCheck chkCustomLogs;
+ CCtrlCombo cmbLogger, cmbLoggerGC;
+
+ void PopulateCombo(const char *pszClass, CCtrlCombo &ctrl)
+ {
+ ctrl.ResetContent();
+
+ for (auto &it : g_arLogClasses) {
+ int idx = ctrl.AddString(TranslateW_LP(it->wszScreenName, it->pPlugin), LPARAM(it));
+ if (!mir_strcmp(it->szShortName, pszClass))
+ ctrl.SetCurSel(idx);
+ }
+ }
public:
CSrmmLogOptionsDlg() :
CDlgBase(g_plugin, IDD_OPT_SRMMLOG),
- m_list(this, IDC_LIST),
- chkCustomLogs(this, IDC_ENABLE_CUSTOM)
+ cmbLogger(this, IDC_LOGGER),
+ cmbLoggerGC(this, IDC_LOGGER_GC)
{
- CreateLink(chkCustomLogs, Chat::bEnableCustomLogs);
-
- m_list.OnSelChange = Callback(this, &CSrmmLogOptionsDlg::onChange_List);
}
bool OnInitDialog() override
{
pDialog = this;
-
- auto *pClass = Srmm_GetWindowClass(0);
- for (auto &it : g_arLogClasses) {
- int idx = m_list.AddString(TranslateW_LP(it->wszScreenName, it->pPlugin), LPARAM(it));
- if (it == pClass)
- m_list.SetCurSel(idx);
- }
-
+ PopulateCombo(g_logger, cmbLogger);
+ PopulateCombo(g_loggerGC, cmbLoggerGC);
return true;
}
bool OnApply() override
{
- int idx = m_list.GetCurSel();
- if (idx == -1)
+ if (auto *pLogger = (SrmmLogWindowClass *)cmbLogger.GetCurData())
+ g_logger = pLogger->szShortName;
+ else
return false;
- if (auto *pLogger = (SrmmLogWindowClass *)m_list.GetItemData(idx))
- g_logger = pLogger->szShortName;
+ if (auto *pLogger = (SrmmLogWindowClass *)cmbLoggerGC.GetCurData())
+ g_loggerGC = pLogger->szShortName;
+ else
+ return false;
if (!m_bExiting) {
PostMessage(m_hwndParent, WM_CLOSE, 1, 0);
@@ -164,7 +171,6 @@ public: void Rebuild()
{
- m_list.ResetContent();
OnInitDialog();
}
diff --git a/src/mir_app/src/srmm_log_hpp.cpp b/src/mir_app/src/srmm_log_hpp.cpp index 8ba597d173..5f60013c2e 100644 --- a/src/mir_app/src/srmm_log_hpp.cpp +++ b/src/mir_app/src/srmm_log_hpp.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/srmm_log_rtf.cpp b/src/mir_app/src/srmm_log_rtf.cpp index 2653b7dc13..e2e875c05f 100644 --- a/src/mir_app/src/srmm_log_rtf.cpp +++ b/src/mir_app/src/srmm_log_rtf.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -173,7 +173,8 @@ void CRtfLogWindow::InsertFileLink(CMStringA &buf, MEVENT hEvent, const DB::FILE if (blob.getSize() > 0 && blob.getSize() == blob.getTransferred())
buf.Append(" \\u10004? ");
- if (uint32_t size = blob.getSize())
+ int64_t size = blob.getSize();
+ if (size > 0)
buf.AppendFormat(" %uKB", size < 1024 ? 1 : unsigned(blob.getSize() / 1024));
CMStringA szHost;
@@ -334,7 +335,7 @@ static bool CreateRtfFromDbEvent(RtfLogStreamData *dat) if (!dat->pLog->CreateRtfEvent(dat, dbei))
return false;
- if (!(dbei.flags & DBEF_SENT)) {
+ if (!dbei.bSent) {
if (dbei.isSrmm())
dat->pLog->GetDialog().MarkEventRead(dbei);
diff --git a/src/mir_app/src/srmm_main.cpp b/src/mir_app/src/srmm_main.cpp index 5695831180..af9b4007bc 100644 --- a/src/mir_app/src/srmm_main.cpp +++ b/src/mir_app/src/srmm_main.cpp @@ -1,6 +1,6 @@ /* -Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org) +Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -183,7 +183,7 @@ static HOTKEYDESC srmmHotkeys[] = { { "srmm_italic", LPGEN("Toggle italic formatting"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'I'), 0, SRMM_HK_ITALIC }, { "srmm_under", LPGEN("Toggle underline formatting"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'U'), 0, SRMM_HK_UNDERLINE }, { "srmm_color", LPGEN("Toggle text color"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'K'), 0, SRMM_HK_COLOR }, - { "srmm_bkcolor", LPGEN("Toggle back color"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), 0, SRMM_HK_BKCOLOR }, + { "srmm_bkcolor", LPGEN("Toggle background color"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), 0, SRMM_HK_BKCOLOR }, { "srmm_clear", LPGEN("Clear formatting"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, VK_SPACE), 0, SRMM_HK_CLEAR }, { "srmm_history", LPGEN("Open history window"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'H'), 0, SRMM_HK_HISTORY}, { "srmm_filter", LPGEN("Toggle filter"), BB_HK_SECTION, nullptr, HOTKEYCODE(HOTKEYF_CONTROL, 'F'), 0, SRMM_HK_FILTERTOGGLE }, @@ -198,6 +198,7 @@ int LoadSrmmModule() g_hCurHyperlinkHand = LoadCursor(nullptr, IDC_HAND); + CheckLogOptions(); LoadSrmmToolbarModule(); CreateServiceFunction(MS_HISTORY_EMPTY, svcEmptyHistory); diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp index ffd22b11c3..4f21be1c10 100644 --- a/src/mir_app/src/srmm_statusicon.cpp +++ b/src/mir_app/src/srmm_statusicon.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/srmm_toolbar.cpp b/src/mir_app/src/srmm_toolbar.cpp index 0cf41733ea..47baa3e5e2 100644 --- a/src/mir_app/src/srmm_toolbar.cpp +++ b/src/mir_app/src/srmm_toolbar.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
diff --git a/src/mir_app/src/srmm_util.cpp b/src/mir_app/src/srmm_util.cpp index af46bbe25e..f7e485a2b4 100644 --- a/src/mir_app/src/srmm_util.cpp +++ b/src/mir_app/src/srmm_util.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team,
+Copyright (C) 2012-25 Miranda NG team,
all portions of this codebase are copyrighted to the people
listed in contributors.txt.
@@ -179,7 +179,7 @@ void GetContactSentFilesDir(MCONTACT hContact, wchar_t *szDir, int cchDir) static void GenerateLocalName(const DB::EventInfo &dbei, DB::FILE_BLOB &blob, MCONTACT hContact)
{
wchar_t wszReceiveFolder[MAX_PATH];
- if (dbei.flags & DBEF_SENT) // don't mix sent & received files
+ if (dbei.bSent) // don't mix sent & received files
GetContactSentFilesDir(hContact, wszReceiveFolder, _countof(wszReceiveFolder));
else
File::GetReceivedFolder(hContact, wszReceiveFolder, _countof(wszReceiveFolder), true);
@@ -227,7 +227,7 @@ void DownloadOfflineFile(MCONTACT hContact, MEVENT hDbEvent, DB::EventInfo &dbei OFDTHREAD *ofd = new OFDTHREAD(hContact, hDbEvent, blob.getLocalName(), iCommand);
ofd->bLocked = true;
- ofd->dwTimestamp = dbei.timestamp;
+ ofd->dwTimestamp = dbei.getUnixtime();
ofd->pCallback = callback.release();
CallProtoService(dbei.szModule, PS_OFFLINEFILE, (WPARAM)ofd);
}
diff --git a/src/mir_app/src/stdafx.cxx b/src/mir_app/src/stdafx.cxx index 07335ea48e..9baeae5952 100644 --- a/src/mir_app/src/stdafx.cxx +++ b/src/mir_app/src/stdafx.cxx @@ -1,6 +1,6 @@ /*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h index 115b410aaa..f8d1529df5 100644 --- a/src/mir_app/src/stdafx.h +++ b/src/mir_app/src/stdafx.h @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/usedIcons.cpp b/src/mir_app/src/usedIcons.cpp index a460e805fc..d077b7ec01 100644 --- a/src/mir_app/src/usedIcons.cpp +++ b/src/mir_app/src/usedIcons.cpp @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/usedIcons.h b/src/mir_app/src/usedIcons.h index d4a8ffcda6..7dcf46bc48 100644 --- a/src/mir_app/src/usedIcons.h +++ b/src/mir_app/src/usedIcons.h @@ -1,7 +1,7 @@ /*
Copyright (C) 2009 Ricardo Pescuma Domenecci
-Copyright (C) 2012-24 Miranda NG team
+Copyright (C) 2012-25 Miranda NG team
This is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
diff --git a/src/mir_app/src/userInfo.cpp b/src/mir_app/src/userInfo.cpp index a70bb60e66..9a2b905e54 100644 --- a/src/mir_app/src/userInfo.cpp +++ b/src/mir_app/src/userInfo.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
diff --git a/src/mir_app/src/utils.cpp b/src/mir_app/src/utils.cpp index b87715a2b2..b67ec4f2da 100644 --- a/src/mir_app/src/utils.cpp +++ b/src/mir_app/src/utils.cpp @@ -2,7 +2,7 @@ Miranda NG: the free IM client for Microsoft* Windows*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org),
+Copyright (C) 2012-25 Miranda NG team (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.
@@ -348,7 +348,7 @@ bool ProcessFileDrop(HDROP hDrop, MCONTACT hContact) if (!(pcaps & PF1_FILESEND))
return false;
- if (Contact::GetStatus(hContact) == ID_STATUS_OFFLINE) {
+ if (Contact::GetStatus(hContact, szProto) == ID_STATUS_OFFLINE) {
pcaps = CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_4);
if (!(pcaps & PF4_OFFLINEFILES))
return false;
@@ -393,7 +393,7 @@ void SendHBitmapAsFile(HBITMAP hbmp, MCONTACT hContact) if (!(protoCaps & PF1_FILESEND))
return;
- if ((ID_STATUS_OFFLINE == wMyStatus) || (ID_STATUS_OFFLINE == Contact::GetStatus(hContact) && !(typeCaps & PF4_OFFLINEFILES)))
+ if ((ID_STATUS_OFFLINE == wMyStatus) || (ID_STATUS_OFFLINE == Contact::GetStatus(hContact, szProto) && !(typeCaps & PF4_OFFLINEFILES)))
return;
IMGSRVC_INFO ii;
|