summaryrefslogtreecommitdiff
path: root/src/tabs/muctab.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/tabs/muctab.py')
-rw-r--r--src/tabs/muctab.py99
1 files changed, 47 insertions, 52 deletions
diff --git a/src/tabs/muctab.py b/src/tabs/muctab.py
index f526ec80..547830cb 100644
--- a/src/tabs/muctab.py
+++ b/src/tabs/muctab.py
@@ -251,7 +251,7 @@ class MucTab(ChatTab):
def completion_nick(self, the_input):
"""Completion for /nick"""
nicks = [os.environ.get('USER'),
- config.get('default_nick', ''),
+ config.get('default_nick'),
self.core.get_bookmark_nickname(self.name)]
nicks = [i for i in nicks if i]
return the_input.auto_completion(nicks, '', quotify=False)
@@ -471,8 +471,8 @@ class MucTab(ChatTab):
char_quit = get_theme().CHAR_QUIT
spec_col = dump_tuple(get_theme().COLOR_QUIT_CHAR)
- if config.get_by_tabname('display_user_color_in_join_part', True,
- self.general_jid, True):
+ if config.get_by_tabname('display_user_color_in_join_part',
+ self.general_jid):
color = dump_tuple(get_theme().COLOR_OWN_NICK)
else:
color = 3
@@ -737,8 +737,8 @@ class MucTab(ChatTab):
msg.enable('html')
msg['html']['body'] = xhtml.poezio_colors_to_html(msg['body'])
msg['body'] = xhtml.clean_text(msg['body'])
- if (config.get_by_tabname('send_chat_states', True, self.general_jid,
- True) and self.remote_wants_chatstates is not False):
+ if (config.get_by_tabname('send_chat_states', self.general_jid)
+ and self.remote_wants_chatstates is not False):
msg['chat_state'] = needed
if correct:
msg['replace']['id'] = self.last_sent_message['id']
@@ -803,7 +803,7 @@ class MucTab(ChatTab):
Resize the whole window. i.e. all its sub-windows
"""
self.need_resize = False
- if config.get("hide_user_list", False) or self.size.tab_degrade_x:
+ if config.get('hide_user_list') or self.size.tab_degrade_x:
display_user_list = False
text_width = self.width
else:
@@ -844,7 +844,7 @@ class MucTab(ChatTab):
if self.need_resize:
self.resize()
log.debug(' TAB Refresh: %s', self.__class__.__name__)
- if config.get("hide_user_list", False) or self.size.tab_degrade_x:
+ if config.get('hide_user_list') or self.size.tab_degrade_x:
display_user_list = False
else:
display_user_list = True
@@ -887,7 +887,7 @@ class MucTab(ChatTab):
for user in sorted(self.users, key=compare_users, reverse=True):
if user.nick != self.own_nick:
word_list.append(user.nick)
- after = config.get('after_completion', ',') + ' '
+ after = config.get('after_completion') + ' '
input_pos = self.input.pos
if ' ' not in self.input.get_text()[:input_pos] or (
self.input.last_completion and
@@ -895,7 +895,7 @@ class MucTab(ChatTab):
self.input.last_completion + after):
add_after = after
else:
- if not config.get('add_space_after_completion', True):
+ if not config.get('add_space_after_completion'):
add_after = ''
else:
add_after = ' '
@@ -907,7 +907,7 @@ class MucTab(ChatTab):
self.send_composing_chat_state(empty_after)
def get_nick(self):
- if not config.get('show_muc_jid', True):
+ if not config.get('show_muc_jid'):
return safeJID(self.name).user
return self.name
@@ -924,25 +924,25 @@ class MucTab(ChatTab):
self.state = 'disconnected'
self.text_win.remove_line_separator()
self.text_win.add_line_separator(self._text_buffer)
- if config.get_by_tabname('send_chat_states', True,
- self.general_jid, True) and not self.input.get_text():
+ if (config.get_by_tabname('send_chat_states', self.general_jid) and
+ not self.input.get_text()):
self.send_chat_state('inactive')
self.check_scrolled()
def on_gain_focus(self):
self.state = 'current'
if (self.text_win.built_lines and self.text_win.built_lines[-1] is None
- and not config.get('show_useless_separator', False)):
+ and not config.get('show_useless_separator')):
self.text_win.remove_line_separator()
curses.curs_set(1)
- if self.joined and config.get_by_tabname('send_chat_states', True,
- self.general_jid, True) and not self.input.get_text():
+ if self.joined and config.get_by_tabname('send_chat_states',
+ self.general_jid) and not self.input.get_text():
self.send_chat_state('active')
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height-3:
return
- if config.get("hide_user_list", False):
+ if config.get("hide_user_list"):
text_width = self.width
else:
text_width = (self.width//10)*9
@@ -1003,7 +1003,7 @@ class MucTab(ChatTab):
new_user.color = get_theme().COLOR_OWN_NICK
if config.get_by_tabname('display_user_color_in_join_part',
- True, self.general_jid, True):
+ self.general_jid):
color = dump_tuple(new_user.color)
else:
color = 3
@@ -1122,11 +1122,11 @@ class MucTab(ChatTab):
user = User(from_nick, affiliation,
show, status, role, jid)
self.users.append(user)
- hide_exit_join = config.get_by_tabname('hide_exit_join', -1,
- self.general_jid, True)
+ hide_exit_join = config.get_by_tabname('hide_exit_join',
+ self.general_jid)
if hide_exit_join != 0:
- if config.get_by_tabname('display_user_color_in_join_part', True,
- self.general_jid, True):
+ if config.get_by_tabname('display_user_color_in_join_part',
+ self.general_jid):
color = dump_tuple(user.color)
else:
color = 3
@@ -1163,8 +1163,8 @@ class MucTab(ChatTab):
self.core.on_muc_own_nickchange(self)
user.change_nick(new_nick)
- if config.get_by_tabname('display_user_color_in_join_part', True,
- self.general_jid, True):
+ if config.get_by_tabname('display_user_color_in_join_part',
+ self.general_jid):
color = dump_tuple(user.color)
else:
color = 3
@@ -1206,10 +1206,9 @@ class MucTab(ChatTab):
self.refresh_tab_win()
self.core.current_tab().input.refresh()
self.core.doupdate()
- if config.get_by_tabname('autorejoin', False,
- self.general_jid, True):
- delay = config.get_by_tabname('autorejoin_delay', '5',
- self.general_jid, True)
+ if config.get_by_tabname('autorejoin', self.general_jid):
+ delay = config.get_by_tabname('autorejoin_delay',
+ self.general_jid)
delay = common.parse_str_to_secs(delay)
if delay <= 0:
muc.join_groupchat(self.core, self.name, self.own_nick)
@@ -1223,7 +1222,7 @@ class MucTab(ChatTab):
else:
if config.get_by_tabname('display_user_color_in_join_part',
- True, self.general_jid, True):
+ self.general_jid):
color = dump_tuple(user.color)
else:
color = 3
@@ -1278,10 +1277,9 @@ class MucTab(ChatTab):
self.core.current_tab().input.refresh()
self.core.doupdate()
# try to auto-rejoin
- if config.get_by_tabname('autorejoin', False,
- self.general_jid, True):
- delay = config.get_by_tabname('autorejoin_delay', "5",
- self.general_jid, True)
+ if config.get_by_tabname('autorejoin', self.general_jid):
+ delay = config.get_by_tabname('autorejoin_delay',
+ self.general_jid)
delay = common.parse_str_to_secs(delay)
if delay <= 0:
muc.join_groupchat(self.core, self.name, self.own_nick)
@@ -1293,8 +1291,8 @@ class MucTab(ChatTab):
self.name,
self.own_nick))
else:
- if config.get_by_tabname('display_user_color_in_join_part', True,
- self.general_jid, True):
+ if config.get_by_tabname('display_user_color_in_join_part',
+ self.general_jid):
color = dump_tuple(user.color)
else:
color = 3
@@ -1327,13 +1325,12 @@ class MucTab(ChatTab):
self.core.disable_private_tabs(from_room)
self.refresh_tab_win()
- hide_exit_join = max(config.get_by_tabname('hide_exit_join', -1,
- self.general_jid, True),
- -1)
+ hide_exit_join = config.get_by_tabname('hide_exit_join',
+ self.general_jid)
- if hide_exit_join == -1 or user.has_talked_since(hide_exit_join):
- if config.get_by_tabname('display_user_color_in_join_part', True,
- self.general_jid, True):
+ if hide_exit_join <= -1 or user.has_talked_since(hide_exit_join):
+ if config.get_by_tabname('display_user_color_in_join_part',
+ self.general_jid):
color = dump_tuple(user.color)
else:
color = 3
@@ -1373,8 +1370,8 @@ class MucTab(ChatTab):
# build the message
display_message = False # flag to know if something significant enough
# to be displayed has changed
- if config.get_by_tabname('display_user_color_in_join_part', True,
- self.general_jid, True):
+ if config.get_by_tabname('display_user_color_in_join_part',
+ self.general_jid):
color = dump_tuple(user.color)
else:
color = 3
@@ -1410,8 +1407,8 @@ class MucTab(ChatTab):
if not display_message:
return
msg = msg[:-2] # remove the last ", "
- hide_status_change = config.get_by_tabname('hide_status_change', -1,
- self.general_jid, True)
+ hide_status_change = config.get_by_tabname('hide_status_change',
+ self.general_jid)
if hide_status_change < -1:
hide_status_change = -1
if ((hide_status_change == -1 or \
@@ -1471,9 +1468,9 @@ class MucTab(ChatTab):
self.state = 'highlight'
highlighted = True
else:
- highlight_words = config.get_by_tabname('highlight_on', '',
- self.general_jid,
- True).split(':')
+ highlight_words = config.get_by_tabname('highlight_on',
+ self.general_jid)
+ highlight_words = highlight_words.split(':')
for word in highlight_words:
if word and word.lower() in txt.lower():
if self.state != 'current':
@@ -1481,10 +1478,9 @@ class MucTab(ChatTab):
highlighted = True
break
if highlighted:
- beep_on = config.get('beep_on', 'highlight private').split()
+ beep_on = config.get('beep_on').split()
if 'highlight' in beep_on and 'message' not in beep_on:
- if not config.get_by_tabname('disable_beep', False,
- self.name, False):
+ if not config.get_by_tabname('disable_beep', self.name):
curses.beep()
return highlighted
@@ -1523,8 +1519,7 @@ class MucTab(ChatTab):
if (not time and nickname and nickname != self.own_nick
and self.state != 'current'):
if (self.state != 'highlight' and
- config.get_by_tabname('notify_messages',
- True, self.name)):
+ config.get_by_tabname('notify_messages', self.name)):
self.state = 'message'
if time and not txt.startswith('/me'):
txt = '\x19%(info_col)s}%(txt)s' % {