--- a/Plugins/Purple Service/CBPurpleOscarAccount.m Thu Sep 13 11:16:24 2012 +0200
+++ b/Plugins/Purple Service/CBPurpleOscarAccount.m Thu Sep 13 11:19:26 2012 +0200
@@ -455,41 +455,40 @@
NSAttributedString *inAttributedString = inContentMessage.message;
- static AIHTMLDecoder * encoderCloseFontTags = nil;
- static AIHTMLDecoder * encoderGroupChat = nil;
- if(!(encoderCloseFontTags && encoderGroupChat)) {
- AIHTMLDecoder *newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:YES
- onlyIncludeOutgoingImages:YES
- allowJavascriptURLs:YES];
- OSAtomicCompareAndSwapPtrBarrier(nil, (__bridge void*)newEncoder, (void *)&encoderCloseFontTags);
+ static AIHTMLDecoder * encoderCloseFontTags = nil; + static AIHTMLDecoder * encoderGroupChat = nil; - newEncoder = [[AIHTMLDecoder alloc] initWithHeaders:NO
- onlyIncludeOutgoingImages:YES
- allowJavascriptURLs:YES];
- OSAtomicCompareAndSwapPtrBarrier(nil, (__bridge void*)newEncoder, (void *)&encoderGroupChat);
- [encoderCloseFontTags setAllowAIMsubprofileLinks:YES];
- [encoderGroupChat setAllowAIMsubprofileLinks:YES];
+ static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + encoderCloseFontTags = [[AIHTMLDecoder alloc] initWithHeaders:YES + onlyIncludeOutgoingImages:YES + allowJavascriptURLs:YES]; + encoderGroupChat = [[AIHTMLDecoder alloc] initWithHeaders:NO + onlyIncludeOutgoingImages:YES + allowJavascriptURLs:YES]; + [encoderCloseFontTags setAllowAIMsubprofileLinks:YES]; + [encoderGroupChat setAllowAIMsubprofileLinks:YES]; if (inContentMessage.chat.isSecure &&