diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-01-07 21:40:06 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-01-07 21:40:06 +0000 |
commit | 4cf5a9ef45a6f6172e93c1f84bcbab22be00e0a4 (patch) | |
tree | 320b0e8f323ac90bb22e9a792bf5ecc25d7a1cf6 | |
parent | 6c61dc812b9a5382c282f3e61111516fff562c0e (diff) |
Tox: enabled profile encryption
git-svn-id: http://svn.miranda-ng.org/main/trunk@11790 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/Tox/res/resource.rc | 10 | ||||
-rw-r--r-- | protocols/Tox/src/tox_account.cpp | 22 | ||||
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 7 | ||||
-rw-r--r-- | protocols/Tox/src/tox_events.cpp | 17 | ||||
-rw-r--r-- | protocols/Tox/src/tox_options.cpp | 233 | ||||
-rw-r--r-- | protocols/Tox/src/tox_profile.cpp | 79 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.cpp | 10 | ||||
-rw-r--r-- | protocols/Tox/src/tox_proto.h | 8 | ||||
-rw-r--r-- | protocols/Tox/src/version.h | 2 |
9 files changed, 200 insertions, 188 deletions
diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc index 8a82bf0522..9d2991b214 100644 --- a/protocols/Tox/res/resource.rc +++ b/protocols/Tox/res/resource.rc @@ -85,14 +85,14 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Name:",IDC_STATIC,12,24,54,12
- EDITTEXT IDC_NAME,66,23,120,12,ES_AUTOHSCROLL | WS_DISABLED
- LTEXT "Password:",IDC_STATIC,12,40,54,12,NOT WS_VISIBLE
+ EDITTEXT IDC_NAME,66,23,120,12,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,12,40,54,12
EDITTEXT IDC_TOXID,66,7,100,12,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
LTEXT "Default group:",IDC_STATIC,12,56,54,12
EDITTEXT IDC_GROUP,66,54,120,12,ES_AUTOHSCROLL
PUSHBUTTON "C",IDC_CLIPBOARD,170,7,16,13,WS_DISABLED
LTEXT "Tox ID:",IDC_STATIC,12,9,54,8
- EDITTEXT IDC_PASSWORD,66,38,120,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED
+ EDITTEXT IDC_PASSWORD,66,38,120,12,ES_PASSWORD | ES_AUTOHSCROLL
END
IDD_OPTIONS_MAIN DIALOGEX 0, 0, 312, 234
@@ -101,7 +101,7 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
LTEXT "Name:",IDC_STATIC,12,35,69,11
- EDITTEXT IDC_NAME,81,33,219,12,ES_AUTOHSCROLL | WS_DISABLED
+ EDITTEXT IDC_NAME,81,33,219,12,ES_AUTOHSCROLL
LTEXT "Tox ID:",IDC_STATIC,12,19,69,11
EDITTEXT IDC_TOXID,81,17,199,12,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED
GROUPBOX "Connection settings",IDC_STATIC,7,89,298,45
@@ -113,7 +113,7 @@ BEGIN EDITTEXT IDC_GROUP,81,65,219,12,ES_AUTOHSCROLL
PUSHBUTTON "C",IDC_CLIPBOARD,284,17,16,13,WS_DISABLED
LTEXT "Password:",IDC_STATIC,12,51,69,8,NOT WS_VISIBLE
- EDITTEXT IDC_PASSWORD,81,49,219,12,ES_PASSWORD | ES_AUTOHSCROLL | NOT WS_VISIBLE | WS_DISABLED
+ EDITTEXT IDC_PASSWORD,81,49,219,12,ES_PASSWORD | ES_AUTOHSCROLL
END
IDD_PROFILE_IMPORT DIALOGEX 0, 0, 313, 87
diff --git a/protocols/Tox/src/tox_account.cpp b/protocols/Tox/src/tox_account.cpp index bc9a984288..5c4154af29 100644 --- a/protocols/Tox/src/tox_account.cpp +++ b/protocols/Tox/src/tox_account.cpp @@ -10,7 +10,6 @@ int CToxProto::OnAccountLoaded(WPARAM, LPARAM) {
HookProtoEvent(ME_OPT_INITIALISE, &CToxProto::OnOptionsInit);
HookProtoEvent(ME_USERINFO_INITIALISE, &CToxProto::OnUserInfoInit);
- //HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CToxProto::OnSettingsChanged);
HookProtoEvent(ME_MSG_PRECREATEEVENT, &CToxProto::OnPreCreateMessage);
return 0;
@@ -64,6 +63,7 @@ bool CToxProto::InitToxCore() }
tox = tox_new(&options);
+ password = mir_utf8encodeW(ptrT(getTStringA("Password")));
bool isProfileLoaded = LoadToxProfile();
if (isProfileLoaded)
{
@@ -101,6 +101,15 @@ bool CToxProto::InitToxCore() SetToxAvatar(avatarPath);
}
}
+ else
+ {
+ if (password != NULL)
+ {
+ mir_free(password);
+ password = NULL;
+ }
+ tox_kill(tox);
+ }
return isProfileLoaded;
}
@@ -111,6 +120,11 @@ void CToxProto::UninitToxCore() tox_set_name(tox, (uint8_t*)(char*)nickname, (uint16_t)strlen(nickname));
SaveToxProfile();
+ if (password != NULL)
+ {
+ mir_free(password);
+ password = NULL;
+ }
tox_kill(tox);
}
@@ -129,7 +143,7 @@ void CToxProto::DoBootstrap() void CToxProto::DoTox()
{
{
- mir_cslock lck(toxLock);
+ mir_cslock lock(toxLock);
tox_do(tox);
}
PulseEvent(hToxEvent);
@@ -150,7 +164,9 @@ void CToxProto::PollingThread(void*) {
isTerminated = true;
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
- ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, (HANDLE)NULL, LOGINERR_NOSERVER);
+ ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, (HANDLE)NULL, LOGINERR_WRONGPASSWORD);
+ debugLogA("CToxProto::PollingThread: leaving");
+ return;
}
while (!isTerminated)
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 48c0de0274..110480ed8c 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -166,6 +166,11 @@ void CToxProto::LoadFriendList() int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM lParam)
{
+ if (!IsOnline())
+ {
+ return 1;
+ }
+
std::string id = getStringA(hContact, TOX_SETTINGS_ID);
std::vector<uint8_t> clientId = HexStringToData(id);
@@ -175,8 +180,6 @@ int CToxProto::OnContactDeleted(MCONTACT hContact, LPARAM lParam) return 1;
}
- SaveToxProfile();
-
return 0;
}
diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index 789ac6039e..0f577dcdb7 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -29,21 +29,4 @@ int CToxProto::OnOptionsInit(WPARAM wParam, LPARAM) mir_free(title);
return 0;
-}
-
-int CToxProto::OnSettingsChanged(WPARAM hContact, LPARAM lParam)
-{
- DBCONTACTWRITESETTING* dbcws = (DBCONTACTWRITESETTING*)lParam;
- if (hContact == NULL && !strcmp(dbcws->szModule, m_szModuleName))
- {
- if (!strcmp(dbcws->szSetting, "Nick") && dbcws->value.pszVal)
- {
- if (tox && tox_set_name(tox, (uint8_t*)dbcws->value.pszVal, (uint16_t)strlen(dbcws->value.pszVal)))
- {
- SaveToxProfile();
- }
- }
- }
-
- return 0;
}
\ No newline at end of file diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index 02748633ea..33c19a0b50 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -1,115 +1,120 @@ -#include "common.h" - -INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA); - - switch (uMsg) - { - case WM_INITDIALOG: - TranslateDialogDefault(hwnd); - { - proto = (CToxProto*)lParam; - SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam); - - ptrT nick(proto->getTStringA("Nick")); - SetDlgItemText(hwnd, IDC_NAME, nick); - - ptrT pass(proto->getTStringA("Password")); - SetDlgItemText(hwnd, IDC_PASSWORD, pass); - - ptrA address(proto->getStringA(TOX_SETTINGS_ID)); - if (address != NULL) - { - SetDlgItemTextA(hwnd, IDC_TOXID, address); - } - - ptrT group(proto->getTStringA(TOX_SETTINGS_GROUP)); - SetDlgItemText(hwnd, IDC_GROUP, group); - SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0); - - CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getBool("DisableUDP", 0)); - CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getBool("DisableIPv6", 0)); - - EnableWindow(GetDlgItem(hwnd, IDC_TOXID), proto->IsOnline()); - EnableWindow(GetDlgItem(hwnd, IDC_CLIPBOARD), proto->IsOnline()); - EnableWindow(GetDlgItem(hwnd, IDC_NAME), proto->IsOnline()); - EnableWindow(GetDlgItem(hwnd, IDC_PASSWORD), proto->IsOnline()); - } - return TRUE; - - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_NAME: - case IDC_GROUP: - case IDC_PASSWORD: - if ((HWND)lParam == GetFocus()) - { - if (HIWORD(wParam) != EN_CHANGE) return 0; - SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); - } - break; - - case IDC_DISABLE_UDP: - case IDC_DISABLE_IPV6: - SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); - break; - } - - case IDC_CLIPBOARD: - { - char toxId[TOX_FRIEND_ADDRESS_SIZE * 2 + 1]; - GetDlgItemTextA(hwnd, IDC_TOXID, toxId, SIZEOF(toxId)); - if (OpenClipboard(GetDlgItem(hwnd, IDC_TOXID))) - { - EmptyClipboard(); - HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, sizeof(toxId)); - memcpy(GlobalLock(hMem), toxId, sizeof(toxId)); - GlobalUnlock(hMem); - SetClipboardData(CF_TEXT, hMem); - CloseClipboard(); - } - } - break; - } - break; - - case WM_NOTIFY: - if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY) - { - TCHAR group[64]; - GetDlgItemText(hwnd, IDC_GROUP, group, SIZEOF(group)); - if (_tcslen(group) > 0) - { - proto->setTString(NULL, TOX_SETTINGS_GROUP, group); - Clist_CreateGroup(0, group); - } - else - { - proto->delSetting(NULL, TOX_SETTINGS_GROUP); - } - - proto->setByte("DisableUDP", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_UDP)); - proto->setByte("DisableIPv6", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_IPV6)); - - if (proto->IsOnline()) - { - TCHAR nick[TOX_MAX_NAME_LENGTH], pass[MAX_PATH]; - GetDlgItemText(hwnd, IDC_NAME, nick, TOX_MAX_NAME_LENGTH); - proto->setTString("Nick", nick); - - GetDlgItemText(hwnd, IDC_PASSWORD, pass, SIZEOF(pass)); - proto->setTString("Password", pass); - - proto->SaveToxProfile(); - } - - return TRUE; - } - break; - } - - return FALSE; +#include "common.h"
+
+INT_PTR CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ CToxProto *proto = (CToxProto*)GetWindowLongPtr(hwnd, GWLP_USERDATA);
+
+ switch (uMsg)
+ {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwnd);
+ {
+ proto = (CToxProto*)lParam;
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, lParam);
+
+ ptrT nick(proto->getTStringA("Nick"));
+ SetDlgItemText(hwnd, IDC_NAME, nick);
+
+ ptrT pass(proto->getTStringA("Password"));
+ SetDlgItemText(hwnd, IDC_PASSWORD, pass);
+
+ ptrA address(proto->getStringA(TOX_SETTINGS_ID));
+ if (address != NULL)
+ {
+ SetDlgItemTextA(hwnd, IDC_TOXID, address);
+ }
+
+ ptrT group(proto->getTStringA(TOX_SETTINGS_GROUP));
+ SetDlgItemText(hwnd, IDC_GROUP, group);
+ SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0);
+
+ CheckDlgButton(hwnd, IDC_DISABLE_UDP, proto->getBool("DisableUDP", 0));
+ CheckDlgButton(hwnd, IDC_DISABLE_IPV6, proto->getBool("DisableIPv6", 0));
+
+ EnableWindow(GetDlgItem(hwnd, IDC_TOXID), proto->IsOnline());
+ EnableWindow(GetDlgItem(hwnd, IDC_CLIPBOARD), proto->IsOnline());
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDC_NAME:
+ case IDC_GROUP:
+ case IDC_PASSWORD:
+ if ((HWND)lParam == GetFocus())
+ {
+ if (HIWORD(wParam) != EN_CHANGE) return 0;
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ }
+ break;
+
+ case IDC_DISABLE_UDP:
+ case IDC_DISABLE_IPV6:
+ SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
+ break;
+ }
+
+ case IDC_CLIPBOARD:
+ {
+ char toxId[TOX_FRIEND_ADDRESS_SIZE * 2 + 1];
+ GetDlgItemTextA(hwnd, IDC_TOXID, toxId, SIZEOF(toxId));
+ if (OpenClipboard(GetDlgItem(hwnd, IDC_TOXID)))
+ {
+ EmptyClipboard();
+ HGLOBAL hMem = GlobalAlloc(GMEM_FIXED, sizeof(toxId));
+ memcpy(GlobalLock(hMem), toxId, sizeof(toxId));
+ GlobalUnlock(hMem);
+ SetClipboardData(CF_TEXT, hMem);
+ CloseClipboard();
+ }
+ }
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ if (reinterpret_cast<NMHDR*>(lParam)->code == PSN_APPLY)
+ {
+ TCHAR nick[TOX_MAX_NAME_LENGTH];
+ GetDlgItemText(hwnd, IDC_NAME, nick, TOX_MAX_NAME_LENGTH);
+ proto->setTString("Nick", nick);
+
+ TCHAR password[MAX_PATH];
+ GetDlgItemText(hwnd, IDC_PASSWORD, password, SIZEOF(password));
+ proto->setTString("Password", password);
+ if (proto->password != NULL)
+ {
+ mir_free(proto->password);
+ proto->password = NULL;
+ }
+ proto->password = mir_utf8encodeW(password);
+
+ TCHAR group[64];
+ GetDlgItemText(hwnd, IDC_GROUP, group, SIZEOF(group));
+ if (_tcslen(group) > 0)
+ {
+ proto->setTString(NULL, TOX_SETTINGS_GROUP, group);
+ Clist_CreateGroup(0, group);
+ }
+ else
+ {
+ proto->delSetting(NULL, TOX_SETTINGS_GROUP);
+ }
+
+ proto->setByte("DisableUDP", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_UDP));
+ proto->setByte("DisableIPv6", (BYTE)IsDlgButtonChecked(hwnd, IDC_DISABLE_IPV6));
+
+ if (proto->IsOnline())
+ {
+ //proto->SaveToxProfile();
+ }
+
+ return TRUE;
+ }
+ break;
+ }
+
+ return FALSE;
}
\ No newline at end of file diff --git a/protocols/Tox/src/tox_profile.cpp b/protocols/Tox/src/tox_profile.cpp index 136bc66ca1..4ee3abc526 100644 --- a/protocols/Tox/src/tox_profile.cpp +++ b/protocols/Tox/src/tox_profile.cpp @@ -25,9 +25,9 @@ bool CToxProto::LoadToxProfile() return true;
}
- fseek(profile, 0L, SEEK_END);
- DWORD size = ftell(profile);
- rewind(profile);
+ fseek(profile, 0, SEEK_END);
+ size_t size = ftell(profile);
+ fseek(profile, 0, SEEK_SET);
if (size == 0)
{
fclose(profile);
@@ -36,7 +36,7 @@ bool CToxProto::LoadToxProfile() }
uint8_t *data = (uint8_t*)mir_calloc(size);
- DWORD read = fread((char*)data, sizeof(char), size, profile);
+ size_t read = fread((char*)data, sizeof(char), size, profile);
if (size != read)
{
fclose(profile);
@@ -46,32 +46,29 @@ bool CToxProto::LoadToxProfile() }
fclose(profile);
- /*if (tox_is_data_encrypted(data))
+ if (tox_is_data_encrypted(data))
{
- ptrA password(mir_utf8encodeW(ptrT(getTStringA("Password"))));
if (password == NULL || strlen(password) == 0)
{
- INT_PTR result = DialogBoxParam(
+ if (!DialogBoxParam(
g_hInstance,
MAKEINTRESOURCE(IDD_PASSWORD),
NULL,
ToxProfilePasswordProc,
- (LPARAM)this);
-
- switch (result)
+ (LPARAM)this))
{
- default: return false;
+ return false;
}
}
- if (tox_encrypted_load(tox, data, size, (uint8_t*)(char*)password, strlen(password)) == TOX_ERROR)
+ if (tox_encrypted_load(tox, data, size, (uint8_t*)password, strlen(password)) == TOX_ERROR)
{
debugLogA("CToxProto::LoadToxData: could not decrypt tox profile");
mir_free(data);
return false;
}
}
- else*/
+ else
{
if (tox_load(tox, data, size) == TOX_ERROR)
{
@@ -87,30 +84,30 @@ bool CToxProto::LoadToxProfile() void CToxProto::SaveToxProfile()
{
- /*ptrA password(mir_utf8encodeW(ptrT(getTStringA("Password"))));
- bool needToEncrypt = password && strlen(password);
- DWORD size = needToEncrypt
- ? tox_encrypted_size(tox)
- : tox_size(tox);
+ size_t size = 0;
+ uint8_t *data = NULL;
- uint8_t *data = (uint8_t*)mir_calloc(size);
- if (needToEncrypt)
{
- if (tox_encrypted_save(tox, data, (uint8_t*)(char*)password, strlen(password)) == TOX_ERROR)
+ mir_cslock lock(toxLock);
+
+ if (password && strlen(password))
{
- debugLogA("CToxProto::LoadToxData: could not encrypt tox profile");
- mir_free(data);
- return;
+ size = tox_encrypted_size(tox);
+ data = (uint8_t*)mir_calloc(size);
+ if (tox_encrypted_save(tox, data, (uint8_t*)password, strlen(password)) == TOX_ERROR)
+ {
+ debugLogA("CToxProto::LoadToxData: could not encrypt tox profile");
+ mir_free(data);
+ return;
+ }
+ }
+ else
+ {
+ size = tox_size(tox);
+ data = (uint8_t*)mir_calloc(size);
+ tox_save(tox, data);
}
}
- else
- {
- tox_save(tox, data);
- }*/
-
- DWORD size = tox_size(tox);
- uint8_t *data = (uint8_t*)mir_calloc(size);
- tox_save(tox, data);
std::tstring profilePath = GetToxProfilePath();
FILE *profile = _tfopen(profilePath.c_str(), _T("wb"));
@@ -120,7 +117,7 @@ void CToxProto::SaveToxProfile() return;
}
- DWORD written = fwrite(data, sizeof(char), size, profile);
+ size_t written = fwrite(data, sizeof(char), size, profile);
if (size != written)
{
fclose(profile);
@@ -228,7 +225,21 @@ INT_PTR CToxProto::ToxProfilePasswordProc(HWND hwnd, UINT uMsg, WPARAM wParam, L switch (LOWORD(wParam))
{
case IDOK:
- EndDialog(hwnd, 1);
+ {
+ TCHAR password[MAX_PATH];
+ GetDlgItemText(hwnd, IDC_PASSWORD, password, SIZEOF(password));
+ if (IsDlgButtonChecked(hwnd, IDC_SAVEPERMANENTLY))
+ {
+ proto->setTString("Password", password);
+ }
+ if (proto->password != NULL)
+ {
+ mir_free(proto->password);
+ }
+ proto->password = mir_utf8encodeW(password);
+
+ EndDialog(hwnd, 1);
+ }
break;
case IDCANCEL:
diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index 89be71ab18..204777d9ec 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -1,9 +1,10 @@ #include "common.h"
CToxProto::CToxProto(const char* protoName, const TCHAR* userName) :
- PROTO<CToxProto>(protoName, userName)
+ PROTO<CToxProto>(protoName, userName), password(NULL)
{
InitNetlib();
+
accountName = mir_tstrdup(userName);
CreateProtoService(PS_CREATEACCMGRUI, &CToxProto::OnAccountManagerInit);
@@ -112,7 +113,6 @@ int __cdecl CToxProto::Authorize(HANDLE hDbEvent) db_unset(hContact, "CList", "NotOnList");
delSetting(hContact, "Grant");
- SaveToxProfile();
return 0;
}
@@ -133,8 +133,6 @@ int __cdecl CToxProto::AuthRequest(MCONTACT hContact, const PROTOCHAR *szMessage int32_t number = tox_add_friend(tox, pubKey.data(), (uint8_t*)(char*)reason, (uint16_t)strlen(reason));
if (number > TOX_ERROR)
{
- SaveToxProfile();
-
// change tox address in contact id by tox id
std::string id = ToxAddressToId(address);
setString(hContact, TOX_SETTINGS_ID, id.c_str());
@@ -237,9 +235,9 @@ int __cdecl CToxProto::SetStatus(int iNewStatus) {
// set tox status
m_iStatus = iNewStatus;
- if (tox_set_user_status(tox, MirandaToToxStatus(iNewStatus)) == 0)
+ if (tox_set_user_status(tox, MirandaToToxStatus(iNewStatus)) == TOX_ERROR)
{
- SaveToxProfile();
+ debugLogA("CToxProto::SetStatus: failed to change status from %i", m_iStatus, iNewStatus);
}
}
}
diff --git a/protocols/Tox/src/tox_proto.h b/protocols/Tox/src/tox_proto.h index 2565ceb70d..faf7baa84b 100644 --- a/protocols/Tox/src/tox_proto.h +++ b/protocols/Tox/src/tox_proto.h @@ -110,11 +110,9 @@ public: static CToxProto* InitAccount(const char* protoName, const wchar_t* userName);
static int UninitAccount(CToxProto* ppro);
- // tox
- bool InitToxCore();
-
private:
Tox *tox;
+ char *password;
mir_cs toxLock;
TCHAR *accountName;
HANDLE hNetlib, hPollingThread, hToxEvent;
@@ -122,6 +120,7 @@ private: std::map<uint8_t, FileTransferParam*> transfers;
// tox
+ bool InitToxCore();
void UninitToxCore();
// ???
@@ -152,9 +151,6 @@ private: bool IsOnline();
int __cdecl OnAccountLoaded(WPARAM, LPARAM);
int __cdecl OnAccountRenamed(WPARAM, LPARAM);
-
- // events
- int __cdecl OnSettingsChanged(WPARAM wParam, LPARAM lParam);
// options
static INT_PTR CALLBACK MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
diff --git a/protocols/Tox/src/version.h b/protocols/Tox/src/version.h index ec3602b81e..775b7089a0 100644 --- a/protocols/Tox/src/version.h +++ b/protocols/Tox/src/version.h @@ -5,7 +5,7 @@ #include <stdver.h>
-#define __PLUGIN_NAME "Tox Protocol"
+#define __PLUGIN_NAME "Tox protocol"
#define __FILENAME "Tox.dll"
#define __DESCRIPTION "Tox protocol support for Miranda NG."
#define __AUTHOR "ForNeVeR, Mataes, unsane"
|