Adium

Changeset 61

Show
Ignore:
Timestamp:
12/20/2002 01:30:13 AM (6 years ago)
Author:
ikrieg
Message:

Sending greater-than, less-than, and ampersand now results in proper encoding to > etc. The
styles seem to be acting a bit strangely now, which may be my fault. If it is, I don't know
what caused it, so feel free to fix it. :-)

I also didn't make it so that >, <, etc would get converted back to the appropriate signs
in received messages. I intend to deal with that later. :-)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/adium/Frameworks/AIUtilities Framework/AIHTMLDecoder.m

    r4 r61  
    4545    int                 messageLength; 
    4646    NSRange             searchRange; 
     47        short           loop; 
    4748     
    4849    //Get the incoming message as a regular string, and it's length 
     
    144145            } 
    145146        } 
    146   */       
    147         [string appendString:[inMessageString substringWithRange:searchRange]]; 
    148  
     147  */     
     148                 
     149        //[string appendString:[inMessageString substringWithRange:searchRange]]; 
     150                //ikrieg commented to replace with the following 
     151                loop = searchRange.location; 
     152                while (loop < (searchRange.location + searchRange.length)) 
     153                { 
     154                        long currentChar = [inMessageString characterAtIndex:loop]; 
     155                         
     156                        if(currentChar == 60){ //replace less-than's (<) with their HTML code (&lt;) 
     157                                //[string replaceCharactersInRange:NSMakeRange(loop, 1) withString:@"&lt;"]; 
     158                                [string appendString:@"&lt;"]; 
     159                        }else if(currentChar == 62){ //replace greater-than's (>) with their HTML code (&gt;) 
     160                                //[string replaceCharactersInRange:NSMakeRange(loop, 1) withString:@"&gt;"]; 
     161                                [string appendString:@"&gt;"]; 
     162                        }else if(currentChar == '&'){ //replace with (&amp;) (breaks links, but we'll deal with that later) 
     163                                //[string replaceCharactersInRange:NSMakeRange(loop, 1) withString:@"&amp;"]; 
     164                                [string appendString:@"&amp;"]; 
     165                        }else{ 
     166                                [string appendCharacter:currentChar]; 
     167                        } 
     168                        loop++; 
     169                } 
     170                 
     171                //ikrieg end 
    149172        searchRange.location += searchRange.length; 
    150173    }