changeset 14995:5d71039b20eb

[gaim-migrate @ 17773] Fixes Debian Bug #398969 Properly handle the following cases: xmpp:... URLs without the // xmpp URLs with no account xmpp URLs with no command committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Sat, 18 Nov 2006 05:25:31 +0000
parents 58849b67f00d
children 0d9f69b23352
files libgaim/gaim-url-handler
diffstat 1 files changed, 16 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libgaim/gaim-url-handler	Sat Nov 18 04:03:48 2006 +0000
+++ b/libgaim/gaim-url-handler	Sat Nov 18 05:25:31 2006 +0000
@@ -189,15 +189,26 @@
 
 def xmpp(uri):
     protocol = "prpl-jabber"
-    match = re.match(r"^xmpp:(//([^/?#]*))?(/?([^?#]*))(\?([^;#]*)(;([^#]*))?)?(#(.*))?", uri)
+    match = re.match(r"^xmpp:((//)?([^/?#]*))?(/?([^?#]*))(\?([^;#]*)(;([^#]*))?)?(#(.*))?", uri)
     if not match:
         print "Invalid xmpp URI: %s" % uri
         return
 
-    accountname = urllib.unquote_plus(match.group(2)) or ""
-    screenname = urllib.unquote_plus(match.group(4))
-    command = urllib.unquote_plus(match.group(6))
-    paramstring = match.group(8)
+    tmp = match.group(3)
+    if (tmp):
+        accountname = urllib.unquote_plus(tmp)
+    else:
+        accountname = ""
+
+    screenname = urllib.unquote_plus(match.group(5))
+
+    tmp = match.group(7)
+    if (tmp):
+        command = urllib.unquote_plus(tmp)
+    else:
+        command = ""
+
+    paramstring = match.group(9)
     params = {}
     if paramstring:
         for param in paramstring.split(";"):