Merge remote branch 'upstream/master'
This commit is contained in:
commit
69ef086b17
7 changed files with 62 additions and 11 deletions
|
@ -15,6 +15,15 @@ message(STATUS "|- log4cxx : -DLOG4CXX_INCLUDE_DIR, -DLOG4CXX_LIBRARY")
|
|||
message(STATUS "|- purple : -DPURPLE_INCLUDE_DIR, -DPURPLE_LIBRARY")
|
||||
message(STATUS " : -DPURPLE_NOT_RUNTIME - enables compilation with libpurple.lib")
|
||||
|
||||
MACRO(LIST_CONTAINS var value)
|
||||
SET(${var})
|
||||
FOREACH (value2 ${ARGN})
|
||||
IF (${value} STREQUAL ${value2})
|
||||
SET(${var} TRUE)
|
||||
ENDIF (${value} STREQUAL ${value2})
|
||||
ENDFOREACH (value2)
|
||||
ENDMACRO(LIST_CONTAINS)
|
||||
|
||||
if(NOT LIB_INSTALL_DIR)
|
||||
set(LIB_INSTALL_DIR "lib")
|
||||
endif()
|
||||
|
@ -131,7 +140,12 @@ if (WIN32)
|
|||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
find_package(Boost COMPONENTS program_options date_time system filesystem regex thread signals REQUIRED)
|
||||
else(WIN32)
|
||||
find_package(Boost COMPONENTS program_options date_time system filesystem regex thread signals REQUIRED)
|
||||
LIST_CONTAINS(contains -lboost_program_options ${SWIFTEN_LIBRARY})
|
||||
if(contains)
|
||||
message(STATUS "Using non-multithreaded boost")
|
||||
set(Boost_USE_MULTITHREADED 0)
|
||||
endif(contains)
|
||||
find_package(Boost COMPONENTS program_options date_time system filesystem regex thread-mt signals REQUIRED)
|
||||
endif(WIN32)
|
||||
|
||||
message( STATUS "Found Boost: ${Boost_LIBRARIES}, ${Boost_INCLUDE_DIR}")
|
||||
|
|
|
@ -561,6 +561,7 @@ class SpectrumNetworkPlugin : public NetworkPlugin {
|
|||
void handleTypingRequest(const std::string &user, const std::string &buddyName) {
|
||||
PurpleAccount *account = m_sessions[user];
|
||||
if (account) {
|
||||
LOG4CXX_INFO(logger, user << ": sending typing notify to " << buddyName);
|
||||
serv_send_typing_wrapped(purple_account_get_connection_wrapped(account), buddyName.c_str(), PURPLE_TYPING);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ admin_password=test
|
|||
#cert=server.pfx #patch to PKCS#12 certificate
|
||||
#cert_password=test #password to that certificate if any
|
||||
users_per_backend=10
|
||||
#backend=../..//backends/swiften/spectrum2_swiften_backend
|
||||
backend=../..//backends/libpurple/spectrum2_libpurple_backend
|
||||
#backend=../../backends/twitter/spectrum2_twitter_backend
|
||||
backend=/home/hanzz/code/libtransport/backends/libpurple/spectrum2_libpurple_backend
|
||||
protocol=prpl-jabber
|
||||
#backend=/home/hanzz/code/libtransport/backends/libpurple/spectrum2_communi_backend
|
||||
protocol=prpl-icq
|
||||
#protocol=prpl-msn
|
||||
#protocol=any
|
||||
#protocol=prpl-icq
|
||||
|
|
|
@ -25,6 +25,7 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
|
|||
CPPUNIT_TEST_SUITE(ConversationManagerTest);
|
||||
CPPUNIT_TEST(handleNormalMessages);
|
||||
CPPUNIT_TEST(handleGroupchatMessages);
|
||||
CPPUNIT_TEST(handleChatstateMessages);
|
||||
CPPUNIT_TEST(handleParticipantChanged);
|
||||
CPPUNIT_TEST(handlePMFromXMPP);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
@ -55,6 +56,38 @@ class ConversationManagerTest : public CPPUNIT_NS :: TestFixture, public BasicTe
|
|||
m_msg = _msg;
|
||||
}
|
||||
|
||||
void handleChatstateMessages() {
|
||||
User *user = userManager->getUser("user@localhost");
|
||||
|
||||
TestingConversation *conv = new TestingConversation(user->getConversationManager(), "buddy1");
|
||||
user->getConversationManager()->addConversation(conv);
|
||||
conv->onMessageToSend.connect(boost::bind(&ConversationManagerTest::handleMessageReceived, this, _1, _2));
|
||||
|
||||
boost::shared_ptr<Swift::Message> msg(new Swift::Message());
|
||||
msg->addPayload(boost::make_shared<Swift::ChatState>(Swift::ChatState::Composing));
|
||||
|
||||
// Forward it
|
||||
conv->handleMessage(msg);
|
||||
loop->processEvents();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(1, (int) received.size());
|
||||
CPPUNIT_ASSERT(dynamic_cast<Swift::Message *>(getStanza(received[0])));
|
||||
CPPUNIT_ASSERT(dynamic_cast<Swift::Message *>(getStanza(received[0]))->getPayload<Swift::ChatState>());
|
||||
received.clear();
|
||||
|
||||
// send response
|
||||
msg->setFrom("user@localhost/resource");
|
||||
msg->setTo("buddy1@localhost/bot");
|
||||
injectMessage(msg);
|
||||
loop->processEvents();
|
||||
|
||||
CPPUNIT_ASSERT_EQUAL(0, (int) received.size());
|
||||
CPPUNIT_ASSERT(m_msg);
|
||||
CPPUNIT_ASSERT(m_msg->getPayload<Swift::ChatState>());
|
||||
|
||||
received.clear();
|
||||
}
|
||||
|
||||
void handleNormalMessages() {
|
||||
User *user = userManager->getUser("user@localhost");
|
||||
|
||||
|
|
|
@ -205,6 +205,7 @@ class UserTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
|
|||
}
|
||||
|
||||
void handleDisconnectedReconnect() {
|
||||
readyToConnect = false;
|
||||
User *user = userManager->getUser("user@localhost");
|
||||
user->handleDisconnected("Connection error");
|
||||
loop->processEvents();
|
||||
|
@ -212,6 +213,7 @@ class UserTest : public CPPUNIT_NS :: TestFixture, public BasicTest {
|
|||
CPPUNIT_ASSERT(!streamEnded);
|
||||
user = userManager->getUser("user@localhost");
|
||||
CPPUNIT_ASSERT(user);
|
||||
CPPUNIT_ASSERT(readyToConnect);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
@ -348,6 +348,7 @@ void User::handleDisconnected(const std::string &error, Swift::SpectrumErrorPayl
|
|||
// TODO: If this stops working, create onReconnect signal
|
||||
m_userManager->onUserDestroyed(this);
|
||||
m_userManager->onUserCreated(this);
|
||||
onReadyToConnect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -334,7 +334,13 @@ void UserManager::handleMessageReceived(Swift::Message::ref message) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (message->getBody().empty()) {
|
||||
// Do not count chatstate notification...
|
||||
boost::shared_ptr<Swift::ChatState> statePayload = message->getPayload<Swift::ChatState>();
|
||||
if (!statePayload) {
|
||||
messageToBackendSent();
|
||||
}
|
||||
|
||||
if (message->getBody().empty() && !statePayload) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -344,12 +350,6 @@ void UserManager::handleMessageReceived(Swift::Message::ref message) {
|
|||
}
|
||||
|
||||
user->getConversationManager()->handleMessageReceived(message);
|
||||
|
||||
// Do not count chatstate notification...
|
||||
boost::shared_ptr<Swift::ChatState> statePayload = message->getPayload<Swift::ChatState>();
|
||||
if (!statePayload) {
|
||||
messageToBackendSent();
|
||||
}
|
||||
}
|
||||
|
||||
void UserManager::handleGeneralPresenceReceived(Swift::Presence::ref presence) {
|
||||
|
|
Loading…
Add table
Reference in a new issue