From c7da566f0ae6fa412341f48f27122ed7f968ae9d Mon Sep 17 00:00:00 2001 From: mathieui Date: Wed, 15 Feb 2012 23:01:50 +0100 Subject: Fixes #2324 --- data/default_config.cfg | 6 ++++++ doc/en/configure.txt | 6 ++++++ src/core.py | 11 ++++++++--- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/data/default_config.cfg b/data/default_config.cfg index 87a121bb..a1149452 100644 --- a/data/default_config.cfg +++ b/data/default_config.cfg @@ -24,6 +24,12 @@ resource = # If this is empty, the $USER environnement variable will be used default_nick = +# Send the initial presence +# true, unless you want to be invisible from your roster +# warning: this disables any presence sending other than MUCs or directed +# presences via /presence +send_initial_presence = true + # Jabber identifier. Specify it only if you want to connect using an existing # account on a server. This is optional and useful only for some features, # like room administration, nickname registration. diff --git a/doc/en/configure.txt b/doc/en/configure.txt index 57907cb6..afe24f3e 100644 --- a/doc/en/configure.txt +++ b/doc/en/configure.txt @@ -148,6 +148,12 @@ section of this documentation. Default setting means: - all quit and join notices will be displayed +*send_initial_presence*:: true + + Send initial presence (normal behaviour). If false, you will not send nor + receive any presence that is not directed (through /presence) or sent by a + MUC. + *display_user_color_in_join_part*:: false If set to true, the color of the nick will be used in MUCs information diff --git a/src/core.py b/src/core.py index 9deac05c..0b5bb37b 100644 --- a/src/core.py +++ b/src/core.py @@ -149,6 +149,10 @@ class Core(object): 'xml_tab': (self.command_xml_tab, _("Usage: /xml_tab\nXML Tab: Open an XML tab."), None), } + if config.get('send_initial_presence', 'true').lower() == 'false': + del self.commands['status'] + del self.commands['show'] + self.key_func = { "KEY_PPAGE": self.scroll_page_up, "KEY_NPAGE": self.scroll_page_down, @@ -629,9 +633,10 @@ class Core(object): # request the roster self.xmpp.getRoster() # send initial presence - pres = self.xmpp.make_presence() - self.events.trigger('send_normal_presence', pres) - pres.send() + if config.get('send_initial_presence', 'true').lower() == 'true': + pres = self.xmpp.make_presence() + self.events.trigger('send_normal_presence', pres) + pres.send() bookmark.get_local() if not self.xmpp.anon and not config.get('use_remote_bookmarks', 'true').lower() == 'false': bookmark.get_remote(self.xmpp) -- cgit v1.2.3