summaryrefslogtreecommitdiff
path: root/noncore/net/opieirc/ircperson.cpp
Unidiff
Diffstat (limited to 'noncore/net/opieirc/ircperson.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/opieirc/ircperson.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/noncore/net/opieirc/ircperson.cpp b/noncore/net/opieirc/ircperson.cpp
new file mode 100644
index 0000000..bd6b8d6
--- a/dev/null
+++ b/noncore/net/opieirc/ircperson.cpp
@@ -0,0 +1,50 @@
1#include "ircperson.h"
2#include <stdio.h>
3
4IRCPerson::IRCPerson() {
5 m_nick = "";
6 m_user = "";
7 m_host = "";
8}
9
10IRCPerson::IRCPerson(QString mask) {
11 IRCPerson();
12 fromMask(mask);
13}
14
15void IRCPerson::fromMask(QString mask) {
16 int sep1 = mask.find("!");
17 int sep2 = mask.find("@");
18
19 m_nick = mask.left(sep1);
20 m_user = mask.mid(sep1+1, sep2-sep1-1);
21 m_host = mask.right(mask.length()-sep2-1);
22}
23
24QString IRCPerson::toMask() {
25 return m_nick + "!" + m_user + "@" + m_host;
26}
27
28void IRCPerson::setNick(QString nick) {
29 m_nick = nick;
30}
31
32void IRCPerson::setUser(QString user) {
33 m_user = user;
34}
35
36void IRCPerson::setHost(QString host) {
37 m_host = host;
38}
39
40QString IRCPerson::nick() {
41 return m_nick;
42}
43
44QString IRCPerson::user() {
45 return m_user;
46}
47
48QString IRCPerson::host() {
49 return m_host;
50}