Exemple #1
0
void Conversation::messageReceived(const QXmppMessage &msg)
{
    if (msg.type() != QXmppMessage::Chat ||
        QXmppUtils::jidToBareJid(msg.from()) != m_jid)
        return;

    // handle chat state
    if (msg.state() != m_remoteState) {
        m_remoteState = msg.state();
        emit remoteStateChanged(m_remoteState);
    }

    // handle message body
    if (msg.body().isEmpty())
        return;

    HistoryMessage message;
    message.body = msg.body();
    message.date = msg.stamp();
    if (!message.date.isValid())
        message.date = m_client->serverTime();
    message.jid = m_jid;
    message.received = true;
    if (m_historyModel)
        m_historyModel->addMessage(message);
}
Exemple #2
0
void CFrmGroupChat::slotMessageReceived(const QXmppMessage &message)
{
    LOG_MODEL_DEBUG("Group chat", "CFrmGroupChat::slotMessageReceived:type:%d;state:%d;from:%s;to:%s;body:%s",
           message.type(),
           message.state(), //消息的状态 0:消息内容,其它值表示这个消息的状态  
           qPrintable(message.from()),
           qPrintable(message.to()),
           qPrintable(message.body())
          );

    if(QXmppUtils::jidToBareJid(message.from()) != QXmppUtils::jidToBareJid(m_pRoom->jid()))
    {
        LOG_MODEL_DEBUG("Group chat", "the room is %s, from %s received",
                        m_pRoom->jid().toStdString().c_str(),
                        message.from().toStdString().c_str());
        return;
    }

    if(message.body().isEmpty())
        return;

    QString nick;
    nick = QXmppUtils::jidToResource(message.from());
    if(nick.isEmpty())
        nick = tr("System");
    AppendMessageToList(message.body(), nick);
}
Exemple #3
0
void Client::messageReceived(const QXmppMessage &message)
{
    qDebug() << message.body();
    QString from = message.from();
    QString msg = message.body();
    m_client->sendPacket(QXmppMessage("", from, "Your message: " + msg));
}
void tst_QXmppMessage::testMessageReceipt()
{
    const QByteArray xml(
        "<message id=\"richard2-4.1.247\" to=\"[email protected]/throne\" from=\"[email protected]/westminster\" type=\"normal\">"
          "<body>My lord, dispatch; read o'er these articles.</body>"
          "<request xmlns=\"urn:xmpp:receipts\"/>"
        "</message>");

    QXmppMessage message;
    parsePacket(message, xml);
    QCOMPARE(message.id(), QString("richard2-4.1.247"));
    QCOMPARE(message.to(), QString("[email protected]/throne"));
    QCOMPARE(message.from(), QString("[email protected]/westminster"));
    QVERIFY(message.extendedAddresses().isEmpty());
    QCOMPARE(message.type(), QXmppMessage::Normal);
    QCOMPARE(message.body(), QString("My lord, dispatch; read o'er these articles."));
    QCOMPARE(message.isAttentionRequested(), false);
    QCOMPARE(message.isReceiptRequested(), true);
    QCOMPARE(message.receiptId(), QString());
    serializePacket(message, xml);

    const QByteArray receiptXml(
        "<message id=\"bi29sg183b4v\" to=\"[email protected]/westminster\" from=\"[email protected]/throne\" type=\"normal\">"
          "<received xmlns=\"urn:xmpp:receipts\" id=\"richard2-4.1.247\"/>"
        "</message>");

    QXmppMessage receipt;
    parsePacket(receipt, receiptXml);
    QCOMPARE(receipt.id(), QString("bi29sg183b4v"));
    QCOMPARE(receipt.to(), QString("[email protected]/westminster"));
    QCOMPARE(receipt.from(), QString("[email protected]/throne"));
    QVERIFY(receipt.extendedAddresses().isEmpty());
    QCOMPARE(receipt.type(), QXmppMessage::Normal);
    QCOMPARE(receipt.body(), QString());
    QCOMPARE(receipt.isAttentionRequested(), false);
    QCOMPARE(receipt.isReceiptRequested(), false);
    QCOMPARE(receipt.receiptId(), QString("richard2-4.1.247"));
    serializePacket(receipt, receiptXml);

    const QByteArray oldXml(
        "<message id=\"richard2-4.1.247\" to=\"[email protected]/westminster\" from=\"[email protected]/throne\" type=\"normal\">"
          "<received xmlns=\"urn:xmpp:receipts\"/>"
        "</message>");

    QXmppMessage old;
    parsePacket(old, oldXml);
    QCOMPARE(old.id(), QString("richard2-4.1.247"));
    QCOMPARE(old.to(), QString("[email protected]/westminster"));
    QCOMPARE(old.from(), QString("[email protected]/throne"));
    QVERIFY(old.extendedAddresses().isEmpty());
    QCOMPARE(old.type(), QXmppMessage::Normal);
    QCOMPARE(old.body(), QString());
    QCOMPARE(old.isAttentionRequested(), false);
    QCOMPARE(old.isReceiptRequested(), false);
    QCOMPARE(old.receiptId(), QString("richard2-4.1.247"));
}
Exemple #5
0
	void RoomHandler::HandleMessage (const QXmppMessage& msg, const QString& nick)
	{
		const bool existed = Nick2Entry_.contains (nick);
		RoomParticipantEntry_ptr entry = GetParticipantEntry (nick, false);
		if (msg.type () == QXmppMessage::Chat && !nick.isEmpty ())
		{
			if (msg.state ())
				entry->UpdateChatState (msg.state (), QString ());

			if (!msg.body ().isEmpty ())
			{
				GlooxMessage *message = new GlooxMessage (msg,
						Account_->GetClientConnection ().get ());
				entry->HandleMessage (message);
			}
		}
		else
		{
			RoomPublicMessage *message = 0;
			if (msg.type () == QXmppMessage::GroupChat &&
				!msg.subject ().isEmpty ())
			{
				Subject_ = msg.subject ();
				CLEntry_->HandleSubjectChanged (Subject_);

				const QString& string = nick.isEmpty () ?
						msg.subject () :
						tr ("%1 changed subject to %2")
							.arg (nick)
							.arg (msg.subject ());

				message = new RoomPublicMessage (string,
					IMessage::DIn,
					CLEntry_,
					IMessage::MTEventMessage,
					IMessage::MSTOther);
			}
			else if (!nick.isEmpty ())
			{
				if (!msg.body ().isEmpty ())
					message = new RoomPublicMessage (msg, CLEntry_, entry);
			}
			else
				message = new RoomPublicMessage (msg.body (),
					IMessage::DIn,
					CLEntry_,
					IMessage::MTEventMessage,
					IMessage::MSTOther);

			if (message)
				CLEntry_->HandleMessage (message);
			
			if (!existed)
				Nick2Entry_.remove (nick);
		}
	}
void MyXmppClient::messageReceivedSlot( const QXmppMessage &xmppMsg )
{
    QString bareJid_from = MyXmppClient::getBareJidByJid( xmppMsg.from() );
    QString bareJid_to = MyXmppClient::getBareJidByJid( xmppMsg.to() );

    if( xmppMsg.state() == QXmppMessage::Active ) qDebug() << "Msg state is QXmppMessage::Active";
    else if( xmppMsg.state() == QXmppMessage::Inactive ) qDebug() << "Msg state is QXmppMessage::Inactive";
    else if( xmppMsg.state() == QXmppMessage::Gone ) qDebug() << "Msg state is QXmppMessage::Gone";
    else if( xmppMsg.state() == QXmppMessage::Composing ) {
        if (bareJid_from != "") {
            m_flTyping = true;
            emit typingChanged(m_accountId,bareJid_from, true);
            qDebug() << bareJid_from << " is composing.";
        }
    }
    else if( xmppMsg.state() == QXmppMessage::Paused ) {
        if (bareJid_from != "") {
            m_flTyping = false;
            emit typingChanged(m_accountId,bareJid_from, false);
            qDebug() << bareJid_from << " paused.";
        }
    } else {
        if( xmppMsg.isAttentionRequested() )
        {
            //qDebug() << "ZZZ: attentionRequest !!! from:" <<xmppMsg.from();
            //msgWrapper->attention( bareJid_from, false );
        }
        qDebug() << "MessageWrapper::messageReceived(): xmppMsg.state():" << xmppMsg.state();
    }
    if ( !( xmppMsg.body().isEmpty() || xmppMsg.body().isNull() || bareJid_from == m_myjid ) ) {
        m_bareJidLastMessage = getBareJidByJid(xmppMsg.from());
        m_resourceLastMessage = getResourceByJid(xmppMsg.from());

        this->openChat( bareJid_from );

        RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid_from );
        if( item != 0 ) { int cnt = item->unreadMsg(); item->setUnreadMsg( ++cnt ); } else {
          RosterItemModel *itemModel = new RosterItemModel( );
          itemModel->setPresence( this->getPicPresence( QXmppPresence::Unavailable ) );
          itemModel->setContactName( bareJid_from );
          itemModel->setJid( bareJid_from );
          itemModel->setUnreadMsg( 1 );
          itemModel->setStatusText( "");
          cachedRoster->append(itemModel);
          itemModel = 0;
          delete itemModel;
        }
        item = 0; delete item;

        emit insertMessage(m_accountId,this->getBareJidByJid(xmppMsg.from()),xmppMsg.body(),QDateTime::currentDateTime().toString("dd-MM-yy hh:mm"),0);
    }
}
Exemple #7
0
void MainWindow::messageReceived(const QXmppMessage &msg)
{
//    qDebug() << msg.body();
    if (msg.body().isEmpty())
        return;

    UserChatDialog *dialog = userChatDialog(QXmppUtils::jidToBareJid(msg.from()));
    if (dialog)
    {
        dialog->show();
        dialog->messageReceived(msg.body());
    }
}
Exemple #8
0
void tst_QXmppMessage::testForwarding()
{
    const QByteArray xml("<message type=\"normal\">"
        "<body>hi!</body>"
        "<forwarded xmlns=\"urn:xmpp:forward:0\">"
        "<delay xmlns=\"urn:xmpp:delay\" stamp=\"2010-06-29T08:23:06Z\"/>"
        "<message xmlns=\"jabber:client\" "
        "type=\"chat\" "
        "from=\"[email protected]/QXmpp\" "
        "to=\"[email protected]/QXmpp\">"
        "<body>ABC</body>"
        "</message>"
        "</forwarded>"
        "</message>");

    QXmppMessage message;
    parsePacket(message, xml);
    QCOMPARE(message.hasForwarded(), true);

    QXmppMessage fwd = message.forwarded();
    QCOMPARE(fwd.stamp(), QDateTime(QDate(2010, 06, 29), QTime(8, 23, 6), Qt::UTC));
    QCOMPARE(fwd.body(), QString("ABC"));
    QCOMPARE(fwd.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(fwd.from(), QString("[email protected]/QXmpp"));
}
static void saveMessage(const QXmppMessage &message, const QDateTime &now, bool received)
{
    const QString localJid = QXmppUtils::jidToBareJid(received ? message.to() : message.from());
    const QString remoteJid = QXmppUtils::jidToBareJid(received ? message.from() : message.to());

    // get or create collection
    int chatId;
    QDjangoQuerySet<ArchiveMessage> qs;
    qs = qs.filter(QDjangoWhere("chat__jid", QDjangoWhere::Equals, localJid));
    qs = qs.filter(QDjangoWhere("chat__with", QDjangoWhere::Equals, remoteJid));
    qs = qs.orderBy(QStringList() << "-date").limit(0, 1);
    ArchiveMessage tmp;
    if (qs.size() > 0 && qs.at(0, &tmp) && tmp.date().secsTo(now) < 3600) {
        chatId = tmp.property("chat_id").toInt();
    } else {
        ArchiveChat chat;
        chat.setJid(localJid);
        chat.setWith(remoteJid);
        chat.setStart(now);
        chat.save();
        chatId = chat.pk().toInt();
    }

    // save outgoing message
    ArchiveMessage msg;
    msg.setProperty("chat_id", chatId);
    msg.setBody(message.body());
    msg.setDate(now);
    msg.setReceived(received);
    msg.save();
}
Exemple #10
0
void tst_QXmppMessage::testReplaceWithEmptyMessage()
{
    const QByteArray replaceXml(
                "<message to='[email protected]/balcony' id='good1'>"
                  "<body/>"
                  "<replace id='bad1' xmlns='urn:xmpp:message-correct:0'/>"
                "</message>");
    QXmppMessage replaceMessage;
    parsePacket(replaceMessage, replaceXml);
    QCOMPARE(replaceMessage.isReplace(), true);
    QCOMPARE(replaceMessage.replaceId(), QString("bad1"));
    QCOMPARE(replaceMessage.body(), QString(""));

    const QByteArray replaceSerialisation(
                "<message id=\"good1\" to=\"[email protected]/balcony\" type=\"chat\">"
                  "<body/>"
                  "<replace id=\"bad1\" xmlns=\"urn:xmpp:message-correct:0\"/>"
                "</message>");

    QXmppMessage serialisationMessage;
    serialisationMessage.setTo("[email protected]/balcony");
    serialisationMessage.setId("good1");
    serialisationMessage.setBody("");
    serialisationMessage.setReplace("bad1");

    serializePacket(serialisationMessage, replaceSerialisation);
}
Exemple #11
0
void tst_QXmppMessage::testBasic()
{
    QFETCH(QByteArray, xml);
    QFETCH(int, type);
    QFETCH(QString, body);
    QFETCH(QString, subject);
    QFETCH(QString, thread);

    QXmppMessage message;
    parsePacket(message, xml);
    QCOMPARE(message.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(message.from(), QString("[email protected]/QXmpp"));
    QVERIFY(message.extendedAddresses().isEmpty());
    QCOMPARE(int(message.type()), type);
    QCOMPARE(message.body(), body);
    QCOMPARE(message.subject(), subject);
    QCOMPARE(message.thread(), thread);
    QCOMPARE(message.state(), QXmppMessage::None);
    QCOMPARE(message.isAttentionRequested(), false);
    QCOMPARE(message.isReceiptRequested(), false);
    QCOMPARE(message.hasForwarded(), false);
    QCOMPARE(message.receiptId(), QString());
    QCOMPARE(message.xhtml(), QString());
    serializePacket(message, xml);
}
Exemple #12
0
	void EntryBase::HandleAttentionMessage (const QXmppMessage& msg)
	{
		QString jid;
		QString resource;
		ClientConnection::Split (msg.from (), &jid, &resource);

		emit attentionDrawn (msg.body (), resource);
	}
Exemple #13
0
void MUCWidget::insertMessage(QXmppMessage &message) {
    if(message.body().isEmpty()) {
		return;
    }
	QString text = message.body();
	text.replace("&", "&amp;");
	text.replace("<", "&lt;");
	text.replace("<", "&gt;");
	text.replace("\"", "&quot;");
	text.replace("\n", "<br />");
	text.replace(HYPERLINK_REPLACE_ARGS);
    QStringList jid = parseJid(message.from());
    if(!jid[5].isEmpty()) {
		ui->chatview->append("<div class=\"message\"><a href=\"talkto:" + jid[5] + "\">&lt;" + jid[5] + "&gt;</a> " + text + "</div>");
    } else {
		ui->chatview->append("<div class=\"info\">" + text + "</div>");
    }
}
Exemple #14
0
void QxmppPeer::messageReceived(const QXmppMessage& message)
{
    QString from = message.from();
    QString msg  = message.body();

    //sendPacket( QXmppMessage("", from, "Your message: " + msg) );
    if ( !m_messageHandler.empty() )
        m_messageHandler( from.toStdString(), msg.toStdString() );
}
Exemple #15
0
void JabberChatService::handleReceivedMessage(const QXmppMessage &xmppMessage)
{
	if (!m_formattedStringFactory)
		return;

	m_chatStateService->extractReceivedChatState(xmppMessage);

	if (xmppMessage.body().isEmpty())
		return;

	if (xmppMessage.type() == QXmppMessage::Type::Error) // #1642
		return;

	auto message = xmppMessage.type() == QXmppMessage::GroupChat
		? m_roomChatService->handleReceivedMessage(xmppMessage)
		: handleNormalReceivedMessage(xmppMessage);
	if (message.isNull())
		return;

	message.setType(MessageTypeReceived);
	message.setSendDate(xmppMessage.stamp().toLocalTime());
	message.setReceiveDate(QDateTime::currentDateTime());

	auto body = xmppMessage.body();
	if (rawMessageTransformerService())
		body = QString::fromUtf8(rawMessageTransformerService()->transform(body.toUtf8(), message).rawContent());

	auto htmlBody = replacedNewLine(Qt::escape(body), QLatin1String("<br/>"));
	auto formattedString = m_formattedStringFactory.data()->fromHtml(htmlBody);
	if (!formattedString || formattedString->isEmpty())
		return;

	message.setContent(std::move(formattedString));

	auto id = xmppMessage.from();
	auto resourceIndex = id.indexOf('/');
	if (resourceIndex >= 0)
		id = id.mid(0, resourceIndex);
	m_contactMessageTypes.insert(id, xmppMessage.type());

	emit messageReceived(message);
}
Exemple #16
0
void Xmpp_client::messageReceived(const QXmppMessage& message)
{
    qDebug() << "Xmpp_client::messageReceived !!!";

    QString from = message.from();

    QByteArray msg = QByteArray::fromBase64(message.body().toUtf8());


    qDebug() << "RECEIVE from : " << from << " MESSAGE : " << msg;

}
Exemple #17
0
void ChatExtension::HandleMessageReceived(const QXmppMessage &message)
{   
    if(message.type() == QXmppMessage::GroupChat)
        return;

    QString sender_jid = jidToBareJid(message.from());
    QString msg = message.body();

    LogInfo("XMPPModule: Received message. From: " + sender_jid.toStdString()
            + " Body: " + msg.toStdString());

    emit MessageReceived(sender_jid, msg);
}
Exemple #18
0
void CFrmUserList::slotClientMessageReceived(const QXmppMessage &message)
{
    LOG_MODEL_DEBUG("Roster", "CFrmUserList::slotClientMessageReceived:type:%d;state:%d;from:%s;to:%s;body:%s",
           message.type(),
           message.state(), //消息的状态 0:消息内容,其它值表示这个消息的状态  
           qPrintable(message.from()),
           qPrintable(message.to()),
           qPrintable(message.body())
          );

    m_LastUser = message.from();//保存接收到最后消息的用户  
    QMap<QString, CRoster*>::iterator it;
    it = m_Rosters.find(QXmppUtils::jidToBareJid(message.from()));
    if(m_Rosters.end() != it)
    {
        if(QXmppMessage::None == message.state())
        {
            it.value()->AppendMessage(message.body());
        }
        //TODO:消息输入状态显示  
    }
}
void MucExtension::HandleMessageReceived(const QXmppMessage &message)
{
    QXmppMucRoom *room = qobject_cast<QXmppMucRoom*>(sender());
    if(!room)
        return;

    QString message_type;

    // Parse message type into string.
    switch(message.type())
    {
        case QXmppMessage::Error:
            message_type = "error";
            break;
        case QXmppMessage::Normal:
            message_type = "normal";
            break;
        case QXmppMessage::Chat:
            message_type = "chat";
            break;
        case QXmppMessage::GroupChat:
            message_type = "groupchat";
            break;
        case QXmppMessage::Headline:
            message_type = "headline";
            break;
        default:
            message_type = "invalid type";
    }

    LogInfo("XMPPModule: Received message. From: " + message.from().toStdString()
            + " Room: " + room->jid().toStdString()
            + " Body: " + message.body().toStdString()
            + " Type: " + message_type.toStdString());

    emit MessageReceived(room->jid(), message.from(), message.body(), message_type);
}
Exemple #20
0
void tst_QXmppMessage::testMessageAttention()
{
    const QByteArray xml(
        "<message to=\"[email protected]/QXmpp\" from=\"[email protected]/QXmpp\" type=\"normal\">"
          "<attention xmlns=\"urn:xmpp:attention:0\"/>"
        "</message>");

    QXmppMessage message;
    parsePacket(message, xml);
    QCOMPARE(message.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(message.from(), QString("[email protected]/QXmpp"));
    QVERIFY(message.extendedAddresses().isEmpty());
    QCOMPARE(message.type(), QXmppMessage::Normal);
    QCOMPARE(message.body(), QString());
    QCOMPARE(message.isAttentionRequested(), true);
    QCOMPARE(message.isReceiptRequested(), false);
    QCOMPARE(message.receiptId(), QString());
    serializePacket(message, xml);
}
void TestPackets::testMessageFull()
{
    const QByteArray xml(
        "<message to=\"[email protected]/QXmpp\" from=\"[email protected]/QXmpp\" type=\"normal\">"
        "<subject>test subject</subject>"
        "<body>test body &amp; stuff</body>"
        "<thread>test thread</thread>"
        "<composing xmlns=\"http://jabber.org/protocol/chatstates\"/>"
        "</message>");

    QXmppMessage message;
    parsePacket(message, xml);
    QCOMPARE(message.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(message.from(), QString("[email protected]/QXmpp"));
    QCOMPARE(message.type(), QXmppMessage::Normal);
    QCOMPARE(message.body(), QString("test body & stuff"));
    QCOMPARE(message.subject(), QString("test subject"));
    QCOMPARE(message.thread(), QString("test thread"));
    QCOMPARE(message.state(), QXmppMessage::Composing);
    serializePacket(message, xml);
}
Exemple #22
0
void tst_QXmppMessage::testMessageCarbons()
{
    const QByteArray xml("<message type=\"normal\">"
        "<body>hi!</body>"
        "<sent xmlns='urn:xmpp:carbons:2'>"
        "<forwarded xmlns=\"urn:xmpp:forward:0\">"
        "<delay xmlns=\"urn:xmpp:delay\" stamp=\"2010-06-29T08:23:06Z\"/>"
        "<message xmlns=\"jabber:client\" "
        "type=\"chat\" "
        "from=\"[email protected]/QXmpp\" "
        "to=\"[email protected]/QXmpp\">"
        "<body>ABC</body>"
        "</message>"
        "</forwarded>"
        "</sent>"
        "</message>");

    QXmppMessage message;
    parsePacket(message, xml);
    QCOMPARE(message.hasMessageCarbon(), true);

    QXmppMessage fwd = message.carbonMessage();
    QCOMPARE(fwd.stamp(), QDateTime(QDate(2010, 06, 29), QTime(8, 23, 6), Qt::UTC));
    QCOMPARE(fwd.body(), QString("ABC"));
    QCOMPARE(fwd.to(), QString("[email protected]/QXmpp"));
    QCOMPARE(fwd.from(), QString("[email protected]/QXmpp"));


    const QByteArray carbonXml("<iq id=\"id1\""
                               " type=\"set\">"
                                   "<enable xmlns=\"urn:xmpp:carbons:2\"/>"
                              "</iq>");

    QXmppMessageCarbonsIq carbonIq;
    carbonIq.setId("id1");
    serializePacket(carbonIq, carbonXml);
}
Exemple #23
0
void Xmpp::messageReceived (const QXmppMessage &message)
{
    QString body = message.body();
    QString peer = users.at (jids.indexOf (QXmppUtils::jidToBareJid (message.from())));
    emit newMessage (peer, body);
}
Exemple #24
0
	void RoomHandler::HandleMessage (const QXmppMessage& msg, const QString& nick)
	{
		Q_FOREACH (const QXmppElement& elem, msg.extensions ())
		{
			const QString& xmlns = elem.attribute ("xmlns");
			if (xmlns == ns_data)
			{
				QXmppDataForm *df = new QXmppDataForm ();
				df->parse (XooxUtil::XmppElem2DomElem (elem));
				if (df->isNull ())
				{
					qWarning () << Q_FUNC_INFO
							<< "unable to parse form from"
							<< msg.from ();
					delete df;
				}
				else
					emit gotPendingForm (df, msg.from ());
			}
			else
				qWarning () << Q_FUNC_INFO
						<< "unhandled <x> element"
						<< xmlns;
		}

		const bool existed = Nick2Entry_.contains (nick);
		RoomParticipantEntry_ptr entry = GetParticipantEntry (nick, false);
		if (msg.type () == QXmppMessage::Chat && !nick.isEmpty ())
		{
			if (msg.isAttentionRequested ())
				entry->HandleAttentionMessage (msg);

			if (msg.state ())
				entry->UpdateChatState (msg.state (), QString ());

			if (!msg.body ().isEmpty ())
			{
				GlooxMessage *message = new GlooxMessage (msg,
						Account_->GetClientConnection ().get ());
				entry->HandleMessage (message);
			}
		}
		else
		{
			RoomPublicMessage *message = 0;
			if (msg.type () == QXmppMessage::GroupChat &&
				!msg.subject ().isEmpty ())
			{
				Subject_ = msg.subject ();
				CLEntry_->HandleSubjectChanged (Subject_);

				const QString& string = nick.isEmpty () ?
						msg.subject () :
						tr ("%1 changed subject to %2")
							.arg (nick)
							.arg (msg.subject ());

				message = new RoomPublicMessage (string,
					IMessage::DIn,
					CLEntry_,
					IMessage::MTEventMessage,
					IMessage::MSTOther);
			}
			else if (!nick.isEmpty ())
			{
				if (!msg.body ().isEmpty ())
					message = new RoomPublicMessage (msg, CLEntry_, entry);
			}
			else if (!msg.body ().isEmpty ())
				message = new RoomPublicMessage (msg.body (),
					IMessage::DIn,
					CLEntry_,
					IMessage::MTEventMessage,
					IMessage::MSTOther);

			if (message)
				CLEntry_->HandleMessage (message);

			if (!existed)
				Nick2Entry_.remove (nick);
		}
	}