Fully intialise with whatsapp on every login
This commit is contained in:
parent
2c2c0fde8d
commit
3fba33ac8b
22
session.py
22
session.py
|
@ -218,16 +218,26 @@ class Session(YowsupApp):
|
||||||
self.backend.handleConnected(self.user)
|
self.backend.handleConnected(self.user)
|
||||||
self.backend.handleBuddyChanged(self.user, "bot", self.bot.name,
|
self.backend.handleBuddyChanged(self.user, "bot", self.bot.name,
|
||||||
["Admin"], protocol_pb2.STATUS_ONLINE)
|
["Admin"], protocol_pb2.STATUS_ONLINE)
|
||||||
if self.initialized == False:
|
# Initialisation?
|
||||||
self.sendOfflineMessages()
|
self.requestPrivacyList()
|
||||||
#self.bot.call("welcome")
|
self.requestClientConfig()
|
||||||
self.initialized = True
|
self.requestServerProperties()
|
||||||
|
# ?
|
||||||
|
|
||||||
|
self.logger.debug('Requesting groups list')
|
||||||
|
self.requestGroupsList(self._updateGroups)
|
||||||
|
# self.requestBroadcastList()
|
||||||
|
|
||||||
|
# This should handle, sync, statuses, and presence
|
||||||
self.sendPresence(True)
|
self.sendPresence(True)
|
||||||
for func in self.loginQueue:
|
for func in self.loginQueue:
|
||||||
func()
|
func()
|
||||||
|
|
||||||
self.logger.debug('Requesting groups list')
|
if self.initialized == False:
|
||||||
self.requestGroupsList(self._updateGroups)
|
self.sendOfflineMessages()
|
||||||
|
#self.bot.call("welcome")
|
||||||
|
self.initialized = True
|
||||||
|
|
||||||
self.loggedIn = True
|
self.loggedIn = True
|
||||||
|
|
||||||
# Called by superclass
|
# Called by superclass
|
||||||
|
|
|
@ -39,7 +39,9 @@ from yowsup.layers.protocol_notifications.protocolentities import *
|
||||||
from yowsup.layers.protocol_messages.protocolentities import *
|
from yowsup.layers.protocol_messages.protocolentities import *
|
||||||
from yowsup.layers.protocol_presence.protocolentities import *
|
from yowsup.layers.protocol_presence.protocolentities import *
|
||||||
from yowsup.layers.protocol_profiles.protocolentities import *
|
from yowsup.layers.protocol_profiles.protocolentities import *
|
||||||
|
from yowsup.layers.protocol_privacy.protocolentities import *
|
||||||
from yowsup.layers.protocol_receipts.protocolentities import *
|
from yowsup.layers.protocol_receipts.protocolentities import *
|
||||||
|
from yowsup.layers.protocol_iq.protocolentities import *
|
||||||
from yowsup.layers.protocol_media.mediauploader import MediaUploader
|
from yowsup.layers.protocol_media.mediauploader import MediaUploader
|
||||||
|
|
||||||
|
|
||||||
|
@ -325,6 +327,21 @@ class YowsupApp(object):
|
||||||
|
|
||||||
self.sendIq(iq, onSuccess = onSuccess, onError = failure)
|
self.sendIq(iq, onSuccess = onSuccess, onError = failure)
|
||||||
|
|
||||||
|
def requestClientConfig(self, success = None, failure = None):
|
||||||
|
"""I'm not sure what this does, but it might be required on first login."""
|
||||||
|
iq = PushIqProtocolEntity()
|
||||||
|
self.sendIq(iq, onSuccess = success, onError = failure)
|
||||||
|
|
||||||
|
|
||||||
|
def requestPrivacyList(self, success = None, failure = None):
|
||||||
|
"""I'm not sure what this does, but it might be required on first login."""
|
||||||
|
iq = PrivacyListIqProtocolEntity()
|
||||||
|
self.sendIq(iq, onSuccess = success, onError = failure)
|
||||||
|
|
||||||
|
def requestServerProperties(self, success = None, failure = None):
|
||||||
|
"""I'm not sure what this does, but it might be required on first login."""
|
||||||
|
iq = PropsIqProtocolEntity()
|
||||||
|
self.sendIq(iq, onSuccess = success, onError = failure)
|
||||||
|
|
||||||
def requestStatuses(self, contacts, success = None, failure = None):
|
def requestStatuses(self, contacts, success = None, failure = None):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue