Mercurial > libervia-backend
changeset 2063:8fa0d95c2142
quick frontend (chat): recreateArgs implementation
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 09 Sep 2016 23:54:33 +0200 |
parents | e22ab34c68f6 |
children | ee9621d92cb9 |
files | frontends/src/quick_frontend/quick_chat.py |
diffstat | 1 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_chat.py Fri Sep 09 23:54:33 2016 +0200 +++ b/frontends/src/quick_frontend/quick_chat.py Fri Sep 09 23:54:33 2016 +0200 @@ -182,6 +182,17 @@ self._state = None @property + def data(self): + """reconstruct data dict from attributes""" + data = {} + data['nick'] = self.nick + if self._entity is not None: + data['entity'] = self._entity + data['affiliation'] = self.affiliation + data['role'] = self.role + return data + + @property def jid(self): """jid in the room""" return jid.JID(u"{}/{}".format(self.parent.target.bare, self.nick)) @@ -273,6 +284,13 @@ if target.resource: self.current_target = target # FIXME: tmp, must use resource priority throught contactList instead + def recreateArgs(self, args, kwargs): + """copy important attribute for a new widget""" + kwargs['type_'] = self.type + if self.type == C.CHAT_GROUP: + kwargs['occupants'] = {o.nick: o.data for o in self.occupants.itervalues()} + kwargs['subject'] = self.subject + def onPrivateCreated(self, widget): """Method called when a new widget for private conversation (MUC) is created""" raise NotImplementedError