pidgin: 1113bba4: Extend purple-url-handler to handle "gta...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Thu Jan 1 12:51:25 EST 2009


-----------------------------------------------------------------
Revision: 1113bba42babcbb9b1fd16e72de4930f50a89f58
Ancestor: 68a6ea7faf68bd38766e147b455ffa0ad105056e
Author: paul at aurich.com
Date: 2009-01-01T17:03:44
Branch: im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/1113bba42babcbb9b1fd16e72de4930f50a89f58

Modified files:
        libpurple/purple-url-handler

ChangeLog: 

Extend purple-url-handler to handle "gtalk" URIs.  Fixes #7889

-------------- next part --------------
============================================================
--- libpurple/purple-url-handler	27f0259b13823258c371f9d8710a99fdce0f0a42
+++ libpurple/purple-url-handler	99b3f5593351d9f745821dbdc6e349f1b2cbdcad
@@ -299,6 +299,31 @@ def xmpp(uri):
     else:
         goim(account, screenname)
 
+def gtalk(uri):
+    protocol = "prpl-jabber"
+    match = re.match(r"^gtalk:([^?]*)(\?(.*))", uri)
+    if not match:
+        print "Invalid gtalk URI: %s" % uri
+        return
+
+    command = urllib.unquote_plus(match.group(1))
+    paramstring = match.group(3)
+    params = {}
+    if paramstring:
+        for param in paramstring.split("&"):
+            key, value = extendlist(param.split("=", 1), 2, "")
+            params[key] = urllib.unquote_plus(value)
+    accountname = params.get("from_jid", "")
+    jid = params.get("jid", "")
+
+    account = findaccount(protocol, accountname)
+
+    if command.lower() == "chat":
+        goim(account, jid)
+    elif command.lower() == "call":
+        # XXX V&V prompt to establish call
+        goim(account, jid)
+
 def ymsgr(uri):
     protocol = "prpl-yahoo"
     match = re.match(r"^ymsgr:([^?]*)(\?([^&]*)(&(.*))?)", uri)
@@ -355,6 +380,8 @@ def main(argv=sys.argv):
             sip(uri)
         elif type == "xmpp":
             xmpp(uri)
+        elif type == "gtalk":
+            gtalk(uri)
         elif type == "ymsgr":
             ymsgr(uri)
         else:


More information about the Commits mailing list