Skip to content

Commit

Permalink
tgalal#3007 pull request
Browse files Browse the repository at this point in the history
  • Loading branch information
bahkadomos committed Apr 27, 2023
1 parent f593182 commit c83d38b
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,13 @@ class ResultGetPictureIqProtocolEntity(PictureIqProtocolEntity):
'''
def __init__(self, jid, pictureData, pictureId, preview = True, _id = None):
super(ResultGetPictureIqProtocolEntity, self).__init__(jid, _id, "result")
self.setResultPictureProps(pictureData, pictureId, preview)
self.setResultPictureProps(jid, pictureData, pictureId, preview)

def setResultPictureProps(self, pictureData, pictureId, preview = True):
def setResultPictureProps(self, jid , pictureData, pictureId, preview = True):
self.preview = preview
self.pictureData = pictureData
self.pictureId = pictureId
self.jid = jid

def isPreview(self):
return self.preview
Expand All @@ -25,6 +26,8 @@ def getPictureData(self):

def getPictureId(self):
return self.pictureId
def getJid(self):
return self.jid

def writeToFile(self, path):
with open(path, "wb") as outFile:
Expand All @@ -41,5 +44,10 @@ def fromProtocolTreeNode(node):
entity = PictureIqProtocolEntity.fromProtocolTreeNode(node)
entity.__class__ = ResultGetPictureIqProtocolEntity
pictureNode = node.getChild("picture")
entity.setResultPictureProps(pictureNode.getData(), pictureNode.getAttributeValue("id"), pictureNode.getAttributeValue("type") == "preview")
entity.setResultPictureProps(
node.getAttributeValue("from"),
pictureNode.getData(),
pictureNode.getAttributeValue("id"),
pictureNode.getAttributeValue("type") == "preview"
)
return entity

0 comments on commit c83d38b

Please sign in to comment.