Mercurial > pidgin.yaz
comparison libpurple/purple-url-handler @ 24857:c260fe3ac5c8
Extend purple-url-handler to handle "gtalk" URIs. Fixes #7889
committer: John Bailey <rekkanoryo@rekkanoryo.org>
author | Paul Aurich <paul@darkrain42.org> |
---|---|
date | Thu, 01 Jan 2009 17:03:44 +0000 |
parents | ab1f79d3ceeb |
children | 0009541d4ec2 |
comparison
equal
deleted
inserted
replaced
24856:a6742d9eadf3 | 24857:c260fe3ac5c8 |
---|---|
296 gochat(account, {"room": room, "server": server}) | 296 gochat(account, {"room": room, "server": server}) |
297 elif command.lower() == "roster": | 297 elif command.lower() == "roster": |
298 addbuddy(account, screenname, params.get("group", ""), params.get("name", "")) | 298 addbuddy(account, screenname, params.get("group", ""), params.get("name", "")) |
299 else: | 299 else: |
300 goim(account, screenname) | 300 goim(account, screenname) |
301 | |
302 def gtalk(uri): | |
303 protocol = "prpl-jabber" | |
304 match = re.match(r"^gtalk:([^?]*)(\?(.*))", uri) | |
305 if not match: | |
306 print "Invalid gtalk URI: %s" % uri | |
307 return | |
308 | |
309 command = urllib.unquote_plus(match.group(1)) | |
310 paramstring = match.group(3) | |
311 params = {} | |
312 if paramstring: | |
313 for param in paramstring.split("&"): | |
314 key, value = extendlist(param.split("=", 1), 2, "") | |
315 params[key] = urllib.unquote_plus(value) | |
316 accountname = params.get("from_jid", "") | |
317 jid = params.get("jid", "") | |
318 | |
319 account = findaccount(protocol, accountname) | |
320 | |
321 if command.lower() == "chat": | |
322 goim(account, jid) | |
323 elif command.lower() == "call": | |
324 # XXX V&V prompt to establish call | |
325 goim(account, jid) | |
301 | 326 |
302 def ymsgr(uri): | 327 def ymsgr(uri): |
303 protocol = "prpl-yahoo" | 328 protocol = "prpl-yahoo" |
304 match = re.match(r"^ymsgr:([^?]*)(\?([^&]*)(&(.*))?)", uri) | 329 match = re.match(r"^ymsgr:([^?]*)(\?([^&]*)(&(.*))?)", uri) |
305 if not match: | 330 if not match: |
353 myim(uri) | 378 myim(uri) |
354 elif type == "sip": | 379 elif type == "sip": |
355 sip(uri) | 380 sip(uri) |
356 elif type == "xmpp": | 381 elif type == "xmpp": |
357 xmpp(uri) | 382 xmpp(uri) |
383 elif type == "gtalk": | |
384 gtalk(uri) | |
358 elif type == "ymsgr": | 385 elif type == "ymsgr": |
359 ymsgr(uri) | 386 ymsgr(uri) |
360 else: | 387 else: |
361 print "Unknown protocol: %s" % type | 388 print "Unknown protocol: %s" % type |
362 except dbus.DBusException, e: | 389 except dbus.DBusException, e: |