I create patch, which add option to jabber account for merging all messages from all contact's resources to one window/tab.

--
Pali Rohár
pali.ro...@gmail.com


On 21.06.2009 12:57, Detlev Casanova wrote:
On Saturday 20 June 2009 21:37:32 Jan Ritzerfeld wrote:
Am Samstag, 20. Juni 2009 schrieb Pali Rohár:
Hello,
if I chating with somebody throw jabber protocol and he change
resource, all new messages from him are shown in new tab (or window).
https://bugs.kde.org/show_bug.cgi?id=111537
https://bugs.kde.org/show_bug.cgi?id=142650
https://bugs.kde.org/show_bug.cgi?id=175078
https://bugs.kde.org/show_bug.cgi?id=194808

It is possible set up kopete to show all incomming messages from all
jabber contacts resources to one tab?
And to which address the outgoing messages should be sent?
There is also the fact that some people want different chat windows for
different resources.

Maybe add an option to redirect messages from all contact's resources to the
same chat window.

Detlev.



------------------------------------------------------------------------

_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel
Index: jabberaccount.h
===================================================================
--- jabberaccount.h	(revision 985213)
+++ jabberaccount.h	(working copy)
@@ -128,6 +128,16 @@
 	 * called when the account is removed in the config ui
 	*/
 	virtual bool removeAccount();
+
+	/**
+	 * return if kopete show all messges from all resources to one session
+	 */
+	bool mergeMessages();
+
+	/**
+	 * set if kopete will merge all messages to one session
+	 */
+	void setMergeMessages(bool b);
 	
 #ifdef JINGLE_SUPPORT
 	JingleCallsManager *jingleCallsManager() const {return m_jcm;}
Index: jabbercontact.cpp
===================================================================
--- jabbercontact.cpp	(revision 985213)
+++ jabbercontact.cpp	(working copy)
@@ -341,7 +341,10 @@
 					m.setPlainBody( i18n("%1 has ended his/her participation in the chat session.", metaContact()->displayName()) );
 					m.setDirection( Kopete::Message::Internal );
 
-					mManager->appendMessage ( m, message.from().resource () );
+					if ( account()->mergeMessages() )
+						mManager->appendMessage ( m, QString::null );
+					else
+						mManager->appendMessage ( m, message.from().resource () );
 				}
 			}
 		}
@@ -426,7 +429,10 @@
 	// append message to (eventually new) manager and preselect the originating resource
 	if ( newMessage )
 	{
-		mManager->appendMessage ( *newMessage, message.from().resource () );
+		if ( account()->mergeMessages() )
+			mManager->appendMessage ( *newMessage, QString::null );
+		else
+			mManager->appendMessage ( *newMessage, message.from().resource () );
 
 		delete newMessage;
 	}
@@ -450,7 +456,10 @@
 		msg.setDirection( Kopete::Message::Inbound );
 		msg.setRequestedPlugin( viewPlugin );
 
-		mManager->appendMessage ( msg, message.from().resource () );
+		if ( account()->mergeMessages() )
+			mManager->appendMessage ( msg, QString::null );
+		else
+			mManager->appendMessage ( msg, message.from().resource () );
 	}
 }
 
Index: jabberaccount.cpp
===================================================================
--- jabberaccount.cpp	(revision 985213)
+++ jabberaccount.cpp	(working copy)
@@ -1720,6 +1720,16 @@
 		Kopete::AccountManager::self()->removeAccount( this ); //this will delete this
 }
 
+void JabberAccount::setMergeMessages(bool b)
+{
+	configGroup()->writeEntry("MergeMessages", b);
+}
+
+bool JabberAccount::mergeMessages()
+{
+	return configGroup()->readEntry("MergeMessages", false);
+}
+
 /*
 JabberMoodAction::JabberMoodAction(const Mood::Type type, QObject *parent):
 KAction(parent)
Index: ui/jabbereditaccountwidget.cpp
===================================================================
--- ui/jabbereditaccountwidget.cpp	(revision 985213)
+++ ui/jabbereditaccountwidget.cpp	(working copy)
@@ -226,6 +226,8 @@
 	cbSendGoneEvent->setChecked( account()->configGroup()->readEntry("SendGoneEvent", true) );
 
 	cbHideSystemInfo->setChecked( account()->configGroup()->readEntry("HideSystemInfo", false) );
+
+	mergeMessages->setChecked(account()->mergeMessages());
 }
 
 Kopete::Account *JabberEditAccountWidget::apply ()
@@ -295,6 +297,8 @@
 	account()->configGroup()->writeEntry("SendGoneEvent", cbSendGoneEvent->isChecked());
 	
 	account()->configGroup()->writeEntry("HideSystemInfo", cbHideSystemInfo->isChecked());
+
+	account()->setMergeMessages(mergeMessages->isChecked());
 }
 
 bool JabberEditAccountWidget::validateData ()
Index: ui/dlgjabbereditaccountwidget.ui
===================================================================
--- ui/dlgjabbereditaccountwidget.ui	(revision 985213)
+++ ui/dlgjabbereditaccountwidget.ui	(working copy)
@@ -590,6 +590,13 @@
         </widget>
        </item>
        <item>
+        <widget class="QCheckBox" name="mergeMessages">
+         <property name="text">
+         <string>Merge all messages from all resources to one window/tab</string>
+         </property>
+        </widget>
+       </item>
+       <item>
         <spacer>
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel

Reply via email to