Browse files

Just because I noticed it break the tags to where it overflows, it no…

…w just uses the tag cleaner for finding out the link. Yes this can infact cause a problem if there is a span tag inside the link, but I am not to sure if I want to spend the time to detect inner tags. I think people won't mind if the link sometimes ends up being with the image.
  • Loading branch information...
1 parent cc420e9 commit 1d6b5dad8de1308fbafd0ca56c2d176dadf145ea @GRMrGecko committed Feb 14, 2011
Showing with 5 additions and 4 deletions.
  1. +5 −4 Classes/MGMAdinline.m
9 Classes/MGMAdinline.m
@@ -48,13 +48,13 @@ - (NSString *)filterHTMLString:(NSString *)theHTMLString content:(AIContentObjec
range.location = linkStartRange.location+linkStartRange.length;
range.length = [html length]-range.location;
+ NSRange linkReplaceEndRange = [html rangeOfString:@"<" options:NSCaseInsensitiveSearch range:range];
NSRange linkEndRange = [html rangeOfString:@"</a" options:NSCaseInsensitiveSearch range:range];
if (linkEndRange.location==NSNotFound)
range.location = linkEndRange.location+linkEndRange.length;
range.length = [html length]-range.location;
- linkRange = NSMakeRange(linkStartRange.location+linkStartRange.length, linkEndRange.location-(linkStartRange.location+linkStartRange.length));
- NSMutableString *link = [[html substringWithRange:linkRange] mutableCopy];
+ NSMutableString *link = [[html substringWithRange:NSMakeRange(linkStartRange.location+linkStartRange.length, linkEndRange.location-(linkStartRange.location+linkStartRange.length))] mutableCopy];
NSRange tagRange = NSMakeRange(0, [link length]);
while (YES) {
NSRange tagStartRange = [link rangeOfString:@"<" options:NSCaseInsensitiveSearch range:tagRange];
@@ -75,8 +75,9 @@ - (NSString *)filterHTMLString:(NSString *)theHTMLString content:(AIContentObjec
shouldScroll = [webview stringByEvaluatingJavaScriptFromString:@"nearBottom();"];
NSString *image = [NSString stringWithFormat:@"<img src=\"%@\" style=\"max-width: 100%%; max-height: 100%%;\" onLoad=\"imageSwap(this, false);alignChat(%@);\" />", link, shouldScroll];
- [html replaceCharactersInRange:linkRange withString:image];
- range.location += [image length]-linkRange.length;
+ NSRange replaceRange = NSMakeRange(linkStartRange.location+linkStartRange.length, linkReplaceEndRange.location-(linkStartRange.location+linkStartRange.length));
+ [html replaceCharactersInRange:replaceRange withString:image];
+ range.location += [image length]-replaceRange.length;
range.length = [html length]-range.location;
[link release];

5 comments on commit 1d6b5da


Not sure where else to comment, but it seems this plugin is broken with the new Adium 1.6 nightlies (available here: )

I don't know Objective-C to save my life, unfortunately :/


@amadeus I noticed sometimes it's something to do with themes... Not sure if it's true with the nightlies though.


It wasn't a theme issue since I decided to test out the new version with no theme changes. My guess is they must've changed something in the APIs.


Is anyone still maintaining this? I would like to be able to collapse the image display.

Please sign in to comment.