aboutsummaryrefslogtreecommitdiff
path: root/sp/src/game/shared/voice_banmgr.h
blob: 6adfdc55eb35ba17d861273fdab5446a4a71974a (plain) (blame)
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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================//

#ifndef VOICE_BANMGR_H
#define VOICE_BANMGR_H
#ifdef _WIN32
#pragma once
#endif


// This class manages the (persistent) list of squelched players.
class CVoiceBanMgr
{
public:

				CVoiceBanMgr();
				~CVoiceBanMgr();	

	// Init loads the list of squelched players from disk.
	bool		Init(const char *pGameDir);
	void		Term();

	// Saves the state into voice_squelch.dt.
	void		SaveState(const char *pGameDir);

	bool		GetPlayerBan(char const playerID[SIGNED_GUID_LEN]);
	void		SetPlayerBan(char const playerID[SIGNED_GUID_LEN], bool bSquelch);


protected:

	class BannedPlayer
	{
	public:
		char			m_PlayerID[SIGNED_GUID_LEN];
		BannedPlayer	*m_pPrev, *m_pNext;
	};

	void			Clear();
	BannedPlayer*	InternalFindPlayerSquelch(char const playerID[SIGNED_GUID_LEN]);
	BannedPlayer*	AddBannedPlayer(char const playerID[SIGNED_GUID_LEN]);


protected:

	BannedPlayer	m_PlayerHash[256];
};


#endif // VOICE_BANMGR_H