diff options
Diffstat (limited to 'src/tabs.py')
-rw-r--r-- | src/tabs.py | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/tabs.py b/src/tabs.py index eaa7c375..e5df2e7d 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -24,7 +24,6 @@ from gettext import gettext as _ import windows import curses import difflib -import text_buffer import string import common import core @@ -40,7 +39,7 @@ from theming import get_theme from sleekxmpp.xmlstream.stanzabase import JID from config import config from roster import RosterGroup, roster -from contact import Contact, Resource +from contact import Contact from text_buffer import TextBuffer from user import User from os import getenv, path @@ -119,13 +118,12 @@ class Tab(object): @state.setter def state(self, value): if not value in STATE_COLORS: - log.debug("WARNING: invalid value for tab state") - return + log.debug("Invalid value for tab state: %s" % value) elif STATE_PRIORITY[value] < STATE_PRIORITY[self._state] and \ value != 'current': - log.debug("WARNING: did not set status because of lower priority") - return - self._state = value + log.debug("Did not set status because of lower priority, asked: %s, kept: %s" % (value, self.state)) + else: + self._state = value @staticmethod def resize(scr): @@ -568,9 +566,9 @@ class MucTab(ChatTab): """ args = arg.split() if len(args): - msg = ' '.join(args) + arg = ' '.join(args) else: - msg = None + arg = None if self.joined: muc.leave_groupchat(self.core.xmpp, self.name, self.own_nick, arg) self.add_message(_("\x195}You left the chatroom\x193}")) @@ -938,7 +936,7 @@ class MucTab(ChatTab): self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':from_nick, 'color':color, 'spec':get_theme().CHAR_JOIN}) else: self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s \x195}(\x194}%(jid)s\x195}) joined the room' % {'spec':get_theme().CHAR_JOIN, 'nick':from_nick, 'color':color, 'jid':jid.full}) - self.core.on_user_rejoined_private_conversation(room.name, from_nick) + 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.find('{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER)).attrib['nick'] @@ -1355,12 +1353,12 @@ class PrivateTab(ChatTab): """ self.activate() tab = self.core.get_tab_by_name(JID(self.name).bare, MucTab) - color = None - if tab: + color = 3 + if tab and config.get('display_user_color_in_join_part', ''): user = tab.get_user_by_name(nick) if user: - color = user.color - self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':nick, 'color': color or 3, 'spec':get_theme().CHAR_JOIN}) + color = user.color[0] + self.add_message('\x194}%(spec)s \x19%(color)d}%(nick)s\x195} joined the room' % {'nick':nick, 'color': color, 'spec':get_theme().CHAR_JOIN}) if self.core.current_tab() is self: self.refresh() self.core.doupdate() @@ -1468,6 +1466,7 @@ class RosterInfoTab(Tab): self.core.information(_('No JID specified'), 'Error') return self.core.xmpp.sendPresence(pto=jid, ptype='subscribe') + self.core.xmpp.sendPresence(pto=jid, ptype='subscribed') def command_name(self, args): """ @@ -1695,7 +1694,6 @@ class RosterInfoTab(Tab): else: jid = args[0] self.core.xmpp.sendPresence(pto=jid, ptype='subscribed') - self.core.xmpp.sendPresence(pto=jid, ptype='subscribe') def refresh(self): if self.need_resize: |