diff options
| author | 2008-09-02 01:07:40 +0000 | |
|---|---|---|
| committer | 2008-09-02 01:07:40 +0000 | |
| commit | 1a3f7dfdb3ff54ba55a579ab15d59f3c2affe418 (patch) | |
| tree | bfb3b151d63f0f20b24431c44f724130f61fcaf2 /src | |
| parent | fixed typo, thx to Ku.ja^ (diff) | |
| download | KVIrc-1a3f7dfdb3ff54ba55a579ab15d59f3c2affe418.tar.gz KVIrc-1a3f7dfdb3ff54ba55a579ab15d59f3c2affe418.tar.bz2 KVIrc-1a3f7dfdb3ff54ba55a579ab15d59f3c2affe418.zip | |
added doxygen comments
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@2383 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src')
| -rw-r--r-- | src/kvilib/irc/kvi_ircserverdb.cpp | 2 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_ircserverdb.h | 146 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_network.cpp | 30 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_network.h | 277 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_useridentity.cpp | 9 | ||||
| -rw-r--r-- | src/kvilib/irc/kvi_useridentity.h | 375 |
6 files changed, 753 insertions, 86 deletions
diff --git a/src/kvilib/irc/kvi_ircserverdb.cpp b/src/kvilib/irc/kvi_ircserverdb.cpp index fddedd9f3..d576acc6f 100644 --- a/src/kvilib/irc/kvi_ircserverdb.cpp +++ b/src/kvilib/irc/kvi_ircserverdb.cpp @@ -383,7 +383,7 @@ void KviServerDataBase::importFromMircIni(const QString & filename, const QStrin kvi_u32_t uPort = 0; parseMircServerRecord(entry,szNet, - szDescription,szHost,szPort,bSsl,uPort); + szDescription,szHost,szPort,bSsl,uPort); recentServers << (bSsl ? "ircs://" : "irc://" ) +szHost+":"+szPort; } diff --git a/src/kvilib/irc/kvi_ircserverdb.h b/src/kvilib/irc/kvi_ircserverdb.h index d9c5bf038..861880939 100644 --- a/src/kvilib/irc/kvi_ircserverdb.h +++ b/src/kvilib/irc/kvi_ircserverdb.h @@ -24,12 +24,23 @@ // //============================================================================= +/** +* \file kvi_ircserverdb.h +* \author Szymon Stefanek +* \brief Irc server database handling +*/ + #include "kvi_settings.h" #include "kvi_qstring.h" #include "kvi_ircserver.h" #include "kvi_network.h" #include "kvi_pointerhashtable.h" +/** +* \typedef KviServerDefinition +* \struct _KviServerDefinition +* \brief Server definition +*/ typedef struct _KviServerDefinition { QString szServer; @@ -45,48 +56,149 @@ typedef struct _KviServerDefinition QString szId; } KviServerDefinition; - +/** +* \class KviServerDataBase +* \brief Irc server database handling class +*/ class KVILIB_API KviServerDataBase { public: + /** + * \brief Constructs the server database object + * \return KviServerDataBase + */ KviServerDataBase(); + + /** + * \brief Destroys the server database object + */ ~KviServerDataBase(); private: KviPointerHashTable<QString,KviNetwork> * m_pRecords; - QString m_szCurrentNetwork; - // This list is computed when the data are loaded from disk - // during the startup and is used by KviApp to - // start the connections. - // The pointer is zero if there are no autoConnect servers - // The list is valid only during the startup phase - // because it contains shallow pointers to the servers - // really contained in the server/network list - // and it is never updated later - KviPointerList<KviServer> * m_pAutoConnectOnStartupServers; - KviPointerList<KviNetwork> * m_pAutoConnectOnStartupNetworks; + QString m_szCurrentNetwork; + KviPointerList<KviServer> * m_pAutoConnectOnStartupServers; + KviPointerList<KviNetwork> * m_pAutoConnectOnStartupNetworks; public: + /** + * \brief Deletes the database + * \return void + */ void clear(); + + /** + * \brief Returns the record dictionary of the database + * \return KviPointerHashTable<QString,KviNetwork> * + */ inline KviPointerHashTable<QString,KviNetwork> * recordDict(){ return m_pRecords; }; + /** + * \brief Returns a list of servers to connect on startup + * This list is computed when the data are loaded from disk during the startup + * and is used by KviApp to start the connections. + * The pointer is zero if there are no autoConnect servers. The list is valid + * only during the startup phase because it contains shallow pointers to the + * servers really contained in the server/network list and it is never updated + * later. + * \return KviPointerList<KviServer> * + */ inline KviPointerList<KviServer> * autoConnectOnStartupServers(){ return m_pAutoConnectOnStartupServers; }; + + /** + * \brief Returns a list of networks to connect on startup + * This list is computed when the data are loaded from disk during the startup + * and is used by KviApp to start the connections. + * The pointer is zero if there are no autoConnect networks. The list is valid + * only during the startup phase because it contains shallow pointers to the + * networks really contained in the server/network list and it is never + * updated later. + * \return KviPointerList<KviNetwork> * + */ inline KviPointerList<KviNetwork> * autoConnectOnStartupNetworks(){ return m_pAutoConnectOnStartupNetworks; }; + /** + * \brief Deletes the list of autoconnect servers + * \return void + */ void clearAutoConnectOnStartupServers(); + + /** + * \brief Deletes the list of autoconnect networks + * \return void + */ void clearAutoConnectOnStartupNetworks(); - inline void setCurrentNetwork(const QString &szNetName){ m_szCurrentNetwork = szNetName; }; + /** + * \brief Sets the current network + * \param szNetName The name of the network + * \return void + */ + inline void setCurrentNetwork(const QString & szNetName){ m_szCurrentNetwork = szNetName; }; + + /** + * \brief Returns the current network name + * \return const QString & + */ inline const QString & currentNetworkName(){ return m_szCurrentNetwork; }; + + /** + * \brief Returns the current network + * \return KviNetwork + */ KviNetwork * currentNetwork(); + /** + * \brief Adds a network to the database + * \param n The source network + * \return void + */ void addNetwork(KviNetwork * n); - KviNetwork * findNetwork(const QString &name); + /** + * \brief Searches fot a network + * \param name The name of the network to find + * \return KviNetwork + */ + KviNetwork * findNetwork(const QString & name); + + /** + * \brief Loads the database data + * \param filename The filename of the database data to load + * \return void + */ void load(const QString & filename); + + /** + * \brief Saves the database data + * \param filename The filename of the database data to save + * \return void + */ void save(const QString & filename); - void importFromMircIni(const QString & filename, const QString & szMircIni, QStringList& recentServers); - bool makeCurrentServer(KviServerDefinition * d,QString &szError); - bool makeCurrentBestServerInNetwork(const QString &szNetName,KviNetwork * d,QString &szError); + /** + * \brief Import servers and networks from a mirc ini file + * \param filename The database file where to add new servers + * \param szMircIni The source mirc ini file to import + * \param recentServers The list of recent servers where to add new servers + * \return void + */ + void importFromMircIni(const QString & filename, const QString & szMircIni, QStringList & recentServers); + + /** + * \brief Marks a server as current + * \param d The server definition + * \param szError The container for a possible error + * \return bool + */ + bool makeCurrentServer(KviServerDefinition * d, QString & szError); + + /** + * \brief Marks the current servers as the best in the network + * \param szNetName The name of the network + * \param d The source network + * \param szError The container for a possible error + * \return bool + */ + bool makeCurrentBestServerInNetwork(const QString & szNetName, KviNetwork * d, QString & szError); }; #endif //_KVI_IRCSERVERDB_H_ diff --git a/src/kvilib/irc/kvi_network.cpp b/src/kvilib/irc/kvi_network.cpp index df6ce7e62..56bc99cbd 100644 --- a/src/kvilib/irc/kvi_network.cpp +++ b/src/kvilib/irc/kvi_network.cpp @@ -1,13 +1,31 @@ -/* - * kvi_network.cpp - * - * Created on: 27.08.2008 - * Author: Alexey - */ +//============================================================================= +// +// File : kvi_network.cpp +// Creation date : Wed Aug 27 2008 17:44:56 by Alexey Uzhva +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2008 Szymon Stefanek (pragma at kvirc dot net) +// +// 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 opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= #include "kvi_network.h" #include "kvi_ircserver.h" #include "kvi_nickserv.h" + #include <QStringList> KviNetwork::KviNetwork(const KviNetwork &src) diff --git a/src/kvilib/irc/kvi_network.h b/src/kvilib/irc/kvi_network.h index c8e4956a3..620d7eabc 100644 --- a/src/kvilib/irc/kvi_network.h +++ b/src/kvilib/irc/kvi_network.h @@ -1,34 +1,76 @@ -/* - * kvi_network.h - * - * Created on: 27.08.2008 - * Author: Alexey - */ - #ifndef KVI_NETWORK_H_ #define KVI_NETWORK_H_ +//============================================================================= +// +// File : kvi_network.cpp +// Creation date : Wed Aug 27 2008 17:44:56 by Alexey Uzhva +// +// This file is part of the KVirc irc client distribution +// Copyright (C) 2008 Szymon Stefanek (pragma at kvirc dot net) +// +// 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 opinion) any later version. +// +// This program is distributed in the HOPE that it will be USEFUL, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +// See the GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, write to the Free Software Foundation, +// Inc. ,59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +//============================================================================= + +/** +* \file kvi_network.cpp +* \author Alexey Uzhva +* \brief Network handling +*/ #include "kvi_settings.h" #include "kvi_heapobject.h" #include "kvi_pointerlist.h" + #include <QString> class KviNickServRuleSet; class KviServer; class QStringList; +/** +* \class KviNetwork +* \brief Network handling class +*/ class KVILIB_API KviNetwork : public KviHeapObject { friend class KviServerDataBase; public: - KviNetwork(const KviNetwork &src); - KviNetwork(const QString &name); + /** + * \brief Construct the network object + * \param name The name of the network + * \return KviNetwork + */ + KviNetwork(const QString & name); + + /** + * \brief Carbon copy + * \param src The source network + * \return KviNetwork + */ + KviNetwork(const KviNetwork & src); + + /** + * \brief Destroys the network object + */ ~KviNetwork(); protected: QString m_szName; QString m_szDescription; QString m_szEncoding; // if empty, use system default - QString m_szTextEncoding; // if empty, use system default + QString m_szTextEncoding; // if empty, use system default QString m_szNickName; // preferred nick name QString m_szUserName; // preferred user name QString m_szRealName; // preferred real name @@ -41,48 +83,229 @@ protected: // Then use the global primary identity //moved from KviServerDataBaseRecord KviPointerList<KviServer> * m_pServerList; - KviServer * m_pCurrentServer; + KviServer * m_pCurrentServer; public: + /** + * \brief Returns the name of the network + * \return const QString & + */ inline const QString & name() const { return m_szName; }; + + /** + * \brief Returns the encoding of the network + * \return const QString & + * Some informations as nickname and channel names are encoded when + * communicating with the server + */ inline const QString & encoding() const { return m_szEncoding; }; + + /** + * \brief Returns the text encoding of the network + * \return const QString & + * This is the default encoding when talking on channels or queries + */ inline const QString & textEncoding() const { return m_szTextEncoding; }; + + /** + * \brief Returns the description of the network + * \return const QString & + */ inline const QString & description() const { return m_szDescription; }; + + /** + * \brief Returns the nickname of the user associated to the network + * \return const QString & + */ inline const QString & nickName() const { return m_szNickName; }; + + /** + * \brief Returns the realname of the user associated to the network + * \return const QString & + */ inline const QString & realName() const { return m_szRealName; }; + + /** + * \brief Returns the username of the user associated to the network + * \return const QString & + */ inline const QString & userName() const { return m_szUserName; }; + + /** + * \brief Returns the commands to run on network login + * \return const QString & + */ inline const QString & onLoginCommand() const { return m_szOnLoginCommand; }; + + /** + * \brief Returns the commands to run on network connect + * \return const QString & + */ inline const QString & onConnectCommand() const { return m_szOnConnectCommand; }; + + /** + * \brief Returns the user identity of the user associated to the network + * \return const QString & + */ inline const QString & userIdentityId() const { return m_szUserIdentityId; }; + + /** + * \brief Returns true if the network has the autoconnect state on + * \return bool + */ inline bool autoConnect() const { return m_bAutoConnect; }; - inline QStringList* autoJoinChannelList(){ return m_pChannelList; }; + + /** + * \brief Returns a list of channels with autojoin flag + * \return QStringList * + */ + inline QStringList * autoJoinChannelList(){ return m_pChannelList; }; + + /** + * \brief Returns a set of rules for the NickServ + * \return KviNickServRuleSet * + */ inline KviNickServRuleSet * nickServRuleSet(){ return m_pNickServRuleSet; }; + /** + * \brief Sets the rules for NickServ + * \param s The rule set where to add rules + * \return void + */ void setNickServRuleSet(KviNickServRuleSet * s); - void copyFrom(const KviNetwork &d); - inline void setName(const QString &szName){ m_szName = szName; }; - inline void setEncoding(const QString &szEncoding){ m_szEncoding = szEncoding; }; - inline void setTextEncoding(const QString &szEncoding){ m_szTextEncoding = szEncoding; }; - inline void setDescription(const QString &szDescription){ m_szDescription = szDescription; }; - inline void setOnConnectCommand(const QString &cmd){ m_szOnConnectCommand = cmd; }; - inline void setOnLoginCommand(const QString &cmd){ m_szOnLoginCommand = cmd; }; - inline void setNickName(const QString &n){ m_szNickName = n; }; - inline void setRealName(const QString &r){ m_szRealName = r; }; - inline void setUserName(const QString &u){ m_szUserName = u; }; + /** + * \brief Carbon copy + * \param d The source network to copy from + * \return void + */ + void copyFrom(const KviNetwork & d); + + /** + * \brief Sets the name of the network + * \param szName The name of the network + * \return void + */ + inline void setName(const QString & szName){ m_szName = szName; }; + + /** + * \brief Sets the encondig of the network + * Some informations as nickname and channel names are encoded when + * communicating with the server + * \param szEncoding The encoding of the network + * \return void + */ + inline void setEncoding(const QString & szEncoding){ m_szEncoding = szEncoding; }; + + /** + * \brief Sets the text encondig of the network + * This is the default encoding when talking on channels or queries + * \param szEncoding The text encoding of the network + * \return void + */ + inline void setTextEncoding(const QString & szEncoding){ m_szTextEncoding = szEncoding; }; + + /** + * \brief Sets the description of the network + * \param szDescription The description of the network + * \return void + */ + inline void setDescription(const QString & szDescription){ m_szDescription = szDescription; }; + + /** + * \brief Sets the list of commands to run on network connection + * \param cmd The commands list to run + * \return void + */ + inline void setOnConnectCommand(const QString & cmd){ m_szOnConnectCommand = cmd; }; + + /** + * \brief Sets the list of commands to run on network login + * \param cmd The commands list to run + * \return void + */ + inline void setOnLoginCommand(const QString & cmd){ m_szOnLoginCommand = cmd; }; + + /** + * \brief Sets the nickname of the user associated to the network + * \param n The nickname + * \return void + */ + inline void setNickName(const QString & n){ m_szNickName = n; }; + + /** + * \brief Sets the realname of the user associated to the network + * \param r The realname + * \return void + */ + inline void setRealName(const QString & r){ m_szRealName = r; }; + + /** + * \brief Sets the username of the user associated to the network + * \param u The username + * \return void + */ + inline void setUserName(const QString & u){ m_szUserName = u; }; + /** + * \brief Sets the list of channels to mark for autojoin + * \param pNewChannelList The channel list + * \return void + */ void setAutoJoinChannelList(QStringList * pNewChannelList); + /** + * \brief Sets the autoconnect flag + * \param bAutoConnect The state of the autoconnect flag + * \return void + */ inline void setAutoConnect(bool bAutoConnect){ m_bAutoConnect = bAutoConnect; }; - inline void setUserIdentityId(const QString &szUserIdentityId){ m_szUserIdentityId = szUserIdentityId; }; + /** + * \brief Sets the user identity id of the user associated to the network + * \param szUserIdentityId The user identity + * \return void + */ + inline void setUserIdentityId(const QString & szUserIdentityId){ m_szUserIdentityId = szUserIdentityId; }; + + /** + * \brief Returns a list of servers associated to the network + * \return KviPointerList<KviServer> * + */ inline KviPointerList<KviServer> * serverList(){ return m_pServerList; }; + + /** + * \brief Returns the current server + * \return KviServer + */ KviServer * currentServer(); - void insertServer(KviServer *srv); - KviServer * findServer(const QString& szHostname); + /** + * \brief Adds a new server to the network + * \param srv The source server to add + * \return void + */ + void insertServer(KviServer * srv); + + /** + * \brief Searches for a server in the network + * \param szHostname The hostname of the server to find + * \return KviServer + */ + KviServer * findServer(const QString & szHostname); + + /** + * \brief Searches for a server in the network + * \param pServer The server to find + * \return KviServer + */ KviServer * findServer(const KviServer * pServer); - void setCurrentServer(KviServer *srv); + /** + * \brief Sets the current server + * \param srv The source server + * \return void + */ + void setCurrentServer(KviServer * srv); }; -#endif /* KVI_NETWORK_H_ */ +#endif // KVI_NETWORK_H_ diff --git a/src/kvilib/irc/kvi_useridentity.cpp b/src/kvilib/irc/kvi_useridentity.cpp index c9a0d6861..5feb72fe3 100644 --- a/src/kvilib/irc/kvi_useridentity.cpp +++ b/src/kvilib/irc/kvi_useridentity.cpp @@ -29,6 +29,15 @@ // FIXME: Put here also the default away message, default away nick, default ctcp replies etc ? +KviUserIdentity::KviUserIdentity() +: KviHeapObject() +{ +} + +KviUserIdentity::~KviUserIdentity() +{ +} + bool KviUserIdentity::load(KviConfig &cfg) { m_szId = cfg.group(); diff --git a/src/kvilib/irc/kvi_useridentity.h b/src/kvilib/irc/kvi_useridentity.h index 5a3f546de..d1f589514 100644 --- a/src/kvilib/irc/kvi_useridentity.h +++ b/src/kvilib/irc/kvi_useridentity.h @@ -6,7 +6,7 @@ // Created on Sun 21 Jan 2007 04:31:47 by Szymon Stefanek // // This file is part of the KVIrc IRC Client distribution -// Copyright (C) 2007 Szymon Stefanek <pragma at kvirc dot net> +// Copyright (C) 2008 Szymon Stefanek <pragma at kvirc dot net> // // This program is FREE software. You can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -24,23 +24,35 @@ // //============================================================================= +/** +* \file kvi_useridentity.h +* \author Szymon Stefanek +* \brief User identity handling +*/ #include "kvi_settings.h" #include "kvi_heapobject.h" #include "kvi_pixmap.h" #include "kvi_config.h" #include "kvi_pointerhashtable.h" +/** +* \class KviUserIdentity +* \brief User identity handling class +*/ class KVILIB_API KviUserIdentity : public KviHeapObject { friend class KviUserIdentityManager; public: - KviUserIdentity() - : KviHeapObject() - { - } - ~KviUserIdentity() - { - } + /** + * \brief Constructs the user identity object + * \return KviUserIdentity + */ + KviUserIdentity(); + + /** + * \brief Destroys the user identity object + */ + ~KviUserIdentity(); protected: QString m_szId; // the identity set name @@ -70,76 +82,369 @@ protected: QString m_szOnConnectCommand; QString m_szOnLoginCommand; public: + /** + * \brief Returns the id of the user + * \return const QString & + */ const QString & id() const { return m_szId; }; + + /** + * \brief Returns the nickname of the user + * \return const QString & + */ const QString & nickName() const { return m_szNickName; }; + + /** + * \brief Returns the alternative nickname of the user + * \return const QString & + */ const QString & altNickName1() const { return m_szAltNickName1; }; + + /** + * \brief Returns the second alternative nickname of the user + * \return const QString & + */ const QString & altNickName2() const { return m_szAltNickName2; }; + + /** + * \brief Returns the third alternative nickanem of the user + * \return const QString & + */ const QString & altNickName3() const { return m_szAltNickName3; }; + + /** + * \brief Returns the username of the user + * \return const QString & + */ const QString & userName() const { return m_szUserName; }; + + /** + * \brief Returns the password of the user + * \return const QString & + */ const QString & password() const { return m_szPassword; }; + + /** + * \brief Returns the avatar of the user + * \return KviPixmap + */ const KviPixmap & avatar() const { return m_pixAvatar; }; + + /** + * \brief Returns the part message of the user + * \return const QString & + */ const QString & partMessage() const { return m_szPartMessage; }; + + /** + * \brief Returns the quit message of the user + * \return const QString & + */ const QString & quitMessage() const { return m_szQuitMessage; }; + + /** + * \brief Returns the age of the user + * \return const QString & + */ const QString & age() const { return m_szAge; }; + + /** + * \brief Returns the gender of the user + * \return const QString & + */ const QString & gender() const { return m_szGender; }; + + /** + * \brief Returns the location of the user + * \return const QString & + */ const QString & location() const { return m_szLocation; }; + + /** + * \brief Returns the languages of the user + * \return const QString & + */ const QString & languages() const { return m_szLanguages; }; + + /** + * \brief Returns the other info field of the user + * \return const QString & + */ const QString & otherInfo() const { return m_szOtherInfo; }; + + /** + * \brief Returns the user mode of the user + * \return const QString & + */ const QString & userMode() const { return m_szUserMode; }; + + /** + * \brief Returns the list of commands to run on connection + * \return const QString & + */ const QString & onConnectCommand() const { return m_szOnConnectCommand; }; + + /** + * \brief Returns the list of commands to run on login + * \return const QString & + */ const QString & onLoginCommand() const { return m_szOnLoginCommand; }; - void setId(const QString &szId){ m_szId = szId; }; - void setNickName(const QString &szNickName){ m_szNickName = szNickName; }; - void setAltNickName1(const QString &szNickName){ m_szAltNickName1 = szNickName; }; - void setAltNickName2(const QString &szNickName){ m_szAltNickName2 = szNickName; }; - void setAltNickName3(const QString &szNickName){ m_szAltNickName3 = szNickName; }; - void setUserName(const QString &szUserName){ m_szUserName = szUserName; }; - void setRealName(const QString &szRealName){ m_szRealName = szRealName; }; - void setPassword(const QString &szPassword){ m_szPassword = szPassword; }; - void setAvatar(const KviPixmap &pix){ m_pixAvatar = pix; }; - void setPartMessage(const QString &szMsg){ m_szPartMessage = szMsg; }; - void setQuitMessage(const QString &szMsg){ m_szQuitMessage = szMsg; }; - void setAge(const QString &szAge){ m_szAge = szAge; }; - void setGender(const QString &szGender){ m_szGender = szGender; }; - void setLocation(const QString &szLocation){ m_szLocation = szLocation; }; - void setLanguages(const QString &szLanguages){ m_szLanguages = szLanguages; }; - void setOtherInfo(const QString &szOtherInfo){ m_szOtherInfo = szOtherInfo; }; - void setUserMode(const QString &szUserMode){ m_szUserMode = szUserMode; }; - void setOnConnectCommand(const QString &szOnConnectCommand){ m_szOnConnectCommand = szOnConnectCommand; }; - void setOnLoginCommand(const QString &szOnLoginCommand){ m_szOnLoginCommand = szOnLoginCommand; }; + + /** + * \brief Sets the id of the user + * \param szId The id of the user + * \return void + */ + void setId(const QString & szId){ m_szId = szId; }; + + /** + * \brief Sets the nickname of the user + * \param szNickName The nickname of the user + * \return void + */ + void setNickName(const QString & szNickName){ m_szNickName = szNickName; }; + + /** + * \brief Sets the alternative nickname of the user + * \param szNickName The nickname of the user + * \return void + */ + void setAltNickName1(const QString & szNickName){ m_szAltNickName1 = szNickName; }; + + /** + * \brief Sets the second alternative nickname of the user + * \param szNickName The nickname of the user + * \return void + */ + void setAltNickName2(const QString & szNickName){ m_szAltNickName2 = szNickName; }; + + /** + * \brief Sets the third alternative nickname of the user + * \param szNickName The nickname of the user + * \return void + */ + void setAltNickName3(const QString & szNickName){ m_szAltNickName3 = szNickName; }; + + /** + * \brief Sets the username of the user + * \param szUserName The username of the user + * \return void + */ + void setUserName(const QString & szUserName){ m_szUserName = szUserName; }; + + /** + * \brief Sets the realname of the user + * \param szRealName The realname of the user + * \return void + */ + void setRealName(const QString & szRealName){ m_szRealName = szRealName; }; + + /** + * \brief Sets the password of the user + * \param szPassword The password of the user + * \return void + */ + void setPassword(const QString & szPassword){ m_szPassword = szPassword; }; + + /** + * \brief Sets the avatar of the user + * \param piz The avatar of the user + * \return void + */ + void setAvatar(const KviPixmap & pix){ m_pixAvatar = pix; }; + + /** + * \brief Sets the part messaege of the user + * \param szMsg The part message of the user + * \return void + */ + void setPartMessage(const QString & szMsg){ m_szPartMessage = szMsg; }; + + /** + * \brief Sets the quit messaege of the user + * \param szMsg The quit message of the user + * \return void + */ + void setQuitMessage(const QString & szMsg){ m_szQuitMessage = szMsg; }; + + /** + * \brief Sets the age of the user + * \param szAge The age of the user + * \return void + */ + void setAge(const QString & szAge){ m_szAge = szAge; }; + + /** + * \brief Sets the gender of the user + * \param szGender The gemder of the user + * \return void + */ + void setGender(const QString & szGender){ m_szGender = szGender; }; + + /** + * \brief Sets the location of the user + * \param szLocation The location of the user + * \return void + */ + void setLocation(const QString & szLocation){ m_szLocation = szLocation; }; + + /** + * \brief Sets the languages of the user + * \param szLanguages The languages of the user + * \return void + */ + void setLanguages(const QString & szLanguages){ m_szLanguages = szLanguages; }; + + /** + * \brief Sets the other info for the user + * \param szOtherInfo The other info of the user + * \return void + */ + void setOtherInfo(const QString & szOtherInfo){ m_szOtherInfo = szOtherInfo; }; + + /** + * \brief Sets the user mode of the user + * \param szUserMode The user mode of the user + * \return void + */ + void setUserMode(const QString & szUserMode){ m_szUserMode = szUserMode; }; + + /** + * \brief Sets the commands list to run on connection + * \param szOnConnectCommand The commands to run + * \return void + */ + void setOnConnectCommand(const QString & szOnConnectCommand){ m_szOnConnectCommand = szOnConnectCommand; }; + + /** + * \brief Sets the commands list to run on login + * \param szOnLoginCommand The commands to run + * \return void + */ + void setOnLoginCommand(const QString & szOnLoginCommand){ m_szOnLoginCommand = szOnLoginCommand; }; protected: - void copyFrom(const KviUserIdentity &src); - bool save(KviConfig &cfg); - bool load(KviConfig &cfg); + /** + * \brief Carbon copy + * \param src The source user identity + * \return void + */ + void copyFrom(const KviUserIdentity & src); + + /** + * \brief Saves the user identity + * \param cfg The config file where to save + * \return bool + */ + bool save(KviConfig & cfg); + + /** + * \brief Loads the user identity + * \param cfg The config file where to load + * \return bool + */ + bool load(KviConfig & cfg); }; +/** +* \class KviUserIdentityManager +* \brief The class to manage the user identity +*/ class KVILIB_API KviUserIdentityManager : public KviHeapObject { protected: + /** + * \brief Constructs the user identity manager object + * \return KviUserIdentityManager + */ KviUserIdentityManager(); + + /** + * \brief Destroys the user identity manager object + */ ~KviUserIdentityManager(); protected: static KviUserIdentityManager * m_pInstance; KviPointerHashTable<QString,KviUserIdentity> * m_pIdentityDict; QString m_szDefaultIdentity; public: + /** + * \brief Initializes a new user identity + * \return void + */ static void init(); + + /** + * \brief Deletese the user identity + * \return void + */ static void done(); + + /** + * \brief Returns the instance of the identity + * \returns KviUserIdentityManager * + */ static KviUserIdentityManager * instance(){ return m_pInstance; }; + /** + * \brief Returns the identity dictionary + * \returns KviPointerHashTable<QString,KviUserIdentity> * + */ KviPointerHashTable<QString,KviUserIdentity> * identityDict(){ return m_pIdentityDict; }; - const KviUserIdentity * findIdentity(const QString &szId){ return m_pIdentityDict->find(szId); }; - // NEVER NULL + + /** + * \brief Searches fot an identity + * \param szId The identity id to find + * \return const KviUserIdentity * + */ + const KviUserIdentity * findIdentity(const QString & szId){ return m_pIdentityDict->find(szId); }; + + /** + * \brief Returns the default identity + * It's NEVER null. + * \return const KviUserIdentity * + */ const KviUserIdentity * defaultIdentity(); - void setDefaultIdentity(const QString &szIdentityId){ m_szDefaultIdentity = szIdentityId; }; + /** + * \brief Sets the default identity + * \param szIdentityId The identity id to set + * \return void + */ + void setDefaultIdentity(const QString & szIdentityId){ m_szDefaultIdentity = szIdentityId; }; + /** + * \brief Creates a new working copy + * \return KviUserIdentityManager * + */ KviUserIdentityManager * createWorkingCopy(); + + /** + * \brief Carbon copy + * \param pWorkingCopy The source working copy + * \return void + */ void copyFrom(KviUserIdentityManager * pWorkingCopy); + + /** + * \brief Deletes the working copy + * \param pWorkingCopy The source working copy + * \return void + */ void releaseWorkingCopy(KviUserIdentityManager * pWorkingCopy); - void save(const QString &szFileName); - void load(const QString &szFileName); + /** + * \brief Saves the user identity database + * \param szFileName The filename where to save + * \return void + */ + void save(const QString & szFileName); + + /** + * \brief Loads the user identity database + * \param szFileName The filename where to load + * \return void + */ + void load(const QString & szFileName); }; #endif //!_KVI_USERIDENTITY_H_ |
