diff options
Diffstat (limited to 'protocols/Tox/src')
-rw-r--r-- | protocols/Tox/src/common.h | 2 | ||||
-rw-r--r-- | protocols/Tox/src/main.cpp | 1 | ||||
-rw-r--r-- | protocols/Tox/src/tox_folders.cpp | 8 | ||||
-rw-r--r-- | protocols/Tox/src/tox_options.cpp | 13 | ||||
-rw-r--r-- | protocols/Tox/src/tox_profile.cpp | 9 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 13 | ||||
-rw-r--r-- | protocols/Tox/src/tox_search.cpp | 2 |
7 files changed, 37 insertions, 11 deletions
diff --git a/protocols/Tox/src/common.h b/protocols/Tox/src/common.h index d6bdc6e1c4..a0fa494107 100644 --- a/protocols/Tox/src/common.h +++ b/protocols/Tox/src/common.h @@ -34,6 +34,8 @@ #include <m_clc.h>
#include <m_clistint.h>
+#include <m_folders.h>
+
#include <tox.h>
#include <toxdns.h>
#include <toxencryptsave.h>
diff --git a/protocols/Tox/src/main.cpp b/protocols/Tox/src/main.cpp index 6d9711e12d..fedd47ccc0 100644 --- a/protocols/Tox/src/main.cpp +++ b/protocols/Tox/src/main.cpp @@ -52,6 +52,7 @@ extern "C" int __declspec(dllexport) Load(void) CToxProto::InitIcons();
CToxProto::InitMenus();
+ CToxProto::InitFolders();
return 0;
}
diff --git a/protocols/Tox/src/tox_folders.cpp b/protocols/Tox/src/tox_folders.cpp new file mode 100644 index 0000000000..a082aeb1b4 --- /dev/null +++ b/protocols/Tox/src/tox_folders.cpp @@ -0,0 +1,8 @@ +#include "common.h"
+
+HANDLE CToxProto::hProfileFolderPath = NULL;
+
+void CToxProto::InitFolders()
+{
+ hProfileFolderPath = FoldersRegisterCustomPathT("Tox", Translate("Profiles folder"), MIRANDA_USERDATAT);
+}
diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 623b05c673..764d3d9469 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -74,9 +74,17 @@ INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l case IDC_IMPORT_PROFILE:
{
+ TCHAR *pFilter, filter[MAX_PATH] = { 0 };
+ pFilter = &filter[0];
+ mir_tstrcat(pFilter, TranslateT("Tox profile(*.tox)"));
+ pFilter += mir_tstrlen(pFilter) + 1;
+ mir_tstrcat(pFilter, _T("*.tox"));
+ pFilter += mir_tstrlen(pFilter) + 1;
+ mir_tstrcat(pFilter, TranslateT("All files(*.*)"));
+ pFilter += mir_tstrlen(pFilter) + 1;
+ mir_tstrcat(pFilter, _T("*.*"));
+
TCHAR profilePath[MAX_PATH] = { 0 };
- TCHAR filter[MAX_PATH] = { 0 };
- mir_sntprintf(filter, MAX_PATH, _T("%s\0*.*"), TranslateT("All files (*.*)"));
OPENFILENAME ofn = { sizeof(ofn) };
ofn.hwndOwner = hwnd;
@@ -86,6 +94,7 @@ INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM l ofn.lpstrTitle = TranslateT("Select tox profile");
ofn.nMaxFile = MAX_PATH;
ofn.Flags = OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_EXPLORER;
+ ofn.lpstrInitialDir = _T("%APPDATA%\\Tox");
if (GetOpenFileName(&ofn))
{
diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index cdfbbe5fb8..9d1d446099 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -7,11 +7,10 @@ std::tstring CToxProto::GetToxProfilePath() std::tstring CToxProto::GetToxProfilePath(const TCHAR *accountName)
{
- std::tstring profilePath;
- TCHAR defaultPath[MAX_PATH];
- mir_sntprintf(defaultPath, MAX_PATH, _T("%s\\%s.tox"), VARST(_T("%miranda_userdata%")), accountName);
- profilePath = defaultPath;
-
+ TCHAR profilePath[MAX_PATH];
+ TCHAR profileRootPath[MAX_PATH];
+ FoldersGetCustomPathT(hProfileFolderPath, profileRootPath, SIZEOF(profileRootPath), VARST(_T("%miranda_userdata%")));
+ mir_sntprintf(profilePath, MAX_PATH, _T("%s\\%s.tox"), profileRootPath, accountName);
return profilePath;
}
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index f6292bdc20..9932a74aca 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -71,6 +71,9 @@ public: static void InitMenus();
static void UninitMenus();
+ // folders
+ static void InitFolders();
+
private:
Tox *tox;
char *password;
@@ -138,6 +141,12 @@ private: int OnInitStatusMenu();
+ // folders
+ static HANDLE hProfileFolderPath;
+
+ //services
+ INT_PTR __cdecl CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam);
+
// options
static INT_PTR CALLBACK MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
static INT_PTR CALLBACK NodesOptionsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
@@ -239,11 +248,11 @@ private: INT_PTR __cdecl GetMyAvatar(WPARAM wParam, LPARAM lParam);
INT_PTR __cdecl SetMyAvatar(WPARAM wParam, LPARAM lParam);
- INT_PTR __cdecl CToxProto::SetMyNickname(WPARAM wParam, LPARAM lParam);
-
static void OnGotFriendAvatarInfo(Tox *tox, int32_t number, uint8_t format, uint8_t *hash, void *arg);
static void OnGotFriendAvatarData(Tox *tox, int32_t number, uint8_t format, uint8_t *hash, uint8_t *data, uint32_t length, void *arg);
+ // folders
+
// utils
TOX_USERSTATUS MirandaToToxStatus(int status);
int ToxToMirandaStatus(TOX_USERSTATUS userstatus);
diff --git a/protocols/Tox/src/tox_search.cpp b/protocols/Tox/src/tox_search.cpp index 49a1b54099..ea2a571a32 100644 --- a/protocols/Tox/src/tox_search.cpp +++ b/protocols/Tox/src/tox_search.cpp @@ -137,8 +137,6 @@ void CToxProto::SearchByNameAsync(void *arg) psr.email = mir_tstrdup(email);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)1, (LPARAM)&psr);
-
- resolved++;
break;
}
}
|