adium-1.4 2898:d0720f14c160: Ignore fileTransfer events (and onl...

commits at adium.im commits at adium.im
Wed Feb 3 18:06:35 UTC 2010


details:	http://hg.adium.im/adium-1.4/rev/d0720f14c160
revision:	2898:d0720f14c160
author:		Stephen Holt <sholt at adium.im>
date:		Wed Feb 03 13:05:37 2010 -0500

Ignore fileTransfer events (and only fileTransfer events) when filtering for emoticons.  Fixes #10927

diffs (24 lines):

diff -r 2beaaf6dc67c -r d0720f14c160 Source/AIEmoticonController.m
--- a/Source/AIEmoticonController.m	Tue Feb 02 19:35:42 2010 -0700
+++ b/Source/AIEmoticonController.m	Wed Feb 03 13:05:37 2010 -0500
@@ -29,6 +29,7 @@
 #import <AIUtilities/AIDictionaryAdditions.h>
 #import <AIUtilities/AICharacterSetAdditions.h>
 #import <Adium/AIChat.h>
+#import <Adium/AIContentEvent.h>
 
 #define EMOTICON_DEFAULT_PREFS				@"EmoticonDefaults"
 #define EMOTICONS_PATH_NAME					@"Emoticons"
@@ -134,7 +135,11 @@
 - (NSAttributedString *)filterAttributedString:(NSAttributedString *)inAttributedString context:(id)context
 {
     NSMutableAttributedString   *replacementMessage = nil;
-    if (inAttributedString) {
+		// We want to filter some status event messages (e.g. changes in status messages), but not fileTransfer messages.
+		// Filenames, afterall, should not have emoticons in them.
+    if (inAttributedString &&
+				!([context isKindOfClass:[AIContentEvent class]] &&
+					[[(AIContentEvent *)context type] rangeOfString:@"fileTransfer"].location == NSNotFound)) {
         /* First, we do a quick scan of the message for any characters that might end up being emoticons
          * This avoids having to do the slower, more complicated scan for the majority of messages.
 		 *




More information about the commits mailing list