summaryrefslogtreecommitdiff
path: root/protocols/IRCG/src/stdafx.h
blob: 32bc8af34d94a3539259ed341073c42a09358424 (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
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
/*
IRC plugin for Miranda IM

Copyright (C) 2003-05 Jurgen Persson
Copyright (C) 2007-09 George Hazan

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/

#ifndef _IRCWIN_H_
#define _IRCWIN_H_

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <shlwapi.h>
#include <shlobj.h>
#include <objbase.h>
#include <shellapi.h>
#include <stdio.h>
#include <stdlib.h>
#include <process.h>
#include <malloc.h>
#include <math.h>
#include <winsock.h>
#include <commctrl.h>
#include <time.h>
#include <ctype.h>
#include <io.h>
#include <fcntl.h>
#include <sys/stat.h>

#include "newpluginapi.h"
#include "m_system.h"
#include "m_protocols.h"
#include "m_protosvc.h"
#include "m_protoint.h"
#include "m_clist.h"
#include "m_options.h"
#include "m_database.h"
#include "m_utils.h"
#include "m_skin.h"
#include "m_netlib.h"
#include "m_langpack.h"
#include "m_chat_int.h"
#include "m_message.h"
#include "m_userinfo.h"
#include "m_contacts.h"
#include "m_button.h"
#include "m_genmenu.h"
#include "m_file.h"
#include "m_ignore.h"
#include "m_chat_int.h"
#include "m_icolib.h"
#include "m_string.h"
#include "win2k.h"
#include "m_gui.h"
#include <m_plugin.h>

#include "resource.h"

#define IRC_QUICKCONNECT      "/QuickConnectMenu"
#define IRC_JOINCHANNEL       "/JoinChannelMenu"
#define IRC_CHANGENICK        "/ChangeNickMenu"
#define IRC_SHOWLIST          "/ShowListMenu"
#define IRC_SHOWSERVER        "/ShowServerMenu"
#define IRC_UM_CHANSETTINGS   "/UMenuChanSettings"
#define IRC_UM_WHOIS          "/UMenuWhois"
#define IRC_UM_DISCONNECT     "/UMenuDisconnect"
#define IRC_UM_IGNORE         "/UMenuIgnore"

#define STR_QUITMESSAGE  L"Miranda NG! Smaller, Faster, Easier. https://miranda-ng.org/"
#define STR_USERINFO     L"I'm a happy Miranda NG user! Get it here: https://miranda-ng.org/"
#define STR_AWAYMESSAGE  L"I'm away from the computer." // Default away
#define DCCSTRING        L" (DCC)"
#define SERVERSMODULE    "IRC Servers"
#define SERVERWINDOW	    L"Network log"

#define DCC_CHAT		1
#define DCC_SEND		2

#define FILERESUME_CANCEL	11

struct CIrcProto;

// special service for tweaking performance, implemented in chat.dll
#define MS_GC_GETEVENTPTR  "GChat/GetNewEventPtr"
typedef int (*GETEVENTFUNC)(WPARAM wParam, LPARAM lParam);
typedef struct
{
	GETEVENTFUNC pfnAddEvent;
}
GCPTRS;

#define IP_AUTO       1
#define IP_MANUAL     2

struct IPRESOLVE      // Contains info about the channels
{
	IPRESOLVE(const char* _addr, int _type) :
		sAddr(_addr),
		iType(_type)
	{
	}

	~IPRESOLVE()
	{
	}

	CMStringA     sAddr;
	int        iType;
};

struct CHANNELINFO   // Contains info about the channels
{
	wchar_t* pszTopic;
	wchar_t* pszMode;
	wchar_t* pszPassword;
	wchar_t* pszLimit;
	BYTE   OwnMode;	/* own mode on the channel. Bitmask:
												0: voice
												1: halfop
												2: op
												3: admin
												4: owner		*/
	int    codepage;
};

struct SERVER_INFO  // Contains info about different servers
{
	~SERVER_INFO();

	char *m_name, *m_address, *m_group;
	int  m_portStart, m_portEnd, m_iSSL;
};

struct PERFORM_INFO  // Contains 'm_perform buffer' for different networks
{
	PERFORM_INFO(const char* szSetting, const wchar_t* value) :
		mSetting(szSetting),
		mText(value)
	{
	}

	~PERFORM_INFO()
	{
	}

	CMStringA mSetting;
	CMStringW mText;
};

struct CONTACT // Contains info about users
{
	const wchar_t *name;
	const wchar_t *user;
	const wchar_t *host;
	bool ExactOnly;
	bool ExactWCOnly;
	bool ExactNick;
};

struct TDbSetting
{
	int    offset;
	char*  name;
	int    type;
	size_t size;
	union
	{
		int    defValue;
		wchar_t* defStr;
	};
};

#include "irclib.h"
using namespace irc;

#include "irc_dlg.h"

#include "ircproto.h"

// map actual member functions to their associated IRC command.
// put any number of this macro in the class's constructor.
#define	IRC_MAP_ENTRY(name, member)	\
	m_handlers.insert( new CIrcHandler( L##name, &CIrcProto::OnIrc_##member ));

/////////////////////////////////////////////////////////////////////////////////////////
// Functions

// main.cpp
extern HINSTANCE hInst;

extern OBJLIST<SERVER_INFO> g_servers;

CIrcProto* GetTimerOwner(UINT_PTR eventId);

VOID CALLBACK IdentTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
VOID CALLBACK TimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
VOID CALLBACK KeepAliveTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
VOID CALLBACK OnlineNotifTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
VOID CALLBACK OnlineNotifTimerProc3(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
VOID CALLBACK DCCTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);

// options.cpp

void    InitServers(void);
void    RereadServers(void);

void    InitContactMenus(void);
void    UninitContactMenus(void);

void    InitIcons(void);
HICON   LoadIconEx(int iIndex, bool big = false);
HANDLE  GetIconHandle(int iconId);

// tools.cpp
int            __stdcall WCCmp(const wchar_t* wild, const wchar_t* string);
char*          __stdcall IrcLoadFile(wchar_t * szPath);
CMStringW      __stdcall GetWord(const wchar_t* text, int index);
const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
void           __stdcall RemoveLinebreaks(CMStringW& Message);
wchar_t*       __stdcall my_strstri(const wchar_t *s1, const wchar_t *s2);
wchar_t*       __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent);

CMStringA      __stdcall GetWord(const char* text, int index);

#pragma comment(lib,"comctl32.lib")

#endif