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.handleBuddyChanged(self.user, "bot", self.bot.name,
|
||||
["Admin"], protocol_pb2.STATUS_ONLINE)
|
||||
if self.initialized == False:
|
||||
self.sendOfflineMessages()
|
||||
#self.bot.call("welcome")
|
||||
self.initialized = True
|
||||
# Initialisation?
|
||||
self.requestPrivacyList()
|
||||
self.requestClientConfig()
|
||||
self.requestServerProperties()
|
||||
# ?
|
||||
|
||||
self.logger.debug('Requesting groups list')
|
||||
self.requestGroupsList(self._updateGroups)
|
||||
# self.requestBroadcastList()
|
||||
|
||||
# This should handle, sync, statuses, and presence
|
||||
self.sendPresence(True)
|
||||
for func in self.loginQueue:
|
||||
func()
|
||||
|
||||
self.logger.debug('Requesting groups list')
|
||||
self.requestGroupsList(self._updateGroups)
|
||||
if self.initialized == False:
|
||||
self.sendOfflineMessages()
|
||||
#self.bot.call("welcome")
|
||||
self.initialized = True
|
||||
|
||||
self.loggedIn = True
|
||||
|
||||
# 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_presence.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_iq.protocolentities import *
|
||||
from yowsup.layers.protocol_media.mediauploader import MediaUploader
|
||||
|
||||
|
||||
|
@ -325,6 +327,21 @@ class YowsupApp(object):
|
|||
|
||||
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):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue