adium 4093:3ccb31cdd0f2: "Quarantine" a received file after rece...

commits at adium.im commits at adium.im
Sat Jul 30 22:54:56 UTC 2011


details:	http://hg.adium.im/adium/rev/3ccb31cdd0f2
revision:	4093:3ccb31cdd0f2
branch:		(none)
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Sun Jul 31 00:54:48 2011 +0200

"Quarantine" a received file after receiving to protect against trojans (so Finder will pop up a message "Adium received this file in a chat message on 00:55" before executables can be opened, similar to Safari.)

diffs (23 lines):

diff -r 5978185973a1 -r 3ccb31cdd0f2 Frameworks/Adium Framework/Source/ESFileTransfer.m
--- a/Frameworks/Adium Framework/Source/ESFileTransfer.m	Sun Jul 31 00:32:44 2011 +0200
+++ b/Frameworks/Adium Framework/Source/ESFileTransfer.m	Sun Jul 31 00:54:48 2011 +0200
@@ -262,6 +262,19 @@
 			[[NSDistributedNotificationCenter defaultCenter] postNotificationName:@"com.apple.DownloadFileFinished"
 																		   object:localFilename];
 			
+			FSRef fsRef;
+			
+			if (FSPathMakeRef((const UInt8 *)[localFilename fileSystemRepresentation], &fsRef, NULL) == noErr) {
+				
+				NSDictionary *quarantineProperties = [NSDictionary dictionaryWithObject:(NSString *)kLSQuarantineTypeInstantMessageAttachment
+																				 forKey:(NSString *)kLSQuarantineTypeKey];
+				
+				LSSetItemAttribute(&fsRef, kLSRolesAll, kLSItemQuarantineProperties, quarantineProperties);
+				
+			} else {
+				AILogWithSignature(@"Danger! Could not find file to quarantine: %@!", localFilename);
+			}
+			
 		} else if ((percentDone != 0) && (status != In_Progress_FileTransfer)) {
 			[self setStatus:In_Progress_FileTransfer];
 		}




More information about the commits mailing list