adium 2516:4928ce6f8222: Trivial simplification. Was investigati...

commits at adium.im commits at adium.im
Thu Jun 25 02:44:13 UTC 2009


details:	http://hg.adium.im/adium/rev/4928ce6f8222
revision:	2516:4928ce6f8222
author:		David Smith <catfish.man at gmail.com>
date:		Wed Jun 24 18:16:48 2009 -0700

Trivial simplification. Was investigating a crash here, but didn't determine the cause
Subject: adium 2517:83ef5f5390a3: Patch from MartialL that fixes #3807

details:	http://hg.adium.im/adium/rev/83ef5f5390a3
revision:	2517:83ef5f5390a3
author:		David Smith <catfish.man at gmail.com>
date:		Wed Jun 24 18:17:40 2009 -0700

Patch from MartialL that fixes #3807
Subject: adium 2518:7a58335a87f8: Patch from MartialL that fixes #3807. A few relatively minor changes by me

details:	http://hg.adium.im/adium/rev/7a58335a87f8
revision:	2518:7a58335a87f8
author:		David Smith <catfish.man at gmail.com>
date:		Wed Jun 24 19:40:33 2009 -0700

Patch from MartialL that fixes #3807. A few relatively minor changes by me
Subject: adium 2519:fc55c522b2d5: Fix the ticket #6539 Adium "Don't show all the emoticons in the contact names"

details:	http://hg.adium.im/adium/rev/fc55c522b2d5
revision:	2519:fc55c522b2d5
author:		Domenico Agresta <d.agresta at gmail.com (mailto:d.agresta at gmail.com)>
date:		Sat Jun 20 17:30:53 2009 +0200

Fix the ticket #6539 Adium "Don't show all the emoticons in the contact names"

diffs (160 lines):

diff -r 69ca5de45e99 -r fc55c522b2d5 Copyright.txt
--- a/Copyright.txt	Wed Jun 24 14:29:31 2009 -0700
+++ b/Copyright.txt	Sat Jun 20 17:30:53 2009 +0200
@@ -1,6 +1,7 @@
 Adium
 Copyright (C) 2001-2009 by the following:
 
+Domenico Agresta
 Adam Atlas
 Jackie Balzer
 Colin Barrett
diff -r 69ca5de45e99 -r fc55c522b2d5 Frameworks/Adium Framework/Source/AIContactObserverManager.m
--- a/Frameworks/Adium Framework/Source/AIContactObserverManager.m	Wed Jun 24 14:29:31 2009 -0700
+++ b/Frameworks/Adium Framework/Source/AIContactObserverManager.m	Sat Jun 20 17:30:53 2009 +0200
@@ -338,8 +338,6 @@
 	NSMutableSet	*attrChange = nil;
 
 	for (NSValue *observerValue in [[contactObservers copy] autorelease]) {
-		id <AIListObjectObserver>	observer;
-		NSSet						*newKeys;
 		
 		/* Skip any observer which has been removed while we were iterating over observers,
 		 * as we don't retain observers and therefore risk messaging a released object.
@@ -347,7 +345,7 @@
 		if (removedContactObservers && [removedContactObservers containsObject:observerValue])
 			continue;
 		
-		observer = [observerValue nonretainedObjectValue];
+		id <AIListObjectObserver> observer = [observerValue nonretainedObjectValue];
 #ifdef CONTACT_OBSERVER_MEMORY_MANAGEMENT_DEBUG
 		/* This will log a warning in 10.4 about +[Object allocWithZone:] being a compatibility method.
 		 * It is only used in debug builds, so that's fine.
@@ -357,7 +355,9 @@
 			NSAssert1(FALSE, @"%p is a released observer. Please check the Adium Debug Log. If it wasn't logging to file, do that next time.", observer);
 		}
 #endif		
-		if ((newKeys = [observer updateListObject:inObject keys:modifiedKeys silent:silent])) {
+		
+		NSSet *newKeys = [observer updateListObject:inObject keys:modifiedKeys silent:silent];
+		if (newKeys) {
 			if (!attrChange) attrChange = [[NSMutableSet alloc] init];
 			[attrChange unionSet:newKeys];
 		}
diff -r 69ca5de45e99 -r fc55c522b2d5 Plugins/WebKit Message View/Template.html
--- a/Plugins/WebKit Message View/Template.html	Wed Jun 24 14:29:31 2009 -0700
+++ b/Plugins/WebKit Message View/Template.html	Sat Jun 20 17:30:53 2009 +0200
@@ -119,34 +119,88 @@
 			head.appendChild( documentFragment );
 		}
 
-		//Swap an image with its alt-tag text on click, or expand/unexpand an attached image
+		/* Swap an images with its alt-tag text on click, or expand/unexpand an attached image.
+		Combined the click with the alt key and all the image in the parent node are swapped. */
 		document.onclick = imageCheck;
 		function imageCheck() {
 			var shouldScroll = nearBottom();
 			var node = event.target;
-			if(node.tagName.toLowerCase() == 'img' && !client.zoomImage(node) && node.alt) {
-				var a = document.createElement('a');
-				a.setAttribute('onclick', 'imageSwap(this)');
-				a.setAttribute('src', node.getAttribute('src'));
-				a.className = node.className;
-				var text = document.createTextNode(node.alt);
-				a.appendChild(text);
-				node.parentNode.replaceChild(a, node);
+			if (node.tagName.toLowerCase() != 'img' && node.tagName.toLowerCase() != 'a')
+				return;
+
+			if (!event.altKey)
+			{
+				if (!client.zoomImage(node) && node.alt) {
+					 imageToText(node);
+				}
+			}
+			else
+			{
+				var chatElement = document.getElementById("Chat");
+				while (node != chatElement && node.parentNode != chatElement)
+					node = node.parentNode;
+				var aImgChilds = node.getElementsByTagName('img');
+				//The odd i++/continue usage is due to getElementsByTagName returning a live NodeList
+				for (i = 0; i < aImgChilds.length;) {
+					var child = aImgChilds[i];
+					if (!client.zoomImage(child) && child.alt) {
+						 imageToText(child);
+						 continue;
+					}
+					i++;
+				}
 			}
 			alignChat(shouldScroll);
 		}
 
+		function imageToText(node)
+		{
+			var a = document.createElement('a');
+			a.setAttribute('onclick', 'imageSwap(this)');
+			a.setAttribute('src', node.getAttribute('src'));
+			a.setAttribute('isEmoticon', true);
+			a.className = node.className;
+			var text = document.createTextNode(node.alt);
+			a.appendChild(text);
+			node.parentNode.replaceChild(a, node);
+		}
+		
+		/* Swap the emoticon text in images.
+		Combined the click with the alt key and all emoticons in text mode in the message are swapped. */
 		function imageSwap(node) {
 			var shouldScroll = nearBottom();
 
+			if (!event.altKey)
+			{
+				textToImage(node);
+			}
+			else
+			{
+				var chatElement = document.getElementById("Chat");
+				while (node != chatElement && node.parentNode != chatElement)
+					node = node.parentNode;
+				var aImgChilds = node.getElementsByTagName('a');
+				//The odd i++/continue usage is due to getElementsByTagName returning a live NodeList
+				for (i = 0; i < aImgChilds.length; ) {
+					var child = aImgChilds[i];
+					if (child.getAttribute('isEmoticon')) {
+						 textToImage(child);
+						continue;
+					}
+
+					i++;
+				}
+			}
+			alignChat(shouldScroll);
+		}
+
+		function textToImage(node) {
 			//Swap the image/text
 			var img = document.createElement('img');
 			img.setAttribute('src', node.getAttribute('src'));
 			img.setAttribute('alt', node.firstChild.nodeValue);
 			img.className = node.className;
 			node.parentNode.replaceChild(img, node);
-
-			alignChat(shouldScroll);
 		}
 
 		//Align our chat to the bottom of the window.  If true is passed, view will also be scrolled down
diff -r 69ca5de45e99 -r fc55c522b2d5 Source/AIEmoticonController.m
--- a/Source/AIEmoticonController.m	Wed Jun 24 14:29:31 2009 -0700
+++ b/Source/AIEmoticonController.m	Sat Jun 20 17:30:53 2009 +0200
@@ -254,8 +254,8 @@
 				 *		so is immediately acceptable. The second should be acceptable because it is to the right of an emoticon and
 				 *		the left of a space.
 				 */
-				char	previousCharacter = [messageString characterAtIndex:(originalEmoticonLocation - 1)] ;
-				char	nextCharacter = [messageString characterAtIndex:(originalEmoticonLocation + textLength)] ;
+				char	previousCharacter = [messageString characterAtIndex:(originalEmoticonLocation)] ;
+				char	nextCharacter = [messageString characterAtIndex:(originalEmoticonLocation + textLength - 1)] ;
 
 				if ((callingRecursively || (previousCharacter == ' ') || (previousCharacter == '\t') ||
 					 (previousCharacter == '\n') || (previousCharacter == '\r') || (previousCharacter == '.') || (previousCharacter == '?') || (previousCharacter == '!') ||




More information about the commits mailing list