summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-09-26 19:14:12 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-09-26 19:14:12 +0000
commit9f54d2d2fe173c2a426dc790e70f14a585829431 (patch)
treee374ddc425d4ed4e7eb2b7f04ad62a294e527166 /protocols/Skype/src/skype.cpp
parentceae8e098fb5f4e3ae1acef7d8d26822ec8e3633 (diff)
- added SKYPEACCOUNT dialog
- added normal skype class starting - merge fixes git-svn-id: http://svn.miranda-ng.org/main/trunk@1668 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/src/skype.cpp')
-rw-r--r--protocols/Skype/src/skype.cpp65
1 files changed, 54 insertions, 11 deletions
diff --git a/protocols/Skype/src/skype.cpp b/protocols/Skype/src/skype.cpp
index 82df6a8da4..f8431166b2 100644
--- a/protocols/Skype/src/skype.cpp
+++ b/protocols/Skype/src/skype.cpp
@@ -1,18 +1,22 @@
#include "skype.h"
+#include "version.h"
+#include "skype_proto.h"
int hLangpack;
HINSTANCE g_hInstance;
+Skype* g_skype;
+
PLUGININFOEX pluginInfo =
{
sizeof(PLUGININFOEX),
- __PLUGIN_NAME,
- PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
- __DESCRIPTION,
- __AUTHOR,
- __AUTHOREMAIL,
- __COPYRIGHT,
- __AUTHORWEB,
+ "Skype Plugin",
+ PLUGIN_MAKE_VERSION(0,1,0,0),
+ "Provides basic support for Skype protocol.",
+ "unsane",
+ "",
+ "© 2012 unsane",
+ "http://miranda-ng.org/",
UNICODE_AWARE,
// {9C448C61-FC3F-42F9-B9F0-4A30E1CF8671}
{ 0x9c448c61, 0xfc3f, 0x42f9, { 0xb9, 0xf0, 0x4a, 0x30, 0xe1, 0xcf, 0x86, 0x71 } }
@@ -43,6 +47,7 @@ static CSkypeProto* SkypeProtoInit(const char* pszProtoName, const TCHAR* tszUse
CSkypeProto *ppro = new CSkypeProto(pszProtoName, tszUserName);
g_Instances.insert(ppro);
return ppro;
+ return 0;
}
static int SkypeProtoUninit(CSkypeProto* ppro)
@@ -52,22 +57,60 @@ static int SkypeProtoUninit(CSkypeProto* ppro)
return 0;
}
+char* keyBuf = 0;
+
+int LoadKeyPair()
+{
+ FILE* f = 0;
+ size_t fsize = 0;
+ int keyLen = 0;
+
+ f = fopen(g_keyFileName, "r");
+
+ if (f != 0)
+ {
+ fseek(f, 0, SEEK_END);
+ fsize = ftell(f);
+ rewind(f);
+ keyLen = fsize + 1;
+ keyBuf = new char[keyLen];
+ size_t read = fread(keyBuf, 1, fsize, f);
+ if (read != fsize)
+ {
+ printf("Error reading %s\n", g_keyFileName);
+ return 0;
+ };
+ keyBuf[fsize] = 0; //cert should be null terminated
+ fclose(f);
+ return keyLen;
+ };
+
+ printf("Error opening app token file: %s\n", g_keyFileName);
+
+ return 0;
+};
+
extern "C" int __declspec(dllexport) Load(void)
{
- mir_getLP(&pluginInfo);
+ g_skype = new Skype();
+ LoadKeyPair();
+ g_skype->init(keyBuf, "127.0.0.1", 8963, "streamlog.txt");
+ g_skype->start();
- PROTOCOLDESCRIPTOR pd = {0};
- pd.cbSize = sizeof(pd);
+ PROTOCOLDESCRIPTOR pd = { sizeof(pd) };
pd.szName = "Skype";
pd.type = PROTOTYPE_PROTOCOL;
pd.fnInit = (pfnInitProto)SkypeProtoInit;
pd.fnUninit = (pfnUninitProto)SkypeProtoUninit;
- CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
+ CallService(MS_PROTO_REGISTERMODULE, 0, reinterpret_cast<LPARAM>(&pd));
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
+ g_skype->stop();
+ delete g_skype;
+
return 0;
} \ No newline at end of file