Index: WAConnection.cpp =================================================================== --- WAConnection.cpp (revision 15145) +++ WAConnection.cpp (working copy) @@ -198,6 +198,9 @@ parseReceipt(node); else if (ProtocolTreeNode::tagEquals(node, "chatstate")) parseChatStates(node); + else { + rawConn->log("Warning: Node parsing not handled:\n", tmp.c_str()); + } delete node; return true; @@ -546,15 +549,11 @@ if (bodyNode != NULL && m_pGroupEventHandler != NULL) m_pGroupEventHandler->onGroupNewSubject(from, participant, bodyNode->getDataAsString(), ts); } + else { + rawConn->log("Warning: Unknown Notification received:\n", node->toString().c_str()); + } - ProtocolTreeNode sendNode("ack"); - sendNode << XATTR("to", from) << XATTR("id", id) << XATTR("type", type) << XATTR("class", "notification"); - const string &to = node->getAttributeValue("to"); - if (!to.empty()) - sendNode << XATTR("from", to); - if (!participant.empty()) - sendNode << XATTR("participant", participant); - out.write(sendNode); + sendAck(node, "notification"); } void WAConnection::parsePresense(ProtocolTreeNode *node) throw(WAException) @@ -606,8 +605,7 @@ m_pEventHandler->onMessageStatusUpdate(msg); } - out.write(ProtocolTreeNode("ack") - << XATTR("to", from) << XATTR("id", id) << XATTR("type", "read") << XATTRI("t", time(0))); + sendAck(node,"receipt"); } std::vector* WAConnection::processGroupSettings(const std::vector& groups) @@ -730,6 +728,28 @@ out.write(ProtocolTreeNode("presence") << XATTR("type", "inactive")); } +void WAConnection::sendAck(ProtocolTreeNode * node, const string classType) { + const string &from = node->getAttributeValue("from"); + const string &to = node->getAttributeValue("to"); + const string &participant = node->getAttributeValue("participant"); + const string &id = node->getAttributeValue("id"); + const string &type = node->getAttributeValue("type"); + + ProtocolTreeNode sendNode("ack"); + if (!to.empty()) + sendNode << XATTR("from", to); + if (!participant.empty()) + sendNode << XATTR("participant", participant); + sendNode + << XATTR("to", from) + << XATTR("id", id) + << XATTR("class", classType); + if (!type.empty()) + sendNode << XATTR("type", type); + + out.write(sendNode); +} + ///////////////////////////////////////////////////////////////////////////////////////// ProtocolTreeNode* WAConnection::getMessageNode(FMessage* message, ProtocolTreeNode *child) @@ -794,7 +814,7 @@ void WAConnection::sendMessageReceived(const FMessage &message) throw(WAException) { out.write(ProtocolTreeNode("receipt") << XATTR("type", "read") - << XATTR("to", message.key.remote_jid) << XATTR("id", message.key.id) << XATTRI("t", (int)time(0))); + << XATTR("to", message.key.remote_jid) << XATTR("id", message.key.id)); } ///////////////////////////////////////////////////////////////////////////////////////// Index: WAConnection.h =================================================================== --- WAConnection.h (revision 15145) +++ WAConnection.h (working copy) @@ -381,6 +381,7 @@ bool read() throw(WAException); + void sendAck(ProtocolTreeNode * node, const string classType); void sendPing() throw(WAException); void sendQueryLastOnline(const std::string &jid) throw (WAException); void sendPong(const std::string &id) throw(WAException);