Mercurial > libervia-backend
annotate src/bridge/DBus.py @ 266:c4b84a2d2ad1
bridge: constructor and template improved, documentation added
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 24 Jan 2011 17:47:45 +0100 |
parents | af3d4f11fe43 |
children | bdcd535e179e |
rev | line source |
---|---|
0 | 1 #!/usr/bin/python |
2 #-*- coding: utf-8 -*- | |
3 | |
4 """ | |
5 SAT: a jabber client | |
228 | 6 Copyright (C) 2009, 2010, 2011 Jérôme Poisson (goffi@goffi.org) |
0 | 7 |
8 This program is free software: you can redistribute it and/or modify | |
9 it under the terms of the GNU General Public License as published by | |
10 the Free Software Foundation, either version 3 of the License, or | |
11 (at your option) any later version. | |
12 | |
13 This program is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
19 along with this program. If not, see <http://www.gnu.org/licenses/>. | |
20 """ | |
21 | |
22 | |
23 from bridge import Bridge | |
24 import dbus | |
25 import dbus.service | |
26 import dbus.mainloop.glib | |
27 from logging import debug, info, error | |
28 | |
10 | 29 const_INT_PREFIX = "org.goffi.SAT" #Interface prefix |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
30 const_COMM_SUFFIX = ".communication" |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
31 const_REQ_SUFFIX = ".request" |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
32 |
0 | 33 class DbusObject(dbus.service.Object): |
34 | |
35 def __init__(self, bus, path): | |
36 dbus.service.Object.__init__(self, bus, path) | |
37 debug("Init DbusObject...") | |
38 self.cb={} | |
39 | |
40 def register(self, name, cb): | |
41 self.cb[name]=cb | |
42 | |
43 ### signals ### | |
44 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
45 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
46 signature='s') |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
47 def connected(self, profile): |
52 | 48 debug("Connected signal") |
49 | |
50 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, | |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
51 signature='s') |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
52 def disconnected(self, profile): |
52 | 53 debug("Disconnected signal") |
54 | |
55 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, | |
262
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
56 signature='ss') |
266
c4b84a2d2ad1
bridge: constructor and template improved, documentation added
Goffi <goffi@goffi.org>
parents:
262
diff
changeset
|
57 def connection_error(self, error_type, profile): |
262
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
58 debug("Connection_error signal") |
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
59 |
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
60 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
61 signature='sa{ss}ass') |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
62 def newContact(self, contact, attributes, groups, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
63 debug("new contact signal (%s) sended (profile: %s)", contact, profile) |
0 | 64 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
65 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
66 signature='sssss') |
67
0e50dd3a234a
message sending bug fixes + sortilege update
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
67 def newMessage(self, from_jid, msg, type, to, profile): |
0 | 68 debug("new message signal (from:%s msg:%s type:%s to:%s) sended", from_jid, msg, type, to) |
69 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
70 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
182
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
135
diff
changeset
|
71 signature='ssss') |
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
135
diff
changeset
|
72 def newAlert(self, msg, title, type, profile): |
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
135
diff
changeset
|
73 debug("new alert signal (title:%s type:%s msg:%s profile:%s) sended", type, title, msg, profile) |
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
135
diff
changeset
|
74 |
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
135
diff
changeset
|
75 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
76 signature='ssia{ss}s') |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
77 def presenceUpdate(self, entity, show, priority, statuses, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
78 debug("presence update signal (from:%s show:%s priority:%d statuses:%s profile:%s) sended" , entity, show, priority, statuses, profile) |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
79 |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
80 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
81 signature='sss') |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
82 def subscribe(self, type, entity, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
83 debug("subscribe (type: [%s] from:[%s] profile:[%s])" , type, entity, profile) |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
84 |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
85 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
86 signature='ssss') |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
87 def paramUpdate(self, name, value, category, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
88 debug("param update signal: %s=%s in category %s (profile: %s)", name, value, category, profile) |
0 | 89 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
90 @dbus.service.signal(const_INT_PREFIX+const_COMM_SUFFIX, |
49 | 91 signature='ss') |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
92 def contactDeleted(self, entity, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
93 debug("contact deleted signal: %s (profile: %s)", entity, profile) |
0 | 94 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
95 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, |
0 | 96 signature='ssa{ss}') |
97 def askConfirmation(self, type, id, data): | |
98 debug("asking for confirmation: id = [%s] type = %s data = %s", id, type, data) | |
99 | |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
100 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
101 signature='ssa{ss}') |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
102 def actionResult(self, type, id, data): |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
103 debug("result of action: id = [%s] type = %s data = %s", id, type, data) |
0 | 104 |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
105 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, |
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
106 signature='ssa{sa{ss}}') |
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
107 def actionResultExt(self, type, id, data): |
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
108 debug("extended result of action: id = [%s] type = %s data = %s", id, type, data) |
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
109 |
49 | 110 @dbus.service.signal(const_INT_PREFIX+const_REQ_SUFFIX, |
111 signature='sa{ss}') | |
112 def updatedValue(self, name, value): | |
113 debug("updated value: %s = %s", name, value) | |
114 | |
0 | 115 ### methods ### |
116 | |
119
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
117 |
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
118 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
119 in_signature='', out_signature='s') |
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
120 def getVersion(self): |
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
121 return self.cb["getVersion"]() |
ded2431cea5a
Primitivus: chat window / text sending.
Goffi <goffi@goffi.org>
parents:
105
diff
changeset
|
122 |
60
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
123 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
124 in_signature='s', out_signature='s') |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
125 def getProfileName(self, profile_key): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
126 return self.cb["getProfileName"](profile_key) |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
127 |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
128 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
60
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
129 in_signature='', out_signature='as') |
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
130 def getProfilesList(self): |
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
131 info ('Profile list asked') |
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
132 return self.cb["getProfilesList"]() |
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
133 |
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
134 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
68 | 135 in_signature='s', out_signature='i') |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
136 def createProfile(self, name): |
60
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
137 info ('Profile creation asked') |
135
7452ac3818e7
Core, wix: added profile management for RegisterNewAccount method, and LaunchAction
Goffi <goffi@goffi.org>
parents:
128
diff
changeset
|
138 return self.cb["createProfile"](unicode(name)) |
68 | 139 |
140 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, | |
141 in_signature='s', out_signature='i') | |
142 def deleteProfile(self, name): | |
143 info ('Profile deletion asked') | |
266
c4b84a2d2ad1
bridge: constructor and template improved, documentation added
Goffi <goffi@goffi.org>
parents:
262
diff
changeset
|
144 return self.cb["deleteProfile"](unicode(name)) |
60
9764e027ecc0
SàT: multi-profile parameters, first draft
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
145 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
146 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
147 in_signature='sssi', out_signature='s') |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
148 def registerNewAccount(self, login, password, host, port=5222): |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
149 info ("New account registration asked") |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
150 return self.cb["registerNewAccount"](login, password, host, port) |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
151 |
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
152 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
153 in_signature='s', out_signature='') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
154 def connect(self, profile_key='@DEFAULT@'): |
0 | 155 info ("Connection asked") |
89
23caf1051099
multi-profile/subscription misc fixes
Goffi <goffi@goffi.org>
parents:
74
diff
changeset
|
156 return self.cb["connect"](profile_key) |
0 | 157 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
158 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
159 in_signature='s', out_signature='') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
160 def disconnect(self, profile_key='@DEFAULT@'): |
1 | 161 info ("Disconnection asked") |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
162 return self.cb["disconnect"](profile_key) |
1 | 163 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
164 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
266
c4b84a2d2ad1
bridge: constructor and template improved, documentation added
Goffi <goffi@goffi.org>
parents:
262
diff
changeset
|
165 in_signature='s', out_signature='b') |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
166 def isConnected(self, profile_key='@DEFAULT@'): |
52 | 167 info ("Connection status asked") |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
168 return self.cb["isConnected"](profile_key) |
52 | 169 |
170 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, | |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
171 in_signature='s', out_signature='a(sa{ss}as)') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
172 def getContacts(self, profile_key='@DEFAULT@'): |
0 | 173 debug("getContacts...") |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
174 return self.cb["getContacts"](profile_key) |
0 | 175 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
176 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
177 in_signature='s', out_signature='a{sa{s(sia{ss})}}') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
178 def getPresenceStatus(self, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
179 debug("getPresenceStatus...") |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
180 return self.cb["getPresenceStatus"](profile_key) |
49 | 181 |
182 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, | |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
183 in_signature='s', out_signature='a{ss}') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
184 def getWaitingSub(self, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
185 debug("getWaitingSub...") |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
186 return self.cb["getWaitingSub"](profile_key) |
0 | 187 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
188 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
260
c8406fe5e81e
Added SMTP server plugin, for sending messages from classic MUA \o/
Goffi <goffi@goffi.org>
parents:
228
diff
changeset
|
189 in_signature='sssss', out_signature='') |
c8406fe5e81e
Added SMTP server plugin, for sending messages from classic MUA \o/
Goffi <goffi@goffi.org>
parents:
228
diff
changeset
|
190 def sendMessage(self, to, message, subject="", type='chat', profile_key='@DEFAULT@'): |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
191 debug("sendMessage...") |
67
0e50dd3a234a
message sending bug fixes + sortilege update
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
192 print "sendtype=", type #gof |
260
c8406fe5e81e
Added SMTP server plugin, for sending messages from classic MUA \o/
Goffi <goffi@goffi.org>
parents:
228
diff
changeset
|
193 self.cb["sendMessage"](to, message, subject, type, profile_key) |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
194 |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
195 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
196 in_signature='ssia{ss}s', out_signature='') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
197 def setPresence(self, to="", show="", priority=0, statuses={}, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
198 self.cb["setPresence"](to, show, priority, statuses, profile_key) |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
199 |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
200 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
201 in_signature='sss', out_signature='') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
202 def subscription(self, type, entity, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
203 self.cb["subscription"](type, entity, profile_key) |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
204 |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
205 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
206 in_signature='ssss', out_signature='') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
207 def setParam(self, name, value, category, profile_key='@DEFAULT@'): |
128
2240f34f6452
Primitivus: misc fixes + menubar first draft
Goffi <goffi@goffi.org>
parents:
119
diff
changeset
|
208 self.cb["setParam"](unicode(name), unicode(value), unicode(category), profile_key) |
0 | 209 |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
210 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
211 in_signature='sss', out_signature='s') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
212 def getParamA(self, name, category="default", profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
213 return self.cb["getParamA"](name, category, profile_key = profile_key) |
0 | 214 |
105 | 215 |
216 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, | |
217 in_signature='s', out_signature='s') | |
218 def getParamsUI(self, profile_key='@DEFAULT@'): | |
219 return self.cb["getParamsUI"](profile_key) | |
220 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
221 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
222 in_signature='s', out_signature='s') |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
223 def getParams(self, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
224 return self.cb["getParams"](profile_key) |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
225 |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
226 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
227 in_signature='ss', out_signature='s') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
228 def getParamsForCategory(self, category, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
229 return self.cb["getParamsForCategory"](category, profile_key) |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
230 |
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
231 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 232 in_signature='', out_signature='as') |
233 def getParamsCategories(self): | |
234 return self.cb["getParamsCategories"]() | |
235 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
236 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
0 | 237 in_signature='ssi', out_signature='a{i(ss)}') |
238 def getHistory(self, from_jid, to_jid, size): | |
239 debug("History asked for %s", to_jid) | |
240 return self.cb["getHistory"](from_jid, to_jid, size) | |
241 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
242 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
243 in_signature='ss', out_signature='') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
244 def addContact(self, entity, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
245 debug("Subscription asked for %s (profile %s)", entity, profile_key) |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
246 return self.cb["addContact"](entity, profile_key) |
0 | 247 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
248 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, |
65
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
249 in_signature='ss', out_signature='') |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
250 def delContact(self, entity, profile_key='@DEFAULT@'): |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
251 debug("Unsubscription asked for %s (profile %s)", entity, profile_key) |
d35c5edab53f
SàT: multi-profile: memory & dbus bridge's methods profile management
Goffi <goffi@goffi.org>
parents:
61
diff
changeset
|
252 return self.cb["delContact"](entity, profile_key) |
0 | 253 |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
254 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
135
7452ac3818e7
Core, wix: added profile management for RegisterNewAccount method, and LaunchAction
Goffi <goffi@goffi.org>
parents:
128
diff
changeset
|
255 in_signature='sa{ss}s', out_signature='s') |
7452ac3818e7
Core, wix: added profile management for RegisterNewAccount method, and LaunchAction
Goffi <goffi@goffi.org>
parents:
128
diff
changeset
|
256 def launchAction(self, type, data, profile_key='@DEFAULT@'): |
7452ac3818e7
Core, wix: added profile management for RegisterNewAccount method, and LaunchAction
Goffi <goffi@goffi.org>
parents:
128
diff
changeset
|
257 return self.cb["launchAction"](type, data, profile_key) |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
258 |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
259 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
0 | 260 in_signature='sba{ss}', out_signature='') |
261 def confirmationAnswer(self, id, accepted, data): | |
262 debug("Answer for confirmation [%s]: %s", id, "Accepted" if accepted else "Refused") | |
263 return self.cb["confirmationAnswer"](id, accepted, data) | |
264 | |
36 | 265 |
266 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, | |
0 | 267 in_signature='s', out_signature='a{ss}') |
268 def getProgress(self, id): | |
269 #debug("Progress asked for %s", id) | |
270 return self.cb["getProgress"](id) | |
271 | |
101 | 272 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, |
273 in_signature='', out_signature='a(sss)') | |
274 def getMenus(self): | |
275 return self.cb["getMenus"]() | |
276 | |
277 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, | |
278 in_signature='sss', out_signature='s') | |
279 def getMenuHelp(self, category, name, type="NORMAL"): | |
280 return self.cb["getMenuHelp"](category, name, type) | |
281 | |
282 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, | |
283 in_signature='ssss', out_signature='s') | |
284 def callMenu(self, category, name, type, profile_key): | |
285 return self.cb["callMenu"](category, name, type, profile_key) | |
286 | |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
287 def __attribute_string(self, in_sign): |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
288 i=0 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
289 idx=0 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
290 attr_string="" |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
291 while i<len(in_sign): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
292 if in_sign[i] not in ['b','y','n','i','x','q','u','t','d','s','a']: |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
293 raise Exception #FIXME: create an exception here (unmanaged attribute type) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
294 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
295 attr_string += ("" if idx==0 else ",") + ("arg_%i" % idx) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
296 idx+=1 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
297 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
298 if in_sign[i] == 'a': |
73 | 299 i+=1 |
182
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
135
diff
changeset
|
300 if in_sign[i]!='{' and in_sign[i]!='(': #FIXME: must manage tuples out of arrays |
73 | 301 i+=1 |
302 continue #we have a simple type for the array | |
303 while (True): #we have a dict or a list of tuples | |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
304 i+=1 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
305 if i>=len(in_sign): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
306 raise Exception #FIXME: create an exception here (the '}' is not presend) |
37
a61beb21d16d
Gateway registration, unregistration & edition
Goffi <goffi@goffi.org>
parents:
36
diff
changeset
|
307 if in_sign[i] == '}' or in_sign[i] == ')': |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
308 break |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
309 i+=1 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
310 return attr_string |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
311 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
312 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
313 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
314 def addMethod(self, name, int_suffix, in_sign, out_sign): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
315 """Dynamically add a method to Dbus Bridge""" |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
316 #FIXME: Better way ??? |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
317 attributes = self.__attribute_string(in_sign) |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
318 |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
319 code = compile ('def '+name+' (self,'+attributes+'): return self.cb["'+name+'"]('+attributes+')', '<DBus bridge>','exec') |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
320 exec (code) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
321 method = locals()[name] |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
322 setattr(DbusObject, name, dbus.service.method( |
10 | 323 const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method)) |
73 | 324 |
325 def addSignal(self, name, int_suffix, signature): | |
326 """Dynamically add a signal to Dbus Bridge""" | |
327 #FIXME: Better way ??? | |
328 attributes = self.__attribute_string(signature) | |
329 | |
330 code = compile ('def '+name+' (self,'+attributes+'): debug ("'+name+' signal")', '<DBus bridge>','exec') | |
331 exec (code) | |
332 signal = locals()[name] | |
333 setattr(DbusObject, name, dbus.service.signal( | |
334 const_INT_PREFIX+int_suffix, signature=signature)(signal)) | |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
335 |
0 | 336 class DBusBridge(Bridge): |
337 def __init__(self): | |
338 dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) | |
339 Bridge.__init__(self) | |
340 info ("Init DBus...") | |
341 self.session_bus = dbus.SessionBus() | |
10 | 342 self.dbus_name = dbus.service.BusName(const_INT_PREFIX, self.session_bus) |
0 | 343 self.dbus_bridge = DbusObject(self.session_bus, '/org/goffi/SAT/bridge') |
344 | |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
345 def connected(self, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
346 self.dbus_bridge.connected(profile) |
52 | 347 |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
348 def disconnected(self, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
349 self.dbus_bridge.disconnected(profile) |
52 | 350 |
262
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
351 def connection_error(self, profile, error_type): |
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
352 self.dbus_bridge.connection_error(profile, error_type) |
af3d4f11fe43
Added management of connection error
Goffi <goffi@goffi.org>
parents:
260
diff
changeset
|
353 |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
354 def newContact(self, contact, attributes, groups, profile): |
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
355 self.dbus_bridge.newContact(contact, attributes, groups, profile) |
0 | 356 |
67
0e50dd3a234a
message sending bug fixes + sortilege update
Goffi <goffi@goffi.org>
parents:
66
diff
changeset
|
357 def newMessage(self, from_jid, msg, type='chat', to='', profile='@NONE@'): |
0 | 358 debug("sending message...") |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
359 self.dbus_bridge.newMessage(from_jid, msg, type, to, profile) |
0 | 360 |
221
96186f36d8cb
bridge: fixed newAlert parameters order
Goffi <goffi@goffi.org>
parents:
182
diff
changeset
|
361 def newAlert(self, msg, title="", alert_type="INFO", profile='@NONE@'): |
96186f36d8cb
bridge: fixed newAlert parameters order
Goffi <goffi@goffi.org>
parents:
182
diff
changeset
|
362 self.dbus_bridge.newAlert(msg, title, alert_type, profile) |
182
556c2bd7c344
Primitivus now implement showDialog + new "newAlert" bridge method to show a dialog from core
Goffi <goffi@goffi.org>
parents:
135
diff
changeset
|
363 |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
364 def presenceUpdate(self, entity, show, priority, statuses, profile): |
49 | 365 debug("updating presence for %s",entity) |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
366 self.dbus_bridge.presenceUpdate(entity, show, priority, statuses, profile) |
72 | 367 |
368 def roomJoined(self, room_id, room_service, room_nicks, user_nick, profile): | |
369 self.dbus_bridge.roomJoined(room_id, room_service, room_nicks, user_nick, profile) | |
49 | 370 |
221
96186f36d8cb
bridge: fixed newAlert parameters order
Goffi <goffi@goffi.org>
parents:
182
diff
changeset
|
371 def subscribe(self, sub_type, entity, profile): |
49 | 372 debug("subscribe request for %s",entity) |
221
96186f36d8cb
bridge: fixed newAlert parameters order
Goffi <goffi@goffi.org>
parents:
182
diff
changeset
|
373 self.dbus_bridge.subscribe(sub_type, entity, profile) |
0 | 374 |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
375 def paramUpdate(self, name, value, category, profile): |
18
6928e3cb73a8
refactoring: using xml params part II
Goffi <goffi@goffi.org>
parents:
17
diff
changeset
|
376 debug("updating param [%s] %s ", category, name) |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
377 self.dbus_bridge.paramUpdate(name, value, category, profile) |
0 | 378 |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
379 def contactDeleted(self, entity, profile): |
49 | 380 debug("sending contact deleted signal %s ", entity) |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
381 self.dbus_bridge.contactDeleted(entity, profile) |
0 | 382 |
383 def askConfirmation(self, type, id, data): | |
384 self.dbus_bridge.askConfirmation(type, id, data) | |
385 | |
22
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
386 def actionResult(self, type, id, data): |
bb72c29f3432
added action cb mechanism for buttons. Tested with a temporary new user registration button.
Goffi <goffi@goffi.org>
parents:
18
diff
changeset
|
387 self.dbus_bridge.actionResult(type, id, data) |
16
0a024d5e0cd0
New account creation (in-band registration)
Goffi <goffi@goffi.org>
parents:
10
diff
changeset
|
388 |
25
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
389 def actionResultExt(self, type, id, data): |
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
390 self.dbus_bridge.actionResultExt(type, id, data) |
53e921c8a357
new plugin: gateways plugin, and first implementation of findGateways
Goffi <goffi@goffi.org>
parents:
22
diff
changeset
|
391 |
49 | 392 def updatedValue(self, name, value): |
393 self.dbus_bridge.updatedValue(name, value) | |
394 | |
0 | 395 def register(self, name, callback): |
66
8147b4f40809
SàT: multi-profile: DBus signals and frontend adaptation (first draft)
Goffi <goffi@goffi.org>
parents:
65
diff
changeset
|
396 debug("registering DBus bridge method [%s]", name) |
0 | 397 self.dbus_bridge.register(name, callback) |
398 | |
7
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
399 def addMethod(self, name, int_suffix, in_sign, out_sign, method): |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
400 """Dynamically add a method to Dbus Bridge""" |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
401 print ("Adding method [%s] to DBus bridge" % name) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
402 self.dbus_bridge.addMethod(name, int_suffix, in_sign, out_sign) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
403 self.register(name, method) |
c14a3a7018a5
added dynamic exportation of Dbus bridge method (usefull for plugins)
Goffi <goffi@goffi.org>
parents:
1
diff
changeset
|
404 |
73 | 405 def addSignal(self, name, int_suffix, signature): |
406 self.dbus_bridge.addSignal(name, int_suffix, signature) | |
74
6e3a06b4dd36
plugin xep-0045: added roomUserJoined and roomUserLeft signals
Goffi <goffi@goffi.org>
parents:
73
diff
changeset
|
407 setattr(DBusBridge, name, getattr(self.dbus_bridge, name)) |
73 | 408 |