Diffstat (limited to 'noncore/net/opieirc/ircchannelperson.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircchannelperson.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircchannelperson.cpp b/noncore/net/opieirc/ircchannelperson.cpp new file mode 100644 index 0000000..1e8ebe4 --- a/dev/null +++ b/noncore/net/opieirc/ircchannelperson.cpp | |||
@@ -0,0 +1,62 @@ | |||
1 | #include "ircperson.h" | ||
2 | #include "ircchannelperson.h" | ||
3 | |||
4 | #include <qstring.h> | ||
5 | #include <qobject.h> | ||
6 | |||
7 | IRCChannelPerson::IRCChannelPerson(IRCPerson *person) | ||
8 | { | ||
9 | m_person = person; | ||
10 | m_flags = 0; | ||
11 | } | ||
12 | |||
13 | IRCChannelPerson::~IRCChannelPerson() | ||
14 | { | ||
15 | //if(m_person) | ||
16 | // delete m_person; | ||
17 | } | ||
18 | |||
19 | QString IRCChannelPerson::setOp(const QString &nickname, bool set) | ||
20 | { | ||
21 | if(set) { | ||
22 | m_flags |= PERSON_FLAG_OP; | ||
23 | return ( nickname + QObject::tr(" gives channel operator status to ") + nick()); | ||
24 | } | ||
25 | |||
26 | m_flags &= 0xFFFF - PERSON_FLAG_OP; | ||
27 | return ( nickname + QObject::tr(" removes channel operator status from ") + nick()); | ||
28 | } | ||
29 | |||
30 | QString IRCChannelPerson::setVoice(const QString &nickname, bool set) | ||
31 | { | ||
32 | if(set) { | ||
33 | m_flags |= PERSON_FLAG_VOICE; | ||
34 | return ( nickname + QObject::tr(" gives voice to ") + nick() ); | ||
35 | } | ||
36 | |||
37 | m_flags &= 0xFFFF - PERSON_FLAG_VOICE; | ||
38 | return ( nickname + QObject::tr(" removes voice from ") + nick()); | ||
39 | } | ||
40 | |||
41 | QString IRCChannelPerson::nick() | ||
42 | { | ||
43 | if(m_person) | ||
44 | return m_person->nick(); | ||
45 | |||
46 | return QString::null; | ||
47 | } | ||
48 | |||
49 | void IRCChannelPerson::setFlags(int flags) | ||
50 | { | ||
51 | m_flags = flags; | ||
52 | } | ||
53 | |||
54 | void IRCChannelPerson::setNick(const QString &nickname) | ||
55 | { | ||
56 | m_person->setNick(nickname); | ||
57 | } | ||
58 | |||
59 | const unsigned int IRCChannelPerson::flags() | ||
60 | { | ||
61 | return m_flags; | ||
62 | } | ||