soc.2009.transport: 3d703681: First support for private messages on IR...

hanzz at soc.pidgin.im hanzz at soc.pidgin.im
Mon Jul 13 05:55:21 EDT 2009


-----------------------------------------------------------------
Revision: 3d70368154675b7ed891b78a3f32dc901cb54121
Ancestor: 0aff5696158cd4874ce8d4d90600e2f870411368
Author: hanzz at soc.pidgin.im
Date: 2009-07-13T09:51:53
Branch: im.pidgin.soc.2009.transport
URL: http://d.pidgin.im/viewmtn/revision/info/3d70368154675b7ed891b78a3f32dc901cb54121

Modified files:
        user.cpp

ChangeLog: 

First support for private messages on IRC

-------------- next part --------------
============================================================
--- user.cpp	40187bff7aece6e31d0437cce6a2c73fc511cb3f
+++ user.cpp	9710394a6ae94f9feae64ad2271b5e3ed0386f7d
@@ -561,6 +561,7 @@ void User::purpleConversationWriteIM(Pur
 	if (name.empty())
 		return;
 	std::for_each( name.begin(), name.end(), replaceBadJidCharacters() );
+	std::transform(name.begin(), name.end(), name.begin(),(int(*)(int)) std::tolower);
 	// new message from legacy network has been received
 	if (!isOpenedConversation(name)) {
 			m_conversations[name].conv = conv;
@@ -761,15 +762,18 @@ void User::receivedMessage(const Message
 void User::receivedMessage(const Message& msg){
 	PurpleConversation * conv;
 	std::string username = msg.to().username();
-	if (!p->protocol()->isMUC(this, username))
+	if (!p->protocol()->isMUC(this, username)) {
 		std::for_each( username.begin(), username.end(), replaceJidCharacters() );
+	}
+	else if (!msg.to().resource().empty())
+		username = msg.to().resource();
 	// open new conversation or get the opened one
 	if (!isOpenedConversation(username)){
 		conv = purple_conversation_new(PURPLE_CONV_TYPE_IM,m_account,username.c_str());
 		m_conversations[username].conv = conv;
 		m_conversations[username].resource = msg.from().resource();
 	}
-	else{
+	else {
 		conv = m_conversations[username].conv;
 		m_conversations[username].resource = msg.from().resource();
 	}


More information about the Commits mailing list