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 @@ +#include "ircperson.h" +#include "ircchannelperson.h" + +#include <qstring.h> +#include <qobject.h> + +IRCChannelPerson::IRCChannelPerson(IRCPerson *person) +{ + m_person = person; + m_flags = 0; +} + +IRCChannelPerson::~IRCChannelPerson() +{ + //if(m_person) + // delete m_person; +} + +QString IRCChannelPerson::setOp(const QString &nickname, bool set) +{ + if(set) { + m_flags |= PERSON_FLAG_OP; + return ( nickname + QObject::tr(" gives channel operator status to ") + nick()); + } + + m_flags &= 0xFFFF - PERSON_FLAG_OP; + return ( nickname + QObject::tr(" removes channel operator status from ") + nick()); +} + +QString IRCChannelPerson::setVoice(const QString &nickname, bool set) +{ + if(set) { + m_flags |= PERSON_FLAG_VOICE; + return ( nickname + QObject::tr(" gives voice to ") + nick() ); + } + + m_flags &= 0xFFFF - PERSON_FLAG_VOICE; + return ( nickname + QObject::tr(" removes voice from ") + nick()); +} + +QString IRCChannelPerson::nick() +{ + if(m_person) + return m_person->nick(); + + return QString::null; +} + +void IRCChannelPerson::setFlags(int flags) +{ + m_flags = flags; +} + +void IRCChannelPerson::setNick(const QString &nickname) +{ + m_person->setNick(nickname); +} + +const unsigned int IRCChannelPerson::flags() +{ + return m_flags; +} |