summaryrefslogtreecommitdiff
path: root/poezio/tabs/muctab.py
diff options
context:
space:
mode:
Diffstat (limited to 'poezio/tabs/muctab.py')
-rw-r--r--poezio/tabs/muctab.py75
1 files changed, 38 insertions, 37 deletions
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index 70d66ffb..246606e3 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -193,9 +193,9 @@ class MucTab(ChatTab):
valid_affiliations = ('outcast', 'none', 'member', 'admin', 'owner')
if affiliation not in valid_affiliations:
- return self.core.information('The affiliation must be one of ' +
- ', '.join(valid_affiliations),
- 'Error')
+ return self.core.information(
+ 'The affiliation must be one of ' +
+ ', '.join(valid_affiliations), 'Error')
if nick_or_jid in [user.nick for user in self.users]:
muc.set_user_affiliation(
self.core.xmpp,
@@ -220,8 +220,9 @@ class MucTab(ChatTab):
def callback(iq):
if iq['type'] == 'error':
- self.core.information("Could not set role '%s' for '%s'." %
- (role, nick), "Warning")
+ self.core.information(
+ "Could not set role '%s' for '%s'." % (role, nick),
+ "Warning")
valid_roles = ('none', 'visitor', 'participant', 'moderator')
@@ -281,10 +282,8 @@ class MucTab(ChatTab):
user = self.get_user_by_name(self.topic_from)
if user:
user_text = dump_tuple(user.color)
- user_string = '\x19%s}(set by \x19%s}%s\x19%s})' % (info_text,
- user_text,
- user.nick,
- info_text)
+ user_string = '\x19%s}(set by \x19%s}%s\x19%s})' % (
+ info_text, user_text, user.nick, info_text)
else:
user_string = self.topic_from
else:
@@ -430,7 +429,7 @@ class MucTab(ChatTab):
self.handle_presence_joined(presence, status_codes)
except PresenceError:
self.core.room_error(presence, presence['from'].bare)
- if self.core.current_tab() is self:
+ if self.core.tabs.current_tab is self:
self.text_win.refresh()
self.user_win.refresh_if_changed(self.users)
self.info_header.refresh(self, self.text_win, user=self.own_user)
@@ -454,9 +453,9 @@ class MucTab(ChatTab):
# Enable the self ping event, to regularly check if we
# are still in the room.
self.enable_self_ping_event()
- if self.core.current_tab() is not self:
+ if self.core.tabs.current_tab is not self:
self.refresh_tab_win()
- self.core.current_tab().refresh_input()
+ self.core.tabs.current_tab.refresh_input()
self.core.doupdate()
def handle_presence_unjoined(self, presence, deterministic, own=False):
@@ -488,9 +487,9 @@ class MucTab(ChatTab):
if self.name in self.core.initial_joins:
self.core.initial_joins.remove(self.name)
self._state = 'normal'
- elif self != self.core.current_tab():
+ elif self != self.core.tabs.current_tab:
self._state = 'joined'
- if (self.core.current_tab() is self
+ if (self.core.tabs.current_tab is self
and self.core.status.show not in ('xa', 'away')):
self.send_chat_state('active')
new_user.color = get_theme().COLOR_OWN_NICK
@@ -650,8 +649,8 @@ class MucTab(ChatTab):
self.core.on_user_rejoined_private_conversation(self.name, from_nick)
def on_user_nick_change(self, presence, user, from_nick, from_room):
- new_nick = presence.xml.find('{%s}x/{%s}item' %
- (NS_MUC_USER, NS_MUC_USER)).attrib['nick']
+ new_nick = presence.xml.find(
+ '{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER)).attrib['nick']
old_color = user.color
if user.nick == self.own_nick:
self.own_nick = new_nick
@@ -722,7 +721,7 @@ class MucTab(ChatTab):
self.core.disable_private_tabs(self.name, reason=kick_msg)
self.disconnect()
self.refresh_tab_win()
- self.core.current_tab().refresh_input()
+ self.core.tabs.current_tab.refresh_input()
if config.get_by_tabname('autorejoin', self.general_jid):
delay = config.get_by_tabname('autorejoin_delay',
self.general_jid)
@@ -800,7 +799,7 @@ class MucTab(ChatTab):
self.core.disable_private_tabs(self.name, reason=kick_msg)
self.disconnect()
self.refresh_tab_win()
- self.core.current_tab().refresh_input()
+ self.core.tabs.current_tab.refresh_input()
# try to auto-rejoin
if config.get_by_tabname('autorejoin', self.general_jid):
delay = config.get_by_tabname('autorejoin_delay',
@@ -959,9 +958,8 @@ class MucTab(ChatTab):
role != user.role):
# display the message in the room
self._text_buffer.add_message(msg)
- self.core.on_user_changed_status_in_private('%s/%s' % (from_room,
- from_nick),
- Status(show, status))
+ self.core.on_user_changed_status_in_private(
+ '%s/%s' % (from_room, from_nick), Status(show, status))
self.users.remove(user)
# finally, effectively change the user status
user.update(affiliation, show, status, role)
@@ -974,7 +972,7 @@ class MucTab(ChatTab):
"""
self.presence_buffer = []
self.users = []
- if self is not self.core.current_tab():
+ if self is not self.core.tabs.current_tab:
self.state = 'disconnected'
self.joined = False
self.disable_self_ping_event()
@@ -1178,8 +1176,9 @@ class MucTab(ChatTab):
info_win_height = self.core.information_win_size
self.user_win.resize(
- self.height - 3 - info_win_height - tab_win_height, self.width -
- (self.width // 10) * 9 - 1, 1, (self.width // 10) * 9 + 1)
+ self.height - 3 - info_win_height - tab_win_height,
+ self.width - (self.width // 10) * 9 - 1, 1,
+ (self.width // 10) * 9 + 1)
self.v_separator.resize(
self.height - 3 - info_win_height - tab_win_height, 1, 1,
9 * (self.width // 10))
@@ -1223,15 +1222,16 @@ class MucTab(ChatTab):
text_width = self.width
else:
text_width = (self.width // 10) * 9
- self.user_win.resize(self.height - 3 - self.core.information_win_size -
- Tab.tab_win_height(),
- self.width - (self.width // 10) * 9 - 1, 1,
- (self.width // 10) * 9 + 1)
+ self.user_win.resize(
+ self.height - 3 - self.core.information_win_size -
+ Tab.tab_win_height(), self.width - (self.width // 10) * 9 - 1, 1,
+ (self.width // 10) * 9 + 1)
self.v_separator.resize(
self.height - 3 - self.core.information_win_size -
Tab.tab_win_height(), 1, 1, 9 * (self.width // 10))
- self.text_win.resize(self.height - 3 - self.core.information_win_size -
- Tab.tab_win_height(), text_width, 1, 0)
+ self.text_win.resize(
+ self.height - 3 - self.core.information_win_size -
+ Tab.tab_win_height(), text_width, 1, 0)
self.info_header.resize(
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)
@@ -1329,8 +1329,9 @@ class MucTab(ChatTab):
nick = args[0]
color = args[1].lower()
if nick == self.own_nick:
- return self.core.information("You cannot change the color of your"
- " own nick.", 'Error')
+ return self.core.information(
+ "You cannot change the color of your"
+ " own nick.", 'Error')
elif color not in xhtml.colors and color not in ('unset', 'random'):
return self.core.information("Unknown color: %s" % color, 'Error')
self.set_nick_color(nick, color)
@@ -1375,7 +1376,7 @@ class MucTab(ChatTab):
"""
message = args[0]
self.leave_room(message)
- if self == self.core.current_tab():
+ if self == self.core.tabs.current_tab:
self.refresh()
self.core.doupdate()
@@ -1405,7 +1406,7 @@ class MucTab(ChatTab):
r = self.core.open_private_window(self.name, user.nick)
if r and len(args) == 2:
msg = args[1]
- self.core.current_tab().command_say(
+ self.core.tabs.current_tab.command_say(
xhtml.convert_simple_to_full_colors(msg))
if not r:
self.core.information("Cannot find user: %s" % nick, 'Error')
@@ -1446,9 +1447,9 @@ class MucTab(ChatTab):
affiliation = aff.get(user.affiliation,
get_theme().CHAR_AFFILIATION_NONE)
color = colors.get(user.role, color_other)
- buff.append('\x19%s}%s\x19o\x19%s}%s\x19o' %
- (color, affiliation, dump_tuple(user.color),
- user.nick))
+ buff.append(
+ '\x19%s}%s\x19o\x19%s}%s\x19o' %
+ (color, affiliation, dump_tuple(user.color), user.nick))
buff.append('\n')
message = ' '.join(buff)