pidgin: b5c61073: Some fixes to IRC handling in purple-url...

nosnilmot at pidgin.im nosnilmot at pidgin.im
Mon Jul 19 22:31:49 EDT 2010


----------------------------------------------------------------------
Revision: b5c6107388ee0be38f9fb15f33d4c13572444d3f
Parent:   07d0765c444a097af45c2650f54323afb900a07b
Author:   nosnilmot at pidgin.im
Date:     07/19/10 22:27:17
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b5c6107388ee0be38f9fb15f33d4c13572444d3f

Changelog: 

Some fixes to IRC handling in purple-url-handler, mainly to fix
https://bugzilla.redhat.com/show_bug.cgi?id=614426
I probably broke it horribly in the process, but given that it wasn't even
verifying the account was an IRC account before it can't be much more
broken now. can it?

Changes against parent 07d0765c444a097af45c2650f54323afb900a07b

  patched  libpurple/purple-url-handler

-------------- next part --------------
============================================================
--- libpurple/purple-url-handler	8a173d29d5131825346c10f64064d92f5ba21c93
+++ libpurple/purple-url-handler	b81b743f3a0fcaa9fc341d65f6698580cd00adda
@@ -73,7 +73,8 @@ def findaccount(protocolname, accountnam
 def findaccount(protocolname, accountname="", matcher=None):
     if matcher:
         for account in cpurple.PurpleAccountsGetAll():
-            if accountname != "" and accountname != cpurple.PurpleAccountGetUsername(a):
+            if (protocolname != cpurple.PurpleAccountGetProtocolID(account)) or \
+               (accountname != "" and accountname != cpurple.PurpleAccountGetUsername(account)):
                 continue
             if matcher(account):
                 bring_account_online(account)
@@ -182,7 +183,7 @@ def irc(uri):
 
 def irc(uri):
     protocol = "prpl-irc"
-    match = re.match(r"^irc:(//([^/]*)/)?([^?]*)(\?(.*))?", uri)
+    match = re.match(r"^irc:(//([^/]*))?/?([^?]*)(\?(.*))?", uri)
     if not match:
         print "Invalid irc URI: %s" % uri
         return
@@ -207,7 +208,7 @@ def irc(uri):
 
     def correct_server(account):
         username = cpurple.PurpleAccountGetUsername(account)
-        return ("@" in username) and (server == (username.split("@"))[1])
+        return ((server == "") or ("@" in username) and (server == (username.split("@"))[1]))
 
     account = findaccount(protocol, matcher=correct_server)
 


More information about the Commits mailing list