comparison libervia.py @ 125:f9d63624699f

radio collective integration, first draft
author Goffi <goffi@goffi.org>
date Thu, 05 Jan 2012 00:22:03 +0100
parents 397a88b340f3
children adecb2566b53
comparison
equal deleted inserted replaced
124:6d1f4a3da29b 125:f9d63624699f
76 class BridgeCall(LiberviaJsonProxy): 76 class BridgeCall(LiberviaJsonProxy):
77 def __init__(self): 77 def __init__(self):
78 LiberviaJsonProxy.__init__(self, "/json_api", 78 LiberviaJsonProxy.__init__(self, "/json_api",
79 ["getContacts", "addContact", "sendMessage", "sendMblog", "getMblogNodes", "getProfileJid", "getHistory", "getPresenceStatus", 79 ["getContacts", "addContact", "sendMessage", "sendMblog", "getMblogNodes", "getProfileJid", "getHistory", "getPresenceStatus",
80 "joinMUC", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed", 80 "joinMUC", "getRoomsJoined", "launchTarotGame", "getTarotCardsPaths", "tarotGameReady", "tarotGameContratChoosed",
81 "tarotGamePlayCards", "getWaitingSub", "subscription", "delContact", "updateContact", "getCardCache"]) 81 "tarotGamePlayCards", "launchRadioCollective", "getWaitingSub", "subscription", "delContact", "updateContact", "getCardCache"])
82 82
83 class BridgeSignals(LiberviaJsonProxy): 83 class BridgeSignals(LiberviaJsonProxy):
84 def __init__(self, host): 84 def __init__(self, host):
85 self.host = host 85 self.host = host
86 LiberviaJsonProxy.__init__(self, "/json_signal_api", 86 LiberviaJsonProxy.__init__(self, "/json_signal_api",
318 if self.whoami and self.whoami.bare == _entity.bare and statuses: 318 if self.whoami and self.whoami.bare == _entity.bare and statuses:
319 self.status_panel.changeStatus(statuses.values()[0]) 319 self.status_panel.changeStatus(statuses.values()[0])
320 if (not self.whoami or self.whoami.bare != _entity.bare): 320 if (not self.whoami or self.whoami.bare != _entity.bare):
321 self.contact_panel.setConnected(_entity.bare, _entity.resource, show, priority, statuses) 321 self.contact_panel.setConnected(_entity.bare, _entity.resource, show, priority, statuses)
322 322
323 def _roomJoinedCb(self, room_id, room_service, room_nicks, user_nick): 323 def _roomJoinedCb(self, room_jid, room_nicks, user_nick):
324 _target = JID("%s@%s" % (room_id,room_service)) 324 _target = JID(room_jid)
325 self.room_list.add(_target) 325 self.room_list.add(_target)
326 chat_panel = panels.ChatPanel(self, _target, type='group') 326 chat_panel = panels.ChatPanel(self, _target, type='group')
327 chat_panel.setUserNick(user_nick) 327 chat_panel.setUserNick(user_nick)
328 if room_id.startswith('sat_tarot_'): #XXX: it's not really beautiful, but it works :) 328 if room_jid.node.startswith('sat_tarot_'): #XXX: it's not really beautiful, but it works :)
329 self.addTab(chat_panel, "Tarot") 329 self.addTab(chat_panel, "Tarot")
330 else: 330 else:
331 self.addTab(chat_panel, _target.node) 331 self.addTab(chat_panel, _target.node)
332 chat_panel.setPresents(room_nicks) 332 chat_panel.setPresents(room_nicks)
333 chat_panel.historyPrint() 333 chat_panel.historyPrint()
334 334
335 def _roomUserJoinedCb(self, room_id, room_service, user_nick, user_data): 335 def _roomUserJoinedCb(self, room_jid, user_nick, user_data):
336 for lib_wid in self.libervia_widgets: 336 for lib_wid in self.libervia_widgets:
337 if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == "%s@%s" % (room_id, room_service): 337 if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid.bare:
338 lib_wid.userJoined(user_nick, user_data) 338 lib_wid.userJoined(user_nick, user_data)
339 339
340 def _roomUserLeftCb(self, room_id, room_service, user_nick, user_data): 340 def _roomUserLeftCb(self, room_jid, user_nick, user_data):
341 for lib_wid in self.libervia_widgets: 341 for lib_wid in self.libervia_widgets:
342 if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == "%s@%s" % (room_id, room_service): 342 if isinstance(lib_wid,panels.ChatPanel) and lib_wid.type == 'group' and lib_wid.target.bare == room_jid.bare:
343 lib_wid.userLeft(user_nick, user_data) 343 lib_wid.userLeft(user_nick, user_data)
344 344
345 def _tarotGameStartedCb(self, room_jid, referee, players): 345 def _tarotGameStartedCb(self, room_jid, referee, players):
346 print ("Tarot Game Started \o/") 346 print ("Tarot Game Started \o/")
347 for lib_wid in self.libervia_widgets: 347 for lib_wid in self.libervia_widgets: