Changeset 22163
- Timestamp:
- 01/06/2008 10:55:57 PM (11 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/Frameworks/AIUtilities Framework/Source/AIAttributedStringAdditions.m
r19438 r22163 527 527 528 528 if (URL) { 529 NSString *replacementString = [URL absoluteString];530 531 529 if (!newAttributedString) { 532 530 newAttributedString = [[self mutableCopy] autorelease]; … … 534 532 } 535 533 536 //Replace the URL with the NSString of where it was pointing 534 NSString *absoluteString = [URL absoluteString]; 535 NSString *originalTitle = [[newAttributedString string] substringWithRange:searchRange]; 536 NSString *replacementString; 537 538 if ([originalTitle caseInsensitiveCompare:absoluteString] == NSOrderedSame) { 539 replacementString = originalTitle; 540 541 } else { 542 replacementString = [NSString stringWithFormat:@"%@ (%@)", originalTitle, absoluteString]; 543 } 544 537 545 [newAttributedString replaceCharactersInRange:searchRange 538 546 withString:replacementString]; 539 547 540 /*The attributed string may have changed length; modify our 541 * searchRange and cached length to reflect the string we just 542 * inserted. 543 */ 548 //Modify our searchRange and cached length to reflect the string we just inserted. 544 549 searchRange.length = [replacementString length]; 545 550 length = [newAttributedString length]; 546 551 547 //Now remove the URL552 //Now remove the link attribute 548 553 [newAttributedString removeAttribute:NSLinkAttributeName range:searchRange]; 549 554 } trunk/Plugins/Purple Service/ESPurpleMSNAccount.m
r21876 r22163 187 187 { 188 188 return [AIHTMLDecoder encodeHTML:inAttributedString 189 headers:NO 190 fontTags:YES 191 includingColorTags:YES 192 closeFontTags:YES 193 styleTags:YES 194 closeStyleTagsOnFontChange:YES 195 encodeNonASCII:NO 196 encodeSpaces:NO 197 imagesPath:nil 198 attachmentsAsText:YES 199 onlyIncludeOutgoingImages:NO 200 simpleTagsOnly:YES 201 bodyBackground:NO 202 allowJavascriptURLs:YES]; 203 } 204 205 - (NSString *)encodedAttributedStringForSendingContentMessage:(AIContentMessage *)inContentMessage 206 { 207 /* If we're sending a message on an encryption chat, we can encode the HTML normally, as links will go through fine. 208 * If we're sending a message normally, MSN will drop the title of any link, so we preprocess it to be in the form "title (link)" 209 */ 210 return [AIHTMLDecoder encodeHTML:([[inContentMessage chat] isSecure] ? inAttributedString : [inAttributedString attributedStringByConvertingLinksToStrings]) 189 211 headers:NO 190 212 fontTags:YES