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
177
178
179
180
181
182
183
|
#pragma once
#define _CRT_SECURE_NO_DEPRECATE 1
#define TEXT_LEN 1024
#define CP_ACP 0
#define code_page CP_ACP;
#define MIRANDA_CUSTOM_LP
// System includes
#include <stdio.h>
#include <windows.h>
#include <commctrl.h>
#include <process.h>
#include <time.h>
#include <stdlib.h>
#include <stddef.h>
#include <shlobj.h>
#include <time.h>
#include "resource.h"
#include "version.h"
#include "util.h"
#pragma warning (push)
#pragma warning (disable: 4100) // unreferenced formal parameter
// Miranda Includes
#include <newpluginapi.h>
#include <m_utils.h>
#include <m_protosvc.h>
#include <m_protomod.h>
#include <m_skin.h>
#include <m_message.h>
#include <m_database.h>
#include <m_clist.h>
#include <m_system.h>
#include <m_folders.h>
#include <m_options.h>
#include <m_langpack.h>
#include <m_userinfo.h>
#include <m_avatars.h>
#include <m_contacts.h>
#include <m_popup.h>
#pragma warning (pop)
// MyDetails defines
// wParam=NULL
// lParam=(char *) new nickname - do not free
// return=0 for sucess
#define PS_SETMYNICKNAME "/SetNickname"
// Optional, default value is 1024
// wParam=NULL
// lParam=NULL
// return= <=0 for error, >0 the max length of the nick
#define PS_GETMYNICKNAMEMAXLENGTH "/GetMyNicknameMaxLength"
// wParam=(char *)Buffer to file name
// lParam=(int)Buffer size
// return=0 for sucess
#define PS_GETMYAVATAR "/GetMyAvatar"
// wParam=0
// lParam=(const char *)Avatar file name
// return=0 for sucess
#define PS_SETMYAVATAR "/SetMyAvatar"
// Program defines
#define SKYPE_NAME "Username"
#define SKYPE_PROTO "PROTOCOL 7"
#define SKYPE_PROTONAME g_szProtoName // Name of our protocol, taken from .DLL name
#define MAX_MSGS 128 // Maximum messages in queue
#define MAX_USERLEN 32 // Maximum length of a username in Skype
#define PING_INTERVAL 10000 // Ping every 10000 msec to see if Skype is still available
#define USEPOPUP 1 // Use the popup-plugin?
#define TIMEOUT_MSGSEND 60000 // Stolen from msgdialog.c
#define MAX_MSG_AGE 30 // Maximum age in seconds before a Message from queue gets trashed
#define SKYPEBUG_OFFLN 1 // Activate fix for the SkypeAPI Offline-Bug
// Program hooks
typedef struct {
char ChatNew[MAXMODULELABELLENGTH];
char SetAvatar[MAXMODULELABELLENGTH];
char SendFile[MAXMODULELABELLENGTH];
char HoldCall[MAXMODULELABELLENGTH];
char AnswerCall[MAXMODULELABELLENGTH];
char ImportHistory[MAXMODULELABELLENGTH];
char AddUser[MAXMODULELABELLENGTH];
char SkypeOutCallUser[MAXMODULELABELLENGTH];
char CallHangupUser[MAXMODULELABELLENGTH];
char CallUser[MAXMODULELABELLENGTH];
} SKYPE_SVCNAMES;
#define SKYPE_CALL g_svcNames.CallUser
#define SKYPE_CALLHANGUP g_svcNames.CallHangupUser
#define SKYPEOUT_CALL g_svcNames.SkypeOutCallUser
#define SKYPE_ADDUSER g_svcNames.AddUser
#define SKYPE_IMPORTHISTORY g_svcNames.ImportHistory
#define SKYPE_ANSWERCALL g_svcNames.AnswerCall
#define SKYPE_HOLDCALL g_svcNames.HoldCall
#define SKYPE_SENDFILE g_svcNames.SendFile
#define SKYPE_SETAVATAR g_svcNames.SetAvatar
#define SKYPE_CHATNEW g_svcNames.ChatNew
#define EVENTTYPE_CALL 2000
#define WM_COPYDATALOCAL WM_USER+100 // WM_COPYDATA for local window communication, needed due to Win98 bug
#ifndef __SKYPESVC_C__
extern SKYPE_SVCNAMES g_svcNames;
#endif
// Skype API Communication services
#define PSS_SKYPEAPIMSG "/SendSkypeAPIMsg"
#define SKYPE_REGPROXY "/RegisterProxySvc"
#define MUUID_SKYPE_CALL { 0x245241eb, 0x178c, 0x4b3f, { 0x91, 0xa, 0x4c, 0x4d, 0xf0, 0xa0, 0xc3, 0xb6 } }
// Common used code-pieces
#define OUTPUT(a) ShowMessage(IDI_ERRORS, a, 1);
#define OUTPUTA(a) ShowMessageA(IDI_ERRORS, a, 1);
typedef void ( __cdecl* pThreadFunc )( void* );
// Prototypes
void __cdecl SkypeSystemInit(char *);
void __cdecl MsgPump (char *dummy);
void PingPong(void);
void CheckIfApiIsResponding(char *);
void TellError(DWORD err);
int ShowMessage(int, TCHAR*, int);
#ifdef _UNICODE
int ShowMessageA(int iconID, char *lpzText, int mustShow);
#else
#define ShowMessageA ShowMessage
#endif
void EndCallThread(char *);
void GetInfoThread(HANDLE);
int OnDetailsInit( WPARAM, LPARAM );
INT_PTR SkypeGetAvatarInfo(WPARAM wParam,LPARAM lParam);
INT_PTR SkypeGetAvatarCaps(WPARAM wParam,LPARAM lParam);
INT_PTR SkypeGetAwayMessage(WPARAM wParam,LPARAM lParam);
int HookContactAdded(WPARAM wParam, LPARAM lParam);
int HookContactDeleted(WPARAM wParam, LPARAM lParam);
INT_PTR ImportHistory(WPARAM wParam, LPARAM lParam);
int CreateTopToolbarButton(WPARAM wParam, LPARAM lParam);
int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSetStatus(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeGetStatus(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeGetInfo(WPARAM wParam,LPARAM lParam);
INT_PTR SkypeAddToList(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeBasicSearch(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSendMessage(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeRecvMessage(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeUserIsTyping(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeSendAuthRequest(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeRecvAuth(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeAuthAllow(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeAuthDeny(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeAddToListByEvent(WPARAM wParam, LPARAM lParam);
INT_PTR SkypeRegisterProxy(WPARAM wParam, LPARAM lParam);
time_t SkypeTime(time_t *timer);
void MessageSendWatchThread(void*);
int OkToExit(WPARAM wParam, LPARAM lParam);
int MirandaExit(WPARAM wParam, LPARAM lParam);
int __stdcall EnterBitmapFileName( char* szDest );
void CleanupNicknames(char *dummy);
int InitVSApi();
int FreeVSApi();
HANDLE GetMetaHandle(DWORD dwId);
void LaunchSkypeAndSetStatusThread(void *newStatus);
// Structs
typedef struct {
char *SkypeSetting;
char *MirandaSetting;
} settings_map;
|