[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bugs-dist
Subject:    [Bug 116614] away messages are clobbered depending on the order they
From:       Jan Ritzerfeld <kde () bugs ! jan ! ritzerfeld ! net>
Date:       2006-04-30 21:26:21
Message-ID: 20060430212621.7499.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
         
http://bugs.kde.org/show_bug.cgi?id=116614         




------- Additional Comments From kde bugs jan ritzerfeld net  2006-04-30 23:26 \
------- SVN commit 535976 by jritzerfeld:

Backport fix:
Use the following method to determine the status message to 
be displayed (the term "contact" should be read as 
"contact of the metacontact" and "online" as "not offline"):
* Display the new status message if
 - the new status message is not empty and
 - the contact who set it is online or there are no contacts online at all.
* Otherwise display the first non-empty status message among all contacts
  online---or offline if there are no contacts online at all.
* If no status message is displayed yet display no status message at all.

CCBUG: 116614


 M  +33 -3     kopete/contactlist/kopetemetacontactlvi.cpp  
 M  +5 -5      protocols/jabber/jabberbasecontact.cpp  


--- branches/KDE/3.5/kdenetwork/kopete/kopete/contactlist/kopetemetacontactlvi.cpp \
#535975:535976  @ -796,15 +796,45  @
 		setTargetVisibility( true );
 }
 
-void KopeteMetaContactLVI::slotContactPropertyChanged( Kopete::Contact */*contact*/,
+void KopeteMetaContactLVI::slotContactPropertyChanged( Kopete::Contact *contact,
 	const QString &key, const QVariant &old, const QVariant &newVal )
 {
+//	if ( key == QString::fromLatin1("awayMessage") )
+//		kdDebug( 14000 ) << k_funcinfo << "contact=" << contact->contactId() << ", \
isonline=" << contact->isOnline() << ", alloffline=" << !m_metaContact->isOnline() << \
", oldvalue=" << old.toString() << ", newvalue=" << newVal.toString() << endl;  if ( \
key == QString::fromLatin1("awayMessage") && d->extraText && old != newVal )  {
-		if ( newVal.toString().isEmpty() )
-			d->extraText->setText( QString::null );
+		bool allOffline = !m_metaContact->isOnline();
+		if ( newVal.toString().isEmpty() || ( !contact->isOnline() && !allOffline ) )
+		{
+			// try to find a more suitable away message to be displayed when: 
+			// -new away message is empty or
+			// -contact who set it is offline and there are contacts online in the \
metacontact +			bool allAwayMessagesEmpty = true;
+			QPtrList<Kopete::Contact> contacts = m_metaContact->contacts();
+			for ( Kopete::Contact *c = contacts.first(); c; c = contacts.next() )
+			{
+//				kdDebug( 14000 ) << k_funcinfo << "ccontact=" << c->contactId() << ", \
isonline=" << c->isOnline() << ", awaymsg=" << c->property( key ).value().toString() \
<< endl; +				QString awayMessage( c->property( key ).value().toString() );
+				if ( ( allOffline || c->isOnline() ) && !awayMessage.isEmpty() )
+				{
+					// display this contact's away message when:
+					// -this contact's away message is not empty and
+					// -this contact is online or there are no contacts online at all
+					allAwayMessagesEmpty = false;
+					d->extraText->setText( awayMessage );
+					break;
+				}
+			}
+			if ( allAwayMessagesEmpty )
+				d->extraText->setText( QString::null );
+		}
 		else
+		{
+			// just use new away message when:
+			// -new away message is not empty and
+			// -contact who set it is online or there are no contacts online at all
 			d->extraText->setText( newVal.toString() );
+		}
 	} // wtf? KopeteMetaContact also connects this signals and emits photoChanged! why \
no connect photoChanged to slotPhotoChanged?  /*else if ( key == \
QString::fromLatin1("photo") && (m_metaContact->photoSourceContact() == contact) && \
(m_metaContact->photoSource() == Kopete::MetaContact::SourceContact))  {
--- branches/KDE/3.5/kdenetwork/kopete/protocols/jabber/jabberbasecontact.cpp \
#535975:535976  @ -267,6 +267,11  @
 
 	status = protocol()->resourceToKOS ( resource );
 
+	updateResourceList ();
+
+	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "New status for " << contactId () << \
" is " << status.description () << endl; +	setOnlineStatus ( status );
+
 	/*
 	 * Set away message property.
 	 * We just need to read it from the current resource.
 @ -280,11 +285,6  @
 		removeProperty ( protocol()->propAwayMessage );
 	}
 
-	updateResourceList ();
-
-	kdDebug (JABBER_DEBUG_GLOBAL) << k_funcinfo << "New status for " << contactId () << \
                " is " << status.description () << endl;
-	setOnlineStatus ( status );
-
 }
 
 QString JabberBaseContact::fullAddress ()


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic