From aa79acb7d9cef2f19376a20ac27c13b9b46ac6e6 Mon Sep 17 00:00:00 2001
From: mathieui <mathieui@mathieui.net>
Date: Sun, 12 Jun 2016 21:45:04 +0200
Subject: Disable smacks by default

---
 data/default_config.cfg      | 5 +++++
 doc/source/configuration.rst | 9 +++++++++
 poezio/config.py             | 1 +
 poezio/connection.py         | 3 ++-
 4 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/data/default_config.cfg b/data/default_config.cfg
index 7135456b..dacf1576 100644
--- a/data/default_config.cfg
+++ b/data/default_config.cfg
@@ -172,6 +172,11 @@ use_bookmarks_method =
 # colored text for example.
 #enable_xhtml_im = true
 
+# Stream Management (XEP-0198) is an extension designed to improve
+# the reliability of XMPP in unreliable network conditions (such
+# as mobile networks). It can however increase bandwidth usage.
+#enable_smacks = false
+
 # Set a number for this setting.
 # The join OR status-change notices will be
 # displayed according to this number.
diff --git a/doc/source/configuration.rst b/doc/source/configuration.rst
index 718d24ca..52f7eb07 100644
--- a/doc/source/configuration.rst
+++ b/doc/source/configuration.rst
@@ -302,6 +302,15 @@ to understand what is :ref:`carbons <carbons-details>` or
         enabled. There should be no reason to disable this except if you encounter
         issues with your server.
 
+    enable_smacks
+
+        **Default value:** ``false``
+
+        Stream Management (XEP-0198) is an extension designed to improve
+        the reliability of XMPP in unreliable network conditions (such
+        as mobile networks). It can however increase bandwidth usage.
+        It also requires server support.
+
     enable_user_activity
 
         **Default value:** ``true``
diff --git a/poezio/config.py b/poezio/config.py
index 7f0c75f6..d84f84e8 100644
--- a/poezio/config.py
+++ b/poezio/config.py
@@ -58,6 +58,7 @@ DEFAULT_CONFIG = {
         'enable_user_tune': True,
         'enable_vertical_tab_list': False,
         'enable_xhtml_im': True,
+        'enable_smacks': False,
         'eval_password': '',
         'exec_remote': False,
         'extract_inline_images': True,
diff --git a/poezio/connection.py b/poezio/connection.py
index b5d60a1b..1803b812 100644
--- a/poezio/connection.py
+++ b/poezio/connection.py
@@ -123,7 +123,8 @@ class Connection(slixmpp.ClientXMPP):
         self.plugin['xep_0184'].auto_request = config.get('request_message_receipts')
 
         self.register_plugin('xep_0191')
-        self.register_plugin('xep_0198')
+        if config.get('enable_smacks'):
+            self.register_plugin('xep_0198')
         self.register_plugin('xep_0199')
 
         if config.get('enable_user_tune'):
-- 
cgit v1.2.3