summaryrefslogtreecommitdiff
path: root/transfers.py
diff options
context:
space:
mode:
Diffstat (limited to 'transfers.py')
-rwxr-xr-xtransfers.py24
1 files changed, 12 insertions, 12 deletions
diff --git a/transfers.py b/transfers.py
index e3ee1a1..fbf72b6 100755
--- a/transfers.py
+++ b/transfers.py
@@ -80,19 +80,19 @@ for t in transactions:
logging.info("Created %s", record.id)
record.save()
-cl = ClientXMPP(config['jabber']['jid'], config['jabber']['password'])
+if len(new_transactions) > 0:
+ cl = ClientXMPP(config['jabber']['jid'], config['jabber']['password'])
-def session_start(event):
- cl.send_presence()
- for t in new_transactions:
- message = t.format_message()
- cl.send_message(config['jabber']['recipient'], message, mtype='chat')
- logging.info("Sent info %s", message)
- cl.disconnect()
+ def session_start(event):
+ for t in new_transactions:
+ message = t.format_message()
+ cl.send_message(config['jabber']['recipient'], message, mtype='chat')
+ logging.info("Sent info %s", message)
+ cl.disconnect()
-cl.add_event_handler('session_start', session_start)
-cl.add_event_handler('killed', lambda *_: cl.loop.stop())
-cl.connect()
-cl.process()
+ cl.add_event_handler('session_start', session_start)
+ cl.add_event_handler('killed', lambda *_: cl.loop.stop())
+ cl.connect()
+ cl.process()