adium 2100:b780e2300dad: Stop linking &local IRC channels, do no...

commits at adium.im commits at adium.im
Wed May 6 19:55:17 UTC 2009


details:	http://hg.adium.im/adium/rev/b780e2300dad
revision:	2100:b780e2300dad
author:		Zachary West <zacw at adium.im>
date:		Wed May 06 15:55:04 2009 -0400

Stop linking &local IRC channels, do not link text with quotes in it.

Fixes #11987.

diffstat:

 Source/AIIRCChannelLinker.m |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (40 lines):

diff -r b1ff01f7278a -r b780e2300dad Source/AIIRCChannelLinker.m
--- a/Source/AIIRCChannelLinker.m	Wed May 06 15:32:54 2009 -0400
+++ b/Source/AIIRCChannelLinker.m	Wed May 06 15:55:04 2009 -0400
@@ -39,6 +39,9 @@
  * <channel>    ::= ('#' | '&') <chstring>
  * <chstring>   ::= <any 8bit code except SPACE, BELL, NUL, CR, LF and comma (',')>
  *
+ * We ignore &channels (local channels) since & is commonly used in text, and we do not
+ * consider channels with quotes in their name since it will mess up linking.
+ *
  * Valid channel names are converted into irc://(account host)/(channel name)
  */
 - (NSAttributedString *)filterAttributedString:(NSAttributedString *)inAttributedString context:(id)context
@@ -69,14 +72,14 @@
 	}
 	
 	if (!channelStart) {
-		channelStart = [[NSCharacterSet characterSetWithCharactersInString:@"&#"] retain];
+		channelStart = [[NSCharacterSet characterSetWithCharactersInString:@"#"] retain];
 	}
 	
 	if (!validValues) {
 		// Start out with newline and whitespace characters.
 		validValues = [[NSCharacterSet whitespaceAndNewlineCharacterSet] mutableCopy];
-		// Add in comma and space
-		[validValues addCharactersInString:@", "];
+		// Add in comma, space and quotation marks (technically valid but messes up linking).
+		[validValues addCharactersInString:@", \""];
 		// Add in all control characters.
 		[validValues formUnionWithCharacterSet:[NSCharacterSet controlCharacterSet]];
 		// Now invert.
@@ -105,7 +108,7 @@
 			break;
 		}
 		
-		// Grab any valid characters we can - # and & are both valid channel names.
+		// Grab any valid characters we can - # is a valid channel names.
 		BOOL anyCharacters = [scanner scanCharactersFromSet:validValues intoString:&linkText];
 
 		// If we're at the start *or* the channel name begins after a space or newline, this is a valid link.




More information about the commits mailing list