Bug 111329

Summary: Jabbe : JEP-0107: User Mood
Product: [Unmaintained] kopete Reporter: Nicolas L. <kde>
Component: Jabber PluginAssignee: Kopete Developers <kopete-bugs-null>
Status: RESOLVED FIXED    
Severity: wishlist CC: mattr, romainguinot
Priority: NOR    
Version First Reported In: unspecified   
Target Milestone: ---   
Platform: Mandriva RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: proposed patch to be able to reset a jabber mood back to none

Description Nicolas L. 2005-08-23 01:31:53 UTC
Version:            (using KDE KDE 3.4.2)
Installed from:    Mandriva RPMs

could we have the support for the JEP 107 ?

see here :

http://www.jabber.org/jeps/jep-0107.html
Comment 1 Nicolas L. 2007-07-13 13:53:44 UTC
can someone take a look at this ?    ( psi have it now )
Comment 2 Tomas Racek 2009-01-30 17:26:54 UTC
*** This bug has been confirmed by popular vote. ***
Comment 3 Romain GUINOT 2009-10-01 11:18:05 UTC
resetting a user mood back to none does not work right now. 
Currently, in protocols/jabber/jabberaccount.cpp (1109-1122)  nothing is done when the mood is 'None'. According to the spec (http://xmpp.org/extensions/xep-0107.html#proto-pubsub), an empty mood tag with no payload should be sent. 

Code snippet : 

void JabberAccount::slotSetMood()
{
    KAction *action = (KAction *)sender();
    Mood::Type type = (Mood::Type)action->data().toInt();
    if(type == Mood::None)
    {
    }
    else
    {
        PubSubItem psi("current", Mood(type).toXml(*client()->client()->rootTask()->doc()));
        JT_PubSubPublish *task = new JT_PubSubPublish(client()->client()->rootTask(), QString("http://jabber.org/protocol/mood"), psi);
        task->go(true);
    }
}


I think this if check should be removed and the pubsub should be sent even if the type is 'None'. 

It looks like the toXml method in mood.cpp would need to be changed to not create a sub-QDomElement when mood id points to None and just return and self-closing <mood xmlns='http://jabber.org/protocol/mood'/> tag. 

I currently do not have the time to set up a build environment and test this,but it should be an easy fix for someone who knows the API and has a build env up and running. 

I'll try it myself in the next few days probably. 

Regards,
Comment 4 Romain GUINOT 2009-10-04 17:27:55 UTC
Created attachment 37357 [details]
proposed patch to be able to reset a jabber mood back to none
Comment 5 Matt Rogers 2009-10-10 05:08:26 UTC
SVN commit 1033390 by mattr:

Fix setting user mood to 'None'

Patch by Romain GUINOT. Thanks!
This is the KDE 4.3 version of the patch.
CCBUG: 111329

 M  +5 -9      jabberaccount.cpp  
 M  +13 -9     tasks/mood.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1033390
Comment 6 Matt Rogers 2009-10-10 22:00:43 UTC
SVN commit 1033693 by mattr:

Fix setting user mood to 'None'

Patch by Romain GUINOT. Thanks!
This is the KDE 4.4 version of the patch. It will also be fixed for KDE
4.3.3
BUG: 111329

 M  +5 -9      jabberaccount.cpp  
 M  +13 -9     tasks/mood.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1033693