comparison libgaim/gaim-url-handler @ 14994: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 b007392d72ff
children
comparison
equal deleted inserted replaced
14993:58849b67f00d 14994:5d71039b20eb
187 account = findaccount(protocol) 187 account = findaccount(protocol)
188 goim(account, screenname) 188 goim(account, screenname)
189 189
190 def xmpp(uri): 190 def xmpp(uri):
191 protocol = "prpl-jabber" 191 protocol = "prpl-jabber"
192 match = re.match(r"^xmpp:(//([^/?#]*))?(/?([^?#]*))(\?([^;#]*)(;([^#]*))?)?(#(.*))?", uri) 192 match = re.match(r"^xmpp:((//)?([^/?#]*))?(/?([^?#]*))(\?([^;#]*)(;([^#]*))?)?(#(.*))?", uri)
193 if not match: 193 if not match:
194 print "Invalid xmpp URI: %s" % uri 194 print "Invalid xmpp URI: %s" % uri
195 return 195 return
196 196
197 accountname = urllib.unquote_plus(match.group(2)) or "" 197 tmp = match.group(3)
198 screenname = urllib.unquote_plus(match.group(4)) 198 if (tmp):
199 command = urllib.unquote_plus(match.group(6)) 199 accountname = urllib.unquote_plus(tmp)
200 paramstring = match.group(8) 200 else:
201 accountname = ""
202
203 screenname = urllib.unquote_plus(match.group(5))
204
205 tmp = match.group(7)
206 if (tmp):
207 command = urllib.unquote_plus(tmp)
208 else:
209 command = ""
210
211 paramstring = match.group(9)
201 params = {} 212 params = {}
202 if paramstring: 213 if paramstring:
203 for param in paramstring.split(";"): 214 for param in paramstring.split(";"):
204 key, value = extendlist(param.split("=", 1), 2, "") 215 key, value = extendlist(param.split("=", 1), 2, "")
205 params[key] = urllib.unquote_plus(value) 216 params[key] = urllib.unquote_plus(value)