working message dispatching
This commit is contained in:
parent
bc585576a9
commit
4c87620c9f
4 changed files with 18 additions and 7 deletions
|
@ -325,16 +325,21 @@ static void conv_write_im(PurpleConversation *conv, const char *who, const char
|
|||
// boost::shared_ptr<Swift::Message> msg(new Swift::Message());
|
||||
|
||||
char *striped = purple_markup_strip_html(message);
|
||||
std::string msg = stripped;
|
||||
std::string msg = striped;
|
||||
g_free(striped);
|
||||
|
||||
np->handleMessage(np->m_accounts[account], who, msg);
|
||||
std::string w = who;
|
||||
size_t pos = w.find("/");
|
||||
if (pos != std::string::npos)
|
||||
w.erase((int) pos, w.length() - (int) pos);
|
||||
|
||||
np->handleMessage(np->m_accounts[account], w, msg);
|
||||
}
|
||||
|
||||
static PurpleConversationUiOps conversation_ui_ops =
|
||||
{
|
||||
conv_new,
|
||||
conv_destroy,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,//conv_write_chat, /* write_chat */
|
||||
conv_write_im, /* write_im */
|
||||
NULL,//conv_write_conv, /* write_conv */
|
||||
|
|
|
@ -3,5 +3,7 @@ FILE(GLOB SRC *.cpp)
|
|||
|
||||
ADD_EXECUTABLE(spectrum ${SRC})
|
||||
|
||||
ADD_DEPENDENCIES(spectrum libpurple_backend)
|
||||
|
||||
target_link_libraries(spectrum ${PURPLE_LIBRARY} ${GLIB2_LIBRARIES} ${EVENT_LIBRARIES} transport)
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ void NetworkPlugin::handleMessage(const std::string &user, const std::string &le
|
|||
m.SerializeToString(&message);
|
||||
|
||||
WRAP(message, pbnetwork::WrapperMessage_Type_TYPE_CONV_MESSAGE);
|
||||
std::cout << "SENDING MESSAGE\n";
|
||||
|
||||
send(message);
|
||||
}
|
||||
|
@ -106,7 +107,8 @@ void NetworkPlugin::handleDisconnected(const std::string &user, const std::strin
|
|||
void NetworkPlugin::handleConnected(bool error) {
|
||||
if (error) {
|
||||
std::cout << "Connecting error\n";
|
||||
m_reconnectTimer->start();
|
||||
// m_reconnectTimer->start();
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
std::cout << "Connected\n";
|
||||
|
@ -116,7 +118,8 @@ void NetworkPlugin::handleConnected(bool error) {
|
|||
|
||||
void NetworkPlugin::handleDisconnected() {
|
||||
std::cout << "Disconnected\n";
|
||||
m_reconnectTimer->start();
|
||||
// m_reconnectTimer->start();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void NetworkPlugin::connect() {
|
||||
|
|
|
@ -195,11 +195,12 @@ void NetworkPluginServer::handleBuddyChangedPayload(const std::string &data) {
|
|||
|
||||
void NetworkPluginServer::handleConvMessagePayload(const std::string &data) {
|
||||
pbnetwork::ConversationMessage payload;
|
||||
std::cout << "payload...\n";
|
||||
if (payload.ParseFromString(data) == false) {
|
||||
// TODO: ERROR
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "payload 2...\n";
|
||||
User *user = m_userManager->getUser(payload.username());
|
||||
if (!user)
|
||||
return;
|
||||
|
|
Loading…
Add table
Reference in a new issue