summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/SkypeWeb/src/skype_db.h15
-rw-r--r--protocols/SkypeWeb/src/skype_events.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_messages.cpp4
-rw-r--r--protocols/SkypeWeb/src/skype_network.cpp23
-rw-r--r--protocols/SkypeWeb/src/skype_proto.cpp29
-rw-r--r--protocols/SkypeWeb/src/skype_proto.h4
-rw-r--r--protocols/SkypeWeb/src/stdafx.h16
-rw-r--r--protocols/SkypeWeb/src/version.h4
8 files changed, 60 insertions, 39 deletions
diff --git a/protocols/SkypeWeb/src/skype_db.h b/protocols/SkypeWeb/src/skype_db.h
new file mode 100644
index 0000000000..089dde16b9
--- /dev/null
+++ b/protocols/SkypeWeb/src/skype_db.h
@@ -0,0 +1,15 @@
+
+enum SKYPE_DB_EVENT_TYPE
+{
+ SKYPE_DB_EVENT_TYPE_ACTION = 10001,
+ SKYPE_DB_EVENT_TYPE_INCOMING_CALL,
+ SKYPE_DB_EVENT_TYPE_CALL_INFO,
+ SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO,
+ SKYPE_DB_EVENT_TYPE_URIOBJ,
+ SKYPE_DB_EVENT_TYPE_EDITED_MESSAGE,
+ SKYPE_DB_EVENT_TYPE_UNKNOWN
+};
+
+#define SKYPE_SETTINGS_ID "Skypename"
+#define SKYPE_SETTINGS_PASSWORD "Password"
+#define SKYPE_SETTINGS_GROUP "DefaultGroup"
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp
index a68c5e8186..2a10ef98d2 100644
--- a/protocols/SkypeWeb/src/skype_events.cpp
+++ b/protocols/SkypeWeb/src/skype_events.cpp
@@ -132,7 +132,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam)
}
case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
{
- pszText = Translate("Incoming call");
+ pszText = mir_strdup(Translate("Incoming call"));
break;
}
case SKYPE_DB_EVENT_TYPE_UNKNOWN:
@@ -150,7 +150,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam)
{
case DBVT_TCHAR:
{
- nRetVal = (INT_PTR)mir_tstrdup(_A2T(pszText));
+ nRetVal = (INT_PTR)mir_a2t(pszText);
break;
}
case DBVT_ASCIIZ:
diff --git a/protocols/SkypeWeb/src/skype_messages.cpp b/protocols/SkypeWeb/src/skype_messages.cpp
index 94fcb0180e..874f156f48 100644
--- a/protocols/SkypeWeb/src/skype_messages.cpp
+++ b/protocols/SkypeWeb/src/skype_messages.cpp
@@ -103,6 +103,10 @@ void CSkypeProto::OnMessageSent(const NETLIBHTTPREQUEST *response, void *arg)
ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, (LPARAM)strError.c_str());
}
}
+ else
+ {
+ ProtoBroadcastAck(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, hMessage, (LPARAM)"Network error!");
+ }
}
// preparing message/action to writing into db
diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp
new file mode 100644
index 0000000000..c8c42ea0c5
--- /dev/null
+++ b/protocols/SkypeWeb/src/skype_network.cpp
@@ -0,0 +1,23 @@
+#include "stdafx.h"
+
+void CSkypeProto::InitNetwork()
+{
+ wchar_t name[128];
+ mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
+ NETLIBUSER nlu = { 0 };
+ nlu.cbSize = sizeof(nlu);
+ nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
+ nlu.ptszDescriptiveName = name;
+ nlu.szSettingsModule = m_szModuleName;
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+}
+
+void CSkypeProto::UnInitNetwork()
+{
+ if (m_pollingConnection)
+ CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0);
+ if (m_TrouterConnection)
+ CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_TrouterConnection, 0);
+
+ Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
+} \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp
index 60294c425f..90af7ae638 100644
--- a/protocols/SkypeWeb/src/skype_proto.cpp
+++ b/protocols/SkypeWeb/src/skype_proto.cpp
@@ -22,22 +22,15 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) :
{
m_hProtoIcon = Icons[0].Handle;
- wchar_t name[128];
- mir_sntprintf(name, _countof(name), TranslateT("%s connection"), m_tszUserName);
- NETLIBUSER nlu = { 0 };
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
- nlu.ptszDescriptiveName = name;
- nlu.szSettingsModule = m_szModuleName;
- m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ InitNetwork();
+
requestQueue = new RequestQueue(m_hNetlibUser);
CreateProtoService(PS_CREATEACCMGRUI, &CSkypeProto::OnAccountManagerInit);
-
- CreateProtoService(PS_GETAVATARINFO, &CSkypeProto::SvcGetAvatarInfo);
- CreateProtoService(PS_GETAVATARCAPS, &CSkypeProto::SvcGetAvatarCaps);
- CreateProtoService(PS_GETMYAVATAR, &CSkypeProto::SvcGetMyAvatar);
- CreateProtoService(PS_SETMYAVATAR, &CSkypeProto::SvcSetMyAvatar);
+ CreateProtoService(PS_GETAVATARINFO, &CSkypeProto::SvcGetAvatarInfo);
+ CreateProtoService(PS_GETAVATARCAPS, &CSkypeProto::SvcGetAvatarCaps);
+ CreateProtoService(PS_GETMYAVATAR, &CSkypeProto::SvcGetMyAvatar);
+ CreateProtoService(PS_SETMYAVATAR, &CSkypeProto::SvcSetMyAvatar);
CreateProtoService("/IncomingCallCLE", &CSkypeProto::OnIncomingCallCLE);
CreateProtoService("/IncomingCallPP", &CSkypeProto::OnIncomingCallPP);
@@ -50,7 +43,7 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) :
db_set_resident(m_szModuleName, "LastAuthRequestTime");
//hooks
- m_hCallHook = CreateHookableEvent(MODULE"/IncomingCall");
+ m_hCallHook = CreateHookableEvent(MODULE "/IncomingCall");
//sounds
SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound"));
@@ -65,13 +58,9 @@ CSkypeProto::~CSkypeProto()
{
requestQueue->Stop();
delete requestQueue;
+
+ UnInitNetwork();
- if (m_pollingConnection)
- CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConnection, 0);
- if (m_TrouterConnection)
- CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_TrouterConnection, 0);
-
- Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
CloseHandle(m_hTrouterEvent); m_hTrouterEvent = NULL;
if (m_hCallHook)
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h
index ecf3d39ee0..4d2031acc6 100644
--- a/protocols/SkypeWeb/src/skype_proto.h
+++ b/protocols/SkypeWeb/src/skype_proto.h
@@ -139,6 +139,10 @@ private:
int InternalSetAvatar(MCONTACT hContact, const char *szJid, const TCHAR *ptszFileName);
// requests
+
+ void InitNetwork();
+ void UnInitNetwork();
+
void PushRequest(HttpRequest *request);
void PushRequest(HttpRequest *request, SkypeResponseCallback response);
void PushRequest(HttpRequest *request, SkypeResponseWithArgCallback response, void *arg);
diff --git a/protocols/SkypeWeb/src/stdafx.h b/protocols/SkypeWeb/src/stdafx.h
index 41137d5963..1cfea038db 100644
--- a/protocols/SkypeWeb/src/stdafx.h
+++ b/protocols/SkypeWeb/src/stdafx.h
@@ -67,6 +67,7 @@ extern char g_szMirVer[];
#include "skype_dialogs.h"
#include "skype_options.h"
#include "skype_trouter.h"
+#include "skype_db.h"
#include "http_request.h"
#include "requests\login.h"
#include "requests\profile.h"
@@ -96,21 +97,6 @@ enum SKYPE_LOGIN_ERROR
LOGIN_ERROR_TOOMANY_REQUESTS
};
-enum SKYPE_DB_EVENT_TYPE
-{
- SKYPE_DB_EVENT_TYPE_ACTION = 10001,
- SKYPE_DB_EVENT_TYPE_INCOMING_CALL,
- SKYPE_DB_EVENT_TYPE_CALL_INFO,
- SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO,
- SKYPE_DB_EVENT_TYPE_URIOBJ,
- SKYPE_DB_EVENT_TYPE_EDITED_MESSAGE,
- SKYPE_DB_EVENT_TYPE_UNKNOWN
-};
-
-#define SKYPE_SETTINGS_ID "Skypename"
-#define SKYPE_SETTINGS_PASSWORD "Password"
-#define SKYPE_SETTINGS_GROUP "DefaultGroup"
-
#define POLLING_ERRORS_LIMIT 3
#endif //_COMMON_H_ \ No newline at end of file
diff --git a/protocols/SkypeWeb/src/version.h b/protocols/SkypeWeb/src/version.h
index 1a0be10427..97ac5d4775 100644
--- a/protocols/SkypeWeb/src/version.h
+++ b/protocols/SkypeWeb/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 12
-#define __RELEASE_NUM 1
-#define __BUILD_NUM 2
+#define __RELEASE_NUM 2
+#define __BUILD_NUM 1
#include <stdver.h>