// http://xmpp.org/extensions/xep-0234.html#example-8 void testSerialize_Xep0234_Example8() { std::string expected = "<jingle" " action=\"session-info\"" " initiator=\"[email protected]/orchard\"" " sid=\"a73sjjvkla37jfea\"" " xmlns=\"urn:xmpp:jingle:1\">" "<checksum xmlns=\"urn:xmpp:jingle:apps:file-transfer:4\">" "<file>" "<hash algo=\"sha-1\" xmlns=\"urn:xmpp:hashes:1\">VS2nSZMIUsaa5dIUHTdmsQ==</hash>" "</file>" "</checksum>" "</jingle>"; JinglePayload::ref payload = boost::make_shared<JinglePayload>(); payload->setAction(JinglePayload::SessionInfo); payload->setInitiator(JID("[email protected]/orchard")); payload->setSessionID("a73sjjvkla37jfea"); JingleFileTransferHash::ref hash = boost::make_shared<JingleFileTransferHash>(); hash->getFileInfo().addHash(HashElement("sha-1", Base64::decode("VS2nSZMIUsaa5dIUHTdmsQ=="))); payload->addPayload(hash); CPPUNIT_ASSERT_EQUAL(expected, createTestling()->serialize(payload)); }
void OutgoingJingleFileTransfer::sendSessionInfoHash() { SWIFT_LOG(debug) << std::endl; JingleFileTransferHash::ref hashElement = std::make_shared<JingleFileTransferHash>(); hashElement->getFileInfo().addHash(HashElement("sha-1", hashCalculator->getSHA1Hash())); hashElement->getFileInfo().addHash(HashElement("md5", hashCalculator->getMD5Hash())); session->sendInfo(hashElement); }