blob: 7a2d75501f785e0dbfab9627b05c4fd232431942 (
plain) (
tree)
|
|
/*
# 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;
}
}
|