summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircchannelperson.cpp21
-rw-r--r--noncore/net/opieirc/ircchannelperson.h21
2 files changed, 42 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircchannelperson.cpp b/noncore/net/opieirc/ircchannelperson.cpp
index 1e8ebe4..5e122c1 100644
--- a/noncore/net/opieirc/ircchannelperson.cpp
+++ b/noncore/net/opieirc/ircchannelperson.cpp
@@ -1,48 +1,69 @@
1/*
2 This file is part of OpieIRC - An embedded IRC client
3 Copyright (C) 2005 Alberto 'Skyhusker' García Hierro
4 <skyhusker@handhelds.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20*/
21
1#include "ircperson.h" 22#include "ircperson.h"
2#include "ircchannelperson.h" 23#include "ircchannelperson.h"
3 24
4#include <qstring.h> 25#include <qstring.h>
5#include <qobject.h> 26#include <qobject.h>
6 27
7IRCChannelPerson::IRCChannelPerson(IRCPerson *person) 28IRCChannelPerson::IRCChannelPerson(IRCPerson *person)
8{ 29{
9 m_person = person; 30 m_person = person;
10 m_flags = 0; 31 m_flags = 0;
11} 32}
12 33
13IRCChannelPerson::~IRCChannelPerson() 34IRCChannelPerson::~IRCChannelPerson()
14{ 35{
15 //if(m_person) 36 //if(m_person)
16 // delete m_person; 37 // delete m_person;
17} 38}
18 39
19QString IRCChannelPerson::setOp(const QString &nickname, bool set) 40QString IRCChannelPerson::setOp(const QString &nickname, bool set)
20{ 41{
21 if(set) { 42 if(set) {
22 m_flags |= PERSON_FLAG_OP; 43 m_flags |= PERSON_FLAG_OP;
23 return ( nickname + QObject::tr(" gives channel operator status to ") + nick()); 44 return ( nickname + QObject::tr(" gives channel operator status to ") + nick());
24 } 45 }
25 46
26 m_flags &= 0xFFFF - PERSON_FLAG_OP; 47 m_flags &= 0xFFFF - PERSON_FLAG_OP;
27 return ( nickname + QObject::tr(" removes channel operator status from ") + nick()); 48 return ( nickname + QObject::tr(" removes channel operator status from ") + nick());
28} 49}
29 50
30QString IRCChannelPerson::setVoice(const QString &nickname, bool set) 51QString IRCChannelPerson::setVoice(const QString &nickname, bool set)
31{ 52{
32 if(set) { 53 if(set) {
33 m_flags |= PERSON_FLAG_VOICE; 54 m_flags |= PERSON_FLAG_VOICE;
34 return ( nickname + QObject::tr(" gives voice to ") + nick() ); 55 return ( nickname + QObject::tr(" gives voice to ") + nick() );
35 } 56 }
36 57
37 m_flags &= 0xFFFF - PERSON_FLAG_VOICE; 58 m_flags &= 0xFFFF - PERSON_FLAG_VOICE;
38 return ( nickname + QObject::tr(" removes voice from ") + nick()); 59 return ( nickname + QObject::tr(" removes voice from ") + nick());
39} 60}
40 61
41QString IRCChannelPerson::nick() 62QString IRCChannelPerson::nick()
42{ 63{
43 if(m_person) 64 if(m_person)
44 return m_person->nick(); 65 return m_person->nick();
45 66
46 return QString::null; 67 return QString::null;
47} 68}
48 69
diff --git a/noncore/net/opieirc/ircchannelperson.h b/noncore/net/opieirc/ircchannelperson.h
index a8c4791..e212cc8 100644
--- a/noncore/net/opieirc/ircchannelperson.h
+++ b/noncore/net/opieirc/ircchannelperson.h
@@ -1,34 +1,55 @@
1/*
2 This file is part of OpieIRC - An embedded IRC client
3 Copyright (C) 2005 Alberto 'Skyhusker' García Hierro
4 <skyhusker@handhelds.org>
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20*/
21
1#ifndef IRCCHANNELPERSON_H 22#ifndef IRCCHANNELPERSON_H
2#define IRCCHANNELPERSON_H 23#define IRCCHANNELPERSON_H
3 24
4class QString; 25class QString;
5class IRCPerson; 26class IRCPerson;
6 27
7/* This class encapsulates a IRCPerson and adds 28/* This class encapsulates a IRCPerson and adds
8 * channel specific information */ 29 * channel specific information */
9class IRCChannelPerson { 30class IRCChannelPerson {
10 31
11public: 32public:
12 /* Flags which a person can have inside a channel */ 33 /* Flags which a person can have inside a channel */
13 enum IRCChannelPersonFlag { 34 enum IRCChannelPersonFlag {
14 PERSON_FLAG_OP = 0x01, 35 PERSON_FLAG_OP = 0x01,
15 PERSON_FLAG_VOICE = 0x02, 36 PERSON_FLAG_VOICE = 0x02,
16 PERSON_FLAG_HALFOP = 0x04 37 PERSON_FLAG_HALFOP = 0x04
17 }; 38 };
18 39
19 IRCChannelPerson(IRCPerson *person = 0); 40 IRCChannelPerson(IRCPerson *person = 0);
20 ~IRCChannelPerson(); 41 ~IRCChannelPerson();
21 42
22 QString setOp(const QString &nickname, bool set); 43 QString setOp(const QString &nickname, bool set);
23 QString setVoice(const QString &nickname, bool set); 44 QString setVoice(const QString &nickname, bool set);
24 QString nick(); 45 QString nick();
25 const unsigned int flags(); 46 const unsigned int flags();
26 void setFlags(int flags); 47 void setFlags(int flags);
27 void setNick(const QString &nickname); 48 void setNick(const QString &nickname);
28 49
29protected: 50protected:
30 IRCPerson *m_person; 51 IRCPerson *m_person;
31 unsigned int m_flags; 52 unsigned int m_flags;
32}; 53};
33 54
34#endif 55#endif