void testHandleAckReceived_AcksMultipleStanzas() { std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createIQ("iq1")); testling->handleStanzaSent(createPresence("p1")); testling->handleStanzaSent(createMessage("m1")); testling->handleAckReceived(3); CPPUNIT_ASSERT_EQUAL(3, static_cast<int>(ackedStanzas.size())); CPPUNIT_ASSERT_EQUAL(std::string("iq1"), ackedStanzas[0]->getID()); CPPUNIT_ASSERT_EQUAL(std::string("p1"), ackedStanzas[1]->getID()); CPPUNIT_ASSERT_EQUAL(std::string("m1"), ackedStanzas[2]->getID()); }
static void onBindElementsReceived(jw_event_data event, void *arg) { UNUSED_PARAM(arg); jw_stream *stream = event->source; jw_dom_node **data = event->data; jw_event_unbind( jw_stream_event(stream, JW_STREAM_EVENT_ELEMRECV), onBindElementsReceived); if (data) { const char *ename = jw_dom_get_ename(data[0]); if (jw_strcmp(ename, XMPP_CLIENT_IQ) == 0) { printf("received bind iq\n"); jw_log(JW_LOG_INFO, "resource binding jid: [%s]", findJidFromBind(data[0])); jw_stream_send(stream, createPresence(), NULL); } } }
void testHandleStanzaSent_PresenceDoesNotRequestAck() { std::shared_ptr<StanzaAckRequester> testling(createRequester()); testling->handleStanzaSent(createPresence("p1")); CPPUNIT_ASSERT_EQUAL(0, acksRequested); }