Guest User

Untitled

a guest
Oct 3rd, 2011
46
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. void ChatClient::sendMessage(const QString &message)
  2. {
  3.     qDebug() << Q_FUNC_INFO;
  4.     QMap<QString,QVariant> map;
  5.     if (message == CLIENT_REQUEST_LIST) {
  6.         map.insert(BT_MESSENGER_MESSAGE_TYPE, CLIENT_REQUEST_LIST);
  7.         map.insert(BT_MESSENGER_MESSAGE, CLIENT_REQUEST_LIST);
  8.     } else {
  9.         map.insert(BT_MESSENGER_MESSAGE_TYPE, MESSAGE_IS_MESSAGE);
  10.         map.insert(BT_MESSENGER_MESSAGE, message);
  11.         map.insert(BT_MESSENGER_SENDER, m_nickName);
  12.         map.insert(BT_MESSENGER_TIMESTAMP, QTime().currentTime());
  13.     }
  14.  
  15.     QByteArray array;
  16.     {
  17.         QDataStream data(&array, QIODevice::WriteOnly);
  18.         data << map;
  19.     }
  20.     socket->write(array);
  21. }
  22.  
  23.  
RAW Paste Data