X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fircuser.h;h=e933fb61fc6081252ec23cc14a1a78bf2bf4fb79;hp=14151bec6e8f203d4286b6233491b8e0308128d7;hb=45d9ea6ed5d64eec3ca351fdcf7610c7cff3529d;hpb=cfbd7e0ec3624307cfb612fe4804d58c34b7eec9 diff --git a/src/common/ircuser.h b/src/common/ircuser.h index 14151bec..e933fb61 100644 --- a/src/common/ircuser.h +++ b/src/common/ircuser.h @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005/06 by The Quassel Team * + * Copyright (C) 2005-07 by the Quassel IRC Team * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -21,73 +21,107 @@ #ifndef _IRCUSER_H_ #define _IRCUSER_H_ -#include -#include -#include #include #include #include +#include + +class SignalProxy; +class NetworkInfo; +class IrcChannel; + +class IrcUser : public QObject { + Q_OBJECT + + Q_PROPERTY(QString user READ user WRITE setUser STORED false) + Q_PROPERTY(QString host READ host WRITE setHost STORED false) + Q_PROPERTY(QString nick READ nick WRITE setNick STORED false) + + Q_PROPERTY(QStringList channels READ channels STORED false) + // Q_PROPERTY(QStringList usermodes READ usermodes WRITE setUsermodes) -#include "global.h" -class IrcUser : public QObject{ -// Q_OBJECT - -// Q_PROPERTY(QString user READ user WRITE setUser) -// Q_PROPERTY(QString host READ host WRITE setHost) -// Q_PROPERTY(QString nick READ nick WRITE setNick) -// Q_PROPERTY(QSet usermodes READ usermodes WRITE setUsermodes) -// Q_PROPERTY(QStringList channels READ channels) - public: - IrcUser(QObject *parent = 0); - IrcUser(const QString &hostmask, QObject *parent = 0); - ~IrcUser(); - - void setUser(const QString &user); + IrcUser(const QString &hostmask, NetworkInfo *networkInfo); + virtual ~IrcUser(); + + bool initialized() const; + QString user() const; - - void setHost(const QString &host); QString host() const; - - void setNick(const QString &nick); QString nick() const; + QString hostmask() const; + + QString userModes() const; + + QStringList channels() const; + +public slots: + void setUser(const QString &user); + void setHost(const QString &host); + void setNick(const QString &nick); + void updateHostmask(const QString &mask); + + void setUserModes(const QString &modes); - void setUsermodes(const QSet &usermodes); - QSet usermodes() const; + void joinChannel(IrcChannel *channel); + void joinChannel(const QString &channelname); + void partChannel(IrcChannel *channel); + void partChannel(const QString &channelname); + + void addUserMode(const QString &mode); + void removeUserMode(const QString &mode); + + // init seters + void initSetChannels(const QStringList channels); + + void setInitialized(); + +signals: + void userSet(QString user); + void hostSet(QString host); + void nickSet(QString newnick); + void hostmaskUpdated(QString mask); - void setChannelmode(const QString &channel, const QSet &channelmode); - QSet channelmode(const QString &channel) const; + void userModesSet(QString modes); - void updateChannelmode(const QString &channel, const QString &channelmode, bool add=true); - void addChannelmode(const QString &channel, const QString &channelmode); - void removeChannelmode(const QString &channel, const QString &channelmode); + void channelJoined(QString channel); + void channelParted(QString channel); - QStringList channels() const; + void userModeAdded(QString mode); + void userModeRemoved(QString mode); + + void renameObject(QString oldname, QString newname); - void joinChannel(const QString &channel); - void partChannel(const QString &channel); +// void setUsermodes(const QSet &usermodes); +// QSet usermodes() const; + + void initDone(); + +private slots: + void updateObjectName(); + void channelDestroyed(); private: inline bool operator==(const IrcUser &ircuser2) { - return (nick_.toLower() == ircuser2.nick().toLower()); + return (_nick.toLower() == ircuser2.nick().toLower()); } inline bool operator==(const QString &nickname) { - return (nick_.toLower() == nickname.toLower()); + return (_nick.toLower() == nickname.toLower()); } - - QString nick_; - QString user_; - QString host_; - - QHash > channelmodes_; //keys: channelnames; values: Set of Channelmodes - QSet usermodes_; -}; -struct IrcUserException : public Exception {}; -struct NoSuchChannelException : public IrcUserException {}; -struct NoSuchNickException : public IrcUserException {}; + bool _initialized; + + QString _nick; + QString _user; + QString _host; + // QSet _channels; + QSet _channels; + QString _userModes; + + NetworkInfo *networkInfo; +}; #endif