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
|
/*
WhatsApp plugin for Miranda NG
Copyright © 2019-23 George Hazan
*/
#include "stdafx.h"
#include "version.h"
CMPlugin g_plugin;
PLUGININFOEX pluginInfo = {
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
__DESCRIPTION,
__AUTHOR,
__COPYRIGHT,
__AUTHORWEB,
UNICODE_AWARE, //not transient
// {008B9CE1-154B-44E4-9823-97C1AAB00C3C}
{ 0x8b9ce1, 0x154b, 0x44e4, { 0x98, 0x23, 0x97, 0xc1, 0xaa, 0xb0, 0xc, 0x3c }}
};
/////////////////////////////////////////////////////////////////////////////////////////
// Interface information
extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = { MIID_PROTOCOL, MIID_LAST };
/////////////////////////////////////////////////////////////////////////////////////////
CMPlugin::CMPlugin() :
ACCPROTOPLUGIN<WhatsAppProto>(MODULENAME, pluginInfo)
{
SetUniqueId(DBKEY_ID);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Load
static int OnPluginLoaded(WPARAM, LPARAM)
{
g_plugin.bHasMessageState = ServiceExists(MS_MESSAGESTATE_UPDATE);
return 0;
}
int CMPlugin::Load()
{
HookEvent(ME_SYSTEM_MODULELOAD, OnPluginLoaded);
HookEvent(ME_SYSTEM_MODULEUNLOAD, OnPluginLoaded);
OnPluginLoaded(0, 0);
// special netlib user for reading avatars, blobs etc via HTTP protocol
NETLIBUSER nlu = {};
nlu.flags = NUF_INCOMING | NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.szSettingsModule = "WhatsApp";
nlu.szDescriptiveName.w = TranslateT("WhatsApp (HTTP)");
hAvatarUser = Netlib_RegisterUser(&nlu);
return 0;
}
/////////////////////////////////////////////////////////////////////////////////////////
// Unload
int CMPlugin::Unload()
{
Netlib_CloseHandle(hAvatarConn);
Netlib_CloseHandle(hAvatarUser);
return 0;
}
|