Diffstat (limited to 'noncore/net/opieirc/ircperson.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/opieirc/ircperson.cpp | 50 |
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 @@ +#include "ircperson.h" +#include <stdio.h> + +IRCPerson::IRCPerson() { + m_nick = ""; + m_user = ""; + m_host = ""; +} + +IRCPerson::IRCPerson(QString mask) { + IRCPerson(); + fromMask(mask); +} + +void IRCPerson::fromMask(QString mask) { + int sep1 = mask.find("!"); + int sep2 = mask.find("@"); + + m_nick = mask.left(sep1); + m_user = mask.mid(sep1+1, sep2-sep1-1); + m_host = mask.right(mask.length()-sep2-1); +} + +QString IRCPerson::toMask() { + return m_nick + "!" + m_user + "@" + m_host; +} + +void IRCPerson::setNick(QString nick) { + m_nick = nick; +} + +void IRCPerson::setUser(QString user) { + m_user = user; +} + +void IRCPerson::setHost(QString host) { + m_host = host; +} + +QString IRCPerson::nick() { + return m_nick; +} + +QString IRCPerson::user() { + return m_user; +} + +QString IRCPerson::host() { + return m_host; +} |