diff libpurple/purple-url-handler @ 25371:0009541d4ec2

In the course of looking at purple-url-handler to compose a response to a post on devel@pidgin.im, I found and fixed a bug where handling an IRC URL will fail if you have any accounts with no user_split in the list of accounts before the IRC account in question.
author Richard Laager <rlaager@wiktel.com>
date Mon, 26 Jan 2009 02:35:25 +0000
parents c260fe3ac5c8
children 971b89243a20
line wrap: on
line diff
--- a/libpurple/purple-url-handler	Sun Jan 25 02:00:03 2009 +0000
+++ b/libpurple/purple-url-handler	Mon Jan 26 02:35:25 2009 +0000
@@ -207,7 +207,11 @@
 
     def correct_server(account):
         username = cpurple.PurpleAccountGetUsername(account)
-        return (server == (username.split("@"))[1])
+        user_split = (username.split("@"))
+        # Not all accounts have a split, so append an empty string so the
+        # [1] doesn't throw an IndexError.
+        user_split.append("")
+        return (server == user_split[1])
 
     account = findaccount(protocol, matcher=correct_server)