diff options
-rw-r--r-- | src/mir_app/src/proto_interface.cpp | 25 | ||||
-rw-r--r-- | src/mir_app/src/stdafx.h | 1 |
2 files changed, 25 insertions, 1 deletions
diff --git a/src/mir_app/src/proto_interface.cpp b/src/mir_app/src/proto_interface.cpp index 573a4177d8..3c0cd26ea7 100644 --- a/src/mir_app/src/proto_interface.cpp +++ b/src/mir_app/src/proto_interface.cpp @@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h"
#include "file.h"
+static wchar_t wszPreviewFolder[MAX_PATH];
+static HANDLE hPreviewFolder;
+
static HGENMENU hReqAuth = nullptr, hGrantAuth = nullptr, hRevokeAuth = nullptr, hServerHist = nullptr;
/////////////////////////////////////////////////////////////////////////////////////////
@@ -68,7 +71,7 @@ CMStringW PROTO_INTERFACE::GetAvatarPath() const CMStringW PROTO_INTERFACE::GetPreviewPath() const
{
- return CMStringW(FORMAT, L"%s\\Preview\\%S", VARSW(L"%miranda_userdata%").get(), m_szModuleName);
+ return CMStringW(FORMAT, L"%s\\%S", wszPreviewFolder, m_szModuleName);
}
void PROTO_INTERFACE::OnBuildProtoMenu()
@@ -275,6 +278,25 @@ int PROTO_INTERFACE::UserIsTyping(MCONTACT, int) }
/////////////////////////////////////////////////////////////////////////////////////////
+// folders support
+
+static int FoldersPathChanged(WPARAM, LPARAM)
+{
+ FoldersGetCustomPathW(hPreviewFolder, wszPreviewFolder, _countof(wszPreviewFolder), L"");
+ return 0;
+}
+
+static int ProtoModulesLoaded(WPARAM, LPARAM)
+{
+ wcsncpy_s(wszPreviewFolder, VARSW(L"%miranda_userdata%\\Preview"), _TRUNCATE);
+ if (hPreviewFolder = FoldersRegisterCustomPathW("Preview", LPGEN("Preview folder"), wszPreviewFolder)) {
+ HookEvent(ME_FOLDERS_PATH_CHANGED, FoldersPathChanged);
+ FoldersPathChanged(0, 0);
+ }
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
// protocol menus
static INT_PTR __cdecl stubRequestAuth(WPARAM hContact, LPARAM)
@@ -356,5 +378,6 @@ void InitProtoMenus(void) hServerHist = Menu_AddContactMenuItem(&mi);
CreateServiceFunction(mi.pszService, stubLoadHistory);
+ HookEvent(ME_SYSTEM_MODULESLOADED, ProtoModulesLoaded);
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, ProtoPrebuildContactMenu);
}
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h index 3962c77b01..115b410aaa 100644 --- a/src/mir_app/src/stdafx.h +++ b/src/mir_app/src/stdafx.h @@ -73,6 +73,7 @@ typedef struct SslHandle *HSSL; #include <m_extraicons.h>
#include <m_file.h>
#include <m_findadd.h>
+#include <m_folders.h>
#include <m_fontservice.h>
#include <m_gui.h>
#include <m_history.h>
|