Skip to content

Commit

Permalink
Merge pull request #1 from hossinasaadi/hossinasaadi-dev
Browse files Browse the repository at this point in the history
add getJid method to ResultGetPictureIqProtocolEntity
  • Loading branch information
hossinasaadi authored Sep 10, 2020
2 parents 2adc067 + e352587 commit 5dc827e
Showing 1 changed file with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ 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 @@ -26,6 +29,9 @@ 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:
outFile.write(self.getPictureData())
Expand All @@ -41,5 +47,5 @@ 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")
return entity
entity.setResultPictureProps(node.getAttributeValue("from"),pictureNode.getData(), pictureNode.getAttributeValue("id"), pictureNode.getAttributeValue("type") == "preview")
return entity

0 comments on commit 5dc827e

Please sign in to comment.