summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-10-03 19:00:16 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-10-03 19:00:16 +0000
commit2ae2f9c86258ee5dc89d42492c591c19acbfa4b5 (patch)
treea5033ab378b6746258de381189cc2c9a472ce452 /protocols
parentead582e080416de21ece0b29109efa8bc4c043d9 (diff)
- skype proto instance init funcs moved to skype_instances.cpp
- some minor fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@1776 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Skype/Skype.vcxproj1
-rw-r--r--protocols/Skype/Skype.vcxproj.filters3
-rw-r--r--protocols/Skype/src/skype.cpp27
-rw-r--r--protocols/Skype/src/skype_dialogs.cpp2
-rw-r--r--protocols/Skype/src/skype_icons.cpp9
-rw-r--r--protocols/Skype/src/skype_instances.cpp24
-rw-r--r--protocols/Skype/src/skype_menus.cpp6
-rw-r--r--protocols/Skype/src/skype_proto.h25
-rw-r--r--protocols/Skype/src/skype_services.cpp2
-rw-r--r--protocols/Skype/src/skype_utils.cpp10
10 files changed, 63 insertions, 46 deletions
diff --git a/protocols/Skype/Skype.vcxproj b/protocols/Skype/Skype.vcxproj
index 840bdab114..42e8d79222 100644
--- a/protocols/Skype/Skype.vcxproj
+++ b/protocols/Skype/Skype.vcxproj
@@ -109,6 +109,7 @@
<ClCompile Include="src\skype_dialogs.cpp" />
<ClCompile Include="src\skype_events.cpp" />
<ClCompile Include="src\skype_icons.cpp" />
+ <ClCompile Include="src\skype_instances.cpp" />
<ClCompile Include="src\skype_menus.cpp" />
<ClCompile Include="src\skype_netlib.cpp" />
<ClCompile Include="src\skype_proto.cpp" />
diff --git a/protocols/Skype/Skype.vcxproj.filters b/protocols/Skype/Skype.vcxproj.filters
index 9146250037..82e61c86f6 100644
--- a/protocols/Skype/Skype.vcxproj.filters
+++ b/protocols/Skype/Skype.vcxproj.filters
@@ -48,6 +48,9 @@
<ClCompile Include="src\skype_menus.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\skype_instances.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\resource.h">
diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp
index a3e5823c7b..e905bcf8be 100644
--- a/protocols/Skype/src/skype.cpp
+++ b/protocols/Skype/src/skype.cpp
@@ -21,16 +21,10 @@ PLUGININFOEX pluginInfo =
{ 0x9c448c61, 0xfc3f, 0x42f9, { 0xb9, 0xf0, 0x4a, 0x30, 0xe1, 0xcf, 0x86, 0x71 } }
};
-static int compare_protos(const CSkypeProto *p1, const CSkypeProto *p2)
-{
- return _tcscmp(p1->m_tszUserName, p2->m_tszUserName);
-}
-
-LIST<CSkypeProto> g_Instances(1, compare_protos);
-
DWORD WINAPI DllMain(HINSTANCE hInstance, DWORD, LPVOID)
{
g_hInstance = hInstance;
+
return TRUE;
}
@@ -41,21 +35,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCOL, MIID_LAST};
-static CSkypeProto* SkypeProtoInit(const char* pszProtoName, const TCHAR* tszUserName)
-{
- CSkypeProto *ppro = new CSkypeProto(pszProtoName, tszUserName);
- g_Instances.insert(ppro);
- return ppro;
- return 0;
-}
-
-static int SkypeProtoUninit(CSkypeProto* ppro)
-{
- g_Instances.remove(ppro);
- delete ppro;
- return 0;
-}
-
char* keyBuf = 0;
int port = 8963;
@@ -150,8 +129,8 @@ extern "C" int __declspec(dllexport) Load(void)
PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = MODULE;
pd.type = PROTOTYPE_PROTOCOL;
- pd.fnInit = (pfnInitProto)SkypeProtoInit;
- pd.fnUninit = (pfnUninitProto)SkypeProtoUninit;
+ pd.fnInit = (pfnInitProto)CSkypeProto::InitSkypeProto;
+ pd.fnUninit = (pfnUninitProto)CSkypeProto::UninitSkypeProto;
CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast<LPARAM>(&pd));
CSkypeProto::InitIcons();
diff --git a/protocols/Skype/src/skype_dialogs.cpp b/protocols/Skype/src/skype_dialogs.cpp
index ca9a3ce63f..eee1e393f8 100644
--- a/protocols/Skype/src/skype_dialogs.cpp
+++ b/protocols/Skype/src/skype_dialogs.cpp
@@ -14,7 +14,7 @@ INT_PTR CALLBACK CSkypeProto::SkypeAccountProc(HWND hwnd, UINT message, WPARAM w
SetWindowLongPtr(hwnd, GWLP_USERDATA, lparam);
SetDlgItemText(hwnd, IDC_SL, proto->GetSettingString(SKYPE_SETTINGS_LOGIN, L""));
- SetDlgItemText(hwnd, IDC_SL, proto->GetDecodeSettingString(SKYPE_SETTINGS_PASSWORD, L""));
+ SetDlgItemText(hwnd, IDC_PW, proto->GetDecodeSettingString(SKYPE_SETTINGS_PASSWORD, L""));
if ( proto->m_iStatus != ID_STATUS_OFFLINE)
{
diff --git a/protocols/Skype/src/skype_icons.cpp b/protocols/Skype/src/skype_icons.cpp
index bb8c727cb5..005fff931a 100644
--- a/protocols/Skype/src/skype_icons.cpp
+++ b/protocols/Skype/src/skype_icons.cpp
@@ -1,13 +1,6 @@
#include "skype_proto.h"
-// todo: need to move in CSkypeProto struct
-struct _tag_iconList
-{
- wchar_t* Description;
- char* Name;
- int IconId;
- HANDLE Handle;
-} static iconList[] =
+_tag_iconList CSkypeProto::iconList[] =
{
{ LPGENT("Protocol icon"), "main", IDI_ICON },
};
diff --git a/protocols/Skype/src/skype_instances.cpp b/protocols/Skype/src/skype_instances.cpp
new file mode 100644
index 0000000000..7a8527dfea
--- /dev/null
+++ b/protocols/Skype/src/skype_instances.cpp
@@ -0,0 +1,24 @@
+#include "skype_proto.h"
+
+int CSkypeProto::SendBroadcast(int type, int result, HANDLE hProcess, LPARAM lParam)
+{
+ return this->SendBroadcast(NULL, type, result, hProcess, lParam);
+}
+
+LIST<CSkypeProto> CSkypeProto::instanceList(1, CSkypeProto::CompareProtos);
+
+CSkypeProto* CSkypeProto::InitSkypeProto(const char* protoName, const wchar_t* userName)
+{
+ CSkypeProto *ppro = new CSkypeProto(protoName, userName);
+ CSkypeProto::instanceList.insert(ppro);
+
+ return ppro;
+}
+
+int CSkypeProto::UninitSkypeProto(CSkypeProto* ppro)
+{
+ CSkypeProto::instanceList.remove(ppro);
+ delete ppro;
+
+ return 0;
+} \ No newline at end of file
diff --git a/protocols/Skype/src/skype_menus.cpp b/protocols/Skype/src/skype_menus.cpp
index dd53e6f41d..e0982e8cf3 100644
--- a/protocols/Skype/src/skype_menus.cpp
+++ b/protocols/Skype/src/skype_menus.cpp
@@ -18,9 +18,9 @@ CSkypeProto* CSkypeProto::GetInstanceByHContact(HANDLE hContact)
if (proto == NULL)
return NULL;
- for (int i = 0; i < g_Instances.getCount(); i++)
- if (!strcmp(proto, g_Instances[i]->m_szModuleName))
- return g_Instances[i];
+ for (int i = 0; i < CSkypeProto::instanceList.getCount(); i++)
+ if (!strcmp(proto, CSkypeProto::instanceList[i]->m_szModuleName))
+ return CSkypeProto::instanceList[i];
return NULL;
}
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h
index a6dbec8df5..2b1384c9ba 100644
--- a/protocols/Skype/src/skype_proto.h
+++ b/protocols/Skype/src/skype_proto.h
@@ -4,13 +4,18 @@
struct CSkypeProto;
-extern LIST<CSkypeProto> g_Instances;
-
typedef void (__cdecl CSkypeProto::* SkypeThreadFunc) (void*);
typedef INT_PTR (__cdecl CSkypeProto::* SkypeServiceFunc)(WPARAM, LPARAM);
typedef int (__cdecl CSkypeProto::* SkypeEventFunc)(WPARAM, LPARAM);
typedef INT_PTR (__cdecl CSkypeProto::* SkypeServiceFuncParam)(WPARAM, LPARAM, LPARAM);
+struct _tag_iconList
+{
+ wchar_t* Description;
+ char* Name;
+ int IconId;
+ HANDLE Handle;
+};
struct CSkypeProto : public PROTO_INTERFACE, public MZeroedObject
{
@@ -66,11 +71,16 @@ public:
virtual int __cdecl OnEvent( PROTOEVENTTYPE eventType, WPARAM wParam, LPARAM lParam );
+ // events
int __cdecl OnModulesLoaded(WPARAM, LPARAM);
int __cdecl OnPreShutdown(WPARAM, LPARAM);
int __cdecl OnOptionsInit(WPARAM, LPARAM);
int __cdecl OnAccountManagerInit(WPARAM wParam, LPARAM lParam);
+ // instances
+ static CSkypeProto* InitSkypeProto(const char* protoName, const wchar_t* userName);
+ static int UninitSkypeProto(CSkypeProto* ppro);
+
// services
static void InitServiceList();
static void UninitServiceList();
@@ -93,7 +103,6 @@ protected:
TCHAR* login;
TCHAR* password;
-
HANDLE signin_lock;
void __cdecl SignIn(void*);
void __cdecl LoadContactList(void*);
@@ -108,7 +117,10 @@ protected:
CContact::AVAILABILITY MirandaToSkypeStatus(int status);
void SetAllContactStatus(int status);
- // utils
+ // instances
+ static LIST<CSkypeProto> instanceList;
+ static int CompareProtos(const CSkypeProto *p1, const CSkypeProto *p2);
+
void CreateService(const char* szService, SkypeServiceFunc serviceProc);
void CreateServiceParam(const char* szService, SkypeServiceFunc serviceProc, LPARAM lParam);
@@ -128,7 +140,10 @@ protected:
void Log(const char* fmt, ...);
// services
- //static LIST<HANDLE> serviceList;
+ static LIST<HANDLE> serviceList;
+
+ // icons
+ static _tag_iconList iconList[];
// menu
static HANDLE hPrebuildMenuHook;
diff --git a/protocols/Skype/src/skype_services.cpp b/protocols/Skype/src/skype_services.cpp
index a575f590fd..04e9b43c3e 100644
--- a/protocols/Skype/src/skype_services.cpp
+++ b/protocols/Skype/src/skype_services.cpp
@@ -1,5 +1,7 @@
#include "skype_proto.h"
+LIST<HANDLE> CSkypeProto::serviceList(0);
+
void CSkypeProto::InitServiceList()
{
}
diff --git a/protocols/Skype/src/skype_utils.cpp b/protocols/Skype/src/skype_utils.cpp
index 1a16af6483..f2a9d28461 100644
--- a/protocols/Skype/src/skype_utils.cpp
+++ b/protocols/Skype/src/skype_utils.cpp
@@ -1,4 +1,9 @@
#include "skype_proto.h"
+
+int CSkypeProto::CompareProtos(const CSkypeProto *p1, const CSkypeProto *p2)
+{
+ return wcscmp(p1->m_tszUserName, p2->m_tszUserName);
+}
void CSkypeProto::CreateService(const char* szService, SkypeServiceFunc serviceProc)
{
@@ -29,11 +34,6 @@ void CSkypeProto::HookEvent(const char* szEvent, SkypeEventFunc handler)
::HookEventObj(szEvent, (MIRANDAHOOKOBJ)*( void**)&handler, this);
}
-int CSkypeProto::SendBroadcast(int type, int result, HANDLE hProcess, LPARAM lParam)
-{
- return this->SendBroadcast(NULL, type, result, hProcess, lParam);
-}
-
int CSkypeProto::SendBroadcast(HANDLE hContact, int type, int result, HANDLE hProcess, LPARAM lParam)
{
ACKDATA ack = {0};