diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-30 11:48:24 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-30 11:48:24 +0000 |
commit | 6adf63a8d746ad357a3bbfedebd2281080241f19 (patch) | |
tree | 80a7972d1bfa83d25e36a985e60681a8b42ed1fa /protocols/SkypeWeb/src | |
parent | 1271802f514d41e8e06df7714d1f1e4a430b417b (diff) |
SkypeWeb: refactoring
git-svn-id: http://svn.miranda-ng.org/main/trunk@14758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/main.cpp | 4 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_accounts.cpp | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 100 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_login.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_network.cpp | 11 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_popups.cpp | 110 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.cpp | 14 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_proto.h | 20 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_timers.cpp | 39 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_trouter.cpp | 6 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_utils.cpp | 70 |
11 files changed, 204 insertions, 178 deletions
diff --git a/protocols/SkypeWeb/src/main.cpp b/protocols/SkypeWeb/src/main.cpp index 65da7e20fe..a65a80bd4f 100644 --- a/protocols/SkypeWeb/src/main.cpp +++ b/protocols/SkypeWeb/src/main.cpp @@ -70,8 +70,8 @@ extern "C" int __declspec(dllexport) Load(void) CSkypeProto::InitMenus();
CSkypeProto::InitLanguages();
- CreateServiceFunction(MODULE"/GetEventIcon", &CSkypeProto::EventGetIcon);
- CreateServiceFunction(MODULE"/GetEventText", &CSkypeProto::GetEventText);
+ CreateServiceFunction(MODULE "/GetEventIcon", &CSkypeProto::EventGetIcon);
+ CreateServiceFunction(MODULE "/GetEventText", &CSkypeProto::GetEventText);
HookEvent(ME_SYSTEM_MODULESLOADED, &CSkypeProto::OnModulesLoaded);
diff --git a/protocols/SkypeWeb/src/skype_accounts.cpp b/protocols/SkypeWeb/src/skype_accounts.cpp index e80c56c004..8255bd185e 100644 --- a/protocols/SkypeWeb/src/skype_accounts.cpp +++ b/protocols/SkypeWeb/src/skype_accounts.cpp @@ -55,8 +55,8 @@ int CSkypeProto::OnAccountLoaded(WPARAM, LPARAM) HookProtoEvent(ME_OPT_INITIALISE, &CSkypeProto::OnOptionsInit);
HookProtoEvent(ME_MSG_PRECREATEEVENT, &CSkypeProto::OnPreCreateMessage);
-
HookProtoEvent(ME_DB_EVENT_MARKED_READ, &CSkypeProto::OnDbEventRead);
+
InitDBEvents();
InitPopups();
InitGroupChatModule();
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 2a10ef98d2..26c3853b89 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -50,11 +50,7 @@ INT_PTR CSkypeProto::GetEventText(WPARAM, LPARAM lParam) }
else
{
-#ifdef _DEBUG
- text = mir_strdup((char*)pEvent->dbei->pBlob);
-#else
text = mir_utf8encode(Translate("Invalid data!"));
-#endif
}
pszText = mir_utf8decodeA(text);
@@ -186,6 +182,21 @@ INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) icon = IcoLib_GetIconByHandle(GetIconHandle("me_action"));
break;
}
+ case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
+ {
+ icon = Skin_LoadIcon(SKINICON_EVENT_FILE);
+ break;
+ }
+ case SKYPE_DB_EVENT_TYPE_URIOBJ:
+ {
+ icon = Skin_LoadIcon(SKINICON_EVENT_URL);
+ break;
+ }
+ case SKYPE_DB_EVENT_TYPE_UNKNOWN:
+ {
+ icon = Skin_LoadIcon(SKINICON_WARNING);
+ break;
+ }
default:
{
icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
@@ -198,6 +209,8 @@ INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam) void CSkypeProto::InitDBEvents()
{
+ db_set_resident(m_szModuleName, "LastAuthRequestTime");
+
// custom event
DBEVENTTYPEDESCR dbEventType = { sizeof(dbEventType) };
dbEventType.module = m_szModuleName;
@@ -235,45 +248,6 @@ void CSkypeProto::InitDBEvents() CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&dbEventType);
}
-void CSkypeProto::InitPopups()
-{
- TCHAR desc[256];
- char name[256];
- POPUPCLASS ppc = { sizeof(ppc) };
- ppc.flags = PCF_TCHAR;
-
- mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Calls"));
- mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
- ppc.ptszDescription = desc;
- ppc.pszName = name;
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
- ppc.colorBack = RGB(255, 255, 255);
- ppc.colorText = RGB(0, 0, 0);
- ppc.iSeconds = 30;
- ppc.PluginWindowProc = PopupDlgProcCall;
- m_PopupClasses.insert(Popup_RegisterClass(&ppc));
-
- mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Notifications"));
- mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
- ppc.ptszDescription = desc;
- ppc.pszName = name;
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("notify"));
- ppc.colorBack = RGB(255, 255, 255);
- ppc.colorText = RGB(0, 0, 0);
- ppc.iSeconds = 5;
- m_PopupClasses.insert(Popup_RegisterClass(&ppc));
-
- mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Errors"));
- mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
- ppc.ptszDescription = desc;
- ppc.pszName = name;
- ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("error"));
- ppc.colorBack = RGB(255, 255, 255);
- ppc.colorText = RGB(0, 0, 0);
- ppc.iSeconds = -1;
- m_PopupClasses.insert(Popup_RegisterClass(&ppc));
-}
-
int CSkypeProto::ProcessSrmmEvent(WPARAM, LPARAM lParam)
{
debugLogA(__FUNCTION__);
@@ -284,43 +258,3 @@ int CSkypeProto::ProcessSrmmEvent(WPARAM, LPARAM lParam) return 0;
}
-
-//Timers
-
-mir_cs CSkypeProto::timerLock;
-mir_cs CSkypeProto::accountsLock;
-
-void CSkypeProto::ProcessTimer()
-{
- if (IsOnline())
- {
- PushRequest(new GetContactListRequest(m_szTokenSecret), &CSkypeProto::LoadContactList);
- SendPresence(false);
- if (!m_hTrouterThread)
- SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
- }
-}
-
-void CALLBACK CSkypeProto::TimerProc(HWND, UINT, UINT_PTR, DWORD)
-{
- mir_cslock lck(accountsLock);
- for (int i = 0; i < Accounts.getCount(); i++)
- {
- Accounts[i]->ProcessTimer();
- }
-}
-
-void CSkypeProto::SkypeSetTimer(void*)
-{
- mir_cslock lck(timerLock);
- if (!m_timer)
- m_timer = SetTimer(NULL, 0, 600000, TimerProc);
-}
-
-void CSkypeProto::SkypeUnsetTimer(void*)
-{
- mir_cslock lck(timerLock);
- if (m_timer && Accounts.getCount() == 0)
- KillTimer(NULL, m_timer);
- m_timer = 0;
-}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_login.cpp b/protocols/SkypeWeb/src/skype_login.cpp index f4e259e753..ae2df823d9 100644 --- a/protocols/SkypeWeb/src/skype_login.cpp +++ b/protocols/SkypeWeb/src/skype_login.cpp @@ -64,10 +64,10 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) if (response->resultCode != 200)
{
int error = 0;
- if (!json["status"].isnull())
+ if (json["status"])
{
const JSONNode &status = json["status"];
- if (!status["code"].isnull())
+ if (status["code"])
{
switch(status["code"].as_int())
{
@@ -91,7 +91,7 @@ void CSkypeProto::OnLoginOAuth(const NETLIBHTTPREQUEST *response) }
default:
{
- ShowNotification(_T("Skype"), !status["text"].isnull() ? status["text"].as_mstring().GetBuffer() : TranslateT("Authentication failed. Unknown error."), NULL, 1);
+ ShowNotification(_T("Skype"), status["text"] ? status["text"].as_mstring() : TranslateT("Authentication failed. Unknown error."), NULL, 1);
error = LOGIN_ERROR_UNKNOWN;
}
}
diff --git a/protocols/SkypeWeb/src/skype_network.cpp b/protocols/SkypeWeb/src/skype_network.cpp index c8c42ea0c5..f6f94b91e1 100644 --- a/protocols/SkypeWeb/src/skype_network.cpp +++ b/protocols/SkypeWeb/src/skype_network.cpp @@ -14,10 +14,11 @@ void CSkypeProto::InitNetwork() 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);
-
+ ShutdownConnections();
Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
+}
+
+void CSkypeProto::ShutdownConnections()
+{
+ Netlib_Shutdown(m_hNetlibUser);
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_popups.cpp b/protocols/SkypeWeb/src/skype_popups.cpp new file mode 100644 index 0000000000..52646ecb98 --- /dev/null +++ b/protocols/SkypeWeb/src/skype_popups.cpp @@ -0,0 +1,110 @@ +#include "stdafx.h"
+
+void CSkypeProto::InitPopups()
+{
+ TCHAR desc[256];
+ char name[256];
+ POPUPCLASS ppc = { sizeof(ppc) };
+ ppc.flags = PCF_TCHAR;
+
+ mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Notifications"));
+ mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
+ ppc.ptszDescription = desc;
+ ppc.pszName = name;
+ ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("notify"));
+ ppc.colorBack = RGB(255, 255, 255);
+ ppc.colorText = RGB(0, 0, 0);
+ ppc.iSeconds = 5;
+ m_PopupClasses.insert(Popup_RegisterClass(&ppc));
+
+ mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Errors"));
+ mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
+ ppc.ptszDescription = desc;
+ ppc.pszName = name;
+ ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("error"));
+ ppc.colorBack = RGB(255, 255, 255);
+ ppc.colorText = RGB(0, 0, 0);
+ ppc.iSeconds = -1;
+ m_PopupClasses.insert(Popup_RegisterClass(&ppc));
+
+ mir_sntprintf(desc, _T("%s %s"), m_tszUserName, TranslateT("Calls"));
+ mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
+ ppc.ptszDescription = desc;
+ ppc.pszName = name;
+ ppc.hIcon = IcoLib_GetIconByHandle(GetIconHandle("inc_call"));
+ ppc.colorBack = RGB(255, 255, 255);
+ ppc.colorText = RGB(0, 0, 0);
+ ppc.iSeconds = 30;
+ ppc.PluginWindowProc = PopupDlgProcCall;
+ m_PopupClasses.insert(Popup_RegisterClass(&ppc));
+}
+
+void CSkypeProto::UninitPopups()
+{
+ for (int i = 0; i < m_PopupClasses.getCount(); i++)
+ {
+ Popup_UnregisterClass(m_PopupClasses[i]);
+ }
+}
+
+void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, MCONTACT hContact, int type)
+{
+ if (Miranda_Terminated())
+ return;
+
+ if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
+ CMStringA className(FORMAT, "%s_", m_szModuleName);
+
+ switch (type)
+ {
+ case 1:
+ {
+ className.Append("Error");
+ break;
+ }
+ case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
+ {
+ className.Append("Call");
+ break;
+ }
+ default:
+ {
+ className.Append("Notification");
+ break;
+ }
+ }
+
+ POPUPDATACLASS ppd = { sizeof(ppd) };
+ ppd.ptszTitle = caption;
+ ppd.ptszText = message;
+ ppd.pszClassName = className.GetBuffer();
+ ppd.hContact = hContact;
+
+ CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
+ }
+ else {
+ DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP;
+ MessageBox(NULL, message, caption, mtype);
+ }
+}
+
+void CSkypeProto::ShowNotification(const TCHAR *message, MCONTACT hContact)
+{
+ ShowNotification(_T(MODULE), message, hContact);
+}
+
+LRESULT CSkypeProto::PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+ switch (uMsg) {
+ case WM_CONTEXTMENU:
+ PUDeletePopup(hPopup);
+ CallService(MODULE "/IncomingCallPP", 0, PUGetContact(hPopup));
+ break;
+ case WM_COMMAND:
+ PUDeletePopup(hPopup);
+ CallService(MODULE "/IncomingCallPP", 1, PUGetContact(hPopup));
+ break;
+ }
+
+ return DefWindowProc(hPopup, uMsg, wParam, lParam);
+}
diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index 90af7ae638..14cf94dffd 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -40,10 +40,8 @@ CSkypeProto::CSkypeProto(const char* protoName, const TCHAR* userName) : if (dwAttributes == 0xffffffff || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
CreateDirectoryTreeT(m_tszAvatarFolder.c_str());
- db_set_resident(m_szModuleName, "LastAuthRequestTime");
-
//hooks
- m_hCallHook = CreateHookableEvent(MODULE "/IncomingCall");
+ if (!m_hCallEvent) m_hCallEvent = CreateHookableEvent(MODULE "/IncomingCall");
//sounds
SkinAddNewSoundEx("skype_inc_call", "SkypeWeb", LPGEN("Incoming call sound"));
@@ -60,16 +58,11 @@ CSkypeProto::~CSkypeProto() delete requestQueue;
UnInitNetwork();
+ UninitPopups();
CloseHandle(m_hTrouterEvent); m_hTrouterEvent = NULL;
- if (m_hCallHook)
- DestroyHookableEvent(m_hCallHook);
-
- for (int i = 0; i < m_PopupClasses.getCount(); i++)
- {
- Popup_UnregisterClass(m_PopupClasses[i]);
- }
+ if (m_hCallEvent && Accounts.getCount() == 0) DestroyHookableEvent(m_hCallEvent);
SkypeUnsetTimer(this);
}
@@ -290,5 +283,6 @@ int CSkypeProto::OnPreShutdown(WPARAM, LPARAM) debugLogA(__FUNCTION__);
isTerminated = true;
requestQueue->Stop();
+ ShutdownConnections();
return 0;
}
diff --git a/protocols/SkypeWeb/src/skype_proto.h b/protocols/SkypeWeb/src/skype_proto.h index 4d2031acc6..6c97908cbb 100644 --- a/protocols/SkypeWeb/src/skype_proto.h +++ b/protocols/SkypeWeb/src/skype_proto.h @@ -64,6 +64,7 @@ public: //popups
void InitPopups();
+ void UninitPopups();
// languages
static void InitLanguages();
@@ -81,7 +82,7 @@ public: private:
- static UINT_PTR m_timer, m_trouterTimer;
+ static UINT_PTR m_timer;
//---Accounts
static LIST<CSkypeProto> CSkypeProto::Accounts;
@@ -92,6 +93,7 @@ private: bool isTerminated,
HistorySynced;
+
std::map<std::string, std::string> cookies;
static std::map<std::tstring, std::tstring> languages;
@@ -99,8 +101,9 @@ private: m_hPollingThread,
m_hTrouterThread,
m_TrouterConnection,
- m_hTrouterEvent,
- m_hCallHook;
+ m_hTrouterEvent;
+
+ static HANDLE m_hCallEvent;
TRInfo TRouter;
@@ -142,6 +145,7 @@ private: void InitNetwork();
void UnInitNetwork();
+ void ShutdownConnections();
void PushRequest(HttpRequest *request);
void PushRequest(HttpRequest *request, SkypeResponseCallback response);
@@ -267,6 +271,8 @@ private: int __cdecl OnGroupChatEventHook(WPARAM, LPARAM lParam);
int __cdecl OnGroupChatMenuHook(WPARAM, LPARAM lParam);
+ INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM);
+ INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM);
void StartChatRoom(const TCHAR *tid, const TCHAR *tname);
@@ -274,8 +280,8 @@ private: void OnGetChatInfo(const NETLIBHTTPREQUEST *response, void *p);
- INT_PTR __cdecl OnJoinChatRoom(WPARAM hContact, LPARAM);
- INT_PTR __cdecl OnLeaveChatRoom(WPARAM hContact, LPARAM);
+
+
void OnChatEvent(const JSONNode &node);
void OnSendChatMessage(const TCHAR *chat_id, const TCHAR * tszMessage);
char *GetChatUsers(const TCHAR *chat_id);
@@ -299,7 +305,7 @@ private: void ProcessThreadUpdateRes(const JSONNode &node);
// utils
- bool IsOnline();
+ inline bool IsOnline();
bool IsMe(const char *skypeName);
MEVENT AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DWORD flags, DWORD cbBlob, PBYTE pBlob);
@@ -353,7 +359,7 @@ private: template<INT_PTR(__cdecl CSkypeProto::*Service)(WPARAM, LPARAM)>
static INT_PTR __cdecl GlobalService(WPARAM wParam, LPARAM lParam)
{
- CSkypeProto *proto = CSkypeProto::GetContactAccount((MCONTACT)wParam);
+ CSkypeProto *proto = GetContactAccount((MCONTACT)wParam);
return proto ? (proto->*Service)(wParam, lParam) : 0;
}
};
diff --git a/protocols/SkypeWeb/src/skype_timers.cpp b/protocols/SkypeWeb/src/skype_timers.cpp new file mode 100644 index 0000000000..ddc72aaa1b --- /dev/null +++ b/protocols/SkypeWeb/src/skype_timers.cpp @@ -0,0 +1,39 @@ +#include "stdafx.h"
+
+mir_cs CSkypeProto::timerLock;
+mir_cs CSkypeProto::accountsLock;
+
+void CSkypeProto::ProcessTimer()
+{
+ if (IsOnline())
+ {
+ PushRequest(new GetContactListRequest(m_szTokenSecret), &CSkypeProto::LoadContactList);
+ SendPresence(false);
+ if (!m_hTrouterThread)
+ SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
+ }
+}
+
+void CALLBACK CSkypeProto::TimerProc(HWND, UINT, UINT_PTR, DWORD)
+{
+ mir_cslock lck(accountsLock);
+ for (int i = 0; i < Accounts.getCount(); i++)
+ {
+ Accounts[i]->ProcessTimer();
+ }
+}
+
+void CSkypeProto::SkypeSetTimer(void*)
+{
+ mir_cslock lck(timerLock);
+ if (!m_timer)
+ m_timer = SetTimer(NULL, 0, 600000, TimerProc);
+}
+
+void CSkypeProto::SkypeUnsetTimer(void*)
+{
+ mir_cslock lck(timerLock);
+ if (m_timer && Accounts.getCount() == 0)
+ KillTimer(NULL, m_timer);
+ m_timer = 0;
+}
diff --git a/protocols/SkypeWeb/src/skype_trouter.cpp b/protocols/SkypeWeb/src/skype_trouter.cpp index e39c08e599..0685bb287e 100644 --- a/protocols/SkypeWeb/src/skype_trouter.cpp +++ b/protocols/SkypeWeb/src/skype_trouter.cpp @@ -17,6 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "stdafx.h"
+HANDLE CSkypeProto::m_hCallEvent;
+
void CSkypeProto::OnCreateTrouter(const NETLIBHTTPREQUEST *response)
{
if (response == NULL || response->pData == NULL)
@@ -225,7 +227,7 @@ void CSkypeProto::OnTrouterEvent(const JSONNode &body, const JSONNode &) INT_PTR CSkypeProto::OnIncomingCallCLE(WPARAM, LPARAM lParam)
{
CLISTEVENT *cle = (CLISTEVENT*)lParam;
- NotifyEventHooks(m_hCallHook, (WPARAM)cle->hContact, (LPARAM)0);
+ NotifyEventHooks(m_hCallEvent, (WPARAM)cle->hContact, (LPARAM)0);
return 0;
}
@@ -242,7 +244,7 @@ INT_PTR CSkypeProto::OnIncomingCallPP(WPARAM wParam, LPARAM hContact) }
if (wParam == 1)
- NotifyEventHooks(m_hCallHook, (WPARAM)hContact, (LPARAM)0);
+ NotifyEventHooks(m_hCallEvent, (WPARAM)hContact, (LPARAM)0);
return 0;
}
\ No newline at end of file diff --git a/protocols/SkypeWeb/src/skype_utils.cpp b/protocols/SkypeWeb/src/skype_utils.cpp index 39e8428b98..bca4c9e76b 100644 --- a/protocols/SkypeWeb/src/skype_utils.cpp +++ b/protocols/SkypeWeb/src/skype_utils.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. bool CSkypeProto::IsOnline()
{
- return m_iStatus > ID_STATUS_OFFLINE && m_hPollingThread;
+ return (m_iStatus > ID_STATUS_OFFLINE && m_hPollingThread);
}
void CSkypeProto::SetSrmmReadStatus(MCONTACT hContact)
@@ -457,68 +457,6 @@ int CSkypeProto::SkypeToMirandaStatus(const char *status) return ID_STATUS_OFFLINE;
}
-void CSkypeProto::ShowNotification(const TCHAR *caption, const TCHAR *message, MCONTACT hContact, int type)
-{
- if (Miranda_Terminated())
- return;
-
- if (ServiceExists(MS_POPUP_ADDPOPUPCLASS)) {
- CMStringA className(FORMAT, "%s_", m_szModuleName);
-
- switch (type)
- {
- case 1:
- {
- className.Append("Error");
- break;
- }
- case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
- {
- className.Append("Call");
- break;
- }
- default:
- {
- className.Append("Notification");
- break;
- }
- }
-
- POPUPDATACLASS ppd = { sizeof(ppd) };
- ppd.ptszTitle = caption;
- ppd.ptszText = message;
- ppd.pszClassName = className.GetBuffer();
- ppd.hContact = hContact;
-
- CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&ppd);
- }
- else {
- DWORD mtype = MB_OK | MB_SETFOREGROUND | MB_ICONSTOP;
- MessageBox(NULL, message, caption, mtype);
- }
-}
-
-LRESULT CSkypeProto::PopupDlgProcCall(HWND hPopup, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- switch (uMsg) {
- case WM_CONTEXTMENU:
- PUDeletePopup(hPopup);
- CallService(MODULE"/IncomingCallPP", 0, PUGetContact(hPopup));
- break;
- case WM_COMMAND:
- PUDeletePopup(hPopup);
- CallService(MODULE"/IncomingCallPP", 1, PUGetContact(hPopup));
- break;
- }
-
- return DefWindowProc(hPopup, uMsg, wParam, lParam);
-}
-
-void CSkypeProto::ShowNotification(const TCHAR *message, MCONTACT hContact)
-{
- ShowNotification(_T(MODULE), message, hContact);
-}
-
bool CSkypeProto::IsFileExists(std::tstring path)
{
return _taccess(path.c_str(), 0) == 0;
@@ -622,7 +560,7 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) else if (!mir_tstrcmpi(szCommand, _T("call")))
{
MCONTACT hContact = AddContact(_T2A(szJid), true);
- NotifyEventHooks(m_hCallHook, (WPARAM)hContact, (LPARAM)0);
+ NotifyEventHooks(m_hCallEvent, (WPARAM)hContact, (LPARAM)0);
return 0;
}
else if (!mir_tstrcmpi(szCommand, _T("userinfo"))){ return 0; }
@@ -635,11 +573,13 @@ INT_PTR CSkypeProto::ParseSkypeUriService(WPARAM, LPARAM lParam) psr.id.t = mir_tstrdup(szJid);
psr.nick.t = mir_tstrdup(szJid);
psr.flags = PSR_TCHAR;
+
ADDCONTACTSTRUCT acs;
acs.handleType = HANDLE_SEARCHRESULT;
acs.szProto = m_szModuleName;
acs.psr = &psr;
- CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
+
+ CallServiceSync(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs);
}
return 0;
}
|