adium 3121:cd004d7bd5d7: Ok, so I've been convinced to do this w...

commits at adium.im commits at adium.im
Fri Feb 12 05:02:45 UTC 2010


details:	http://hg.adium.im/adium/rev/cd004d7bd5d7
revision:	3121:cd004d7bd5d7
author:		Stephen Holt <sholt at adium.im>
date:		Fri Feb 12 00:02:11 2010 -0500

Ok, so I've been convinced to do this without blocking.  Yay CAS funtimes!

diffs (143 lines):

diff -r bb6ae18089d0 -r cd004d7bd5d7 Adium.xcodeproj/project.pbxproj
--- a/Adium.xcodeproj/project.pbxproj	Thu Feb 11 23:42:14 2010 -0500
+++ b/Adium.xcodeproj/project.pbxproj	Fri Feb 12 00:02:11 2010 -0500
@@ -4735,7 +4735,7 @@
 		9E791DA40577094400547562 /* CBStatusMenuItemController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CBStatusMenuItemController.m; path = "Plugins/Status Menu Item/CBStatusMenuItemController.m"; sourceTree = "<group>"; };
 		9E95316703C8E0BE00415B22 /* AIDockController.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIDockController.h; path = Source/AIDockController.h; sourceTree = "<group>"; };
 		9E95316903C8E0C700415B22 /* AIDockController.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIDockController.m; path = Source/AIDockController.m; sourceTree = "<group>"; };
-		9EA125E8055B630900ECF349 /* CBPurpleOscarAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CBPurpleOscarAccount.m; path = "Plugins/Purple Service/CBPurpleOscarAccount.m"; sourceTree = "<group>"; };
+		9EA125E8055B630900ECF349 /* CBPurpleOscarAccount.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 2; lastKnownFileType = sourcecode.c.objc; name = CBPurpleOscarAccount.m; path = "Plugins/Purple Service/CBPurpleOscarAccount.m"; sourceTree = "<group>"; tabWidth = 2; usesTabs = 1; };
 		9EA125EE055B633000ECF349 /* CBPurpleOscarAccount.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CBPurpleOscarAccount.h; path = "Plugins/Purple Service/CBPurpleOscarAccount.h"; sourceTree = "<group>"; };
 		9ECB03E209F2A9D800996F44 /* AIDictionaryDebug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = AIDictionaryDebug.h; path = Source/AIDictionaryDebug.h; sourceTree = "<group>"; };
 		9ECB03E309F2A9D800996F44 /* AIDictionaryDebug.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; name = AIDictionaryDebug.m; path = Source/AIDictionaryDebug.m; sourceTree = "<group>"; };
diff -r bb6ae18089d0 -r cd004d7bd5d7 Plugins/Purple Service/CBPurpleOscarAccount.m
--- a/Plugins/Purple Service/CBPurpleOscarAccount.m	Thu Feb 11 23:42:14 2010 -0500
+++ b/Plugins/Purple Service/CBPurpleOscarAccount.m	Fri Feb 12 00:02:11 2010 -0500
@@ -382,28 +382,27 @@
 
 - (NSString *)encodedAttributedString:(NSAttributedString *)inAttributedString forListObject:(AIListObject *)inListObject
 {
-	static OSSpinLock spinLock = OS_SPINLOCK_INIT;
-	static AIHTMLDecoder * encoderCloseFontTagsAttachmentsAsText = nil;
-	
-	OSSpinLockLock(&spinLock);
-	if(!encoderCloseFontTagsAttachmentsAsText) {
-		encoderCloseFontTagsAttachmentsAsText = [[AIHTMLDecoder alloc] initWithHeaders:YES
-																																					fontTags:YES
-																																		 closeFontTags:YES
-																																				 colorTags:YES
-																																				 styleTags:YES
-																																		encodeNonASCII:NO
-																																			encodeSpaces:NO
-																																 attachmentsAsText:YES
-																												 onlyIncludeOutgoingImages:YES
-																																		simpleTagsOnly:NO
-																																		bodyBackground:NO
-																															 allowJavascriptURLs:YES];
-		[encoderCloseFontTagsAttachmentsAsText setAllowAIMsubprofileLinks:YES];
-	}
-	OSSpinLockUnlock(&spinLock);
-	
-	return ([inAttributedString length] ? [encoderCloseFontTagsAttachmentsAsText encodeHTML:inAttributedString imagesPath:nil] : nil);
+  static AIHTMLDecoder * encoderCloseFontTagsAttachmentsAsText = nil;
+  
+  if(!encoderCloseFontTagsAttachmentsAsText) {
+	AIHTMLDecoder *newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:YES
+															  fontTags:YES
+														 closeFontTags:YES
+															 colorTags:YES
+															 styleTags:YES
+														encodeNonASCII:NO
+														  encodeSpaces:NO
+													 attachmentsAsText:YES
+											 onlyIncludeOutgoingImages:YES
+														simpleTagsOnly:NO
+														bodyBackground:NO
+												   allowJavascriptURLs:YES];
+	if(!OSAtomicCompareAndSwapPtrBarrier(nil, newEncoder, (void *)&encoderCloseFontTagsAttachmentsAsText))
+	  [newEncoder release];
+	[encoderCloseFontTagsAttachmentsAsText setAllowAIMsubprofileLinks:YES];
+  }
+  
+  return ([inAttributedString length] ? [encoderCloseFontTagsAttachmentsAsText encodeHTML:inAttributedString imagesPath:nil] : nil);
 }
 
 - (NSString *)encodedAttributedStringForSendingContentMessage:(AIContentMessage *)inContentMessage
@@ -412,41 +411,43 @@
 	NSAttributedString	*inAttributedString = inContentMessage.message;
 	NSString			*encodedString;
 	
-	static OSSpinLock spinLock = OS_SPINLOCK_INIT;
-	static AIHTMLDecoder * encoderCloseFontTags = nil;
-	static AIHTMLDecoder * encoderGroupChat = nil;
+  static AIHTMLDecoder * encoderCloseFontTags = nil;
+  static AIHTMLDecoder * encoderGroupChat = nil;
+  
+  if(!(encoderCloseFontTags && encoderGroupChat)) {
+	AIHTMLDecoder *newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:YES
+															  fontTags:YES
+														 closeFontTags:YES
+															 colorTags:YES
+															 styleTags:YES
+														encodeNonASCII:NO
+														  encodeSpaces:NO
+													 attachmentsAsText:NO
+											 onlyIncludeOutgoingImages:YES
+														simpleTagsOnly:NO
+														bodyBackground:NO
+												   allowJavascriptURLs:YES];
+	if(!OSAtomicCompareAndSwapPtrBarrier(nil, newEncoder, (void *)&encoderCloseFontTags))
+	  [newEncoder release];
 	
-	OSSpinLockLock(&spinLock);
-	if(!(encoderCloseFontTags && encoderGroupChat)) {
-		encoderCloseFontTags = [[AIHTMLDecoder alloc] initWithHeaders:YES
-																												 fontTags:YES
-																										closeFontTags:YES
-																												colorTags:YES
-																												styleTags:YES
-																									 encodeNonASCII:NO
-																										 encodeSpaces:NO
-																								attachmentsAsText:NO
-																				onlyIncludeOutgoingImages:YES
-																									 simpleTagsOnly:NO
-																									 bodyBackground:NO
-																							allowJavascriptURLs:YES];
-		
-		encoderGroupChat = [[AIHTMLDecoder alloc] initWithHeaders:NO
-																										 fontTags:YES
-																								closeFontTags:NO
-																										colorTags:YES
-																										styleTags:YES
-																							 encodeNonASCII:NO
-																								 encodeSpaces:NO
-																						attachmentsAsText:YES
-																		onlyIncludeOutgoingImages:YES
-																							 simpleTagsOnly:YES
-																							 bodyBackground:NO
-																					allowJavascriptURLs:YES];
-		[encoderCloseFontTags setAllowAIMsubprofileLinks:YES];
-		[encoderGroupChat setAllowAIMsubprofileLinks:YES];
-	}
-	OSSpinLockUnlock(&spinLock);
+	newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:NO
+											   fontTags:YES
+										  closeFontTags:NO
+											  colorTags:YES
+											  styleTags:YES
+										 encodeNonASCII:NO
+										   encodeSpaces:NO
+									  attachmentsAsText:YES
+							  onlyIncludeOutgoingImages:YES
+										 simpleTagsOnly:YES
+										 bodyBackground:NO
+									allowJavascriptURLs:YES];
+	if(!OSAtomicCompareAndSwapPtrBarrier(nil, newEncoder, (void *)&encoderGroupChat))
+	  [newEncoder release];
+	
+	[encoderCloseFontTags setAllowAIMsubprofileLinks:YES];
+	[encoderGroupChat setAllowAIMsubprofileLinks:YES];
+  }
 	
 	if (inListObject) {
 		if (inContentMessage.chat.isSecure &&




More information about the commits mailing list