KVIrc  4.9.2
DeveloperAPIs
KviIrcConnectionUserInfo.h
Go to the documentation of this file.
1 #ifndef _KVI_IRCCONNECTIONUSERINFO_H_
2 #define _KVI_IRCCONNECTIONUSERINFO_H_
3 //=============================================================================
4 //
5 // File : KviIrcConnectionUserInfo.h
6 // Creation date : Sun 20 Jun 2004 01:45:42 by Szymon Stefanek
7 //
8 // This file is part of the KVIrc IRC client distribution
9 // Copyright (C) 2004-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 #include "kvi_settings.h"
28 #include "KviQString.h"
29 #include "KviTimeUtils.h"
30 
32 {
33  friend class KviIrcConnection;
34  friend class KviIrcServerParser;
35  friend class KviConsoleWindow;
36 
37 protected:
40 
41 private:
42  QString m_szRealName; // the actual real name sent from the server
43  QString m_szNickName; // the actual nick name acknowledged by the server
44  QString m_szPassword; // the password used connecting to the server
45  QString m_szUserMode; // the actual user mode
46  QString m_szUserName; // user name with ident char
47  QString m_szLocalHostIp; // the local host ip as found by resolveLocalHost() at connection startup
48  QString m_szHostName; // the local host name that the server reports
49  QString m_szHostIp; // the host name above resolved, if possible
50  QString m_szAwayReason;
51  bool m_bAway; // is the user away ?
52  kvi_time_t m_tAway; // time at that the user went away
53  QString m_szNickBeforeAway; // the nickname that the user had just before going away
54  // From bugtrack:
55  // On many IRC networks the host is masked or hashed, and if one also is connected through a LAN,
56  // it is basically impossible to initiate DCC transfers, as 192.168.0.13 or similar will be sent as IP.
57  // But IRC servers usually (at least in my experience) send the unmasked host in the 001 raw event
58  // with something like ":Welcome to the Internet Relay Chat network, nick!ident@host". I think
59  // it'd be a good idea to just grab the IP from that event and use it for DCC transfers by default.
61 
62 public:
63  const QString & realName() { return m_szRealName; };
64  const QString & nickName() { return m_szNickName; };
65  const QString & userMode() { return m_szUserMode; };
66  const QString & userName() { return m_szUserName; };
67  const QString & password() { return m_szPassword; };
68  const QString & localHostIp() { return m_szLocalHostIp; };
69  const QString & hostName() { return m_szHostName; };
70  const QString & unmaskedHostName() { return m_szUnmaskedHostName; };
71  const QString & hostIp() { return m_szHostIp; };
72  const QString & awayReason() { return m_szAwayReason; };
73  bool hasUserMode(const QChar & m);
74  bool isAway() { return m_bAway; };
75  time_t awayTime() { return m_tAway; };
76  const QString & nickNameBeforeAway() { return m_szNickBeforeAway; };
77 protected:
78  void setRealName(const QString & szRealName) { m_szRealName = szRealName; };
79  void setNickName(const QString & szNickName) { m_szNickName = szNickName; };
80  void setUserMode(const QString & szUserMode) { m_szUserMode = szUserMode; };
81  void setUserName(const QString & szUserName) { m_szUserName = szUserName; };
82  void setPassword(const QString & szPassword) { m_szPassword = szPassword; };
83  void setHostName(const QString & szHostName) { m_szHostName = szHostName; };
84  void setUnmaskedHostName(const QString & szHostName) { m_szUnmaskedHostName = szHostName; };
85  void setHostIp(const QString & szHostIp) { m_szHostIp = szHostIp; };
86  void setLocalHostIp(const QString & szLocalHostIp) { m_szLocalHostIp = szLocalHostIp; };
87  bool addUserMode(const QChar & m); // returns false if the mode was already there
88  bool removeUserMode(const QChar & m); // returns fales if the mode was not there
89  void setAwayReason(const QString & szReazon) { m_szAwayReason = szReazon; };
90  void setAway();
91  void setBack();
92 };
93 
94 #endif
void setPassword(const QString &szPassword)
Definition: KviIrcConnectionUserInfo.h:82
const QString & realName()
Definition: KviIrcConnectionUserInfo.h:63
QString m_szAwayReason
Definition: KviIrcConnectionUserInfo.h:50
void setUserName(const QString &szUserName)
Definition: KviIrcConnectionUserInfo.h:81
Definition: KviConsoleWindow.h:75
void setHostName(const QString &szHostName)
Definition: KviIrcConnectionUserInfo.h:83
#define KVIRC_API
Definition: kvi_settings.h:128
const QString & unmaskedHostName()
Definition: KviIrcConnectionUserInfo.h:70
QString m_szNickBeforeAway
Definition: KviIrcConnectionUserInfo.h:53
time_t awayTime()
Definition: KviIrcConnectionUserInfo.h:75
#define m
Definition: detector.cpp:77
QString m_szLocalHostIp
Definition: KviIrcConnectionUserInfo.h:47
An abstraction of a connection to an IRC server.
Definition: KviIrcConnection.h:95
void setUnmaskedHostName(const QString &szHostName)
Definition: KviIrcConnectionUserInfo.h:84
~KviIrcConnectionUserInfo()
Definition: KviIrcConnectionUserInfo.h:39
QString m_szUserName
Definition: KviIrcConnectionUserInfo.h:46
QString m_szHostName
Definition: KviIrcConnectionUserInfo.h:48
const QString & nickNameBeforeAway()
Definition: KviIrcConnectionUserInfo.h:76
const QString & hostIp()
Definition: KviIrcConnectionUserInfo.h:71
#define kvi_time_t
Definition: KviTimeUtils.h:43
void setHostIp(const QString &szHostIp)
Definition: KviIrcConnectionUserInfo.h:85
const QString & userMode()
Definition: KviIrcConnectionUserInfo.h:65
const QString & hostName()
Definition: KviIrcConnectionUserInfo.h:69
kvi_time_t m_tAway
Definition: KviIrcConnectionUserInfo.h:52
QString m_szUserMode
Definition: KviIrcConnectionUserInfo.h:45
Definition: KviIrcConnectionUserInfo.h:31
void setLocalHostIp(const QString &szLocalHostIp)
Definition: KviIrcConnectionUserInfo.h:86
Time management.
bool isAway()
Definition: KviIrcConnectionUserInfo.h:74
const QString & nickName()
Definition: KviIrcConnectionUserInfo.h:64
const QString & userName()
Definition: KviIrcConnectionUserInfo.h:66
QString m_szPassword
Definition: KviIrcConnectionUserInfo.h:44
QString m_szNickName
Definition: KviIrcConnectionUserInfo.h:43
const QString & awayReason()
Definition: KviIrcConnectionUserInfo.h:72
QString m_szHostIp
Definition: KviIrcConnectionUserInfo.h:49
void setAwayReason(const QString &szReazon)
Definition: KviIrcConnectionUserInfo.h:89
void setUserMode(const QString &szUserMode)
Definition: KviIrcConnectionUserInfo.h:80
bool m_bAway
Definition: KviIrcConnectionUserInfo.h:51
Definition: KviIrcServerParser.h:115
This file contains compile time settings.
QString m_szUnmaskedHostName
Definition: KviIrcConnectionUserInfo.h:60
Helper functions for the QString class.
const QString & password()
Definition: KviIrcConnectionUserInfo.h:67
const QString & localHostIp()
Definition: KviIrcConnectionUserInfo.h:68
void setNickName(const QString &szNickName)
Definition: KviIrcConnectionUserInfo.h:79
void setRealName(const QString &szRealName)
Definition: KviIrcConnectionUserInfo.h:78