From 50421b7809c47bd95c59b4a5627e2f89c8bccfa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Tue, 29 Oct 2013 08:47:48 +0000 Subject: SkypeClassic: Folders structure and project cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@6668 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/SkypeClassic/alogon.cpp | 129 -------------------------------------- 1 file changed, 129 deletions(-) delete mode 100644 protocols/SkypeClassic/alogon.cpp (limited to 'protocols/SkypeClassic/alogon.cpp') diff --git a/protocols/SkypeClassic/alogon.cpp b/protocols/SkypeClassic/alogon.cpp deleted file mode 100644 index 8002d495fc..0000000000 --- a/protocols/SkypeClassic/alogon.cpp +++ /dev/null @@ -1,129 +0,0 @@ -#include "skype.h" -#include "debug.h" - -extern char g_szProtoName[]; -extern HANDLE SkypeReady; - -/** - * Purpose: Retrieves class name from window - * - * Note: This is some sort of hack to return static local variable, - * but it works :) - */ -static const TCHAR* getClassName(HWND wnd) -{ - static TCHAR className[256]; - - *className=0; - GetClassName(wnd, &className[0], sizeof(className)/sizeof(className[0])); - return className; -} - -/** - * Purpose: Finds a window - * - * Note: This function relies on Skype window placement. - * It should work for Skype 3.x - */ -static HWND findWindow(HWND parent, const TCHAR* childClassName) -{ - // Get child window - // This window is not combo box or edit box - HWND wnd = GetWindow(parent, GW_CHILD); - while(wnd != NULL && _tcscmp(getClassName(wnd), childClassName) != 0) - wnd = GetWindow(wnd, GW_HWNDNEXT); - - return wnd; -} - -static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam) -{ - DWORD dwPID; - const TCHAR *lpszClassName; - - - GetWindowThreadProcessId(hWnd,&dwPID); - if (lParam != 0 && dwPID != (DWORD)lParam) return TRUE; - lpszClassName = getClassName(hWnd); - if(_tcscmp(lpszClassName, _T("tSkMainForm.UnicodeClass")) == 0 || - _tcscmp(lpszClassName, _T("TLoginForm.UnicodeClass")) == 0) - { - HWND loginControl = GetWindow(hWnd, GW_CHILD); - - LOG(("setUserNamePasswordThread: Skype window found!")); - - // Sleep for some time, while Skype is loading - // It loads slowly :( - //Sleep(5000); - LOG (("TLoginControl = %S", getClassName(loginControl))); - - // Check for login control - if(_tcscmp(getClassName(loginControl), _T("TLoginControl")) == 0) - { - // Find user name window - HWND userName = findWindow(loginControl, _T("TNavigableTntComboBox.UnicodeClass")); - HWND password = findWindow(loginControl, _T("TNavigableTntEdit.UnicodeClass")); - - LOG (("userName=%08X; password=%08X", userName, password)); - if (userName && password) - { - // Set user name and password - DBVARIANT dbv; - - if(!db_get_ws(NULL,SKYPE_PROTONAME,"LoginUserName",&dbv)) - { - SendMessageW(userName, WM_SETTEXT, 0, (LPARAM)dbv.pwszVal); - db_free(&dbv); - } - - if(!db_get_ws(NULL,SKYPE_PROTONAME,"LoginPassword",&dbv)) - { - SendMessageW(password, WM_SETTEXT, 0, (LPARAM)dbv.pwszVal); - db_free(&dbv); - SendMessageW(password, WM_CHAR, 13, 0); - } - - - SendMessageW(hWnd, - WM_COMMAND, - 0x4a8, // sign-in button; WARNING: This ID can change during newer Skype versions - (LPARAM)findWindow(loginControl, _T("TTntButton.UnicodeClass"))); - } - return FALSE; - } - - } - return TRUE; -} - -DWORD WINAPI setUserNamePasswordThread(LPVOID lpDummy) -{ - DWORD dwPid = (DWORD)lpDummy; - HANDLE mutex = CreateMutex(NULL, TRUE, _T("setUserNamePasswordMutex")); - - // Check double entrance - if(GetLastError() == ERROR_ALREADY_EXISTS) - return 0; - - WaitForSingleObject(SkypeReady, 5000); - EnumWindows (EnumWindowsProc, dwPid); - - ReleaseMutex(mutex); - CloseHandle(mutex); - return 0; -} - -/** - * Purpose: Finds Skype window and sets user name and password. - * - * Note: This function relies on Skype window placement. - * It should work for Skype 3.x - */ -void setUserNamePassword(int dwPid) -{ - DWORD threadId; - CreateThread(NULL, 0, &setUserNamePasswordThread, (LPVOID)dwPid, 0, &threadId); - - // Give time to thread - Sleep(100); -} -- cgit v1.2.3