[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kopete/protocols/jabber
From: Pali Rohár <pali.rohar () gmail ! com>
Date: 2013-06-01 20:55:35
Message-ID: 20130601205535.23A95AC85D () svn ! kde ! org
[Download RAW message or body]
SVN commit 1356748 by pali:
In jabber protocol Top Level group is without name
M +21 -0 jabberaccount.cpp
M +15 -3 jabberbasecontact.cpp
M +6 -1 jabbercontact.cpp
--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberaccount.cpp #1356747:1356748
@@ -289,8 +289,16 @@
QStringList groupNames;
Kopete::GroupList groupList = metaContact->groups();
foreach( Kopete::Group *group, groupList )
+ {
+ if (group->type() == Kopete::Group::Normal)
groupNames += group->displayName();
+ else if (group->type() == Kopete::Group::TopLevel)
+ groupNames += QString();
+ }
+ if(groupNames.size() == 1 && groupNames.at(0).isEmpty())
+ groupNames.clear();
+
XMPP::Jid jid ( contactId );
XMPP::RosterItem item ( jid );
item.setName ( metaContact->displayName () );
@@ -1246,8 +1254,16 @@
QStringList groupNames;
Kopete::GroupList groupList = parentContact->groups();
foreach(Kopete::Group *group,groupList)
+ {
+ if (group->type() == Kopete::Group::Normal)
groupNames += group->displayName();
+ else if (group->type() == Kopete::Group::TopLevel)
+ groupNames += QString();
+ }
+ if(groupNames.size() == 1 && groupNames.at(0).isEmpty())
+ groupNames.clear();
+
XMPP::RosterItem item;
item.setJid ( jid );
@@ -1329,7 +1345,12 @@
// add this metacontact to all groups the contact is a member of
for (QStringList::Iterator it = groups.begin (); it != groups.end (); ++it)
+ {
+ if ( it->isEmpty() )
+ metaContact->addToGroup (Kopete::Group::topLevel ());
+ else
metaContact->addToGroup (Kopete::ContactList::self ()->findGroup (*it));
+ }
// put it onto contact list
Kopete::ContactList::self ()->addMetaContact ( metaContact );
--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabberbasecontact.cpp #1356747:1356748
@@ -148,8 +148,11 @@
// find all groups our contact is in but that are not in the server side roster
for ( int i = 0; i < metaContact()->groups().count (); i++ )
{
- if ( !item.groups().contains ( metaContact()->groups().at(i)->displayName () ) )
- groupsToRemoveFrom.append ( metaContact()->groups().at ( i ) );
+ Kopete::Group *gr = metaContact()->groups().at ( i );
+ if ( gr->type () == Kopete::Group::Normal && !item.groups().contains ( gr->displayName () ) )
+ groupsToRemoveFrom.append ( gr );
+ else if ( gr->type () == Kopete::Group::TopLevel && !item.groups().contains ( QString () ) )
+ groupsToRemoveFrom.append ( gr );
}
// now find all groups that are in the server side roster but not in the local group
@@ -158,15 +161,24 @@
bool found = false;
for ( int j = 0; j < metaContact()->groups().count (); j++)
{
- if ( metaContact()->groups().at(j)->displayName () == item.groups().at(i) )
+ Kopete::Group *gr = metaContact()->groups().at ( j );
+ if ( gr->type () == Kopete::Group::Normal && gr->displayName () == item.groups().at(i) )
{
found = true;
break;
}
+ else if ( gr->type () == Kopete::Group::TopLevel && item.groups().at(i).isEmpty() )
+ {
+ found = true;
+ break;
}
+ }
if ( !found )
{
+ if ( item.groups().at(i).isEmpty() )
+ groupsToAddTo.append ( Kopete::Group::topLevel() );
+ else
groupsToAddTo.append ( Kopete::ContactList::self()->findGroup ( item.groups().at(i) ) );
}
}
--- trunk/KDE/kdenetwork/kopete/protocols/jabber/jabbercontact.cpp #1356747:1356748
@@ -1088,10 +1088,15 @@
foreach ( Kopete::Group * g, groupList )
{
- if ( g->type () != Kopete::Group::TopLevel )
+ if ( g->type () == Kopete::Group::Normal )
groups += g->displayName ();
+ else if ( g->type () == Kopete::Group::TopLevel )
+ groups += QString();
}
+ if(groups.size() == 1 && groups.at(0).isEmpty())
+ groups.clear();
+
if(mRosterItem.groups() != groups)
{
changed=true;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic