adium 3100:e0513db38fb9: Fix for Ticket #13731, Dueling Resource...
commits at adium.im
commits at adium.im
Wed Feb 3 04:45:51 UTC 2010
details: http://hg.adium.im/adium/rev/e0513db38fb9
revision: 3100:e0513db38fb9
author: jhildebr at cisco.com
date: Tue Feb 02 19:35:42 2010 -0700
Fix for Ticket #13731, Dueling Resources. Ensure that the real disconnect error is kept, and not over-ridden by subsequent socket errors.
Reviewed by Stephen Holt <sholt at adium.im>. Fixes #13731.
(transplanted from 2beaaf6dc67c1f2b8cb77bd9fdf911f1ada57a69)
diffs (66 lines):
diff -r d68b2e761e79 -r e0513db38fb9 Copyright.txt
--- a/Copyright.txt Mon Dec 14 16:00:37 2009 +1100
+++ b/Copyright.txt Tue Feb 02 19:35:42 2010 -0700
@@ -31,6 +31,7 @@
Christopher Harms
Jasper Hauser
Arno Hautala
+Joe Hildebrand
Stephen Holt
Peter Hosey
Adam Iser
diff -r d68b2e761e79 -r e0513db38fb9 Frameworks/Adium Framework/Source/AIAbstractAccount.m
--- a/Frameworks/Adium Framework/Source/AIAbstractAccount.m Mon Dec 14 16:00:37 2009 +1100
+++ b/Frameworks/Adium Framework/Source/AIAbstractAccount.m Tue Feb 02 19:35:42 2010 -0700
@@ -1432,6 +1432,12 @@
*/
- (void)setLastDisconnectionError:(NSString *)inError
{
+ // If we already have an error, ignore the new one, unless
+ // we're resetting to nil.
+ if (lastDisconnectionError && inError) {
+ return;
+ }
+
if (lastDisconnectionError != inError) {
[lastDisconnectionError release];
lastDisconnectionError = [inError retain];
diff -r d68b2e761e79 -r e0513db38fb9 Plugins/Purple Service/CBPurpleAccount.m
--- a/Plugins/Purple Service/CBPurpleAccount.m Mon Dec 14 16:00:37 2009 +1100
+++ b/Plugins/Purple Service/CBPurpleAccount.m Tue Feb 02 19:35:42 2010 -0700
@@ -1865,6 +1865,9 @@
{
finishedConnectProcess = NO;
+ // When we *start* to connect, ensure there is no previous error. Waiting until connection succeeds
+ // could lead to looping.
+ [self setLastDisconnectionError:nil];
[super connect];
//Ensure we have a purple account if one does not already exist
@@ -2196,7 +2199,14 @@
- (void)setLastDisconnectionReason:(PurpleConnectionError)reason
{
- lastDisconnectionReason = reason;
+ // Libpurple now calls this twice, once with the real error, and once when we're disconnected.
+ // Discard the second call.
+ // BE CAREFUL to always call setLastDisconnectionReason BEFORE setLastDisconnectionError
+ // for this to work.
+ if (!lastDisconnectionError)
+ {
+ lastDisconnectionReason = reason;
+ }
}
- (PurpleConnectionError)lastDisconnectionReason
@@ -2209,8 +2219,8 @@
*/
- (void)accountConnectionReportDisconnect:(NSString *)text withReason:(PurpleConnectionError)reason
{
+ [self setLastDisconnectionReason:reason];
[self setLastDisconnectionError:text];
- [self setLastDisconnectionReason:reason];
if (reason == PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED)
[self serverReportedInvalidPassword];
More information about the commits
mailing list