summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_popups.cpp
diff options
context:
space:
mode:
authorMikalaiR <nikolay.romanovich@narod.ru>2015-07-30 11:48:24 +0000
committerMikalaiR <nikolay.romanovich@narod.ru>2015-07-30 11:48:24 +0000
commit6adf63a8d746ad357a3bbfedebd2281080241f19 (patch)
tree80a7972d1bfa83d25e36a985e60681a8b42ed1fa /protocols/SkypeWeb/src/skype_popups.cpp
parent1271802f514d41e8e06df7714d1f1e4a430b417b (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/skype_popups.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_popups.cpp110
1 files changed, 110 insertions, 0 deletions
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);
+}