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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
#define __SKYPESVC_C__
#include "skype.h"
#include "skypesvc.h"
#include "skypeapi.h"
#include "skypeopt.h"
#include "contacts.h"
#include "filexfer.h"
// Exports
SKYPE_SVCNAMES g_svcNames;
//From skype.c
extern BOOL bHasFileXfer;
extern char protocol, g_szProtoName[];
extern HINSTANCE hInst;
void CreateProtoService(const char* szService, MIRANDASERVICE svc)
{
char str[MAXMODULELABELLENGTH];
_snprintf(str, sizeof(str), "%s%s", SKYPE_PROTONAME, szService);
CreateServiceFunction(str, svc);
}
#define CreateServiceName(srvce) _snprintf (g_svcNames.##srvce, sizeof(g_svcNames.##srvce), "%s/"#srvce, SKYPE_PROTONAME);
void CreateServices(void)
{
CreateServiceName(ChatNew);
CreateServiceName(SetAvatar);
CreateServiceName(SendGuiFile);
CreateServiceName(HoldCall);
CreateServiceName(AnswerCall);
CreateServiceName(ImportHistory);
CreateServiceName(AddUser);
CreateServiceName(SkypeOutCallUser);
CreateServiceName(CallHangupUser);
CreateServiceName(CallUser);
CreateServiceName(BlockContact);
CreateServiceFunction(SKYPE_CALL, SkypeCall);
CreateServiceFunction(SKYPE_CALLHANGUP, SkypeCallHangup);
CreateServiceFunction(SKYPEOUT_CALL, SkypeOutCall);
CreateServiceFunction(SKYPE_HOLDCALL, SkypeHoldCall);
CreateServiceFunction(SKYPE_ADDUSER, SkypeAdduserDlg);
CreateServiceFunction(SKYPE_IMPORTHISTORY, ImportHistory);
CreateServiceFunction(SKYPE_ANSWERCALL, SkypeAnswerCall);
CreateServiceFunction(SKYPE_SENDFILE, SkypeSendGuiFile);
CreateServiceFunction(SKYPE_SETAVATAR, SkypeSetAvatar);
CreateServiceFunction(SKYPE_BLOCKCONTACT, SkypeBlockContact);
CreateProtoService(PS_GETCAPS, SkypeGetCaps);
CreateProtoService(PS_GETNAME, SkypeGetName);
CreateProtoService(PS_LOADICON, SkypeLoadIcon);
CreateProtoService(PS_SETSTATUS, SkypeSetStatus);
CreateProtoService(PS_GETSTATUS, SkypeGetStatus);
CreateProtoService(PS_ADDTOLIST, SkypeAddToList);
CreateProtoService(PS_ADDTOLISTBYEVENT, SkypeAddToListByEvent);
CreateProtoService(PS_BASICSEARCH, SkypeBasicSearch);
CreateProtoService(PS_SEARCHBYEMAIL, SkypeBasicSearch);
CreateProtoService(PSS_GETINFO, SkypeGetInfo);
CreateProtoService(PSS_MESSAGE, SkypeSendMessage);
CreateProtoService(PSR_MESSAGE, SkypeRecvMessage);
CreateProtoService(PSS_USERISTYPING, SkypeUserIsTyping);
CreateProtoService(PSS_AUTHREQUEST, SkypeSendAuthRequest);
CreateProtoService(PSR_AUTH, SkypeRecvAuth);
CreateProtoService(PS_AUTHALLOW, SkypeAuthAllow);
CreateProtoService(PS_AUTHDENY, SkypeAuthDeny);
CreateProtoService(PSR_FILE, SkypeRecvFile);
CreateProtoService(PSS_FILEALLOWT, SkypeFileAllow);
CreateProtoService(PSS_FILEDENY, SkypeFileCancel);
CreateProtoService(PSS_FILECANCEL, SkypeFileCancel);
CreateProtoService(PSS_FILET, SkypeSendFile);
CreateProtoService(PS_GETAVATARINFO, SkypeGetAvatarInfo);
CreateProtoService(PS_GETAVATARCAPS, SkypeGetAvatarCaps);
CreateProtoService(PS_GETMYAVATAR, SkypeGetAvatar);
CreateProtoService(PS_SETMYAVATAR, SkypeSetAvatar);
CreateProtoService(PS_SETAWAYMSG, SkypeSetAwayMessage);
CreateProtoService(PS_SETAWAYMSGW, SkypeSetAwayMessageW);
CreateProtoService(PSS_GETAWAYMSG, SkypeGetAwayMessage);
CreateProtoService(PS_SETMYNICKNAME, SkypeSetNick);
CreateProtoService(PSS_SKYPEAPIMSG, SkypeReceivedAPIMessage);
CreateProtoService(SKYPE_REGPROXY, SkypeRegisterProxy);
}
void HookEvents(void)
{
HookEvent(ME_CLIST_PREBUILDCONTACTMENU, PrebuildContactMenu);
//HookEvent(ME_CLIST_DOUBLECLICKED, ClistDblClick);
HookEvent(ME_OPT_INITIALISE, RegisterOptions);
HookEvent(ME_DB_CONTACT_ADDED,HookContactAdded);
HookEvent(ME_DB_CONTACT_DELETED, HookContactDeleted );
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
HookEvent(ME_SYSTEM_OKTOEXIT, MirandaExit);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OkToExit);
}
void HookEventsLoaded(void)
{
// We cannot check for the TTB-service before this event gets fired... :-/
HookEvent(ME_TTB_MODULELOADED, CreateTopToolbarButton);
HookEvent(ME_USERINFO_INITIALISE, OnDetailsInit );
}
INT_PTR SkypeGetCaps(WPARAM wParam, LPARAM)
{
INT_PTR ret = 0;
switch (wParam) {
case PFLAGNUM_1:
ret = PF1_BASICSEARCH | PF1_IM | PF1_MODEMSG | PF1_SEARCHBYEMAIL; // | PF1_AUTHREQ;
if (protocol>=5) ret |= PF1_ADDSEARCHRES;
if (bHasFileXfer) ret |= PF1_FILE;
return ret;
case PFLAGNUM_2:
ret = PF2_ONLINE | PF2_SHORTAWAY | PF2_INVISIBLE | PF2_HEAVYDND;
#ifdef MAPDND
ret |= PF2_LIGHTDND | PF2_HEAVYDND;
#endif
if (!db_get_b(NULL, SKYPE_PROTONAME, "NoSkype3Stats", 0))
ret |= PF2_LONGAWAY | PF2_FREECHAT;
ret |= Proto_Status2Flag(db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE));
return ret;
case PFLAGNUM_3:
return PF2_ONLINE | PF2_INVISIBLE | PF2_SHORTAWAY | PF2_LONGAWAY | PF2_LIGHTDND | PF2_HEAVYDND | PF2_FREECHAT | PF2_OUTTOLUNCH | PF2_ONTHEPHONE | PF2_IDLE;
case PFLAGNUM_4:
return PF4_FORCEAUTH | PF4_FORCEADDED | PF4_AVATARS | PF4_SUPPORTTYPING;
case PFLAGNUM_5:
return Proto_Status2Flag(db_get_dw(NULL, SKYPE_PROTONAME, "SkypeOutStatusMode", ID_STATUS_ONTHEPHONE));
case PFLAG_UNIQUEIDTEXT:
return (INT_PTR)Translate("Skype ID");
case PFLAG_UNIQUEIDSETTING:
return (INT_PTR) SKYPE_NAME;
default:
return 0;
}
}
INT_PTR SkypeGetName(WPARAM wParam, LPARAM lParam)
{
if (lParam)
{
strncpy((char *)lParam, SKYPE_PROTONAME, wParam);
return 0; // Success
}
return 1; // Failure
}
INT_PTR SkypeLoadIcon(WPARAM wParam,LPARAM)
{
UINT id;
switch(wParam&0xFFFF) {
case PLI_PROTOCOL: id=IDI_SKYPE; break; // IDI_MAIN is the main icon for the protocol
default: return 0;
}
return (INT_PTR)LoadImage(hInst,MAKEINTRESOURCE(id),IMAGE_ICON,GetSystemMetrics(wParam&PLIF_SMALL?SM_CXSMICON:SM_CXICON),GetSystemMetrics(wParam&PLIF_SMALL?SM_CYSMICON:SM_CYICON),0);
}
INT_PTR SkypeGetAvatar(WPARAM wParam,LPARAM lParam)
{
DBVARIANT dbv;
if (!db_get_s(NULL,SKYPE_PROTONAME, "AvatarFile", &dbv)){
mir_strncpy((char*)wParam, dbv.pszVal, (int)lParam);
db_free(&dbv);
}
return 0;
}
|