summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/VKontakte/res/resource.rc95
-rw-r--r--protocols/VKontakte/src/misc.cpp28
-rw-r--r--protocols/VKontakte/src/resource.h8
-rw-r--r--protocols/VKontakte/src/vk_options.cpp69
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp1
-rw-r--r--protocols/VKontakte/src/vk_proto.h4
-rw-r--r--protocols/VKontakte/vk_10.vcxproj2
-rw-r--r--protocols/VKontakte/vk_10.vcxproj.filters6
-rw-r--r--protocols/VKontakte/vk_11.vcxproj2
-rw-r--r--protocols/VKontakte/vk_11.vcxproj.filters6
10 files changed, 217 insertions, 4 deletions
diff --git a/protocols/VKontakte/res/resource.rc b/protocols/VKontakte/res/resource.rc
new file mode 100644
index 0000000000..fe46d8ad2f
--- /dev/null
+++ b/protocols/VKontakte/res/resource.rc
@@ -0,0 +1,95 @@
+// Microsoft Visual C++ generated resource script.
+//
+#include "..\src\resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (United States) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ACCMGRUI DIALOGEX 0, 0, 186, 68
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+EXSTYLE WS_EX_CONTROLPARENT
+FONT 8, "MS Shell Dlg", 0, 0, 0x1
+BEGIN
+ LTEXT "Your login or phone number:",IDC_STATIC,0,0,53,23
+ EDITTEXT IDC_LOGIN,54,8,131,12,ES_AUTOHSCROLL
+ LTEXT "Password:",IDC_STATIC,0,28,53,13
+ EDITTEXT IDC_PASSWORD,54,27,131,12,ES_PASSWORD | ES_AUTOHSCROLL
+ CONTROL "Open VK site",IDC_URL,"Hyperlink",WS_TABSTOP,7,49,174,12
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// DESIGNINFO
+//
+
+#ifdef APSTUDIO_INVOKED
+GUIDELINES DESIGNINFO
+BEGIN
+ IDD_ACCMGRUI, DIALOG
+ BEGIN
+ LEFTMARGIN, 7
+ TOPMARGIN, 7
+ END
+END
+#endif // APSTUDIO_INVOKED
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "..\\src\\resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""winres.h""\0"
+ "#include ""..\\src\\version.h""\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+#endif // English (United States) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp
new file mode 100644
index 0000000000..dba3de5535
--- /dev/null
+++ b/protocols/VKontakte/src/misc.cpp
@@ -0,0 +1,28 @@
+/*
+Copyright (C) 2013 Miranda NG Project (http://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
+as published by the Free Software Foundation version 2
+of the License.
+
+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, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "stdafx.h"
+
+TCHAR* CVkProto::GetUserStoredPassword()
+{
+ ptrA szRawPass( getStringA("Password"));
+ if (szRawPass != NULL) {
+ CallService(MS_DB_CRYPT_DECODESTRING, strlen(szRawPass), szRawPass);
+ return mir_utf8decodeT(szRawPass);
+ }
+ return NULL;
+}
diff --git a/protocols/VKontakte/src/resource.h b/protocols/VKontakte/src/resource.h
index dc2b908493..3060905969 100644
--- a/protocols/VKontakte/src/resource.h
+++ b/protocols/VKontakte/src/resource.h
@@ -1,16 +1,20 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
+// Used by D:\Myranda\protocols\VKontakte\res\resource.rc
//
#define IDD_ACCMGRUI 101
+#define IDC_LOGIN 1001
+#define IDC_PASSWORD 1002
+#define IDC_URL 1003
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NO_MFC 1
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
+#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/VKontakte/src/vk_options.cpp b/protocols/VKontakte/src/vk_options.cpp
index a854a9f335..27d4a902f4 100644
--- a/protocols/VKontakte/src/vk_options.cpp
+++ b/protocols/VKontakte/src/vk_options.cpp
@@ -22,8 +22,73 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
INT_PTR CALLBACK VKAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- return 0;
-};
+ CVkProto* ppro = (CVkProto*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+
+ switch (uMsg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+
+ ppro = (CVkProto*)lParam;
+ SetWindowLongPtr( hwndDlg, GWLP_USERDATA, lParam );
+
+ SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon, true));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)Skin_GetIconByHandle(ppro->m_hProtoIcon));
+
+ SendDlgItemMessage(hwndDlg, IDC_PASSWORD, EM_LIMITTEXT, 30, 0);
+ {
+ ptrT tszLogin( ppro->getTStringA("Login"));
+ if (tszLogin != NULL)
+ SetDlgItemText(hwndDlg, IDC_LOGIN, tszLogin);
+
+ ptrT tszPassw( ppro->GetUserStoredPassword());
+ if (tszPassw != NULL)
+ SetDlgItemText(hwndDlg, IDC_PASSWORD, tszPassw);
+ }
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_URL:
+ CallService(MS_UTILS_OPENURL, 1, (LPARAM)"http://www.vk.com");
+ break;
+
+ case IDC_LOGIN:
+ case IDC_PASSWORD:
+ if (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()) {
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
+ }
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ TCHAR str[128];
+ GetDlgItemText(hwndDlg, IDC_LOGIN, str, SIZEOF(str));
+ ppro->setTString("Login", str);
+
+ GetDlgItemText(hwndDlg, IDC_PASSWORD, str, SIZEOF(str));
+ ptrA szRawPasswd( mir_utf8encodeT(str));
+ if (szRawPasswd != NULL) {
+ CallService(MS_DB_CRYPT_ENCODESTRING, strlen(szRawPasswd), szRawPasswd);
+ ppro->setString("Password", szRawPasswd);
+ }
+ }
+ break;
+
+ case WM_CLOSE:
+ EndDialog(hwndDlg, 0);
+ break;
+
+ case WM_DESTROY:
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_BIG, 0));
+ Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_GETICON, ICON_SMALL, 0));
+ break;
+ }
+
+ return FALSE;
+}
INT_PTR CVkProto::SvcCreateAccMgrUI(WPARAM wParam, LPARAM lParam)
{
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index ca1e8193fd..ebc47f8516 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
CVkProto::CVkProto(const char *szModuleName, const TCHAR *ptszUserName) :
PROTO<CVkProto>(szModuleName, ptszUserName)
{
+ CreateProtoService(PS_CREATEACCMGRUI, &CVkProto::SvcCreateAccMgrUI);
}
CVkProto::~CVkProto()
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index ffb92c5990..9000017dee 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -78,4 +78,8 @@ struct CVkProto : public PROTO<CVkProto>
//==== Services ======================================================================
INT_PTR __cdecl SvcCreateAccMgrUI(WPARAM, LPARAM);
+
+ //==== Misc ==========================================================================
+
+ TCHAR* GetUserStoredPassword(void);
};
diff --git a/protocols/VKontakte/vk_10.vcxproj b/protocols/VKontakte/vk_10.vcxproj
index fe83ab85d1..731d00cb26 100644
--- a/protocols/VKontakte/vk_10.vcxproj
+++ b/protocols/VKontakte/vk_10.vcxproj
@@ -167,6 +167,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
+ <ClCompile Include="src\misc.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
@@ -184,6 +185,7 @@
<ClInclude Include="src\vk_proto.h" />
</ItemGroup>
<ItemGroup>
+ <ResourceCompile Include="res\resource.rc" />
<ResourceCompile Include="res\version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/protocols/VKontakte/vk_10.vcxproj.filters b/protocols/VKontakte/vk_10.vcxproj.filters
index 1d83c9190c..91b996d16d 100644
--- a/protocols/VKontakte/vk_10.vcxproj.filters
+++ b/protocols/VKontakte/vk_10.vcxproj.filters
@@ -27,6 +27,9 @@
<ClCompile Include="src\vk_options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\misc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\resource.h">
@@ -49,5 +52,8 @@
<ResourceCompile Include="res\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
</ItemGroup>
</Project> \ No newline at end of file
diff --git a/protocols/VKontakte/vk_11.vcxproj b/protocols/VKontakte/vk_11.vcxproj
index 07e71e00bc..1e4eccda74 100644
--- a/protocols/VKontakte/vk_11.vcxproj
+++ b/protocols/VKontakte/vk_11.vcxproj
@@ -170,6 +170,7 @@
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\main.cpp" />
+ <ClCompile Include="src\misc.cpp" />
<ClCompile Include="src\stdafx.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
@@ -186,6 +187,7 @@
<ClInclude Include="src\vk_proto.h" />
</ItemGroup>
<ItemGroup>
+ <ResourceCompile Include="res\resource.rc" />
<ResourceCompile Include="res\version.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/protocols/VKontakte/vk_11.vcxproj.filters b/protocols/VKontakte/vk_11.vcxproj.filters
index ccfedcabb8..1e2a6fa2c9 100644
--- a/protocols/VKontakte/vk_11.vcxproj.filters
+++ b/protocols/VKontakte/vk_11.vcxproj.filters
@@ -27,6 +27,9 @@
<ClCompile Include="src\vk_options.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\misc.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\version.h">
@@ -46,5 +49,8 @@
<ResourceCompile Include="res\version.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
+ <ResourceCompile Include="res\resource.rc">
+ <Filter>Resource Files</Filter>
+ </ResourceCompile>
</ItemGroup>
</Project> \ No newline at end of file