comparison frontends/src/bridge/DBus.py @ 272:1d2e0dfe7114

bridge: core & frontend sides of bridge are now generated
author Goffi <goffi@goffi.org>
date Mon, 24 Jan 2011 22:05:04 +0100
parents bdcd535e179e
children a00e87d48213
comparison
equal deleted inserted replaced
271:0288f97334f2 272:1d2e0dfe7114
19 along with this program. If not, see <http://www.gnu.org/licenses/>. 19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20 """ 20 """
21 21
22 from bridge_frontend import BridgeFrontend 22 from bridge_frontend import BridgeFrontend
23 import dbus, dbus.glib 23 import dbus, dbus.glib
24 from logging import debug
24 25
25 class BridgeExceptionNoService(Exception): 26 class BridgeExceptionNoService(Exception):
26 pass 27 pass
27 28
28 class DBusBridgeFrontend(BridgeFrontend): 29 class DBusBridgeFrontend(BridgeFrontend):
46 if iface == "communication": 47 if iface == "communication":
47 self.db_comm_iface.connect_to_signal(functionName, handler) 48 self.db_comm_iface.connect_to_signal(functionName, handler)
48 elif iface == "request": 49 elif iface == "request":
49 self.db_req_iface.connect_to_signal(functionName, handler) 50 self.db_req_iface.connect_to_signal(functionName, handler)
50 51
51 ##METHODS_PART## 52 def addContact(self, entity, profile_key="@DEFAULT@"):
53 debug ("addContact")
54 return self.db_comm_iface.addContact(entity, profile_key)
55
56 def callMenu(self, category, name, menu_type, profile_key):
57 debug ("callMenu")
58 return self.db_req_iface.callMenu(category, name, menu_type, profile_key)
59
60 def confirmationAnswer(self, id, accepted, data):
61 debug ("confirmationAnswer")
62 return self.db_req_iface.confirmationAnswer(id, accepted, data)
63
64 def connect(self, profile_key="@DEFAULT@"):
65 debug ("connect")
66 return self.db_comm_iface.connect(profile_key)
67
68 def createProfile(self, profile):
69 debug ("createProfile")
70 return self.db_req_iface.createProfile(profile)
71
72 def delContact(self, entity, profile_key="@DEFAULT@"):
73 debug ("delContact")
74 return self.db_comm_iface.delContact(entity, profile_key)
75
76 def deleteProfile(self, profile):
77 debug ("deleteProfile")
78 return self.db_req_iface.deleteProfile(profile)
79
80 def disconnect(self, profile_key="@DEFAULT@"):
81 debug ("disconnect")
82 return self.db_comm_iface.disconnect(profile_key)
83
84 def getContacts(self, profile_key="@DEFAULT@"):
85 debug ("getContacts")
86 return self.db_comm_iface.getContacts(profile_key)
87
88 def getHistory(self, from_jid, to_jid, size):
89 debug ("getHistory")
90 return self.db_comm_iface.getHistory(from_jid, to_jid, size)
91
92 def getMenuHelp(self, category, name, menu_type):
93 debug ("getMenuHelp")
94 return self.db_req_iface.getMenuHelp(category, name, menu_type)
95
96 def getMenus(self, ):
97 debug ("getMenus")
98 return self.db_req_iface.getMenus()
99
100 def getParamA(self, name, category, attribute="value", profile_key="@DEFAULT@"):
101 debug ("getParamA")
102 return self.db_comm_iface.getParamA(name, category, attribute, profile_key)
103
104 def getParams(self, profile_key="@DEFAULT@"):
105 debug ("getParams")
106 return self.db_comm_iface.getParams(profile_key)
107
108 def getParamsCategories(self, ):
109 debug ("getParamsCategories")
110 return self.db_comm_iface.getParamsCategories()
111
112 def getParamsForCategory(self, category, profile_key="@DEFAULT@"):
113 debug ("getParamsForCategory")
114 return self.db_comm_iface.getParamsForCategory(category, profile_key)
115
116 def getParamsUI(self, profile_key="@DEFAULT@"):
117 debug ("getParamsUI")
118 return self.db_comm_iface.getParamsUI(profile_key)
119
120 def getPresenceStatus(self, profile_key="@DEFAULT@"):
121 debug ("getPresenceStatus")
122 return self.db_comm_iface.getPresenceStatus(profile_key)
123
124 def getProfileName(self, profile_key="@DEFAULT@"):
125 debug ("getProfileName")
126 return self.db_req_iface.getProfileName(profile_key)
127
128 def getProfilesList(self, ):
129 debug ("getProfilesList")
130 return self.db_req_iface.getProfilesList()
131
132 def getProgress(self, id):
133 debug ("getProgress")
134 return self.db_req_iface.getProgress(id)
135
136 def getVersion(self, ):
137 debug ("getVersion")
138 return self.db_req_iface.getVersion()
139
140 def getWaitingSub(self, profile_key="@DEFAULT@"):
141 debug ("getWaitingSub")
142 return self.db_comm_iface.getWaitingSub(profile_key)
143
144 def isConnected(self, profile_key="@DEFAULT@"):
145 debug ("isConnected")
146 return self.db_comm_iface.isConnected(profile_key)
147
148 def launchAction(self, action_type, data, profile_key="@DEFAULT@"):
149 debug ("launchAction")
150 return self.db_req_iface.launchAction(action_type, data, profile_key)
151
152 def registerNewAccount(self, login, password, host, port=5222):
153 debug ("registerNewAccount")
154 return self.db_comm_iface.registerNewAccount(login, password, host, port)
155
156 def sendMessage(self, to_jid, message, subject='', mess_type="chat", profile_key="@DEFAULT@"):
157 debug ("sendMessage")
158 return self.db_comm_iface.sendMessage(to_jid, message, subject, mess_type, profile_key)
159
160 def setParam(self, name, value, category, profile_key="@DEFAULT@"):
161 debug ("setParam")
162 return self.db_comm_iface.setParam(name, value, category, profile_key)
163
164 def setPresence(self, to_jid='', show='', priority=0, statuses={}, profile_key="@DEFAULT@"):
165 debug ("setPresence")
166 return self.db_comm_iface.setPresence(to_jid, show, priority, statuses, profile_key)
167
168 def subscription(self, sub_type, entity, profile_key="@DEFAULT@"):
169 debug ("subscription")
170 return self.db_comm_iface.subscription(sub_type, entity, profile_key)
171
52 172
53 #methods from plugins 173 #methods from plugins
54 def getRoomJoined(self, profile_key='@DEFAULT@'): 174 def getRoomJoined(self, profile_key='@DEFAULT@'):
55 return self.db_comm_iface.getRoomJoined(profile_key) 175 return self.db_comm_iface.getRoomJoined(profile_key)
56 176
93 def gatewayRegister(self, action, target, data, profile_key='@DEFAULT@'): 213 def gatewayRegister(self, action, target, data, profile_key='@DEFAULT@'):
94 if data == None: 214 if data == None:
95 data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature 215 data = [('', '')] #XXX: we have to do this awful hack because python dbus need to guess the signature
96 return self.db_req_iface.gatewayRegister(action, target, data, profile_key) 216 return self.db_req_iface.gatewayRegister(action, target, data, profile_key)
97 217
98