diff options
Diffstat (limited to 'src/core/pvsChatMsg.cpp')
| -rw-r--r-- | src/core/pvsChatMsg.cpp | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/core/pvsChatMsg.cpp b/src/core/pvsChatMsg.cpp new file mode 100644 index 0000000..7a2d755 --- /dev/null +++ b/src/core/pvsChatMsg.cpp @@ -0,0 +1,108 @@ +/* +# Copyright (c) 2009 - OpenSLX Project, Computer Center University of Freiburg +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +*/ + +// pvsChatMsg.cpp + +#include "src/core/pvsChatMsg.h" +#include <QStringList> + +PVSChatMsg::PVSChatMsg(PVSMsg pvsMsg) +{ + QStringList l = pvsMsg.getMessage().split(":"); + + if(l[0] == "") + { + _command = pvsMsg.getIdent(); + _nickFrom = "unseted"; + _nickTo = "unseted"; + _msg = "unseted"; + + if(l[2] == "local") + { + _username = l[1]; + _ip = pvsMsg.getRemoteIp(); + } + else + { + _username = l[1]; + _ip = l[2]; + } + } + else + { + _nickFrom = l[0]; + _msg = pvsMsg.getMessage().remove(0, l[0].size()+1); + _nickTo = pvsMsg.getIdent(); + _command = "unseted"; + _username = "unseted"; + _ip = "unseted"; + } +} + +PVSChatMsg::~PVSChatMsg(){}; + +void PVSChatMsg::setNickFrom(QString nick) +{ + _nickFrom = nick; +} + +void PVSChatMsg::setNickTo(QString nick) +{ + _nickTo = nick; +} + +void PVSChatMsg::setMsg(QString msg) +{ + _msg = msg; +} + +QString PVSChatMsg::getNickFrom() +{ + return _nickFrom; +} + +QString PVSChatMsg::getNickTo() +{ + return _nickTo; +} + +QString PVSChatMsg::getMsg() +{ + return _msg; +} + +QString PVSChatMsg::getCommand() +{ + return _command; +} + +QString PVSChatMsg::getUsername() +{ + return _username; +} + +QString PVSChatMsg::getIp() +{ + return _ip; +} + +bool PVSChatMsg::isCommand() +{ + if(_command == "unseted") + { + return false; + } + else + { + return true; + } +} |
