summaryrefslogtreecommitdiff
path: root/src/connection.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/connection.py')
-rw-r--r--src/connection.py51
1 files changed, 25 insertions, 26 deletions
diff --git a/src/connection.py b/src/connection.py
index 214194f9..1bbe632d 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -29,28 +29,28 @@ class Connection(slixmpp.ClientXMPP):
"""
__init = False
def __init__(self):
- resource = config.get('resource', '')
- if config.get('jid', ''):
+ resource = config.get('resource')
+ if config.get('jid'):
# Field used to know if we are anonymous or not.
# many features will be handled differently
# depending on this setting
self.anon = False
- jid = '%s' % config.get('jid', '')
+ jid = '%s' % config.get('jid')
if resource:
jid = '%s/%s'% (jid, resource)
- password = config.get('password', '') or getpass.getpass()
+ password = config.get('password') or getpass.getpass()
else: # anonymous auth
self.anon = True
- jid = config.get('server', 'anon.jeproteste.info')
+ jid = config.get('server')
if resource:
jid = '%s/%s' % (jid, resource)
password = None
jid = safeJID(jid)
# TODO: use the system language
slixmpp.ClientXMPP.__init__(self, jid, password,
- lang=config.get('lang', 'en'))
+ lang=config.get('lang'))
- force_encryption = config.get('force_encryption', True)
+ force_encryption = config.get('force_encryption')
if force_encryption:
self['feature_mechanisms'].unencrypted_plain = False
self['feature_mechanisms'].unencrypted_digest = False
@@ -58,6 +58,7 @@ class Connection(slixmpp.ClientXMPP):
self['feature_mechanisms'].unencrypted_scram = False
self.core = None
+ self.auto_reconnect = config.get('auto_reconnect')
self.reconnect_max_attempts = 0
self.auto_authorize = None
# prosody defaults, lowest is AES128-SHA, it should be a minimum
@@ -65,12 +66,12 @@ class Connection(slixmpp.ClientXMPP):
self.ciphers = config.get('ciphers',
'HIGH+kEDH:HIGH+kEECDH:HIGH:!PSK'
':!SRP:!3DES:!aNULL')
- self.ca_certs = config.get('ca_cert_path', '') or None
- interval = config.get('whitespace_interval', '300')
- if interval.isdecimal() and int(interval) > 0:
+ self.ca_certs = config.get('ca_cert_path') or None
+ interval = config.get('whitespace_interval')
+ if int(interval) > 0:
self.whitespace_keepalive_interval = int(interval)
else:
- self.whitespace_keepalive_interval = 300
+ self.whitespace_keepalive = False
self.register_plugin('xep_0004')
self.register_plugin('xep_0012')
self.register_plugin('xep_0030')
@@ -89,33 +90,31 @@ class Connection(slixmpp.ClientXMPP):
# without a body
XEP_0184._filter_add_receipt_request = fixes._filter_add_receipt_request
self.register_plugin('xep_0184')
- self.plugin['xep_0184'].auto_ack = config.get('ack_message_receipts',
- True)
- self.plugin['xep_0184'].auto_request = config.get(
- 'request_message_receipts', True)
+ self.plugin['xep_0184'].auto_ack = config.get('ack_message_receipts')
+ self.plugin['xep_0184'].auto_request = config.get('request_message_receipts')
self.register_plugin('xep_0191')
self.register_plugin('xep_0199')
- if config.get('enable_user_tune', True):
+ if config.get('enable_user_tune'):
self.register_plugin('xep_0118')
- if config.get('enable_user_nick', True):
+ if config.get('enable_user_nick'):
self.register_plugin('xep_0172')
- if config.get('enable_user_mood', True):
+ if config.get('enable_user_mood'):
self.register_plugin('xep_0107')
- if config.get('enable_user_activity', True):
+ if config.get('enable_user_activity'):
self.register_plugin('xep_0108')
- if config.get('enable_user_gaming', True):
+ if config.get('enable_user_gaming'):
self.register_plugin('xep_0196')
- if config.get('send_poezio_info', True):
+ if config.get('send_poezio_info'):
info = {'name':'poezio',
'version': options.version}
- if config.get('send_os_info', True):
+ if config.get('send_os_info'):
info['os'] = common.get_os_info()
self.plugin['xep_0030'].set_identities(
identities=set([('client', 'pc', None, 'Poezio')]))
@@ -124,7 +123,7 @@ class Connection(slixmpp.ClientXMPP):
self.plugin['xep_0030'].set_identities(
identities=set([('client', 'pc', None, '')]))
self.register_plugin('xep_0092', pconfig=info)
- if config.get('send_time', True):
+ if config.get('send_time'):
self.register_plugin('xep_0202')
self.register_plugin('xep_0224')
self.register_plugin('xep_0249')
@@ -143,8 +142,8 @@ class Connection(slixmpp.ClientXMPP):
# Happens when we change the value with /set while we are not
# connected. Do nothing in that case
return
- ping_interval = config.get('connection_check_interval', 60)
- timeout_delay = config.get('connection_timeout_delay', 10)
+ ping_interval = config.get('connection_check_interval')
+ timeout_delay = config.get('connection_timeout_delay')
if timeout_delay <= 0:
# We help the stupid user (with a delay of 0, poezio will try to
# reconnect immediately because the timeout is immediately
@@ -161,7 +160,7 @@ class Connection(slixmpp.ClientXMPP):
"""
Connect and process events.
"""
- custom_host = config.get('custom_host', '')
+ custom_host = config.get('custom_host')
custom_port = config.get('custom_port', 5222)
if custom_port == -1:
custom_port = 5222