summaryrefslogtreecommitdiff
path: root/nonprism/pidgin/pidgin-py3-fixes.patch
blob: 9385e242fd4c96732bb9e1b21a4bc8b488240f05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff -uprb pidgin-2.10.12.orig/libpurple/purple-remote pidgin-2.10.12/libpurple/purple-remote
--- pidgin-2.10.12.orig/libpurple/purple-remote	2016-01-01 01:19:41.000000000 +0200
+++ pidgin-2.10.12/libpurple/purple-remote	2016-01-02 06:23:14.082831498 +0200
@@ -3,13 +3,20 @@
 import codecs
 import dbus
 import re
-import urllib
 import sys
+try:
+    from urllib.parse import unquote
+except ImportError:
+    from urllib import unquote
 
 import xml.dom.minidom 
 
-sys.stdin = codecs.getwriter('utf-8')(sys.stdin);
-sys.stdout = codecs.getwriter('utf-8')(sys.stdout);
+if sys.version_info[0] >= 3:
+    sys.stdin = codecs.getwriter('utf-8')(sys.stdin.buffer)
+    sys.stdout = codecs.getwriter('utf-8')(sys.stdout.buffer)
+else:
+    sys.stdin = codecs.getwriter('utf-8')(sys.stdin)
+    sys.stdout = codecs.getwriter('utf-8')(sys.stdout)
 
 xml.dom.minidom.Element.all   = xml.dom.minidom.Element.getElementsByTagName
 
@@ -41,7 +48,7 @@ class CheckedAttribute:
         return result
             
 def show_help(requested=False):
-    print """This program uses D-Bus to communicate with purple.
+    print("""This program uses D-Bus to communicate with purple.
 
 Usage:
 
@@ -72,7 +79,7 @@ Examples of commands:
 
     PurpleAccountsFindConnected?name=&protocol=prpl-jabber
     PurpleAccountsFindConnected(,prpl-jabber)
-""" % sys.argv[0]
+""" % sys.argv[0])
     if (requested):
         sys.exit(0)
     else:
@@ -120,7 +127,7 @@ def execute(uri):
     if paramstring is not None:
         for param in paramstring.split("&"):
             key, value = extendlist(param.split("=",1), 2, "")
-            params[key] = urllib.unquote(value)
+            params[key] = unquote(value)
 
     accountname = params.get("account", "")
 
@@ -233,12 +240,11 @@ if len(sys.argv) == 1:
 elif (sys.argv[1] == "--help" or sys.argv[1] == "-h"):
     show_help(True)
 elif (obj == None):
-    print "No existing libpurple instance detected."
+    print("No existing libpurple instance detected.")
     sys.exit(1);
     
 for arg in sys.argv[1:]:
     output = execute(arg)
 
     if (output != None):
-        print output
-
+        print(output)