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
184
185
186
187
188
189
|
#include "headers.h"
BOOL gbDosServiceExist = 0;
DWORD gbMaxQuestCount = 5;
BOOL gbInfTalkProtection = 0;
BOOL gbAddPermanent = 0;
BOOL gbHandleAuthReq = 1;
BOOL gbSpecialGroup = 0;
BOOL gbHideContacts = 1;
BOOL gbIgnoreContacts = 0;
BOOL gbExclude = 1;
BOOL gbDelExcluded = 0;
BOOL gbDosServiceIntegration = 0;
//BOOL gbDelNotInList = 0;
tstring gbSpammersGroup = _T("Spammers");
tstring gbQuestion;
tstring gbAnswer;
tstring gbCongratulation;
std::string gbAuthRepl;
extern char * pluginDescription;
extern TCHAR const * defQuestion;
struct MM_INTERFACE mmi;
UTF8_INTERFACE utfi;
/////////////////////////////////////////////////////////////////////////////////////////
// returns plugin's extended information
// {553811EE-DEB6-48b8-8902-A8A00C1FD679}
#define MIID_STOPSPAM { 0x553811ee, 0xdeb6, 0x48b8, { 0x89, 0x2, 0xa8, 0xa0, 0xc, 0x1f, 0xd6, 0x79 } }
PLUGININFOEX pluginInfoEx = {
sizeof(PLUGININFOEX),
0,
PLUGIN_MAKE_VERSION(0, 0, 1, 6),
pluginDescription,
"Roman Miklashevsky",
"sss123next@list.ru",
"© 2004-2009 Roman Miklashevsky, A. Petkevich, Kosh&chka, sss",
"http://sss.chaoslab.ru:81/tracker/mim_plugs/",
UNICODE_AWARE,
0,
MIID_STOPSPAM
};
char *date()
{
static char d[11];
char *tmp = __DATE__, m[4], mn[3] = "01";
m[0]=tmp[0];
m[1]=tmp[1];
m[2]=tmp[2];
if(strstr(m,"Jan"))
strcpy(mn,"01");
else if(strstr(m,"Feb"))
strcpy(mn,"02");
else if(strstr(m,"Mar"))
strcpy(mn,"03");
else if(strstr(m,"Apr"))
strcpy(mn,"04");
else if(strstr(m,"May"))
strcpy(mn,"05");
else if(strstr(m,"Jun"))
strcpy(mn,"06");
else if(strstr(m,"Jul"))
strcpy(mn,"07");
else if(strstr(m,"Aug"))
strcpy(mn,"08");
else if(strstr(m,"Sep"))
strcpy(mn,"09");
else if(strstr(m,"Oct"))
strcpy(mn,"10");
else if(strstr(m,"Nov"))
strcpy(mn,"11");
else if(strstr(m,"Dec"))
strcpy(mn,"12");
d[0]=tmp[7];
d[1]=tmp[8];
d[2]=tmp[9];
d[3]=tmp[10];
d[4]='.';
d[5]=mn[0];
d[6]=mn[1];
d[7]='.';
if (tmp[4] == ' ')
d[8] = '0';
else
d[8]=tmp[4];
d[9]=tmp[5];
return d;
}
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
{
if ( mirandaVersion < PLUGIN_MAKE_VERSION( 0, 7, 0, 0 ))
return NULL;
{
static char plugname[52];
strcpy(plugname, pluginName" mod [");
strcat(plugname, date());
strcat(plugname, " ");
strcat(plugname, __TIME__);
strcat(plugname, "]");
pluginInfoEx.shortName = plugname;
}
return &pluginInfoEx;
}
void InitVars()
{
gbDosServiceIntegration = DBGetContactSettingByte(NULL, pluginName, "DOSIntegration", 0);
gbSpammersGroup = DBGetContactSettingStringPAN(NULL, pluginName, "SpammersGroup", _T("Spammers"));
gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam"));
gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", _T("Congratulations! You just passed human/robot test. Now you can write me a message."));
gbInfTalkProtection = DBGetContactSettingByte(NULL, pluginName, "infTalkProtection", 0);
gbAddPermanent = DBGetContactSettingByte(NULL, pluginName, "addPermanent", 0);
gbMaxQuestCount = DBGetContactSettingDword(NULL, pluginName, "maxQuestCount", 5);
gbHandleAuthReq = DBGetContactSettingByte(NULL, pluginName, "handleAuthReq", 1);
gbQuestion = DBGetContactSettingStringPAN(NULL, pluginName, "question", defQuestion);
gbAnswer = DBGetContactSettingStringPAN(NULL, pluginName, "answer", _T("nospam"));
gbCongratulation = DBGetContactSettingStringPAN(NULL, pluginName, "congratulation", _T("Congratulations! You just passed human/robot test. Now you can write me a message."));
gbAuthRepl = DBGetContactSettingStringPAN_A(NULL, pluginName, "authrepl", "StopSpam: send a message and reply to a anti-spam bot question.");
gbSpecialGroup = DBGetContactSettingByte(NULL, pluginName, "SpecialGroup", 0);
gbHideContacts = DBGetContactSettingByte(NULL, pluginName, "HideContacts", 0);
gbIgnoreContacts = DBGetContactSettingByte(NULL, pluginName, "IgnoreContacts", 0);
gbExclude = DBGetContactSettingByte(NULL, pluginName, "ExcludeContacts", 1);
gbDelExcluded = DBGetContactSettingByte(NULL, pluginName, "DelExcluded", 0);
// gbDelNotInList = DBGetContactSettingByte(NULL, pluginName, "DelNotInList", 0);
}
static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam)
{
if (ServiceExists(MS_DOS_SERVICE))
gbDosServiceExist = TRUE;
InitVars();
if(gbDelExcluded)
RemoveExcludedUsers();
return 0;
}
PLUGINLINK *pluginLink;
HANDLE hEventFilter = 0, hOptInitialise = 0, hSettingChanged = 0;
BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved)
{
/*if(DLL_PROCESS_ATTACH == fdwReason)
hInst=hinstDLL;
return TRUE;*/
hInst = hinstDLL;
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////////////////
// returns plugin's interfaces information
static const MUUID interfaces[] = { MIID_STOPSPAM, MIID_LAST };
extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void)
{
return interfaces;
}
extern "C" int __declspec(dllexport) Load(PLUGINLINK *link)
{
pluginLink = link;
mir_getMMI(&mmi);
mir_getUTFI(&utfi);
HookEvent(ME_SYSTEM_MODULESLOADED, OnSystemModulesLoaded);
miranda::EventHooker::HookAll();
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
miranda::EventHooker::UnhookAll();
return 0;
}
|