# HG changeset patch # User Goffi # Date 1473458073 -7200 # Node ID 8fa0d95c2142af5d8e84b8e34f325d0ce93c9054 # Parent e22ab34c68f63fb24c3a3fa6e9f0defbec1427d7 quick frontend (chat): recreateArgs implementation diff -r e22ab34c68f6 -r 8fa0d95c2142 frontends/src/quick_frontend/quick_chat.py --- 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