diff --git a/yowsup/layers/protocol_profiles/protocolentities/iq_picture_get_result.py b/yowsup/layers/protocol_profiles/protocolentities/iq_picture_get_result.py index 676adbb9d..a31964abc 100644 --- a/yowsup/layers/protocol_profiles/protocolentities/iq_picture_get_result.py +++ b/yowsup/layers/protocol_profiles/protocolentities/iq_picture_get_result.py @@ -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 @@ -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: @@ -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 \ No newline at end of file