quick frontend (chat): recreateArgs implementation
This commit is contained in:
parent
2808312c77
commit
48871f96cc
1 changed files with 18 additions and 0 deletions
|
|
@ -181,6 +181,17 @@ class Occupant(object):
|
||||||
self.widgets = set() # widgets linked to this occupant
|
self.widgets = set() # widgets linked to this occupant
|
||||||
self._state = None
|
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
|
@property
|
||||||
def jid(self):
|
def jid(self):
|
||||||
"""jid in the room"""
|
"""jid in the room"""
|
||||||
|
|
@ -273,6 +284,13 @@ class QuickChat(quick_widgets.QuickWidget):
|
||||||
if target.resource:
|
if target.resource:
|
||||||
self.current_target = target # FIXME: tmp, must use resource priority throught contactList instead
|
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):
|
def onPrivateCreated(self, widget):
|
||||||
"""Method called when a new widget for private conversation (MUC) is created"""
|
"""Method called when a new widget for private conversation (MUC) is created"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue