Changeset - 408413abf255
[Not reviewed]
0 2 0
Jan Kaluza - 9 years ago 2016-02-18 12:25:29
jkaluza@redhat.com
Libpurple: Try to get topic when conversation is presented by libpurple.
2 files changed with 20 insertions and 8 deletions:
0 comments (0 inline, 0 general)
backends/libpurple/main.cpp
Show inline comments
 
@@ -1229,10 +1229,24 @@ static void conv_chat_remove_users(PurpleConversation *conv, GList *users) {
 
	}
 
}
 

	
 
gboolean conv_has_focus(PurpleConversation *conv) {
 
static gboolean conv_has_focus(PurpleConversation *conv) {
 
	return TRUE;
 
}
 

	
 
static void conv_chat_topic_changed(PurpleConversation *conv, const char *who, const char *topic) {
 
	PurpleAccount *account = purple_conversation_get_account_wrapped(conv);
 
	np->handleSubject(np->m_accounts[account], purple_conversation_get_name_wrapped(conv), topic ? topic : "", who ? who : "Spectrum 2");
 
}
 

	
 
static void conv_present(PurpleConversation *conv) {
 
	if (purple_conversation_get_type_wrapped(conv) == PURPLE_CONV_TYPE_CHAT) {
 
		const char *topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT_WRAPPED(conv));
 
		if (topic && *topic != '\0') {
 
			conv_chat_topic_changed(conv, topic, PURPLE_CONV_CHAT_WRAPPED(conv)->who);
 
		}
 
	}
 
}
 

	
 
static PurpleConversationUiOps conversation_ui_ops =
 
{
 
	NULL,
 
@@ -1244,7 +1258,7 @@ static PurpleConversationUiOps conversation_ui_ops =
 
	NULL,//conv_chat_rename_user,     /* chat_rename_user     */
 
	conv_chat_remove_users,    /* chat_remove_users    */
 
	NULL,//pidgin_conv_chat_update_user,     /* chat_update_user     */
 
	NULL,//pidgin_conv_present_conversation, /* present              */
 
	conv_present,//pidgin_conv_present_conversation, /* present              */
 
	conv_has_focus,//pidgin_conv_has_focus,            /* has_focus            */
 
	NULL,//pidgin_conv_custom_smiley_add,    /* custom_smiley_add    */
 
	NULL,//pidgin_conv_custom_smiley_write,  /* custom_smiley_write  */
 
@@ -1869,11 +1883,6 @@ static void gotAttention(PurpleAccount *account, const char *who, PurpleConversa
 
	np->handleAttention(np->m_accounts[account], w, "");
 
}
 

	
 
static void conv_chat_topic_changed(PurpleConversation *conv, const char *who, const char *topic) {
 
	PurpleAccount *account = purple_conversation_get_account_wrapped(conv);
 
	np->handleSubject(np->m_accounts[account], purple_conversation_get_name_wrapped(conv), topic ? topic : "", who ? who : "Spectrum 2");
 
}
 

	
 
static bool initPurple() {
 
	bool ret;
 

	
libtransport/Conversation.cpp
Show inline comments
 
@@ -132,8 +132,12 @@ void Conversation::handleRawMessage(boost::shared_ptr<Swift::Message> &message)
 
				if (!message->getSubject().empty()) {
 
					m_subject = message;
 
					if (m_sentInitialPresence == false) {
 
						LOG4CXX_INFO(logger, m_jid.toString() << ": Caching subject message, initial presence not sent yet.");
 
						return;
 
					}
 
					else {
 
						LOG4CXX_INFO(logger, m_jid.toString() << ": Forwarding subject message.");
 
					}
 
				}
 
				m_conversationManager->getComponent()->getFrontend()->sendMessage(message);
 
			}
 
@@ -406,7 +410,6 @@ void Conversation::handleParticipantChanged(const std::string &nick, Conversatio
 
		m_participants[nick].alias = alias;
 
	}
 

	
 

	
 
	BOOST_FOREACH(const Swift::JID &jid, m_jids) {
 
		presence->setTo(jid);
 
		m_conversationManager->getComponent()->getFrontend()->sendPresence(presence);
0 comments (0 inline, 0 general)