File: Nick.h

package info (click to toggle)
znc 0.058-2%2Blenny4
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,464 kB
  • ctags: 2,692
  • sloc: cpp: 20,613; sh: 3,043; perl: 358; makefile: 169
file content (68 lines) | stat: -rw-r--r-- 1,560 bytes parent folder | download
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 (C) 2004-2008  See the AUTHORS file for details.
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License version 2 as published
 * by the Free Software Foundation.
 */

#ifndef _NICK_H
#define _NICK_H

#include "String.h"
#include <set>
#include <vector>

using std::vector;
using std::set;

// Forward Decl
class CUser;
class CChan;
// !Forward Decl

class CNick
{
public:
	CNick();
	CNick(const CString& sNick);
	virtual ~CNick();

	void Reset();
	void Parse(const CString& sNickMask);
	CString GetHostMask() const;
	unsigned int GetCommonChans(vector<CChan*>& vChans, CUser* pUser) const;
	static CString Concat(const CString& sNick, const CString& sSuffix, unsigned int uMaxNickLen = 9);

	// Setters
	void SetUser(CUser* pUser);
	void UpdatePermChar();
	void SetPermChar(char c);
	void SetNick(const CString& s);
	void SetIdent(const CString& s);
	void SetHost(const CString& s);
	bool AddPerm(unsigned char uPerm);
	bool RemPerm(unsigned char uPerm);
	// !Setters

	// Getters
	const set<unsigned char>& GetChanPerms() const;
	CString GetPermStr() const;
	unsigned char GetPermChar() const;
	bool HasPerm(unsigned char uPerm) const;
	const CString& GetNick() const;
	const CString& GetIdent() const;
	const CString& GetHost() const;
	CString GetNickMask() const;
	// !Getters
private:
protected:
	set<unsigned char>	m_suChanPerms;
	unsigned char		m_cPerm;
	CUser*				m_pUser;
	CString				m_sNick;
	CString				m_sIdent;
	CString				m_sHost;
};

#endif // !_NICK_H