From 8520b85226d8486fe4069a3f5eb9cb340514866d Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Mon, 4 Oct 2010 17:25:19 +0100
Subject: Re-apply the contact's presence after roster changes.

Resolves: #578

diff --git a/Swift/Controllers/RosterController.cpp b/Swift/Controllers/RosterController.cpp
index 96056ca..48a3aa9 100644
--- a/Swift/Controllers/RosterController.cpp
+++ b/Swift/Controllers/RosterController.cpp
@@ -146,6 +146,10 @@ void RosterController::handleOnJIDUpdated(const JID& jid, const String& oldName,
 			roster_->removeContactFromGroup(jid, group);
 		}
 	}
+	Presence::ref presence(presenceOracle_->getHighestPriorityPresence(jid));
+	if (presence) {
+		roster_->applyOnItems(SetPresence(presence));
+	}
 }
 
 void RosterController::handleUIEvent(boost::shared_ptr<UIEvent> event) {
diff --git a/Swift/QtUI/QtSetGroupsDialog.cpp b/Swift/QtUI/QtSetGroupsDialog.cpp
index ad24122..82a71a1 100644
--- a/Swift/QtUI/QtSetGroupsDialog.cpp
+++ b/Swift/QtUI/QtSetGroupsDialog.cpp
@@ -69,7 +69,7 @@ boost::shared_ptr<RegroupRosterItemUIEvent> QtSetGroupsDialog::getRegroupEvent()
 			if (pair.first == "Contacts") {
 				wantsContacts = true;
 			}
-			if (!existing) {
+			if (!existing && pair.first != "Contacts") {
 				addedGroups.push_back(pair.first);
 			}
 		} else {
-- 
cgit v0.10.2-6-g49f6