00001 #include "ircchannel.h" 00002 #include "ircchannelperson.h" 00003 00004 IRCChannel::IRCChannel(QString channelname) { 00005 m_hasPeople = FALSE; 00006 m_channelname = channelname; 00007 } 00008 00009 IRCChannel::~IRCChannel() { 00010 /* We want this to get deleted */ 00011 m_people.setAutoDelete(TRUE); 00012 } 00013 00014 QString IRCChannel::channelname() { 00015 return m_channelname; 00016 } 00017 00018 bool IRCChannel::hasPeople() { 00019 return m_hasPeople; 00020 } 00021 00022 void IRCChannel::setHasPeople(bool hasPeople) { 00023 m_hasPeople = hasPeople; 00024 } 00025 00026 void IRCChannel::addPerson(IRCChannelPerson *person) { 00027 m_people.append(person); 00028 } 00029 00030 void IRCChannel::removePerson(IRCChannelPerson *person) { 00031 m_people.remove(person); 00032 } 00033 00034 QListIterator<IRCChannelPerson> IRCChannel::people() { 00035 QListIterator<IRCChannelPerson> it(m_people); 00036 return it; 00037 } 00038 00039 IRCChannelPerson *IRCChannel::getPerson(QString nickname) { 00040 QListIterator<IRCChannelPerson> it(m_people); 00041 for (; it.current(); ++it) { 00042 if (it.current()->nick() == nickname) { 00043 return it.current(); 00044 } 00045 } 00046 return 0; 00047 } 00048 00049 bool IRCChannel::isValid(const QString &channel) 00050 { 00051 return ( channel.startsWith("#") || channel.startsWith("&") 00052 || channel.startsWith("+") || channel.startsWith("!")); 00053 } 00054
1.4.2