summaryrefslogtreecommitdiff
path: root/protocols/Skype/skype_proto.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2012-09-25 19:18:37 +0000
committerAlexander Lantsev <aunsane@gmail.com>2012-09-25 19:18:37 +0000
commit016a848803aaaff835a51a495327148781163342 (patch)
treee8092ef39faa5fec75c4c586763899294911b69e /protocols/Skype/skype_proto.cpp
parent2eea33b2dcc64a02461a95b026d01c54c651fe26 (diff)
- init commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@1657 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Skype/skype_proto.cpp')
-rw-r--r--protocols/Skype/skype_proto.cpp46
1 files changed, 46 insertions, 0 deletions
diff --git a/protocols/Skype/skype_proto.cpp b/protocols/Skype/skype_proto.cpp
new file mode 100644
index 0000000000..eede6c744e
--- /dev/null
+++ b/protocols/Skype/skype_proto.cpp
@@ -0,0 +1,46 @@
+#include "skype_proto.h"
+
+CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName)
+{
+ m_iVersion = 2;
+ m_iStatus = ID_STATUS_OFFLINE;
+ m_tszUserName = mir_tstrdup(userName);
+ m_szModuleName = mir_strdup(protoName);
+ m_szProtoName = mir_strdup(protoName);
+ _strlwr(m_szProtoName);
+ m_szProtoName[0] = toupper(m_szProtoName[0]);
+
+ TCHAR name[128];
+ mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
+
+ NETLIBUSER nlu = {0};
+ nlu.cbSize = sizeof( nlu );
+ nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_TCHAR; // | NUF_HTTPGATEWAY;
+ nlu.ptszDescriptiveName = name;
+ nlu.szSettingsModule = m_szModuleName;
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+
+ this->Log("Setting protocol/module name to '%s/%s'", m_szProtoName, m_szModuleName);
+}
+
+CSkypeProto::~CSkypeProto()
+{
+ Netlib_CloseHandle(m_hNetlibUser);
+ m_hNetlibUser = NULL;
+
+ mir_free(m_szProtoName);
+ mir_free(m_szModuleName);
+ mir_free(m_tszUserName);
+}
+
+void CSkypeProto::Log( const char* fmt, ... )
+{
+ va_list va;
+ char msg[1024];
+
+ va_start(va, fmt);
+ mir_vsnprintf(msg, sizeof(msg), fmt, va);
+ va_end(va);
+
+ CallService(MS_NETLIB_LOG, ( WPARAM )m_hNetlibUser, (LPARAM)msg);
+} \ No newline at end of file