From 8c4e9632602b62e7484fab3a741bbc1daa33c412 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Wed, 20 Aug 2014 18:08:33 +0000 Subject: Tox: - added own Tox ID in options dialog git-svn-id: http://svn.miranda-ng.org/main/trunk@10243 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/res/resource.rc | 33 ++++++++++++++++++++++----------- protocols/Tox/src/resource.h | Bin 2006 -> 1094 bytes protocols/Tox/src/tox_events.cpp | 2 +- protocols/Tox/src/tox_options.cpp | 19 +++++++++++++++++++ protocols/Tox/src/tox_proto.cpp | 8 +------- 5 files changed, 43 insertions(+), 19 deletions(-) diff --git a/protocols/Tox/res/resource.rc b/protocols/Tox/res/resource.rc index 245f59d36d..cb3a04498b 100644 --- a/protocols/Tox/res/resource.rc +++ b/protocols/Tox/res/resource.rc @@ -17,6 +17,7 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEUD) LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT +#pragma code_page(1251) ///////////////////////////////////////////////////////////////////////////// // @@ -35,6 +36,7 @@ IDI_TOX ICON "tox.ico" #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_RUS) LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT +#pragma code_page(1251) #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// @@ -70,6 +72,7 @@ END #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) LANGUAGE LANG_ENGLISH, SUBLANG_NEUTRAL +#pragma code_page(1252) ///////////////////////////////////////////////////////////////////////////// // @@ -83,8 +86,11 @@ FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN LTEXT "Name:",IDC_STATIC,12,8,54,12 EDITTEXT IDC_NAME,66,7,120,12,ES_AUTOHSCROLL - LTEXT "Default group:",IDC_STATIC,12,24,54,12 - EDITTEXT IDC_GROUP,66,23,120,12,ES_AUTOHSCROLL + LTEXT "Tox ID:",IDC_STATIC,12,24,54,12 + EDITTEXT IDC_TOXID,66,23,100,12,ES_AUTOHSCROLL | ES_READONLY + LTEXT "Default group:",IDC_STATIC,12,40,54,12 + EDITTEXT IDC_GROUP,66,39,120,12,ES_AUTOHSCROLL + PUSHBUTTON "C",IDC_CLIPBOARD,170,22,16,13 END IDD_OPTIONS_MAIN DIALOGEX 0, 0, 312, 234 @@ -92,15 +98,18 @@ STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_SYSMENU EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 400, 0, 0x1 BEGIN - LTEXT "Username:",IDC_STATIC,12,20,61,12 + LTEXT "Name:",IDC_STATIC,12,20,61,12 EDITTEXT IDC_NAME,81,19,219,12,ES_AUTOHSCROLL - LTEXT "Default group:",IDC_STATIC,12,36,61,12 - EDITTEXT IDC_GROUP,81,35,219,12,ES_AUTOHSCROLL - GROUPBOX "Connection settings",IDC_STATIC,7,58,298,49 + LTEXT "Tox ID:",IDC_STATIC,12,36,61,12 + EDITTEXT IDC_TOXID,81,35,199,12,ES_AUTOHSCROLL | ES_READONLY + GROUPBOX "Connection settings",IDC_STATIC,7,85,298,49 CONTROL "Disable UDP (force Tox to use TCP)",IDC_DISABLE_UDP, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,74,288,10 - CONTROL "Disable IPv6",IDC_DISABLE_IPV6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,89,288,10 - GROUPBOX "Tox",IDC_STATIC,7,7,298,49 + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,101,288,10 + CONTROL "Disable IPv6",IDC_DISABLE_IPV6,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,12,116,288,10 + GROUPBOX "Tox",IDC_STATIC,7,7,298,72 + LTEXT "Default group:",IDC_STATIC,12,53,60,12 + EDITTEXT IDC_GROUP,81,51,219,12,ES_AUTOHSCROLL + PUSHBUTTON "C",IDC_CLIPBOARD,284,35,16,13 END IDD_PROFILE_MANAGER DIALOGEX 0, 0, 235, 111 @@ -111,8 +120,8 @@ BEGIN DEFPUSHBUTTON "OK",IDOK,126,90,50,14 PUSHBUTTON "Cancel",IDCANCEL,178,90,50,14 LTEXT "Tox profile contains your ID and friend list.\r\nYou may create new profile if you never used tox or use existing profile from other tox client.",IDC_STATIC,7,7,221,33 - CONTROL "Create new profile",IDC_CREATE_NEW,"Button",BS_AUTORADIOBUTTON,7,43,75,10 - CONTROL "Use existing profile",IDC_USE_EXISTING,"Button",BS_AUTORADIOBUTTON,7,55,77,10 + CONTROL "Create new profile",IDC_CREATE_NEW,"Button",BS_AUTORADIOBUTTON,7,43,221,10 + CONTROL "Use existing profile",IDC_USE_EXISTING,"Button",BS_AUTORADIOBUTTON,7,55,221,10 EDITTEXT IDC_PROFILE_PATH,18,67,191,14,ES_AUTOHSCROLL | WS_DISABLED PUSHBUTTON "...",IDC_BROWSE_PROFILE,212,67,16,14,WS_DISABLED END @@ -132,6 +141,8 @@ BEGIN RIGHTMARGIN, 192 VERTGUIDE, 12 VERTGUIDE, 66 + VERTGUIDE, 166 + VERTGUIDE, 170 VERTGUIDE, 186 TOPMARGIN, 7 BOTTOMMARGIN, 85 diff --git a/protocols/Tox/src/resource.h b/protocols/Tox/src/resource.h index eceb7f7415..d78970c747 100644 Binary files a/protocols/Tox/src/resource.h and b/protocols/Tox/src/resource.h differ diff --git a/protocols/Tox/src/tox_events.cpp b/protocols/Tox/src/tox_events.cpp index 51d2421629..ee439c8fdf 100644 --- a/protocols/Tox/src/tox_events.cpp +++ b/protocols/Tox/src/tox_events.cpp @@ -3,7 +3,7 @@ int CToxProto::OnAccountLoaded(WPARAM, LPARAM) { HookEventObj(ME_OPT_INITIALISE, OnOptionsInit, this); - HookEventObj(ME_USERINFO_INITIALISE, OnUserInfoInit, this); + //HookEventObj(ME_USERINFO_INITIALISE, OnUserInfoInit, this); HookEventObj(ME_PROTO_ACCLISTCHANGED, OnAccountListChanged, this); InitNetlib(); diff --git a/protocols/Tox/src/tox_options.cpp b/protocols/Tox/src/tox_options.cpp index ddbed584a6..e048769ce1 100644 --- a/protocols/Tox/src/tox_options.cpp +++ b/protocols/Tox/src/tox_options.cpp @@ -15,6 +15,9 @@ INT_PTR CALLBACK CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, ptrW nick(proto->getTStringA("Nick")); SetDlgItemText(hwnd, IDC_NAME, nick); + ptrA toxId(proto->getStringA(TOX_SETTINGS_ID)); + SetDlgItemTextA(hwnd, IDC_TOXID, toxId); + ptrW group(proto->getTStringA(TOX_SETTINGS_GROUP)); SetDlgItemText(hwnd, IDC_GROUP, group); SendDlgItemMessage(hwnd, IDC_GROUP, EM_LIMITTEXT, 64, 0); @@ -36,6 +39,22 @@ INT_PTR CALLBACK CToxProto::MainOptionsProc(HWND hwnd, UINT uMsg, WPARAM wParam, } 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; + case IDC_GROUP: if ((HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus())) return 0; diff --git a/protocols/Tox/src/tox_proto.cpp b/protocols/Tox/src/tox_proto.cpp index ceee2bb544..1f618a5b58 100644 --- a/protocols/Tox/src/tox_proto.cpp +++ b/protocols/Tox/src/tox_proto.cpp @@ -151,13 +151,7 @@ int __cdecl CToxProto::RecvFile(MCONTACT hContact, PROTOFILEEVENT*) { return 0; int __cdecl CToxProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre) { - return (INT_PTR)AddDbEvent( - hContact, - EVENTTYPE_MESSAGE, - pre->timestamp, - DBEF_UTF, - lstrlenA(pre->szMessage), - (BYTE*)pre->szMessage); + return Proto_RecvMessage(hContact, pre); } int __cdecl CToxProto::RecvUrl(MCONTACT hContact, PROTORECVEVENT*) { return 0; } -- cgit v1.2.3