summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircchannel.cpp
blob: 5d8159622067d2d965de8adfb42baa80b68f460c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "ircchannel.h"
#include "ircchannelperson.h"

IRCChannel::IRCChannel(QString channelname) {
    m_hasPeople = FALSE;
    m_channelname = channelname;
}

IRCChannel::~IRCChannel() {
    /* We want this to get deleted */
    m_people.setAutoDelete(TRUE);
}

QString IRCChannel::channelname() {
    return m_channelname;
}

bool IRCChannel::hasPeople() {
    return m_hasPeople;
}

void IRCChannel::setHasPeople(bool hasPeople) {
    m_hasPeople = hasPeople;
}

void IRCChannel::addPerson(IRCChannelPerson *person) {
    m_people.append(person);
}

void IRCChannel::removePerson(IRCChannelPerson *person) {
    m_people.remove(person);
}

QListIterator<IRCChannelPerson> IRCChannel::people()  {
    QListIterator<IRCChannelPerson> it(m_people);
    return it;
}

IRCChannelPerson *IRCChannel::getPerson(QString nickname) {
    QListIterator<IRCChannelPerson> it(m_people);
    for (; it.current(); ++it) {
        if (it.current()->nick() == nickname) {
            return it.current();
        }
    }
    return 0;
}