1 /***************************************************************************
2 * Copyright (C) 2005-07 by The Quassel Team *
3 * devel@quassel-irc.org *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #include "serverinfo.h"
22 ServerInfo::ServerInfo(QObject *parent)
26 ServerInfo::~ServerInfo() {
29 void ServerInfo::setNetworkname(const QString &networkname) {
30 networkname_ = networkname;
33 QString ServerInfo::networkname() const {
37 void ServerInfo::setCurrentServer(const QString ¤tServer) {
38 currentServer_ = currentServer;
41 QString ServerInfo::currentServer() const {
42 return currentServer_;
45 void ServerInfo::setOwnNick(const QString &ownnick) {
49 QString ServerInfo::ownNick() const {
53 QList<IrcUser *> ServerInfo::ircUsers() const {
54 return ircUsers_.values();
58 IrcUser *ServerInfo::newIrcUser(const QString &hostmask) {
59 IrcUser *ircuser = new IrcUser(hostmask);
60 return ircUsers_[ircuser->nick()] = ircuser;
63 IrcUser *ServerInfo::ircUser(const QString &nickname) const {
64 if(ircUsers_.contains(nickname))
65 return ircUsers_[nickname];
67 throw NoSuchNickException();
70 void ServerInfo::setTopics(const QHash<QString, QString> &topics) {
74 QHash<QString, QString> ServerInfo::topics() const {
78 void ServerInfo::updateTopic(const QString &channel, const QString &topic) {
79 topics_[channel] = topic;
82 QString ServerInfo::topic(const QString &channel) const {
83 if(topics_.contains(channel))
84 return topics_[channel];
86 throw NoSuchChannelException();
89 void ServerInfo::setSupports(const QHash<QString, QString> &supports) {
93 QHash<QString, QString> ServerInfo::supports() const {
97 QString ServerInfo::supports(const QString &feature) const {
98 if(supports_.contains(feature))
99 return supports_[feature];
101 throw UnsupportedFeatureException();
104 bool ServerInfo::isOwnNick(const QString &nick) const {
105 return (ownNick_.toLower() == nick.toLower());
108 bool ServerInfo::isOwnNick(const IrcUser &ircuser) const {
109 return (ircuser.nick().toLower() == ownNick_.toLower());