本文整理汇总了C++中QXmppMessage::mamMessage方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppMessage::mamMessage方法的具体用法?C++ QXmppMessage::mamMessage怎么用?C++ QXmppMessage::mamMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppMessage
的用法示例。
在下文中一共展示了QXmppMessage::mamMessage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleStanza
bool QXmppSimpleArchiveManager::handleStanza(const QDomElement &element)
{
bool isIq = (element.tagName() == "iq");
if (!isIq && (element.tagName() != "message")) {
return false;
}
// XEP-0313: Message Archiving
if(isIq && !QXmppSimpleArchiveQueryIq::isSimpleArchiveQueryIq(element)) {
return false;
}
if (isIq && (element.attribute("type") == "result")) {
QString id = element.attribute("id");
if (m_pendingQueries.contains(id)) {
PendingQuery pendingQuery = m_pendingQueries.value(id);
m_pendingQueries.remove(id);
QXmppSimpleArchiveQueryIq packet;
packet.parse(element);
emit archiveMessagesReceived(pendingQuery.jid, pendingQuery.messages, packet.resultSetReply());
return true;
}
} else if (isIq && (element.attribute("type") == "error")) {
QDomElement queryElement = element.firstChildElement("query");
if (!queryElement.isNull()) {
QString queryId = queryElement.attribute("queryid");
if (m_pendingQueries.contains(queryId)) {
PendingQuery pendingQuery = m_pendingQueries.value(queryId);
m_pendingQueries.remove(queryId);
emit archiveMessagesReceived(pendingQuery.jid, pendingQuery.messages, QXmppResultSetReply());
return true;
}
}
} else {
// message, check for result UUID + query ID
QDomElement resultElement = element.firstChildElement("result");
if (!resultElement.isNull()) {
QString queryId = resultElement.attribute("queryid");
if (m_pendingQueries.contains(queryId)) {
QXmppMessage msg;
msg.parse(element);
m_pendingQueries[queryId].messages.append(msg.mamMessage());
return true;
} else {
qWarning() << "SimpleArchiveManager: unknown query ID:" << queryId;
}
}
}
return false;
}