comparison sat_bridge/DBus.py @ 65:d35c5edab53f

SàT: multi-profile: memory & dbus bridge's methods profile management /!\ profiles not managed yet for dbus signals
author Goffi <goffi@goffi.org>
date Sun, 31 Jan 2010 15:57:03 +1100
parents 58d49fc19639
children 8147b4f40809
comparison
equal deleted inserted replaced
64:d46f849664aa 65:d35c5edab53f
122 def registerNewAccount(self, login, password, host, port=5222): 122 def registerNewAccount(self, login, password, host, port=5222):
123 info ("New account registration asked") 123 info ("New account registration asked")
124 return self.cb["registerNewAccount"](login, password, host, port) 124 return self.cb["registerNewAccount"](login, password, host, port)
125 125
126 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 126 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
127 in_signature='', out_signature='') 127 in_signature='s', out_signature='')
128 def connect(self): 128 def connect(self, profile_key='@DEFAULT@'):
129 info ("Connection asked") 129 info ("Connection asked")
130 return self.cb["connect"]() 130 return self.cb["connect"]()
131 131
132 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 132 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
133 in_signature='', out_signature='') 133 in_signature='s', out_signature='')
134 def disconnect(self): 134 def disconnect(self, profile_key='@DEFAULT@'):
135 info ("Disconnection asked") 135 info ("Disconnection asked")
136 return self.cb["disconnect"]() 136 return self.cb["disconnect"](profile_key)
137 137
138 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 138 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
139 in_signature='', out_signature='b') 139 in_signature='', out_signature='b')
140 def isConnected(self): 140 def isConnected(self, profile_key='@DEFAULT@'):
141 info ("Connection status asked") 141 info ("Connection status asked")
142 return self.cb["isConnected"]() 142 return self.cb["isConnected"](profile_key)
143 143
144 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 144 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
145 in_signature='', out_signature='a(sa{ss}as)') 145 in_signature='s', out_signature='a(sa{ss}as)')
146 def getContacts(self): 146 def getContacts(self, profile_key='@DEFAULT@'):
147 debug("getContacts...") 147 debug("getContacts...")
148 return self.cb["getContacts"]() 148 return self.cb["getContacts"](profile_key)
149 149
150 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 150 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
151 in_signature='', out_signature='a{sa{s(sia{ss})}}') 151 in_signature='s', out_signature='a{sa{s(sia{ss})}}')
152 def getPresenceStatus(self): 152 def getPresenceStatus(self, profile_key='@DEFAULT@'):
153 debug("getPresenceStatus...") 153 debug("getPresenceStatus...")
154 return self.cb["getPresenceStatus"]() 154 return self.cb["getPresenceStatus"](profile_key)
155 155
156 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 156 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
157 in_signature='', out_signature='a{ss}') 157 in_signature='s', out_signature='a{ss}')
158 def getWaitingSub(self): 158 def getWaitingSub(self, profile_key='@DEFAULT@'):
159 debug("getWaitingSub...") 159 debug("getWaitingSub...")
160 return self.cb["getWaitingSub"]() 160 return self.cb["getWaitingSub"](profile_key)
161 161
162 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 162 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
163 in_signature='ss', out_signature='') 163 in_signature='sss', out_signature='')
164 def sendMessage(self, to, message): 164 def sendMessage(self, to, message, profile_key='@DEFAULT@'):
165 debug("sendMessage...") 165 debug("sendMessage...")
166 self.cb["sendMessage"](to, message) 166 self.cb["sendMessage"](to, message, profile_key)
167 167
168 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 168 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
169 in_signature='ssia{ss}', out_signature='') 169 in_signature='ssia{ss}s', out_signature='')
170 def setPresence(self, to="", show="", priority=0, statuses={}): 170 def setPresence(self, to="", show="", priority=0, statuses={}, profile_key='@DEFAULT@'):
171 self.cb["setPresence"](to, show, priority, statuses) 171 self.cb["setPresence"](to, show, priority, statuses, profile_key)
172
173 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
174 in_signature='ss', out_signature='')
175 def subscription(self, type, entity):
176 self.cb["subscription"](type, entity)
177 172
178 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 173 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
179 in_signature='sss', out_signature='') 174 in_signature='sss', out_signature='')
180 def setParam(self, name, value, category): 175 def subscription(self, type, entity, profile_key='@DEFAULT@'):
181 self.cb["setParam"](str(name), str(value), str(category)) 176 self.cb["subscription"](type, entity, profile_key)
177
178 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
179 in_signature='ssss', out_signature='')
180 def setParam(self, name, value, category, profile_key='@DEFAULT@'):
181 self.cb["setParam"](str(name), str(value), str(category), profile_key)
182 182
183 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 183 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
184 in_signature='sss', out_signature='s')
185 def getParamA(self, name, category="default", profile_key='@DEFAULT@'):
186 return self.cb["getParamA"](name, category, profile_key = profile_key)
187
188 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
189 in_signature='s', out_signature='s')
190 def getParams(self, profile_key='@DEFAULT@'):
191 return self.cb["getParams"](profile_key)
192
193 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
184 in_signature='ss', out_signature='s') 194 in_signature='ss', out_signature='s')
185 def getParamA(self, name, category="default"): 195 def getParamsForCategory(self, category, profile_key='@DEFAULT@'):
186 return self.cb["getParamA"](name, category) 196 return self.cb["getParamsForCategory"](category, profile_key)
187
188 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
189 in_signature='', out_signature='s')
190 def getParams(self):
191 return self.cb["getParams"]()
192
193 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
194 in_signature='s', out_signature='s')
195 def getParamsForCategory(self, category):
196 return self.cb["getParamsForCategory"](category)
197 197
198 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 198 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
199 in_signature='', out_signature='as') 199 in_signature='', out_signature='as')
200 def getParamsCategories(self): 200 def getParamsCategories(self):
201 return self.cb["getParamsCategories"]() 201 return self.cb["getParamsCategories"]()
205 def getHistory(self, from_jid, to_jid, size): 205 def getHistory(self, from_jid, to_jid, size):
206 debug("History asked for %s", to_jid) 206 debug("History asked for %s", to_jid)
207 return self.cb["getHistory"](from_jid, to_jid, size) 207 return self.cb["getHistory"](from_jid, to_jid, size)
208 208
209 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 209 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
210 in_signature='s', out_signature='') 210 in_signature='ss', out_signature='')
211 def addContact(self, entity): 211 def addContact(self, entity, profile_key='@DEFAULT@'):
212 debug("Subscription asked for %s", entity) 212 debug("Subscription asked for %s (profile %s)", entity, profile_key)
213 return self.cb["addContact"](entity) 213 return self.cb["addContact"](entity, profile_key)
214 214
215 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, 215 @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX,
216 in_signature='s', out_signature='') 216 in_signature='ss', out_signature='')
217 def delContact(self, entity): 217 def delContact(self, entity, profile_key='@DEFAULT@'):
218 debug("Unsubscription asked for %s", entity) 218 debug("Unsubscription asked for %s (profile %s)", entity, profile_key)
219 return self.cb["delContact"](entity) 219 return self.cb["delContact"](entity, profile_key)
220 220
221 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX, 221 @dbus.service.method(const_INT_PREFIX+const_REQ_SUFFIX,
222 in_signature='sa{ss}', out_signature='s') 222 in_signature='sa{ss}', out_signature='s')
223 def launchAction(self, type, data): 223 def launchAction(self, type, data):
224 return self.cb["launchAction"](type, data) 224 return self.cb["launchAction"](type, data)