00001 /* 00002 This file is part of OpieIRC - An embedded IRC client 00003 Copyright (C) 2005 Alberto 'Skyhusker' García Hierro 00004 <skyhusker@handhelds.org> 00005 00006 This program is free software; you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation; either version 2 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program; if not, write to the Free Software 00018 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00019 00020 */ 00021 00022 #include "ircperson.h" 00023 #include "ircchannelperson.h" 00024 00025 #include <qstring.h> 00026 #include <qobject.h> 00027 00028 IRCChannelPerson::IRCChannelPerson(IRCPerson *person) 00029 { 00030 m_person = person; 00031 m_flags = 0; 00032 } 00033 00034 IRCChannelPerson::~IRCChannelPerson() 00035 { 00036 //if(m_person) 00037 // delete m_person; 00038 } 00039 00040 QString IRCChannelPerson::setOp(const QString &nickname, bool set) 00041 { 00042 if(set) { 00043 m_flags |= PERSON_FLAG_OP; 00044 return ( nickname + QObject::tr(" gives channel operator status to ") + nick()); 00045 } 00046 00047 m_flags &= 0xFFFF - PERSON_FLAG_OP; 00048 return ( nickname + QObject::tr(" removes channel operator status from ") + nick()); 00049 } 00050 00051 QString IRCChannelPerson::setVoice(const QString &nickname, bool set) 00052 { 00053 if(set) { 00054 m_flags |= PERSON_FLAG_VOICE; 00055 return ( nickname + QObject::tr(" gives voice to ") + nick() ); 00056 } 00057 00058 m_flags &= 0xFFFF - PERSON_FLAG_VOICE; 00059 return ( nickname + QObject::tr(" removes voice from ") + nick()); 00060 } 00061 00062 QString IRCChannelPerson::nick() 00063 { 00064 if(m_person) 00065 return m_person->nick(); 00066 00067 return QString::null; 00068 } 00069 00070 void IRCChannelPerson::setFlags(int flags) 00071 { 00072 m_flags = flags; 00073 } 00074 00075 void IRCChannelPerson::setNick(const QString &nickname) 00076 { 00077 m_person->setNick(nickname); 00078 } 00079 00080 const unsigned int IRCChannelPerson::flags() 00081 { 00082 return m_flags; 00083 }
1.4.2