diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-08-20 14:28:10 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-08-20 14:28:10 (GMT) |
commit | 7e78cc2b173db39f12e92a929ad17b706877e33d (patch) | |
tree | fdebc18a100fe1d16e174262297dbd7a4016abe9 /Swiften/Roster/GroupRosterItem.cpp | |
parent | b3de442223a5b3281c159b34f047d715da8ca3c9 (diff) | |
download | swift-contrib-7e78cc2b173db39f12e92a929ad17b706877e33d.zip swift-contrib-7e78cc2b173db39f12e92a929ad17b706877e33d.tar.bz2 |
Don't include status in MUC roster sorting.
Resolves: #536
Diffstat (limited to 'Swiften/Roster/GroupRosterItem.cpp')
-rw-r--r-- | Swiften/Roster/GroupRosterItem.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Swiften/Roster/GroupRosterItem.cpp b/Swiften/Roster/GroupRosterItem.cpp index bf4f838..aa9fdd4 100644 --- a/Swiften/Roster/GroupRosterItem.cpp +++ b/Swiften/Roster/GroupRosterItem.cpp @@ -12,7 +12,7 @@ namespace Swift { -GroupRosterItem::GroupRosterItem(const String& name, GroupRosterItem* parent) : RosterItem(name, parent) { +GroupRosterItem::GroupRosterItem(const String& name, GroupRosterItem* parent, bool sortByStatus) : RosterItem(name, parent), sortByStatus_(sortByStatus) { expanded_ = true; } @@ -115,11 +115,15 @@ bool GroupRosterItem::sortDisplayed() { // return false; // } //Sholudn't need stable_sort here - std::sort(displayedChildren_.begin(), displayedChildren_.end(), itemLessThan); + std::sort(displayedChildren_.begin(), displayedChildren_.end(), sortByStatus_? itemLessThanWithStatus : itemLessThanWithoutStatus); return true; } -bool GroupRosterItem::itemLessThan(const RosterItem* left, const RosterItem* right) { +bool GroupRosterItem::itemLessThanWithoutStatus(const RosterItem* left, const RosterItem* right) { + return left->getSortableDisplayName() < right->getSortableDisplayName(); +} + +bool GroupRosterItem::itemLessThanWithStatus(const RosterItem* left, const RosterItem* right) { const ContactRosterItem* leftContact = dynamic_cast<const ContactRosterItem*>(left); const ContactRosterItem* rightContact = dynamic_cast<const ContactRosterItem*>(right); if (leftContact) { |