コード例 #1
0
	void testMessageWithLabelItem() {
		boost::shared_ptr<SecurityLabel> label = boost::make_shared<SecurityLabel>();
		label->setLabel("a");
		SecurityLabelsCatalog::Item labelItem;
		labelItem.setSelector("Bob");
		labelItem.setLabel(label);
		window_->label_ = labelItem;
		boost::shared_ptr<DiscoInfo> features = boost::make_shared<DiscoInfo>();
		features->addFeature(DiscoInfo::SecurityLabelsCatalogFeature);
		controller_->setAvailableServerFeatures(features);
		IQ::ref iq = iqChannel_->iqs_[iqChannel_->iqs_.size() - 1];
		SecurityLabelsCatalog::ref labelPayload = boost::make_shared<SecurityLabelsCatalog>();
		labelPayload->addItem(labelItem);
		IQ::ref result = IQ::createResult(self_, iq->getID(), labelPayload);
		iqChannel_->onIQReceived(result);
		std::string messageBody("agamemnon");
		window_->onSendMessageRequest(messageBody, false);
		boost::shared_ptr<Stanza> rawStanza = stanzaChannel_->sentStanzas[stanzaChannel_->sentStanzas.size() - 1];
		Message::ref message = boost::dynamic_pointer_cast<Message>(rawStanza);
		CPPUNIT_ASSERT_EQUAL(iq->getTo(), result->getFrom());
		CPPUNIT_ASSERT(window_->labelsEnabled_);
		CPPUNIT_ASSERT(stanzaChannel_->isAvailable()); /* Otherwise will prevent sends. */
		CPPUNIT_ASSERT(message);
		CPPUNIT_ASSERT_EQUAL(messageBody, message->getBody());
		CPPUNIT_ASSERT_EQUAL(label, message->getPayload<SecurityLabel>());
	}
コード例 #2
0
		void testAddFromNonAccount() {
			boost::shared_ptr<XMPPRosterController> testling(createController());

			boost::shared_ptr<RosterPayload> payload(new RosterPayload());
			payload->addItem(RosterItemPayload(jid1_, "Bob", RosterItemPayload::Both));
			IQ::ref request = IQ::createRequest(IQ::Set, JID(), "eou", payload);
			request->setFrom(jid2_);
			channel_->onIQReceived(request);

			CPPUNIT_ASSERT_EQUAL(None, handler_->getLastEvent());
		}
コード例 #3
0
ファイル: IBBReceiveSessionTest.cpp プロジェクト: swift/swift
 IQ::ref createIBBRequest(IBB::ref ibb, const JID& from, const std::string& id) {
     IQ::ref request = IQ::createRequest(IQ::Set, JID("[email protected]/dum"), id, ibb);
     request->setFrom(from);
     return request;
 }