Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
matcher.h
Go to the documentation of this file.
1/*
2** Command & Conquer Generals Zero Hour(tm)
3** Copyright 2025 Electronic Arts Inc.
4**
5** This program is free software: you can redistribute it and/or modify
6** it under the terms of the GNU General Public License as published by
7** the Free Software Foundation, either version 3 of the License, or
8** (at your option) any later version.
9**
10** This program is distributed in the hope that it will be useful,
11** but WITHOUT ANY WARRANTY; without even the implied warranty of
12** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13** GNU General Public License for more details.
14**
15** You should have received a copy of the GNU General Public License
16** along with this program. If not, see <http://www.gnu.org/licenses/>.
17*/
18
19#ifndef __MATCHER_H__
20#define __MATCHER_H__
21
22#ifdef _WIN32
23#include <process.h>
24#endif
25#include <configfile.h>
26#include <critsec.h>
27#include <threadfac.h>
28#include <tcp.h>
29#include <cstdarg>
30#include <sem4.h>
31
32#include <string>
33
34#include <peer/peer.h>
35
37{
38public:
40 virtual ~MatcherClass()
41 {}
42
43 virtual void init(void)
44 {}
45
46 virtual void checkMatches(void)
47 {}
48
49 virtual void handleDisconnect( const char *reason )
50 {}
51 virtual void handleRoomMessage( const char *nick, const char *message, MessageType messageType )
52 {}
53 virtual void handlePlayerMessage( const char *nick, const char *message, MessageType messageType )
54 {}
55 virtual void handlePlayerJoined( const char *nick )
56 {}
57 virtual void handlePlayerLeft( const char *nick )
58 {}
59 virtual void handlePlayerChangedNick( const char *oldNick, const char *newNick )
60 {}
61 virtual void handlePlayerEnum( bool success, int gameSpyIndex, const char *nick, int flags )
62 {}
63
64 void handleConnect( bool success );
65 void handleGroupRoomList( bool success, int groupID, const char *name );
66 void handleJoin( bool success );
67 void handleNickError( const char *badNick );
68
69 void connectAndLoop( void );
70
71protected:
72
73 Wstring getString(const Wstring& key);
74
76 std::string m_nick;
78 PEER m_peer;
81 void readLoop( void );
82
83 int done; // 0=no, neg=quit;error, pos=quit;success
84 bool quiet;
86
87 bool m_rotateLogs; // check for log rotation in this thread?
89
90};
91
92#endif /* __MATCHER_H__ */
93
virtual void handlePlayerEnum(bool success, int gameSpyIndex, const char *nick, int flags)
Definition matcher.h:61
void connectAndLoop(void)
Definition matcher.cpp:313
virtual void handleDisconnect(const char *reason)
Definition matcher.h:49
void handleConnect(bool success)
Definition matcher.cpp:270
bool m_rotateLogs
Definition matcher.h:87
int m_profileID
Definition matcher.h:77
Wstring getString(const Wstring &key)
Definition matcher.cpp:40
virtual void handlePlayerLeft(const char *nick)
Definition matcher.h:57
virtual void handlePlayerJoined(const char *nick)
Definition matcher.h:55
PEER m_peer
Definition matcher.h:78
virtual void init(void)
Definition matcher.h:43
virtual void handlePlayerChangedNick(const char *oldNick, const char *newNick)
Definition matcher.h:59
virtual ~MatcherClass()
Definition matcher.h:40
virtual void handlePlayerMessage(const char *nick, const char *message, MessageType messageType)
Definition matcher.h:53
virtual void handleRoomMessage(const char *nick, const char *message, MessageType messageType)
Definition matcher.h:51
int m_groupID
Definition matcher.h:85
void handleGroupRoomList(bool success, int groupID, const char *name)
Definition matcher.cpp:279
bool quiet
Definition matcher.h:84
bool m_connectSuccess
Definition matcher.h:79
void readLoop(void)
Definition matcher.cpp:55
virtual void checkMatches(void)
Definition matcher.h:46
time_t m_lastRotation
Definition matcher.h:88
Wstring m_baseNick
Definition matcher.h:75
bool m_joinSuccess
Definition matcher.h:80
std::string m_nick
Definition matcher.h:76
void handleNickError(const char *badNick)
Definition matcher.cpp:293
void handleJoin(bool success)
Definition matcher.cpp:283
long time_t
Definition wolapi.h:436