yowsup icon indicating copy to clipboard operation
yowsup copied to clipboard

set Profile Status in yowsup 2.0?

Open MrLight opened this issue 11 years ago • 11 comments

Hi, is there a way to set the Profile Status in yowsup 2.0? I haven't found a entitie for that. I think notification_status is not the same, or? If it is possible to set the Status it would be great, if someone could provide a short sample.

Thanks a lot!

MrLight avatar Jan 10 '15 20:01 MrLight

Also, How to set a profile picture?

kuldippatel avatar Jan 11 '15 07:01 kuldippatel

And also, How to get other Users status and profile picture. There is iq_picture which includes the string "w:profile:picture" but i dont quite understand that. Edit: I just noticed you get status updates after doing /contacts sync number,number... I didnt try but i suppose you'll also get picture updates after that.

dedmen avatar Jan 11 '15 13:01 dedmen

Trying to get User's "status" and "profile picture". It would be great if someone tell me how to do this??

ksingh11 avatar Jan 12 '15 12:01 ksingh11

@kaushalsingh11 do /contacts sync then it will subscribe to them for status and profile picture updates like /presence subscribe does to presence. But it will only tell you once theyve changed picture or status not directly as you sync. And it will tell you the status message they changed to but with the profile picture it will only tell you that there is an updated picture but it wont send the picture with the notification

dedmen avatar Jan 12 '15 13:01 dedmen

Any leads guys? To update status and set profile picture?

kuldippatel avatar Jan 13 '15 09:01 kuldippatel

WIP

tgalal avatar Jan 31 '15 15:01 tgalal

If a apply your patch, I get this exception:

...
  File "yowsup/yowsup/layers/__init__.py", line 107, in send
    send(entity)
  File "yowsup/yowsup/layers/protocol_profiles/layer.py", line 17, in sendIq
    self.toLower(entity)
  File "yowsup/yowsup/layers/__init__.py", line 59, in toLower
    self.__lower.send(data)
  File "yowsup/yowsup/layers/logger/layer.py", line 9, in send
    self.toLower(data)
  File "yowsup/yowsup/layers/__init__.py", line 59, in toLower
    self.__lower.send(data)
  File "yowsup/yowsup/layers/coder/layer.py", line 30, in send
    self.write(self.writer.protocolTreeNodeToBytes(data))
  File "yowsup/yowsup/layers/coder/encoder.py", line 26, in protocolTreeNodeToBytes
    self.writeInternal(node, outBytes)
  File "yowsup/yowsup/layers/coder/encoder.py", line 33, in writeInternal
    x = 1 + (0 if not hasattr(node, 'attributes') or node.attributes is None else len(node.attributes) * 2) + (0 if not node.hasChildren() else 1) + (0 if node.data is None else 1)
AttributeError: 'SetStatusIqProtocolEntity' object has no attribute 'hasChildren'

I've changed layers/protocol_profiles/layer.py line 17 from:

            self.toLower(entity)

to:

            self.entityToLower(entity)

And now message goes out:

<iq to="s.whatsapp.net" type="set" id="1">
<status>
My Status
HEX:5265323616479
</status>
</iq>

However I get 501 code:

DEBUG:yowsup.layers.logger.layer:rx:
<iq type="error" from="s.whatsapp.net" id="1">
<error text="feature-not-implemented" code="501">
</error>
</iq>

Finally I fixed it and also added yowsup-cli support with https://github.com/jlguardi/yowsup/commit/804c713135644bcaf5891cab3948861cc37b8804

jlguardi avatar Mar 12 '15 09:03 jlguardi

jlguardi@804c713 works for me!

thank you @jlguardi !

aguiraf avatar Mar 15 '15 20:03 aguiraf

This was solved by @tgalal in f9b88e5, right?

aesedepece avatar May 08 '15 11:05 aesedepece

@aesedepece I think it is to receive the pic, not set a new one. -> @clicmd("Get profile picture for contact")

IamC8 avatar May 08 '15 11:05 IamC8

Fixed, set through SetStatusIqProtocolEntity. See this cli demo command as an example

tgalal avatar May 11 '15 05:05 tgalal