summaryrefslogtreecommitdiff
path: root/plugins/StopSpamPlus/src/stdafx.h
blob: 75840d2c033921f805d57ea3feb4e754557a8b51 (plain)
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
#ifndef _stopspam_headers_h
#define _stopspam_headers_h

// disable security warnings about "*_s" functions
#define _CRT_SECURE_NO_DEPRECATE

#include <windows.h>
#include <commctrl.h>
#include <sstream>
#include <list>

#include <newpluginapi.h>
#include <m_contacts.h>
#include <m_database.h>
#include <m_protosvc.h>
#include <m_options.h>
#include <m_langpack.h>
#include <m_icolib.h>
#include <m_skin.h>
#include <m_clistint.h>
#include <m_gui.h>

#include <m_variables.h>

typedef std::wstring tstring;
#define PREF_TCHAR2 PREF_UTF

#include "version.h"
#include "resource.h"

#define MODULENAME LPGEN("StopSpam")

#define DB_KEY_ANSWERED "Answered"
#define DB_KEY_HASAUTH "HasAuth"
#define DB_KEY_HASSENT "HasSent"
#define DB_KEY_QUESTCOUNT "QuestionCount"

struct CMPlugin : public PLUGIN<CMPlugin>
{
	CMPlugin();

	CMOption<bool> InfTalkProtection, AddPermanent, HandleAuthReq, AnswNotCaseSens, HistLog;
	CMOption<wchar_t *> Question, AuthRepl, Answer, Congratulation, AnswSplitString;
	CMOption<char *> DisabledProtoList;
	CMOption<uint32_t> MaxQuestCount;

	const wchar_t* getQuestion();
	const wchar_t* getReply();
	const wchar_t* getCongrats();

	bool ProtoDisabled(const char *proto)
	{
		std::string temp(proto); temp += ' ';
		return strstr(DisabledProtoList, temp.c_str()) != nullptr;
	}

	int Load() override;
};

// utils
tstring variables_parse(const wchar_t *tstrFormat, MCONTACT hContact);
tstring trim(tstring const &tstr, tstring const &trimChars = L" \f\n\r\t\v");

INT_PTR IsContactPassed(WPARAM, LPARAM);
int OnDbEventAdded(WPARAM, LPARAM);
int OnDbEventFilterAdd(WPARAM, LPARAM);
int OnOptInit(WPARAM, LPARAM);
int OnShutdown(WPARAM, LPARAM);

#endif