From 4d89c280976426c9e29ee9235b296afc4d38a7cd Mon Sep 17 00:00:00 2001
From: Kevin Smith <git@kismith.co.uk>
Date: Sat, 26 Dec 2009 23:00:53 +0000
Subject: Fix segfault at launch due to argument reversal.


diff --git a/Swift/Controllers/ChatsManager.cpp b/Swift/Controllers/ChatsManager.cpp
index fe8efb3..2863a14 100644
--- a/Swift/Controllers/ChatsManager.cpp
+++ b/Swift/Controllers/ChatsManager.cpp
@@ -41,7 +41,7 @@ ChatsManager::~ChatsManager() {
 /**
  * If a resource goes offline, release bound chatdialog to that resource.
  */
-void ChatsManager::handlePresenceChange(boost::shared_ptr<Presence> /*oldPresence*/, boost::shared_ptr<Presence> newPresence) {
+void ChatsManager::handlePresenceChange(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> /*lastPresence*/) {
 	if (newPresence->getType() != Presence::Unavailable) return;
 	JID fullJID(newPresence->getFrom());
 	std::map<JID, ChatController*>::iterator it = chatControllers_.find(fullJID);
diff --git a/Swift/Controllers/ChatsManager.h b/Swift/Controllers/ChatsManager.h
index 260bd1d..dd80d95 100644
--- a/Swift/Controllers/ChatsManager.h
+++ b/Swift/Controllers/ChatsManager.h
@@ -35,7 +35,7 @@ namespace Swift {
 			void handleJoinMUCRequest(const JID& muc, const String& nick);
 		private:
 			void rebindControllerJID(const JID& from, const JID& to);
-			void handlePresenceChange(boost::shared_ptr<Presence> oldPresence, boost::shared_ptr<Presence> newPresence);
+			void handlePresenceChange(boost::shared_ptr<Presence> newPresence, boost::shared_ptr<Presence> lastPresence);
 			ChatController* getChatController(const JID &contact);
 			virtual bool isMUC(const JID& muc) const;
 
diff --git a/Swift/Controllers/UnitTest/ChatsManagerTest.cpp b/Swift/Controllers/UnitTest/ChatsManagerTest.cpp
index 9df244f..0dfc52b 100644
--- a/Swift/Controllers/UnitTest/ChatsManagerTest.cpp
+++ b/Swift/Controllers/UnitTest/ChatsManagerTest.cpp
@@ -176,7 +176,7 @@ public:
 		boost::shared_ptr<Presence> jid1Offline(new Presence());
 		jid1Offline->setFrom(JID(fullJIDString1));
 		jid1Offline->setType(Presence::Unavailable);
-		presenceOracle_->onPresenceChange(jid1Online, jid1Offline);
+		presenceOracle_->onPresenceChange(jid1Offline, jid1Online);
 
 		boost::shared_ptr<Message> message2(new Message());
 		message2->setFrom(JID(fullJIDString2));
@@ -221,14 +221,14 @@ public:
 		boost::shared_ptr<Presence> jid1Offline(new Presence());
 		jid1Offline->setFrom(JID(messageJID1));
 		jid1Offline->setType(Presence::Unavailable);
-		presenceOracle_->onPresenceChange(jid1Online, jid1Offline);
+		presenceOracle_->onPresenceChange(jid1Offline, jid1Online);
  
 		boost::shared_ptr<Presence> jid2Online(new Presence());
 		jid2Online->setFrom(JID(messageJID2));
 		boost::shared_ptr<Presence> jid2Offline(new Presence());
 		jid2Offline->setFrom(JID(messageJID2));
 		jid2Offline->setType(Presence::Unavailable);
-		presenceOracle_->onPresenceChange(jid2Online, jid2Offline);
+		presenceOracle_->onPresenceChange(jid2Offline, jid2Online);
 
 		JID messageJID3("testling@test.com/resource3");
 
-- 
cgit v0.10.2-6-g49f6