Skip to content
This repository has been archived by the owner on Feb 11, 2019. It is now read-only.

Commit

Permalink
Merge pull request #2 from praekelt/feature/issue-2-transport-config-…
Browse files Browse the repository at this point in the history
…class

Write WhatsApp transport config class body
  • Loading branch information
Hannarst authored and Hannarst committed Jun 24, 2015
2 parents 85311b7 + eca7468 commit 08e587a
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions vxyowsup/whatsapp.py
Expand Up @@ -7,8 +7,14 @@


class WhatsAppTransportConfig(Transport.CONFIG_CLASS):
extra_config = ConfigText('Some Config var', default='foo',
static=True)
cc = ConfigText('Country code of host phone number', default='27',
static=True)
phone = ConfigText(
'Phone number, excluding "+", including country code',
static=True)
password = ConfigText(
'Password received from WhatsApp on yowsup registration',
static=True)


class WhatsAppTransport(Transport):
Expand All @@ -18,7 +24,9 @@ class WhatsAppTransport(Transport):

def setup_transport(self):
config = self.get_static_config()
log.info('Transport starting with: %s' % (config.extra_config,))
log.info('Transport starting with: %s' % (config,))
CREDENTIALS = (config.phone, config.password)

return defer.succeed(1)

def teardown_transport(self):
Expand All @@ -29,4 +37,5 @@ def handle_outbound_message(self, message):
log.info('Sending %r' % (message.to_json(),))
if message['content'] == 'fail!':
return self.publish_nack(message['message_id'], 'failed')
return self.publish_ack(message['message_id'], 'remote-message-id')
return self.publish_ack(message['message_id'],
'remote-message-id')

0 comments on commit 08e587a

Please sign in to comment.