Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add getJid method to ResultGetPictureIqProtocolEntity #3007

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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