diff libpurple/purple-url-handler @ 16455:27dfbca8dd40

Ticket #320 from ltm "The simplest form of XMPP URIs are handled incorrectly by purple-url-handler. The URI xmpp:romeo@montague.net specifies a screenname (recipient) and no accountname (sender). The purple-url-handler script will, however, assume no screenname and treat romeo@montague.net as the accountname." "The attached patch fixes the issue and makes some minor cleanup in the aim and icq handlers."
author Richard Laager <rlaager@wiktel.com>
date Thu, 26 Apr 2007 19:55:16 +0000
parents d06673964ff9
children ca69d4253246 cc9242ce1435
line wrap: on
line diff
--- a/libpurple/purple-url-handler	Thu Apr 26 18:10:06 2007 +0000
+++ b/libpurple/purple-url-handler	Thu Apr 26 19:55:16 2007 +0000
@@ -92,13 +92,13 @@
 
 def aim(uri):
     protocol = "prpl-aim"
-    match = re.match(r"^(aim):([^?]*)(\?(.*))", uri)
+    match = re.match(r"^aim:([^?]*)(\?(.*))", uri)
     if not match:
         print "Invalid aim URI: %s" % uri
         return
 
-    command = urllib.unquote_plus(match.group(2))
-    paramstring = match.group(4)
+    command = urllib.unquote_plus(match.group(1))
+    paramstring = match.group(3)
     params = {}
     if paramstring:
         for param in paramstring.split("&"):
@@ -129,13 +129,13 @@
 
 def icq(uri):
     protocol = "prpl-icq"
-    match = re.match(r"^(icq):([^?]*)(\?(.*))", uri)
+    match = re.match(r"^icq:([^?]*)(\?(.*))", uri)
     if not match:
-        print "Invalid aim URI: %s" % uri
+        print "Invalid icq URI: %s" % uri
         return
 
-    command = urllib.unquote_plus(match.group(2))
-    paramstring = match.group(4)
+    command = urllib.unquote_plus(match.group(1))
+    paramstring = match.group(3)
     params = {}
     if paramstring:
         for param in paramstring.split("&"):
@@ -225,26 +225,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
 
-    tmp = match.group(3)
+    tmp = match.group(2)
     if (tmp):
         accountname = urllib.unquote_plus(tmp)
     else:
         accountname = ""
 
-    screenname = urllib.unquote_plus(match.group(5))
+    screenname = urllib.unquote_plus(match.group(3))
 
-    tmp = match.group(7)
+    tmp = match.group(5)
     if (tmp):
         command = urllib.unquote_plus(tmp)
     else:
         command = ""
 
-    paramstring = match.group(9)
+    paramstring = match.group(7)
     params = {}
     if paramstring:
         for param in paramstring.split(";"):