adium 3614:da8dcd425fd6: Fix xmpp:-urls without a user part open...

commits at adium.im commits at adium.im
Tue Jan 4 20:45:08 UTC 2011


details:	http://hg.adium.im/adium/rev/da8dcd425fd6
revision:	3614:da8dcd425fd6
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Tue Jan 04 21:41:50 2011 +0100

Fix xmpp:-urls without a user part opening chats with (null)@...

Fixes #14908
(transplanted from 9f091fa22d7910b7fbbd52dbc86eeb3127a19c56)

diffs (26 lines):

diff -r 3a34f6708fd2 -r da8dcd425fd6 Source/AIURLHandlerPlugin.m
--- a/Source/AIURLHandlerPlugin.m	Tue Dec 28 15:44:55 2010 -0800
+++ b/Source/AIURLHandlerPlugin.m	Tue Jan 04 21:41:50 2011 +0100
@@ -369,11 +369,19 @@
 		} else if ([scheme isEqualToString:@"xmpp"]) {
 			if ([query rangeOfString:@"message"].location == 0) {
 				//xmpp:johndoe at jabber.org?message;subject=Subject;body=Body
+				//xmpp:jabber.org?message;subject=Subject;body=Body
 				NSString *msg = [[url queryArgumentForKey:@"body"] stringByDecodingURLEscapes];
 				
-				[self _openChatToContactWithName:[NSString stringWithFormat:@"%@@%@", [url user], [url host]]
-									   onService:serviceID
-									 withMessage:msg];
+				if ([url user]) {
+					[self _openChatToContactWithName:[NSString stringWithFormat:@"%@@%@", [url user], [url host]]
+										   onService:serviceID
+										 withMessage:msg];
+				} else {
+					[self _openChatToContactWithName:[url host]
+										   onService:serviceID
+										 withMessage:msg];
+					
+				}
 			} else if ([query rangeOfString:@"roster"].location == 0
 					   || [query rangeOfString:@"subscribe"].location == 0) {
 				//xmpp:johndoe at jabber.org?roster;name=John%20Doe;group=Friends




More information about the commits mailing list