Fix #3322 (send a beep when we get disconnected)

This commit is contained in:
mathieui 2017-10-09 01:06:53 +02:00
parent 156cfb5546
commit 3b5ea1a961
4 changed files with 5 additions and 3 deletions

View file

@ -355,7 +355,7 @@ use_bookmarks_method =
# someone from a chatroiom) # someone from a chatroiom)
# - message (any message from a chatroom) # - message (any message from a chatroom)
# - invite (when you receive an invitation for joining a chatroom) # - invite (when you receive an invitation for joining a chatroom)
#beep_on = highlight private invite #beep_on = highlight private invite disconnect
# Theme # Theme

View file

@ -820,7 +820,7 @@ Options that change the behavior of poezio in a non-visual manner.
beep_on beep_on
**Default value:** ``highlight private`` **Default value:** ``highlight private invite disconnect``
The terminal can beep on various event. Put the event you want in a list The terminal can beep on various event. Put the event you want in a list
(separated by spaces). (separated by spaces).

View file

@ -32,7 +32,7 @@ DEFAULT_CONFIG = {
'auto_reconnect': True, 'auto_reconnect': True,
'autorejoin_delay': '5', 'autorejoin_delay': '5',
'autorejoin': False, 'autorejoin': False,
'beep_on': 'highlight private invite', 'beep_on': 'highlight private invite disconnect',
'ca_cert_path': '', 'ca_cert_path': '',
'certificate': '', 'certificate': '',
'certfile': '', 'certfile': '',

View file

@ -1033,6 +1033,8 @@ class HandlerCore:
""" """
When we are disconnected from remote server When we are disconnected from remote server
""" """
if 'disconnect' in config.get('beep_on').split():
curses.beep()
roster.connected = 0 roster.connected = 0
# Stop the ping plugin. It would try to send stanza on regular basis # Stop the ping plugin. It would try to send stanza on regular basis
self.core.xmpp.plugin['xep_0199'].disable_keepalive() self.core.xmpp.plugin['xep_0199'].disable_keepalive()