summaryrefslogtreecommitdiff
path: root/serverbrowser/BlacklistedServers.h
blob: ce8b9b50efeac22aabae500d510f37b2146ea530 (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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//=============================================================================

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

#include "ServerBrowser/blacklisted_server_manager.h"

//-----------------------------------------------------------------------------
// Purpose: Blacklisted servers list
//-----------------------------------------------------------------------------
class CBlacklistedServers : public vgui::PropertyPage
{
	DECLARE_CLASS_SIMPLE( CBlacklistedServers, vgui::PropertyPage );

public:
	CBlacklistedServers(vgui::Panel *parent);
	~CBlacklistedServers();

	// blacklist list, loads/saves from file
	void LoadBlacklistedList();
	void SaveBlacklistedList();
	void AddServer(gameserveritem_t &server);

	virtual void ApplySchemeSettings(vgui::IScheme *pScheme);
	
	// passed from main server browser window instead of messages
	void OnConnectToGame();
	void OnDisconnectFromGame( void );

	blacklisted_server_t *GetBlacklistedServer( int iServerID );
	bool IsServerBlacklisted(gameserveritem_t &server); 

private:
	// context menu message handlers
	MESSAGE_FUNC( OnPageShow, "PageShow" );
	MESSAGE_FUNC_INT( OnOpenContextMenu, "OpenContextMenu", itemID );
	MESSAGE_FUNC( OnAddServerByName, "AddServerByName" );
	MESSAGE_FUNC( OnRemoveFromBlacklist, "RemoveFromBlacklist" );
	MESSAGE_FUNC_CHARPTR( OnFileSelected, "FileSelected", fullpath );

	void ClearServerList( void );
	void OnAddCurrentServer( void );
	void OnImportBlacklist( void );
	void OnCommand(const char *command);
	void UpdateBlacklistUI( blacklisted_server_t *blackServer );
	int  GetSelectedServerID( void );
	bool AddServersFromFile( const char *pszFilename, bool bResetTimes );

private:
	vgui::Button *m_pAddServer;
	vgui::Button *m_pAddCurrentServer;
	vgui::ListPanel *m_pGameList;
	vgui::DHANDLE< vgui::FileOpenDialog >	m_hImportDialog;

	CBlacklistedServerManager m_blackList;
	long m_blackListTimestamp;
};


#endif // BLACKLISTEDSERVERS_H