1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
#include "stdafx.h"
void CSkypeProto::InitPopups()
{
TCHAR desc[256];
char name[256];
POPUPCLASS ppc = { sizeof(ppc) };
ppc.flags = PCF_TCHAR;
mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Notifications"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Notification");
ppc.ptszDescription = desc;
ppc.pszName = name;
ppc.hIcon = GetIcon(IDI_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, L"%s %s", m_tszUserName, TranslateT("Errors"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Error");
ppc.ptszDescription = desc;
ppc.pszName = name;
ppc.hIcon = GetIcon(IDI_ERRORICON);
ppc.colorBack = RGB(255, 255, 255);
ppc.colorText = RGB(0, 0, 0);
ppc.iSeconds = -1;
m_PopupClasses.insert(Popup_RegisterClass(&ppc));
mir_sntprintf(desc, L"%s %s", m_tszUserName, TranslateT("Calls"));
mir_snprintf(name, "%s_%s", m_szModuleName, "Call");
ppc.ptszDescription = desc;
ppc.pszName = name;
ppc.hIcon = GetIcon(IDI_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);
}
|