Mercurial > pidgin
annotate libpurple/purple-remote @ 22019:0ae2e64dcff9
Give credit where due.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Sun, 06 Jan 2008 19:48:18 +0000 |
parents | fefe61275687 |
children | 4b4be7609072 |
rev | line source |
---|---|
22013
fefe61275687
A small patch from shreevatsa: "Some of the Python scripts start with
Richard Laager <rlaager@wiktel.com>
parents:
20303
diff
changeset
|
1 #!/usr/bin/env python |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
2 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
3 import dbus |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
4 import re |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
5 import urllib |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
6 import sys |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
7 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
8 import xml.dom.minidom |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
9 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
10 xml.dom.minidom.Element.all = xml.dom.minidom.Element.getElementsByTagName |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
11 |
20303
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
12 obj = None |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
13 try: |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
14 obj = dbus.SessionBus().get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject") |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
15 except: |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
16 pass |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
17 |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
18 purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface") |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
19 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
20 class CheckedObject: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
21 def __init__(self, obj): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
22 self.obj = obj |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
23 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
24 def __getattr__(self, attr): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
25 return CheckedAttribute(self, attr) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
26 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
27 class CheckedAttribute: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
28 def __init__(self, cobj, attr): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
29 self.cobj = cobj |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
30 self.attr = attr |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
31 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
32 def __call__(self, *args): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
33 result = self.cobj.obj.__getattr__(self.attr)(*args) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
34 if result == 0: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
35 raise "Error: " + self.attr + " " + str(args) + " returned " + str(result) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
36 return result |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
37 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
38 def show_help(): |
17477
3bcdb320e619
Fix http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=240589
Mark Doliner <mark@kingant.net>
parents:
17344
diff
changeset
|
39 print """This program uses D-Bus to communicate with purple. |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
40 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
41 Usage: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
42 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
43 %s "command1" "command2" ... |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
44 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
45 Each command is of one of the three types: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
46 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
47 [protocol:]commandname?param1=value1¶m2=value2&... |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
48 FunctionName?param1=value1¶m2=value2&... |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
49 FunctionName(value1,value2,...) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
50 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
51 The second and third form are provided for completeness but their use |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
52 is not recommended; use purple-send or purple-send-async instead. The |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
53 second form uses introspection to find out the parameter names and |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
54 their types, therefore it is rather slow. |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
55 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
56 Examples of commands: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
57 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
58 jabber:goim?screenname=testone@localhost&message=hi |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
59 jabber:gochat?room=TestRoom&server=conference.localhost |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
60 jabber:getinfo?screenname=testone@localhost |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
61 jabber:addbuddy?screenname=my friend |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
62 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
63 setstatus?status=away&message=don't disturb |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
64 quit |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
65 |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
66 PurpleAccountsFindConnected?name=&protocol=prpl-jabber |
18622 | 67 PurpleAccountsFindConnected(,prpl-jabber) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
68 """ % sys.argv[0] |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
69 |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
70 cpurple = CheckedObject(purple) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
71 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
72 urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?" |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
73 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
74 def extendlist(list, length, fill): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
75 if len(list) < length: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
76 return list + [fill] * (length - len(list)) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
77 else: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
78 return list |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
79 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
80 def convert(value): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
81 try: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
82 return int(value) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
83 except: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
84 return value |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
85 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
86 def findaccount(accountname, protocolname): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
87 try: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
88 # prefer connected accounts |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
89 account = cpurple.PurpleAccountsFindConnected(accountname, protocolname) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
90 return account |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
91 except: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
92 # try to get any account and connect it |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
93 account = cpurple.PurpleAccountsFindAny(accountname, protocolname) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
94 purple.PurpleAccountSetStatusVargs(account, "online", 1) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
95 purple.PurpleAccountConnect(account) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
96 return account |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
97 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
98 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
99 def execute(uri): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
100 match = re.match(urlregexp, uri) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
101 protocol = match.group(2) |
17344
3c8ccbc4a667
A conditional in purple_remote was missing a trailing colon.
Ethan Blanton <elb@pidgin.im>
parents:
17157
diff
changeset
|
102 if protocol == "xmpp": |
17157
c36124736326
Make purple-remote accept xmpp as a protocol
Stu Tomlinson <stu@nosnilmot.com>
parents:
16143
diff
changeset
|
103 protocol = "jabber" |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
104 if protocol is not None: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
105 protocol = "prpl-" + protocol |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
106 command = match.group(5) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
107 paramstring = match.group(7) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
108 params = {} |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
109 if paramstring is not None: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
110 for param in paramstring.split("&"): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
111 key, value = extendlist(param.split("=",1), 2, "") |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
112 params[key] = urllib.unquote(value) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
113 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
114 accountname = params.get("account", "") |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
115 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
116 if command == "goim": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
117 account = findaccount(accountname, protocol) |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
118 conversation = cpurple.PurpleConversationNew(1, account, params["screenname"]) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
119 if "message" in params: |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
120 im = cpurple.PurpleConversationGetImData(conversation) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
121 purple.PurpleConvImSend(im, params["message"]) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
122 return None |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
123 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
124 elif command == "gochat": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
125 account = findaccount(accountname, protocol) |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
126 connection = cpurple.PurpleAccountGetConnection(account) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
127 return purple.ServJoinChat(connection, params) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
128 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
129 elif command == "addbuddy": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
130 account = findaccount(accountname, protocol) |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
131 return cpurple.PurpleBlistRequestAddBuddy(account, params["screenname"], |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
132 params.get("group", ""), "") |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
133 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
134 elif command == "setstatus": |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
135 current = purple.PurpleSavedstatusGetCurrent() |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
136 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
137 if "status" in params: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
138 status_id = params["status"] |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
139 status_type = purple.PurplePrimitiveGetTypeFromId(status_id) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
140 else: |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
141 status_type = purple.PurpleSavedstatusGetType(current) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
142 status_id = purple.PurplePrimitiveGetIdFromType(status_type) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
143 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
144 if "message" in params: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
145 message = params["message"]; |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
146 else: |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
147 message = purple.PurpleSavedstatusGetMessage(current) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
148 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
149 if "account" in params: |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
150 accounts = [cpurple.PurpleAccountsFindAny(accountname, protocol)] |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
151 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
152 for account in accounts: |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
153 status = purple.PurpleAccountGetStatus(account, status_id) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
154 type = purple.PurpleStatusGetType(status) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
155 purple.PurpleSavedstatusSetSubstatus(current, account, type, message) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
156 purple.PurpleSavedstatusActivateForAccount(current, account) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
157 else: |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
158 accounts = purple.PurpleAccountsGetAllActive() |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
159 saved = purple.PurpleSavedstatusNew("", status_type) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
160 purple.PurpleSavedstatusSetMessage(saved, message) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
161 purple.PurpleSavedstatusActivate(saved) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
162 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
163 return None |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
164 |
18035
c168d1ae2012
A patch from Norbert Buchmuller:
Norbert Buchmuller <norbi@nix.hu>
parents:
17344
diff
changeset
|
165 elif command == "getstatus": |
c168d1ae2012
A patch from Norbert Buchmuller:
Norbert Buchmuller <norbi@nix.hu>
parents:
17344
diff
changeset
|
166 current = purple.PurpleSavedstatusGetCurrent() |
c168d1ae2012
A patch from Norbert Buchmuller:
Norbert Buchmuller <norbi@nix.hu>
parents:
17344
diff
changeset
|
167 status_type = purple.PurpleSavedstatusGetType(current) |
c168d1ae2012
A patch from Norbert Buchmuller:
Norbert Buchmuller <norbi@nix.hu>
parents:
17344
diff
changeset
|
168 status_id = purple.PurplePrimitiveGetIdFromType(status_type) |
c168d1ae2012
A patch from Norbert Buchmuller:
Norbert Buchmuller <norbi@nix.hu>
parents:
17344
diff
changeset
|
169 return status_id |
c168d1ae2012
A patch from Norbert Buchmuller:
Norbert Buchmuller <norbi@nix.hu>
parents:
17344
diff
changeset
|
170 |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
171 elif command == "getinfo": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
172 account = findaccount(accountname, protocol) |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
173 connection = cpurple.PurpleAccountGetConnection(account) |
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
174 return purple.ServGetInfo(connection, params["screenname"]) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
175 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
176 elif command == "quit": |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
177 return purple.PurpleCoreQuit() |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
178 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
179 elif command == "uri": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
180 return None |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
181 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
182 else: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
183 match = re.match(r"(\w+)\s*\(([^)]*)\)", command) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
184 if match is not None: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
185 name = match.group(1) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
186 argstr = match.group(2) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
187 if argstr == "": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
188 args = [] |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
189 else: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
190 args = argstr.split(",") |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
191 fargs = [] |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
192 for arg in args: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
193 fargs.append(convert(arg.strip())) |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
194 return purple.__getattr__(name)(*fargs) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
195 else: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
196 # introspect the object to get parameter names and types |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
197 # this is slow because the entire introspection info must be downloaded |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
198 data = dbus.Interface(obj, "org.freedesktop.DBus.Introspectable").\ |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
199 Introspect() |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
200 introspect = xml.dom.minidom.parseString(data).documentElement |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
201 for method in introspect.all("method"): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
202 if command == method.getAttribute("name"): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
203 methodparams = [] |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
204 for arg in method.all("arg"): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
205 if arg.getAttribute("direction") == "in": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
206 value = params[arg.getAttribute("name")] |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
207 type = arg.getAttribute("type") |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
208 if type == "s": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
209 methodparams.append(value) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
210 elif type == "i": |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
211 methodparams.append(int(value)) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
212 else: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
213 raise "Don't know how to handle type \"%s\"" % type |
16143
598b1b15b199
Trac Ticket #149 from JensenDied
Richard Laager <rlaager@wiktel.com>
parents:
15884
diff
changeset
|
214 return purple.__getattr__(command)(*methodparams) |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
215 show_help() |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
216 raise "Unknown command: %s" % command |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
217 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
218 if len(sys.argv) == 1: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
219 show_help() |
20303
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
220 elif (obj == None): |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
221 print "No existing libpurple instance detected." |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
222 sys.exit(1); |
d130a8a8e354
applied changes from c699de7eec5194554b5fcb885019835fb902d95a
Luke Schierer <lschiere@pidgin.im>
parents:
18622
diff
changeset
|
223 |
15884
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
224 for arg in sys.argv[1:]: |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
225 output = execute(arg) |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
226 |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
227 if (output != None): |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
228 print output |
c6e563dfaa7a
More s/gaim/pidgin/ and s/gaim/purple/ and make the RPM spec file work a bit
Stu Tomlinson <stu@nosnilmot.com>
parents:
diff
changeset
|
229 |