summaryrefslogtreecommitdiff
path: root/protocols/Skype/src
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-09-27 17:23:10 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-09-27 17:23:10 +0000
commit89c883cf565ac91bf21d1711f7c3972fb6281bf7 (patch)
tree89315d0fd74187b4cce86332c0a250fa9b13b51a /protocols/Skype/src
parent795fd3b5c0a366bd1455d4c0ae8a7d9bb474c348 (diff)
-- added proto caps
- added service function (creating and hoking services, events, threads) - some minir issues and code review git-svn-id: http://svn.miranda-ng.org/main/trunk@1687 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src')
-rw-r--r--protocols/Skype/src/resource.h3
-rw-r--r--protocols/Skype/src/skype.h5
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp32
-rw-r--r--protocols/Skype/src/skype_proto.cpp23
-rw-r--r--protocols/Skype/src/skype_proto.h16
-rw-r--r--protocols/Skype/src/skype_settings.cpp2
-rw-r--r--protocols/Skype/src/skype_utils.cpp57
7 files changed, 105 insertions, 33 deletions
diff --git a/protocols/Skype/src/resource.h b/protocols/Skype/src/resource.h
index dd62507289..2cfd6eaeab 100644
--- a/protocols/Skype/src/resource.h
+++ b/protocols/Skype/src/resource.h
@@ -7,6 +7,7 @@
#define IDI_ICON 101
#define IDC_SN 1001
#define IDC_PW 1002
+#define IDC_SL 1003
// Next default values for new objects
//
@@ -14,7 +15,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 102
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1003
+#define _APS_NEXT_CONTROL_VALUE 1004
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/protocols/Skype/src/skype.h b/protocols/Skype/src/skype.h
index 49f0f59234..2c16c608cf 100644
--- a/protocols/Skype/src/skype.h
+++ b/protocols/Skype/src/skype.h
@@ -65,4 +65,7 @@ extern HINSTANCE g_hInstance;
static const char* g_keyFileName = "..\\..\\..\\SkypeKit\\keypair.crt";
-extern CSkype* g_skype; \ No newline at end of file
+extern CSkype* g_skype;
+
+#define SKYPE_SETTINGS_LOGIN "SkypeLogin"
+#define SKYPE_SETTINGS_PASSWORD "Password" \ No newline at end of file
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp
index 4410d91364..f8563c4922 100644
--- a/protocols/Skype/src/skype_dialogs.cpp
+++ b/protocols/Skype/src/skype_dialogs.cpp
@@ -13,13 +13,13 @@ INT_PTR CALLBACK CSkypeProto::SkypeAccountProc(HWND hwnd, UINT message, WPARAM w
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(0, proto->ModuleName(), "SkypeName", &dbv))
+ if ( !DBGetContactSettingWString(0, proto->ModuleName(), SKYPE_SETTINGS_LOGIN, &dbv))
{
- SetDlgItemText(hwnd, IDC_SN, dbv.ptszVal);
+ SetDlgItemText(hwnd, IDC_SL, dbv.ptszVal);
DBFreeVariant(&dbv);
}
- if ( !DBGetContactSettingString(0, proto->ModuleName(), "Password", &dbv))
+ if ( !DBGetContactSettingWString(0, proto->ModuleName(), SKYPE_SETTINGS_PASSWORD, &dbv))
{
CallService(
MS_DB_CRYPT_DECODESTRING,
@@ -31,7 +31,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeAccountProc(HWND hwnd, UINT message, WPARAM w
if ( !proto->IsOffline())
{
- SendMessage(GetDlgItem(hwnd, IDC_SN), EM_SETREADONLY, 1, 0);
+ SendMessage(GetDlgItem(hwnd, IDC_SL), EM_SETREADONLY, 1, 0);
SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
}
@@ -42,7 +42,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeAccountProc(HWND hwnd, UINT message, WPARAM w
{
switch(LOWORD(wparam))
{
- case IDC_SN:
+ case IDC_SL:
case IDC_PW:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
@@ -55,12 +55,12 @@ INT_PTR CALLBACK CSkypeProto::SkypeAccountProc(HWND hwnd, UINT message, WPARAM w
proto = reinterpret_cast<CSkypeProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
TCHAR str[128];
- GetDlgItemText(hwnd, IDC_SN, str, sizeof(str));
- DBWriteContactSettingTString(0, proto->ModuleName(), "SkypeName", str);
+ GetDlgItemText(hwnd, IDC_SL, str, sizeof(str));
+ DBWriteContactSettingWString(0, proto->ModuleName(), SKYPE_SETTINGS_LOGIN, str);
GetDlgItemText(hwnd, IDC_PW, str, sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), reinterpret_cast<LPARAM>(str));
- DBWriteContactSettingTString(0, proto->ModuleName(), "Password", str);
+ DBWriteContactSettingWString(0, proto->ModuleName(), SKYPE_SETTINGS_PASSWORD, str);
return TRUE;
}
@@ -85,13 +85,13 @@ INT_PTR CALLBACK CSkypeProto::SkypeOptionsProc(HWND hwnd, UINT message, WPARAM w
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
DBVARIANT dbv;
- if ( !DBGetContactSettingString(0, proto->ModuleName(), "SkypeName", &dbv))
+ if ( !DBGetContactSettingString(0, proto->ModuleName(), SKYPE_SETTINGS_LOGIN, &dbv))
{
- SetDlgItemText(hwnd, IDC_SN, dbv.ptszVal);
+ SetDlgItemText(hwnd, IDC_SL, dbv.ptszVal);
DBFreeVariant(&dbv);
}
- if ( !DBGetContactSettingString(0, proto->ModuleName(), "Password", &dbv))
+ if ( !DBGetContactSettingString(0, proto->ModuleName(), SKYPE_SETTINGS_PASSWORD, &dbv))
{
CallService(
MS_DB_CRYPT_DECODESTRING,
@@ -103,7 +103,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeOptionsProc(HWND hwnd, UINT message, WPARAM w
if ( !proto->IsOffline())
{
- SendMessage(GetDlgItem(hwnd, IDC_SN), EM_SETREADONLY, 1, 0);
+ SendMessage(GetDlgItem(hwnd, IDC_SL), EM_SETREADONLY, 1, 0);
SendMessage(GetDlgItem(hwnd, IDC_PW), EM_SETREADONLY, 1, 0);
}
}
@@ -115,7 +115,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeOptionsProc(HWND hwnd, UINT message, WPARAM w
{
switch(LOWORD(wparam))
{
- case IDC_SN:
+ case IDC_SL:
case IDC_PW:
SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0);
}
@@ -128,12 +128,12 @@ INT_PTR CALLBACK CSkypeProto::SkypeOptionsProc(HWND hwnd, UINT message, WPARAM w
proto = reinterpret_cast<CSkypeProto*>(GetWindowLongPtr(hwnd, GWLP_USERDATA));
TCHAR str[128];
- GetDlgItemText(hwnd, IDC_SN, str, sizeof(str));
- DBWriteContactSettingTString(0, proto->ModuleName(), "SkypeName", str);
+ GetDlgItemText(hwnd, IDC_SL, str, sizeof(str));
+ DBWriteContactSettingTString(0, proto->ModuleName(), SKYPE_SETTINGS_LOGIN, str);
GetDlgItemText(hwnd, IDC_PW, str, sizeof(str));
CallService(MS_DB_CRYPT_ENCODESTRING, sizeof(str), reinterpret_cast<LPARAM>(str));
- DBWriteContactSettingTString(0, proto->ModuleName(), "Password", str);
+ DBWriteContactSettingTString(0, proto->ModuleName(), SKYPE_SETTINGS_PASSWORD, str);
return TRUE;
}
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp
index ba3635274c..18cc3a9e52 100644
--- a/protocols/Skype/src/skype_proto.cpp
+++ b/protocols/Skype/src/skype_proto.cpp
@@ -50,7 +50,27 @@ int __cdecl CSkypeProto::FileCancel( HANDLE hContact, HANDLE hTransfer ) { re
int __cdecl CSkypeProto::FileDeny( HANDLE hContact, HANDLE hTransfer, const TCHAR* szReason ) { return 0; }
int __cdecl CSkypeProto::FileResume( HANDLE hTransfer, int* action, const TCHAR** szFilename ) { return 0; }
-DWORD_PTR __cdecl CSkypeProto:: GetCaps( int type, HANDLE hContact ) { return 0; }
+DWORD_PTR __cdecl CSkypeProto:: GetCaps(int type, HANDLE hContact)
+{
+ switch(type)
+ {
+ case PFLAGNUM_1:
+ return PF1_IM | PF1_PEER2PEER;
+ case PFLAGNUM_2:
+ case PFLAGNUM_3:
+ return PF2_ONLINE | PF2_SHORTAWAY | PF2_HEAVYDND | PF2_INVISIBLE;
+ case PFLAGNUM_4:
+ return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_SUPPORTTYPING | PF4_AVATARS |
+ PF4_OFFLINEFILES | PF4_IMSENDUTF | PF4_IMSENDOFFLINE;
+ case PFLAG_UNIQUEIDTEXT:
+ return (INT_PTR)Translate("Skype login");
+ case PFLAG_UNIQUEIDSETTING:
+ return (INT_PTR) "SL";
+ default:
+ return 0;
+ }
+}
+
HICON __cdecl CSkypeProto::GetIcon( int iconIndex ) { return 0; }
int __cdecl CSkypeProto::GetInfo( HANDLE hContact, int infoType ) { return 0; }
@@ -81,6 +101,7 @@ int CSkypeProto::SetStatus(int new_status)
{
this->isOffline = true;
this->account->Logout(false);
+ this->account->BlockWhileLoggingOut();
};
break;
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index 43a430c153..bbd6a37926 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -76,22 +76,20 @@ public:
protected:
bool isOffline;
CAccount::Ref account;
+ TCHAR* password;
HANDLE hNetlibUser;
- void Log( const char* fmt, ... );
-
-
-
+ void Log(const char* fmt, ...);
void CreateService(const char* szService, SkypeServiceFunc serviceProc);
- //void CreateServiceParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam);
+ void CreateServiceParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam);
- //HANDLE CreateHookableEvent(const char* szService);
+ HANDLE CreateHookableEvent(const char* szService);
void HookEvent(const char*, SkypeEventFunc);
- //int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam);
+ int SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam);
- //void ForkThread(SkypeThreadFunc, void*);
- //HANDLE ForkThreadEx(SkypeThreadFunc, void*, UINT* threadID = NULL);
+ void ForkThread(SkypeThreadFunc, void*);
+ HANDLE ForkThreadEx(SkypeThreadFunc, void*, UINT* threadID = NULL);
TCHAR* GetSettingString(const char *szSetting, TCHAR* defVal = NULL);
diff --git a/protocols/Skype/src/skype_settings.cpp b/protocols/Skype/src/skype_settings.cpp
index 8a2d0c0bfa..3222605577 100644
--- a/protocols/Skype/src/skype_settings.cpp
+++ b/protocols/Skype/src/skype_settings.cpp
@@ -20,7 +20,7 @@ TCHAR* CSkypeProto::GetDecodeSettingString(HANDLE hContact, const char *szSettin
{
DBVARIANT dbv;
TCHAR* result = NULL;
- if ( !DBGetContactSettingString(0, this->m_szModuleName, szSetting, &dbv))
+ if ( !DBGetContactSettingWString(0, this->m_szModuleName, szSetting, &dbv))
{
CallService(
MS_DB_CRYPT_DECODESTRING,
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index 1f218dfc08..66529fb097 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -12,15 +12,64 @@ void CSkypeProto::Log(const char* fmt, ...)
CallService(MS_NETLIB_LOG, (WPARAM)this->hNetlibUser, (LPARAM)msg);
}
+void CSkypeProto::CreateService(const char* szService, SkypeServiceFunc serviceProc)
+{
+ char moduleName[MAXMODULELABELLENGTH];
+
+ mir_snprintf(moduleName, sizeof(moduleName), "%s%s", this->m_szModuleName, szService);
+ CreateServiceFunctionObj(moduleName, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
+}
+
+void CSkypeProto::CreateServiceParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam)
+{
+ char moduleName[MAXMODULELABELLENGTH];
+
+ mir_snprintf(moduleName, sizeof(moduleName), "%s%s", this->m_szModuleName, szService);
+ CreateServiceFunctionObjParam(moduleName, (MIRANDASERVICEOBJPARAM)*(void**)&serviceProc, this, lParam);
+}
+
+HANDLE CSkypeProto::CreateHookableEvent(const char* szService)
+{
+ char moduleName[MAXMODULELABELLENGTH];
+
+ mir_snprintf(moduleName, sizeof(moduleName), "%s%s", this->m_szModuleName, szService);
+ return CreateHookableEvent(moduleName);
+}
+
void CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler)
{
HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this);
}
-void CSkypeProto::CreateService(const char* szService, SkypeServiceFunc serviceProc)
+int CSkypeProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
- char temp[MAX_PATH*2];
+ ACKDATA ack = {0};
+ ack.cbSize = sizeof(ACKDATA);
+ ack.szModule = m_szModuleName;
+ ack.hContact = hContact;
+ ack.type = type;
+ ack.result = result;
+ ack.hProcess = hProcess;
+ ack.lParam = lParam;
+ return CallService(MS_PROTO_BROADCASTACK, 0, (LPARAM)&ack);
+}
- mir_snprintf(temp, sizeof(temp), "%s%s", this->m_szModuleName, szService);
- CreateServiceFunctionObj(temp, (MIRANDASERVICEOBJ)*(void**)&serviceProc, this);
+void CSkypeProto::ForkThread(SkypeThreadFunc pFunc, void *param)
+{
+ UINT threadID;
+ CloseHandle((HANDLE)mir_forkthreadowner(
+ (pThreadFuncOwner)*(void**)&pFunc,
+ this,
+ param,
+ &threadID));
+}
+
+HANDLE CSkypeProto::ForkThreadEx(SkypeThreadFunc pFunc, void *param, UINT* threadID)
+{
+ UINT lthreadID;
+ return (HANDLE)mir_forkthreadowner(
+ (pThreadFuncOwner)*(void**)&pFunc,
+ this,
+ param,
+ threadID ? threadID : &lthreadID);
} \ No newline at end of file