QTfrontend/newnetclient.cpp
changeset 2405 3b8607ac32c6
parent 2403 6c5d504af2ba
child 2442 228757f6c54d
equal deleted inserted replaced
2404:8281eea32196 2405:3b8607ac32c6
   268 		{
   268 		{
   269 			qWarning("Net: Empty CHAT message");
   269 			qWarning("Net: Empty CHAT message");
   270 			return;
   270 			return;
   271 		}
   271 		}
   272 		if (netClientState == 2)
   272 		if (netClientState == 2)
   273 			emit chatStringLobby(formatChatMsg(lst[1], lst[2]));
   273 			emit chatStringLobby(HWProto::formatChatMsg(lst[1], lst[2]));
   274 		else
   274 		else
   275 			emit chatStringFromNet(formatChatMsg(lst[1], lst[2]));
   275 			emit chatStringFromNet(HWProto::formatChatMsg(lst[1], lst[2]));
   276 		return;
   276 		return;
   277 	}
   277 	}
   278 
   278 
   279 	if (lst[0] == "INFO") {
   279 	if (lst[0] == "INFO") {
   280 		if(lst.size() < 5)
   280 		if(lst.size() < 5)
   591 
   591 
   592 void HWNewNet::chatLineToNet(const QString& str)
   592 void HWNewNet::chatLineToNet(const QString& str)
   593 {
   593 {
   594 	if(str != "") {
   594 	if(str != "") {
   595 		RawSendNet(QString("CHAT") + delimeter + str);
   595 		RawSendNet(QString("CHAT") + delimeter + str);
   596 		emit(chatStringFromMe(formatChatMsg(mynick, str)));
   596 		emit(chatStringFromMe(HWProto::formatChatMsg(mynick, str)));
   597 	}
   597 	}
   598 }
   598 }
   599 
   599 
   600 void HWNewNet::chatLineToLobby(const QString& str)
   600 void HWNewNet::chatLineToLobby(const QString& str)
   601 {
   601 {
   602 	if(str != "") {
   602 	if(str != "") {
   603 		RawSendNet(QString("CHAT") + delimeter + str);
   603 		RawSendNet(QString("CHAT") + delimeter + str);
   604 		emit(chatStringFromMeLobby(formatChatMsg(mynick, str)));
   604 		emit(chatStringFromMeLobby(HWProto::formatChatMsg(mynick, str)));
   605 	}
   605 	}
   606 }
   606 }
   607 
   607 
   608 void HWNewNet::SendTeamMessage(const QString& str)
   608 void HWNewNet::SendTeamMessage(const QString& str)
   609 {
   609 {
   629 {
   629 {
   630 	if (netClientState == 5) netClientState = 3;
   630 	if (netClientState == 5) netClientState = 3;
   631 	RawSendNet(QString("ROUNDFINISHED"));
   631 	RawSendNet(QString("ROUNDFINISHED"));
   632 }
   632 }
   633 
   633 
   634 QString HWNewNet::formatChatMsg(const QString & nick, const QString & msg)
       
   635 {
       
   636 	if(msg.left(4) == "/me ")
       
   637 		return QString("\x02* %1 %2").arg(nick).arg(msg.mid(4));
       
   638 	else
       
   639 		return QString("\x01%1: %2").arg(nick).arg(msg);
       
   640 }
       
   641 
       
   642 void HWNewNet::banPlayer(const QString & nick)
   634 void HWNewNet::banPlayer(const QString & nick)
   643 {
   635 {
   644 	RawSendNet(QString("BAN%1%2").arg(delimeter).arg(nick));
   636 	RawSendNet(QString("BAN%1%2").arg(delimeter).arg(nick));
   645 }
   637 }
   646 
   638