Mercurial > libervia-backend
comparison src/plugins/plugin_xep_0045.py @ 450:afe9cfd2ddbb
plugins: radio collective first draft
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 05 Jan 2012 00:21:30 +0100 |
parents | 2e0dc5299bce |
children | 4f196e2d3781 |
comparison
equal
deleted
inserted
replaced
449:961543b20806 | 450:afe9cfd2ddbb |
---|---|
58 info(_("Plugin XEP_0045 initialization")) | 58 info(_("Plugin XEP_0045 initialization")) |
59 self.host = host | 59 self.host = host |
60 self.clients={} | 60 self.clients={} |
61 host.bridge.addMethod("joinMUC", ".plugin", in_sign='ssa{ss}s', out_sign='', method=self._join) | 61 host.bridge.addMethod("joinMUC", ".plugin", in_sign='ssa{ss}s', out_sign='', method=self._join) |
62 host.bridge.addMethod("getRoomsJoined", ".plugin", in_sign='s', out_sign='a(sass)', method=self.getRoomsJoined) | 62 host.bridge.addMethod("getRoomsJoined", ".plugin", in_sign='s', out_sign='a(sass)', method=self.getRoomsJoined) |
63 host.bridge.addMethod("getRoomsSubjectss", ".plugin", in_sign='s', out_sign='a(ss)', method=self.getRoomsSubjectss) | 63 host.bridge.addMethod("getRoomsSubjects", ".plugin", in_sign='s', out_sign='a(ss)', method=self.getRoomsSubjects) |
64 host.bridge.addMethod("getUniqueRoomName", ".plugin", in_sign='s', out_sign='s', method=self.getUniqueName) | 64 host.bridge.addMethod("getUniqueRoomName", ".plugin", in_sign='s', out_sign='s', method=self.getUniqueName) |
65 host.bridge.addSignal("roomJoined", ".plugin", signature='sasss') #args: room_jid, room_nicks, user_nick, profile | 65 host.bridge.addSignal("roomJoined", ".plugin", signature='sasss') #args: room_jid, room_nicks, user_nick, profile |
66 host.bridge.addSignal("roomUserJoined", ".plugin", signature='ssa{ss}s') #args: room_jid, user_nick, user_data, profile | 66 host.bridge.addSignal("roomUserJoined", ".plugin", signature='ssa{ss}s') #args: room_jid, user_nick, user_data, profile |
67 host.bridge.addSignal("roomUserLeft", ".plugin", signature='ssa{ss}s') #args: room_jid, user_nick, user_data, profile | 67 host.bridge.addSignal("roomUserLeft", ".plugin", signature='ssa{ss}s') #args: room_jid, user_nick, user_data, profile |
68 host.bridge.addSignal("roomNewSubject", ".plugin", signature='sss') #args: room_jid, subject, profile | 68 host.bridge.addSignal("roomNewSubject", ".plugin", signature='sss') #args: room_jid, subject, profile |
99 def __err_joining_room(self, failure, profile): | 99 def __err_joining_room(self, failure, profile): |
100 """Called when something is going wrong when joining the room""" | 100 """Called when something is going wrong when joining the room""" |
101 mess = _("Error when joining the room") | 101 mess = _("Error when joining the room") |
102 error (mess) | 102 error (mess) |
103 self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile) | 103 self.host.bridge.newAlert(mess, _("Group chat error"), "ERROR", profile) |
104 raise failure | |
104 | 105 |
105 def getRoomsJoined(self, profile_key='@DEFAULT@'): | 106 def getRoomsJoined(self, profile_key='@DEFAULT@'): |
106 """Return room where user is""" | 107 """Return room where user is""" |
107 profile = self.host.memory.getProfileName(profile_key) | 108 profile = self.host.memory.getProfileName(profile_key) |
108 result = [] | 109 result = [] |
120 profile = self.host.memory.getProfileName(profile_key) | 121 profile = self.host.memory.getProfileName(profile_key) |
121 if not self.__check_profile(profile) or not self.clients[profile].joined_rooms.has_key(room_jid): | 122 if not self.__check_profile(profile) or not self.clients[profile].joined_rooms.has_key(room_jid): |
122 return '' | 123 return '' |
123 return self.clients[profile].joined_rooms[room_jid].nick | 124 return self.clients[profile].joined_rooms[room_jid].nick |
124 | 125 |
125 | 126 def getRoomsSubjects(self, profile_key='@DEFAULT@'): |
126 def getRoomsSubjectss(self, profile_key='@DEFAULT@'): | |
127 """Return received subjects of rooms""" | 127 """Return received subjects of rooms""" |
128 profile = self.host.memory.getProfileName(profile_key) | 128 profile = self.host.memory.getProfileName(profile_key) |
129 if not self.__check_profile(profile): | 129 if not self.__check_profile(profile): |
130 return [] | 130 return [] |
131 return self.clients[profile].rec_subjects.values() | 131 return self.clients[profile].rec_subjects.values() |