Mercurial > libervia-backend
comparison frontends/src/quick_frontend/quick_chat.py @ 2063:8fa0d95c2142
quick frontend (chat): recreateArgs implementation
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 09 Sep 2016 23:54:33 +0200 |
parents | a52a6ed7d48f |
children | 09c18fcd8225 |
comparison
equal
deleted
inserted
replaced
2062:e22ab34c68f6 | 2063:8fa0d95c2142 |
---|---|
180 self.role = data['role'] | 180 self.role = data['role'] |
181 self.widgets = set() # widgets linked to this occupant | 181 self.widgets = set() # widgets linked to this occupant |
182 self._state = None | 182 self._state = None |
183 | 183 |
184 @property | 184 @property |
185 def data(self): | |
186 """reconstruct data dict from attributes""" | |
187 data = {} | |
188 data['nick'] = self.nick | |
189 if self._entity is not None: | |
190 data['entity'] = self._entity | |
191 data['affiliation'] = self.affiliation | |
192 data['role'] = self.role | |
193 return data | |
194 | |
195 @property | |
185 def jid(self): | 196 def jid(self): |
186 """jid in the room""" | 197 """jid in the room""" |
187 return jid.JID(u"{}/{}".format(self.parent.target.bare, self.nick)) | 198 return jid.JID(u"{}/{}".format(self.parent.target.bare, self.nick)) |
188 | 199 |
189 @property | 200 @property |
271 def addTarget(self, target): | 282 def addTarget(self, target): |
272 super(QuickChat, self).addTarget(target) | 283 super(QuickChat, self).addTarget(target) |
273 if target.resource: | 284 if target.resource: |
274 self.current_target = target # FIXME: tmp, must use resource priority throught contactList instead | 285 self.current_target = target # FIXME: tmp, must use resource priority throught contactList instead |
275 | 286 |
287 def recreateArgs(self, args, kwargs): | |
288 """copy important attribute for a new widget""" | |
289 kwargs['type_'] = self.type | |
290 if self.type == C.CHAT_GROUP: | |
291 kwargs['occupants'] = {o.nick: o.data for o in self.occupants.itervalues()} | |
292 kwargs['subject'] = self.subject | |
293 | |
276 def onPrivateCreated(self, widget): | 294 def onPrivateCreated(self, widget): |
277 """Method called when a new widget for private conversation (MUC) is created""" | 295 """Method called when a new widget for private conversation (MUC) is created""" |
278 raise NotImplementedError | 296 raise NotImplementedError |
279 | 297 |
280 def getOrCreatePrivateWidget(self, entity): | 298 def getOrCreatePrivateWidget(self, entity): |