379 { |
379 { |
380 qWarning("Net: Empty CHAT message"); |
380 qWarning("Net: Empty CHAT message"); |
381 return; |
381 return; |
382 } |
382 } |
383 |
383 |
384 QString action = HWProto::chatStringToAction(lst[2]); |
384 QString action; |
|
385 QString message; |
|
386 // Fake nicks are nicks used for messages from the server with nicks like |
|
387 // [server], [random], etc. |
|
388 // The '[' character is not allowed in real nicks. |
|
389 bool isFakeNick = lst[1].startsWith('['); |
|
390 if(!isFakeNick) |
|
391 { |
|
392 // Normal message |
|
393 message = lst[2]; |
|
394 // Check for action (/me command) |
|
395 action = HWProto::chatStringToAction(message); |
|
396 } |
|
397 else |
|
398 { |
|
399 // Server message |
|
400 // Server messages are translated client-side |
|
401 message = HWApplication::translate("server", lst[2].toLatin1().constData()); |
|
402 } |
385 |
403 |
386 if (netClientState == InLobby) |
404 if (netClientState == InLobby) |
387 { |
405 { |
388 if (action != NULL) |
406 if (!action.isNull()) |
389 emit lobbyChatAction(lst[1], action); |
407 emit lobbyChatAction(lst[1], action); |
390 else |
408 else |
391 emit lobbyChatMessage(lst[1], lst[2]); |
409 emit lobbyChatMessage(lst[1], message); |
392 } |
410 } |
393 else |
411 else |
394 { |
412 { |
395 emit chatStringFromNet(HWProto::formatChatMsg(lst[1], lst[2])); |
413 emit chatStringFromNet(HWProto::formatChatMsg(lst[1], message)); |
396 if (action != NULL) |
414 if (!action.isNull()) |
397 emit roomChatAction(lst[1], action); |
415 emit roomChatAction(lst[1], action); |
398 else |
416 else |
399 emit roomChatMessage(lst[1], lst[2]); |
417 emit roomChatMessage(lst[1], message); |
400 } |
418 } |
401 return; |
419 return; |
402 } |
420 } |
403 |
421 |
404 if (lst[0] == "INFO") |
422 if (lst[0] == "INFO") |