From 8e2c03aaaed4d951cff335c69ecf2e0d0e00b143 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Tue, 6 Aug 2013 23:21:37 +0400 Subject: [PATCH] Transport was not initialized if user have no status message --- session.py | 2 +- whatsappbackend.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/session.py b/session.py index 8ff488d..e1d8e61 100644 --- a/session.py +++ b/session.py @@ -190,7 +190,7 @@ class Session: self.call("presence_sendUnavailable") def changeStatusMessage(self, statusMessage): - if statusMessage != self.statusMessage: + if (statusMessage != self.statusMessage) or (self.initialized == False): self.statusMessage = statusMessage self.call("profile_setStatus", (statusMessage.encode("utf-8"),)) self.logger.info("Status message changed: %s", statusMessage) diff --git a/whatsappbackend.py b/whatsappbackend.py index 7b627ad..4aa0b17 100644 --- a/whatsappbackend.py +++ b/whatsappbackend.py @@ -63,9 +63,7 @@ class WhatsAppBackend(SpectrumBackend): def handleStatusChangeRequest(self, user, status, statusMessage): self.logger.debug("handleStatusChangeRequest(user=%s, status=%d, statusMessage=%s)", user, status, statusMessage) - if len(statusMessage): - self.sessions[user].changeStatusMessage(statusMessage) - + self.sessions[user].changeStatusMessage(statusMessage) self.sessions[user].changeStatus(status) def handleBuddyUpdatedRequest(self, user, buddy, nick, groups):