1 #ifndef _KVI_USERIDENTITY_H_ 2 #define _KVI_USERIDENTITY_H_ 3 //============================================================================= 4 // 5 // File : KviUserIdentity.h 6 // Creation date : Sun 21 Jan 2007 04:31:47 by Szymon Stefanek 7 // 8 // This file is part of the KVIrc IRC Client distribution 9 // Copyright (C) 2007-2010 Szymon Stefanek <pragma at kvirc dot net> 10 // 11 // This program is FREE software. You can redistribute it and/or 12 // modify it under the terms of the GNU General Public License 13 // as published by the Free Software Foundation; either version 2 14 // of the License, or (at your option) any later version. 15 // 16 // This program is distributed in the HOPE that it will be USEFUL, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 19 // See the GNU General Public License for more details. 20 // 21 // You should have received a copy of the GNU General Public License 22 // along with this program. If not, write to the Free Software Foundation, 23 // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 // 25 //============================================================================= 26 27 /** 28 * \file KviUserIdentity.h 29 * \author Szymon Stefanek 30 * \brief User identity handling 31 */ 32 #include "kvi_settings.h" 33 #include "KviHeapObject.h" 34 #include "KviPixmap.h" 35 36 #include <QString> 37 38 class KviConfigurationFile; 39 40 /** 41 * \class KviUserIdentity 42 * \brief User identity handling class 43 */ 44 class KVILIB_API KviUserIdentity : public KviHeapObject 45 { 46 friend class KviUserIdentityManager; 47 48 public: 49 /** 50 * \brief Constructs the user identity object 51 * \return KviUserIdentity 52 */ 53 KviUserIdentity(); 54 55 /** 56 * \brief Destroys the user identity object 57 */ 58 ~KviUserIdentity(); 59 60 protected: 61 QString m_szId; // the identity set name 62 63 QString m_szNickName; 64 65 QString m_szAltNickName1; 66 QString m_szAltNickName2; 67 QString m_szAltNickName3; 68 69 QString m_szUserName; 70 QString m_szRealName; 71 QString m_szPassword; 72 73 KviPixmap m_pixAvatar; 74 75 QString m_szPartMessage; 76 QString m_szQuitMessage; 77 78 QString m_szAge; 79 QString m_szGender; 80 QString m_szLocation; 81 QString m_szLanguages; 82 QString m_szOtherInfo; 83 84 QString m_szUserMode; 85 86 QString m_szOnConnectCommand; 87 QString m_szOnLoginCommand; 88 89 public: 90 /** 91 * \brief Returns the id of the user 92 * \return const QString & 93 */ id()94 const QString & id() const { return m_szId; }; 95 96 /** 97 * \brief Returns the nickname of the user 98 * \return const QString & 99 */ nickName()100 const QString & nickName() const { return m_szNickName; }; 101 102 /** 103 * \brief Returns the alternative nickname of the user 104 * \return const QString & 105 */ altNickName1()106 const QString & altNickName1() const { return m_szAltNickName1; }; 107 108 /** 109 * \brief Returns the second alternative nickname of the user 110 * \return const QString & 111 */ altNickName2()112 const QString & altNickName2() const { return m_szAltNickName2; }; 113 114 /** 115 * \brief Returns the third alternative nickanem of the user 116 * \return const QString & 117 */ altNickName3()118 const QString & altNickName3() const { return m_szAltNickName3; }; 119 120 /** 121 * \brief Returns the username of the user 122 * \return const QString & 123 */ userName()124 const QString & userName() const { return m_szUserName; }; 125 126 /** 127 * \brief Returns the password of the user 128 * \return const QString & 129 */ password()130 const QString & password() const { return m_szPassword; }; 131 132 /** 133 * \brief Returns the avatar of the user 134 * \return KviPixmap 135 */ avatar()136 const KviPixmap & avatar() const { return m_pixAvatar; }; 137 138 /** 139 * \brief Returns the part message of the user 140 * \return const QString & 141 */ partMessage()142 const QString & partMessage() const { return m_szPartMessage; }; 143 144 /** 145 * \brief Returns the quit message of the user 146 * \return const QString & 147 */ quitMessage()148 const QString & quitMessage() const { return m_szQuitMessage; }; 149 150 /** 151 * \brief Returns the age of the user 152 * \return const QString & 153 */ age()154 const QString & age() const { return m_szAge; }; 155 156 /** 157 * \brief Returns the gender of the user 158 * \return const QString & 159 */ gender()160 const QString & gender() const { return m_szGender; }; 161 162 /** 163 * \brief Returns the location of the user 164 * \return const QString & 165 */ location()166 const QString & location() const { return m_szLocation; }; 167 168 /** 169 * \brief Returns the languages of the user 170 * \return const QString & 171 */ languages()172 const QString & languages() const { return m_szLanguages; }; 173 174 /** 175 * \brief Returns the other info field of the user 176 * \return const QString & 177 */ otherInfo()178 const QString & otherInfo() const { return m_szOtherInfo; }; 179 180 /** 181 * \brief Returns the user mode of the user 182 * \return const QString & 183 */ userMode()184 const QString & userMode() const { return m_szUserMode; }; 185 186 /** 187 * \brief Returns the list of commands to run on connection 188 * \return const QString & 189 */ onConnectCommand()190 const QString & onConnectCommand() const { return m_szOnConnectCommand; }; 191 192 /** 193 * \brief Returns the list of commands to run on login 194 * \return const QString & 195 */ onLoginCommand()196 const QString & onLoginCommand() const { return m_szOnLoginCommand; }; 197 198 /** 199 * \brief Sets the id of the user 200 * \param szId The id of the user 201 * \return void 202 */ setId(const QString & szId)203 void setId(const QString & szId) { m_szId = szId; }; 204 205 /** 206 * \brief Sets the nickname of the user 207 * \param szNickName The nickname of the user 208 * \return void 209 */ setNickName(const QString & szNickName)210 void setNickName(const QString & szNickName) { m_szNickName = szNickName; }; 211 212 /** 213 * \brief Sets the alternative nickname of the user 214 * \param szNickName The nickname of the user 215 * \return void 216 */ setAltNickName1(const QString & szNickName)217 void setAltNickName1(const QString & szNickName) { m_szAltNickName1 = szNickName; }; 218 219 /** 220 * \brief Sets the second alternative nickname of the user 221 * \param szNickName The nickname of the user 222 * \return void 223 */ setAltNickName2(const QString & szNickName)224 void setAltNickName2(const QString & szNickName) { m_szAltNickName2 = szNickName; }; 225 226 /** 227 * \brief Sets the third alternative nickname of the user 228 * \param szNickName The nickname of the user 229 * \return void 230 */ setAltNickName3(const QString & szNickName)231 void setAltNickName3(const QString & szNickName) { m_szAltNickName3 = szNickName; }; 232 233 /** 234 * \brief Sets the username of the user 235 * \param szUserName The username of the user 236 * \return void 237 */ setUserName(const QString & szUserName)238 void setUserName(const QString & szUserName) { m_szUserName = szUserName; }; 239 240 /** 241 * \brief Sets the realname of the user 242 * \param szRealName The realname of the user 243 * \return void 244 */ setRealName(const QString & szRealName)245 void setRealName(const QString & szRealName) { m_szRealName = szRealName; }; 246 247 /** 248 * \brief Sets the password of the user 249 * \param szPassword The password of the user 250 * \return void 251 */ setPassword(const QString & szPassword)252 void setPassword(const QString & szPassword) { m_szPassword = szPassword; }; 253 254 /** 255 * \brief Sets the avatar of the user 256 * \param pix The avatar of the user 257 * \return void 258 */ setAvatar(const KviPixmap & pix)259 void setAvatar(const KviPixmap & pix) { m_pixAvatar = pix; }; 260 261 /** 262 * \brief Sets the part messaege of the user 263 * \param szMsg The part message of the user 264 * \return void 265 */ setPartMessage(const QString & szMsg)266 void setPartMessage(const QString & szMsg) { m_szPartMessage = szMsg; }; 267 268 /** 269 * \brief Sets the quit messaege of the user 270 * \param szMsg The quit message of the user 271 * \return void 272 */ setQuitMessage(const QString & szMsg)273 void setQuitMessage(const QString & szMsg) { m_szQuitMessage = szMsg; }; 274 275 /** 276 * \brief Sets the age of the user 277 * \param szAge The age of the user 278 * \return void 279 */ setAge(const QString & szAge)280 void setAge(const QString & szAge) { m_szAge = szAge; }; 281 282 /** 283 * \brief Sets the gender of the user 284 * \param szGender The gemder of the user 285 * \return void 286 */ setGender(const QString & szGender)287 void setGender(const QString & szGender) { m_szGender = szGender; }; 288 289 /** 290 * \brief Sets the location of the user 291 * \param szLocation The location of the user 292 * \return void 293 */ setLocation(const QString & szLocation)294 void setLocation(const QString & szLocation) { m_szLocation = szLocation; }; 295 296 /** 297 * \brief Sets the languages of the user 298 * \param szLanguages The languages of the user 299 * \return void 300 */ setLanguages(const QString & szLanguages)301 void setLanguages(const QString & szLanguages) { m_szLanguages = szLanguages; }; 302 303 /** 304 * \brief Sets the other info for the user 305 * \param szOtherInfo The other info of the user 306 * \return void 307 */ setOtherInfo(const QString & szOtherInfo)308 void setOtherInfo(const QString & szOtherInfo) { m_szOtherInfo = szOtherInfo; }; 309 310 /** 311 * \brief Sets the user mode of the user 312 * \param szUserMode The user mode of the user 313 * \return void 314 */ setUserMode(const QString & szUserMode)315 void setUserMode(const QString & szUserMode) { m_szUserMode = szUserMode; }; 316 317 /** 318 * \brief Sets the commands list to run on connection 319 * \param szOnConnectCommand The commands to run 320 * \return void 321 */ setOnConnectCommand(const QString & szOnConnectCommand)322 void setOnConnectCommand(const QString & szOnConnectCommand) { m_szOnConnectCommand = szOnConnectCommand; }; 323 324 /** 325 * \brief Sets the commands list to run on login 326 * \param szOnLoginCommand The commands to run 327 * \return void 328 */ setOnLoginCommand(const QString & szOnLoginCommand)329 void setOnLoginCommand(const QString & szOnLoginCommand) { m_szOnLoginCommand = szOnLoginCommand; }; 330 protected: 331 /** 332 * \brief Carbon copy 333 * \param src The source user identity 334 * \return void 335 */ 336 void copyFrom(const KviUserIdentity & src); 337 338 /** 339 * \brief Saves the user identity 340 * \param cfg The config file where to save 341 * \return bool 342 */ 343 bool save(KviConfigurationFile & cfg); 344 345 /** 346 * \brief Loads the user identity 347 * \param cfg The config file where to load 348 * \return bool 349 */ 350 bool load(KviConfigurationFile & cfg); 351 }; 352 353 #endif // _KVI_USERIDENTITY_H_ 354