annotate src/gaim-remote.py @ 12123:355c7acbb61d

[gaim-migrate @ 14423] Renamed /core/status/default and /core/status/idleaway to /core/savedstatus/default and /core/savedstatus/idleaway, and removed to redundant calls to set the 'default' pref /core/savedstatus/default is set by gaim_savedstatus_activate() in savedstatus.c committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 18 Nov 2005 03:45:01 +0000
parents 64fadbf3810f
children 2e4e02b72e43
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
1 #!/usr/bin/python
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
2
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
3 import dbus
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
4 import re
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
5 import urllib
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
6 import sys
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
7
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
8 import xml.dom.minidom
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
9
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
10 xml.dom.minidom.Element.all = xml.dom.minidom.Element.getElementsByTagName
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
11
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
12 obj = dbus.SessionBus().get_object("org.gaim.GaimService", "/org/gaim/GaimObject")
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
13 gaim = dbus.Interface(obj, "org.gaim.GaimInterface")
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
14
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
15 class CheckedObject:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
16 def __init__(self, obj):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
17 self.obj = obj
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
18
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
19 def __getattr__(self, attr):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
20 return CheckedAttribute(self, attr)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
21
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
22 class CheckedAttribute:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
23 def __init__(self, cobj, attr):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
24 self.cobj = cobj
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
25 self.attr = attr
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
26
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
27 def __call__(self, *args):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
28 result = self.cobj.obj.__getattr__(self.attr)(*args)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
29 if result == 0:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
30 raise "Error: " + self.attr + " " + str(args) + " returned " + str(result)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
31 return result
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
32
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
33 cgaim = CheckedObject(gaim)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
34
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
35 urlregexp = r"^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?"
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
36
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
37 def extendlist(list, length, fill):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
38 if len(list) < length:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
39 return list + [fill] * (length - len(list))
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
40 else:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
41 return list
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
42
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
43 def convert(value):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
44 try:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
45 return int(value)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
46 except:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
47 return value
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
48
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
49 def findaccount(accountname, protocolname):
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
50 try:
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
51 # prefer connected accounts
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
52 account = cgaim.GaimAccountsFindConnected(accountname, protocolname)
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
53 return account
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
54 except:
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
55 # try to get any account and connect it
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
56 account = cgaim.GaimAccountsFindAny(accountname, protocolname)
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
57 print gaim.GaimAccountGetUsername(account)
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
58 gaim.GaimAccountSetStatusVargs(account, "online", 1)
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
59 gaim.GaimAccountConnect(account)
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
60 return account
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
61
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
62
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
63 def execute(uri):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
64 match = re.match(urlregexp, uri)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
65 protocol = match.group(2)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
66 if protocol is not None:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
67 protocol = "prpl-" + protocol
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
68 command = match.group(5)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
69 paramstring = match.group(7)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
70 params = {}
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
71 if paramstring is not None:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
72 for param in paramstring.split("&"):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
73 key, value = extendlist(param.split("=",1), 2, "")
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
74 params[key] = urllib.unquote(value)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
75
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
76 accountname = params.get("account", "")
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
77
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
78 if command == "goim":
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
79 print params
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
80 account = findaccount(accountname, protocol)
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
81 conversation = cgaim.GaimConversationNew(1, account, params["screenname"])
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
82 if "message" in params:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
83 im = cgaim.GaimConversationGetImData(conversation)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
84 gaim.GaimConvImSend(im, params["message"])
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
85 return None
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
86
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
87 elif command == "gochat":
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
88 account = findaccount(accountname, protocol)
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
89 connection = cgaim.GaimAccountGetConnection(account)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
90 return gaim.ServJoinChat(connection, params)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
91
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
92 elif command == "addbuddy":
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
93 account = findaccount(accountname, protocol)
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
94 return cgaim.GaimBlistRequestAddBuddy(account, params["screenname"],
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
95 params.get("group", ""), "")
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
96
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
97 elif command == "setstatus":
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
98 if "account" in params:
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
99 accounts = [cgaim.GaimAccountsFindAny(accountname, protocol)]
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
100 else:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
101 accounts = gaim.GaimAccountsGetAllActive()
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
102
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
103 for account in accounts:
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
104 status = cgaim.GaimAccountGetStatus(account, params["status"])
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
105 for key, value in params.items():
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
106 if key not in ["status", "account"]:
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
107 gaim.GaimStatusSetAttrString(status, key, value)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
108 gaim.GaimAccountSetStatusVargs(account, params["status"], 1)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
109 return None
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
110
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
111 elif command == "getinfo":
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
112 account = findaccount(accountname, protocol)
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
113 connection = cgaim.GaimAccountGetConnection(account)
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
114 return gaim.ServGetInfo(connection, params["screenname"])
11241
66f872f30e40 [gaim-migrate @ 13404]
Piotr Zielinski <zielaj>
parents: 11187
diff changeset
115
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
116 elif command == "quit":
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
117 return gaim.GaimCoreQuit()
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
118
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
119 elif command == "uri":
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
120 return None
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
121
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
122 else:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
123 match = re.match(r"(\w+)\s*\(([^)]*)\)", command)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
124 if match is not None:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
125 name = match.group(1)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
126 argstr = match.group(2)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
127 if argstr == "":
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
128 args = []
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
129 else:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
130 args = argstr.split(",")
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
131 fargs = []
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
132 for arg in args:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
133 fargs.append(convert(arg.strip()))
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
134 return gaim.__getattr__(name)(*fargs)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
135 else:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
136 # introspect the object to get parameter names and types
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
137 # this is slow because the entire introspection info must be downloaded
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
138 data = dbus.Interface(obj, "org.freedesktop.DBus.Introspectable").\
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
139 Introspect()
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
140 introspect = xml.dom.minidom.parseString(data).documentElement
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
141 for method in introspect.all("method"):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
142 if command == method.getAttribute("name"):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
143 methodparams = []
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
144 for arg in method.all("arg"):
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
145 if arg.getAttribute("direction") == "in":
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
146 value = params[arg.getAttribute("name")]
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
147 type = arg.getAttribute("type")
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
148 if type == "s":
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
149 methodparams.append(value)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
150 elif type == "i":
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
151 methodparams.append(int(value))
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
152 else:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
153 raise "Don't know how to handle type \"%s\"" % type
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
154 return gaim.__getattr__(command)(*methodparams)
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
155 raise "Unknown command: %s" % command
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
156
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
157
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
158 if len(sys.argv) == 1:
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
159 print """This program uses DBus to communicate with gaim.
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
160
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
161 Usage:
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
162
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
163 %s "command1" "command2" ...
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
164
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
165 Each command is of one of the three types:
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
166
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
167 [protocol:]commandname?param1=value1&param2=value2&...
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
168 FunctionName?param1=value1&param2=value2&...
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
169 FunctionName(value1,value2,...)
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
170
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
171 The second and third form are provided for completeness but their use
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
172 is not recommended; use gaim-send or gaim-send-async instead. The
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
173 second form uses introspection to find out the parameter names and
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
174 their types, therefore it is rather slow.
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
175
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
176 Examples of commands:
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
177
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
178 jabber:goim?screenname=testone@localhost&message=hi
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
179 jabber:gochat?room=TestRoom&server=conference.localhost
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
180 jabber:getinfo?screenname=testone@localhost
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
181 jabber:addbuddy?screenname=my friend
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
182
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
183 setstatus?status=away&message=don't disturb
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
184 quit
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
185
11331
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
186 GaimAccountsFindConnected?name=&protocol=prpl-jabber
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
187 GaimAccountFindConnected(,prpl-jabber)
64fadbf3810f [gaim-migrate @ 13544]
Piotr Zielinski <zielaj>
parents: 11241
diff changeset
188 """ % sys.argv[0]
11187
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
189
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
190 for arg in sys.argv[1:]:
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
191 print execute(arg)
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
192
744c0708d11f [gaim-migrate @ 13303]
Piotr Zielinski <zielaj>
parents:
diff changeset
193