diff options
author | Florent Le Coz <louiz@louiz.org> | 2011-09-09 19:13:56 +0200 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2011-09-09 19:13:56 +0200 |
commit | eacf2bf62d18b445bd0a8ba74f6105c5d3286cd4 (patch) | |
tree | d74ae0ffa9177ba85c158fc9afb0b6d725e84c22 /src | |
parent | d26845e2a3896755a04a2c338cb2ebb6c9fcc0de (diff) | |
parent | eb180ed52ee12784ec35213aa89413114a94297e (diff) | |
download | poezio-eacf2bf62d18b445bd0a8ba74f6105c5d3286cd4.tar.gz poezio-eacf2bf62d18b445bd0a8ba74f6105c5d3286cd4.tar.bz2 poezio-eacf2bf62d18b445bd0a8ba74f6105c5d3286cd4.tar.xz poezio-eacf2bf62d18b445bd0a8ba74f6105c5d3286cd4.zip |
Merge changes from default branch, too
Diffstat (limited to 'src')
-rw-r--r-- | src/atom_parser.py | 13 | ||||
-rw-r--r-- | src/common.py | 35 | ||||
-rw-r--r-- | src/config.py | 14 | ||||
-rw-r--r-- | src/connection.py | 13 | ||||
-rw-r--r-- | src/contact.py | 13 | ||||
-rw-r--r-- | src/core.py | 52 | ||||
-rw-r--r-- | src/data_forms.py | 13 | ||||
-rw-r--r-- | src/keyboard.py | 14 | ||||
-rw-r--r-- | src/logger.py | 13 | ||||
-rw-r--r-- | src/multiuserchat.py | 19 | ||||
-rw-r--r-- | src/poezio.py | 16 | ||||
-rw-r--r-- | src/pubsub.py | 13 | ||||
-rw-r--r-- | src/roster.py | 13 | ||||
-rw-r--r-- | src/singleton.py | 13 | ||||
-rw-r--r-- | src/tabs.py | 80 | ||||
-rw-r--r-- | src/theme.py | 13 | ||||
-rw-r--r-- | src/timed_events.py | 13 | ||||
-rw-r--r-- | src/user.py | 13 |
18 files changed, 125 insertions, 248 deletions
diff --git a/src/atom_parser.py b/src/atom_parser.py index e676d968..6b37cb7d 100644 --- a/src/atom_parser.py +++ b/src/atom_parser.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Defines a function returning a dict containing the values from an diff --git a/src/common.py b/src/common.py index 0bc93c8d..aa74e5c1 100644 --- a/src/common.py +++ b/src/common.py @@ -1,32 +1,9 @@ -# some functions coming from gajim sources (thanks) - -## Copyright (C) 2003-2008 Yann Leboulanger <asterix AT lagaule.org> -## Copyright (C) 2005-2006 Dimitur Kirov <dkirov AT gmail.com> -## Nikos Kouremenos <kourem AT gmail.com> -## Copyright (C) 2006 Alex Mauer <hawke AT hawkesnest.net> -## Copyright (C) 2006-2007 Travis Shirk <travis AT pobox.com> -## Copyright (C) 2006-2008 Jean-Marie Traissard <jim AT lapin.org> -## Copyright (C) 2007 Lukas Petrovicky <lukas AT petrovicky.net> -## James Newton <redshodan AT gmail.com> -## Julien Pivotto <roidelapluie AT gmail.com> -## Copyright (C) 2007-2008 Stephan Erb <steve-e AT h3c.de> -## Copyright (C) 2008 Brendan Taylor <whateley AT gmail.com> -## Jonathan Schleifer <js-gajim AT webkeks.org> -## - -# Copyright 2010-2011, Florent Le Coz <louiz@louiz.org> - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation version 3 of the License. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> +# +# This file is part of Poezio. +# +# Poezio is free software: you can redistribute it and/or modify +# it under the terms of the MIT license. See the COPYING file. """ various useful functions diff --git a/src/config.py b/src/config.py index ee37b9a9..801d0b38 100644 --- a/src/config.py +++ b/src/config.py @@ -1,19 +1,9 @@ -# Copyright 2009 chickenzilla -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Defines the global config instance, used to get or set (and save) values diff --git a/src/connection.py b/src/connection.py index d021f44b..f35ec178 100644 --- a/src/connection.py +++ b/src/connection.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Defines the Connection class diff --git a/src/contact.py b/src/contact.py index ee0e1e80..cf9163ab 100644 --- a/src/contact.py +++ b/src/contact.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Defines the Resource and Contact classes, which are used in diff --git a/src/core.py b/src/core.py index 242b22a6..e25be58f 100644 --- a/src/core.py +++ b/src/core.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. from gettext import gettext as _ @@ -101,7 +92,7 @@ class Core(object): self.information_buffer.add_window(self.information_win) self.tabs = [] self.previous_tab_nb = 0 - self.own_nick = config.get('own_nick', '') or self.xmpp.boundjid.user + self.own_nick = config.get('default_nick', '') or self.xmpp.boundjid.user # global commands, available from all tabs # a command is tuple of the form: # (the function executing the command. Takes a string as argument, @@ -113,6 +104,7 @@ class Core(object): 'help': (self.command_help, '\_o< KOIN KOIN KOIN', self.completion_help), 'join': (self.command_join, _("Usage: /join [room_name][@server][/nick] [password]\nJoin: Join the specified room. You can specify a nickname after a slash (/). If no nickname is specified, you will use the default_nick in the configuration file. You can omit the room name: you will then join the room you\'re looking at (useful if you were kicked). You can also provide a room_name without specifying a server, the server of the room you're currently in will be used. You can also provide a password to join the room.\nExamples:\n/join room@server.tld\n/join room@server.tld/John\n/join room2\n/join /me_again\n/join\n/join room@server.tld/my_nick password\n/join / password"), self.completion_join), 'exit': (self.command_quit, _("Usage: /exit\nExit: Just disconnect from the server and exit poezio."), None), + 'quit': (self.command_quit, _("Usage: /quit\nQuit: Just disconnect from the server and exit poezio."), None), 'next': (self.rotate_rooms_right, _("Usage: /next\nNext: Go to the next room."), None), 'prev': (self.rotate_rooms_left, _("Usage: /prev\nPrev: Go to the previous room."), None), 'win': (self.command_win, _("Usage: /win <number>\nWin: Go to the specified room."), self.completion_win), @@ -466,6 +458,7 @@ class Core(object): tab = self.get_tab_by_name('%s/%s' % (room_name, old_nick), tabs.PrivateTab) if tab: tab.rename_user(old_nick, new_nick) + self.on_user_rejoined_private_conversation(room_name, new_nick) def on_user_left_private_conversation(self, room_name, nick, status_message): """ @@ -475,6 +468,30 @@ class Core(object): if tab: tab.user_left(status_message, nick) + def on_user_rejoined_private_conversation(self, room_name, nick): + """ + The user joined a MUC: add a message in the associated private conversation + """ + tab = self.get_tab_by_name('%s/%s' % (room_name, nick), tabs.PrivateTab) + if tab: + tab.user_rejoined(nick) + + def disable_private_tabs(self, room_name): + """ + Disable private tabs when leaving a room + """ + for tab in self.tabs: + if tab.get_name().startswith(room_name) and isinstance(tab, tabs.PrivateTab): + tab.deactivate() + + def enable_private_tabs(self,room_name): + """ + Enable private tabs when joining a room + """ + for tab in self.tabs: + if tab.get_name().startswith(room_name) and isinstance(tab, tabs.PrivateTab): + tab.activate() + def on_user_changed_status_in_private(self, jid, msg): tab = self.get_tab_by_name(jid) if tab: # display the message in private @@ -660,8 +677,11 @@ class Core(object): self.resize_global_information_win() with resize_lock: for tab in self.tabs: - tab.resize() - self.refresh_window() + if config.get('lazy_resize', 'true') == 'true': + tab.need_resize = True + else: + tab.resize() + self.full_screen_redraw() def read_keyboard(self): """ @@ -1060,6 +1080,9 @@ class Core(object): pres['status'] = msg pres['type'] = show pres.send() + current = self.current_tab() + if isinstance(current, tabs.MucTab) and current.get_room().joined: + current.send_chat_state('inactive') for tab in self.tabs: if isinstance(tab, tabs.MucTab) and tab.get_room().joined: muc.change_show(self.xmpp, tab.get_room().name, tab.get_room().own_nick, show, msg) @@ -1270,6 +1293,7 @@ class Core(object): else: r.own_nick = nick r.users = [] + self.enable_private_tabs(room) def command_bookmark(self, arg): """ diff --git a/src/data_forms.py b/src/data_forms.py index 5537c767..106b1f77 100644 --- a/src/data_forms.py +++ b/src/data_forms.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Defines the data-forms Tab and all the Windows for it. diff --git a/src/keyboard.py b/src/keyboard.py index 5fee7444..dce987e1 100644 --- a/src/keyboard.py +++ b/src/keyboard.py @@ -1,19 +1,9 @@ -# -*- coding: utf-8 -*- -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Functions to interact with the keyboard diff --git a/src/logger.py b/src/logger.py index d87eaa6b..58e04b3b 100644 --- a/src/logger.py +++ b/src/logger.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. import sys from os import environ, makedirs diff --git a/src/multiuserchat.py b/src/multiuserchat.py index dd936039..1c226553 100644 --- a/src/multiuserchat.py +++ b/src/multiuserchat.py @@ -1,16 +1,9 @@ -# Copyright 2010-2011, Florent Le Coz <louiz@louiz.org> - -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation version 3 of the License. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. - -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> +# +# This file is part of Poezio. +# +# Poezio is free software: you can redistribute it and/or modify +# it under the terms of the MIT license. See the COPYING file. """ Implementation of the XEP-0045: Multi-User Chat. diff --git a/src/poezio.py b/src/poezio.py index 334357e5..24225c2e 100644 --- a/src/poezio.py +++ b/src/poezio.py @@ -1,20 +1,10 @@ -#!/usr/bin/env python3 -# -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. + """ Starting point of poezio. Launches both the Connection and Gui diff --git a/src/pubsub.py b/src/pubsub.py index 498843cf..0066265e 100644 --- a/src/pubsub.py +++ b/src/pubsub.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. import logging log = logging.getLogger(__name__) diff --git a/src/roster.py b/src/roster.py index afe83c9e..ed9b58f4 100644 --- a/src/roster.py +++ b/src/roster.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ diff --git a/src/singleton.py b/src/singleton.py index c47fb269..66bfc933 100644 --- a/src/singleton.py +++ b/src/singleton.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Defines a Singleton function that initialize an object diff --git a/src/tabs.py b/src/tabs.py index 0ced51e1..af4de010 100644 --- a/src/tabs.py +++ b/src/tabs.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ a Tab object is a way to organize various Windows (see windows.py) @@ -299,12 +290,12 @@ class ChatTab(Tab): self.command_say(txt) self.cancel_paused_delay() - def send_chat_state(self, state): + def send_chat_state(self, state, always_send=False): """ Send an empty chatstate message """ if not isinstance(self, MucTab) or self.get_room().joined: - if state in ('active', 'inactive', 'gone') and self.core.status.show in ('xa', 'away'): + if state in ('active', 'inactive', 'gone') and self.core.status.show in ('xa', 'away') and not always_send: return msg = self.core.xmpp.make_message(self.get_name()) msg['type'] = self.message_type @@ -312,24 +303,20 @@ class ChatTab(Tab): self.chat_state = state msg.send() - def send_composing_chat_state(self, empty_before, empty_after): + def send_composing_chat_state(self, empty_after): """ Send the "active" or "composing" chatstate, depending on the the current status of the input """ if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates: - if self.chat_state == "composing" and not empty_after: - self.cancel_paused_delay() - self.set_paused_delay(True) - elif empty_after and not self.chat_state == 'active': - self.cancel_paused_delay() - self.send_chat_state("active") - elif empty_after: - self.cancel_paused_delay() - elif empty_before or (self.timed_event_paused is not None and not self.timed_event_paused()): - self.cancel_paused_delay() - self.send_chat_state("composing") + needed = 'inactive' if self.core.status.show in ('xa', 'away') else 'active' + self.cancel_paused_delay() + if not empty_after: + if self.chat_state != "composing": + self.send_chat_state("composing") self.set_paused_delay(True) + elif empty_after and self.chat_state != needed: + self.send_chat_state(needed, True) def set_paused_delay(self, composing): """ @@ -462,6 +449,7 @@ class MucTab(ChatTab): if self.get_room().joined: muc.leave_groupchat(self.core.xmpp, self.get_name(), self.get_room().own_nick, arg) self.get_room().disconnect() + self.core.disable_private_tabs(self.get_room().name) self.core.command_join('/', "0") def command_recolor(self, arg): @@ -531,6 +519,7 @@ class MucTab(ChatTab): if self.get_room().joined: muc.leave_groupchat(self.core.xmpp, room.name, room.own_nick, arg) self.core.close_tab() + self.core.disable_private_tabs(self.get_room().name) def command_query(self, arg): """ @@ -704,10 +693,9 @@ class MucTab(ChatTab): if key in self.key_func: self.key_func[key]() return False - empty_before = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) self.input.do_command(key) empty_after = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) - self.send_composing_chat_state(empty_before, empty_after) + self.send_composing_chat_state(empty_after) return False def completion(self): @@ -728,10 +716,9 @@ class MucTab(ChatTab): else: add_after = ' ' - empty_before = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) self.input.auto_completion(word_list, add_after) empty_after = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) - self.send_composing_chat_state(empty_before, empty_after) + self.send_composing_chat_state(empty_after) def get_color_state(self): return self._room.color_state @@ -798,6 +785,7 @@ class MucTab(ChatTab): room.users.append(new_user) if from_nick == room.own_nick: room.joined = True + self.send_chat_state('active') new_user.color = theme.COLOR_OWN_NICK room.add_message(_("\x195Your nickname is \x193%s") % (from_nick)) if '170' in status_codes: @@ -843,6 +831,8 @@ class MucTab(ChatTab): room.add_message('\x194%(spec)s \x193%(nick)s\x195 joined the room' % {'nick':from_nick, 'spec':theme.CHAR_JOIN}) else: room.add_message('\x194%(spec)s \x193%(nick)s \x195(\x194%(jid)s\x195) joined the room' % {'spec':theme.CHAR_JOIN, 'nick':from_nick, 'jid':jid.full}) + self.core.on_user_rejoined_private_conversation(room.name, from_nick) + def on_user_nick_change(self, room, presence, user, from_nick, from_room): new_nick = presence.find('{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER)).attrib['nick'] @@ -867,6 +857,7 @@ class MucTab(ChatTab): by = by.attrib['jid'] if by is not None else None if from_nick == room.own_nick: # we are banned room.disconnect() + self.core.disable_private_tabs(room.name) if by: kick_msg = _('\x191%(spec)s \x193You\x195 have been banned by \x194%(by)s') % {'spec': theme.CHAR_KICK, 'by':by} else: @@ -890,6 +881,7 @@ class MucTab(ChatTab): by = by.attrib['jid'] if by is not None else None if from_nick == room.own_nick: # we are kicked room.disconnect() + self.core.disable_private_tabs(room.name) if by: kick_msg = _('\x191%(spec)s \x193You\x195 have been kicked by \x193%(by)s') % {'spec': theme.CHAR_KICK, 'by':by} else: @@ -914,6 +906,7 @@ class MucTab(ChatTab): if room.own_nick == user.nick: # We are now out of the room. Happens with some buggy (? not sure) servers room.disconnect() + self.core.disable_private_tabs(from_room) hide_exit_join = config.get('hide_exit_join', -1) if config.get('hide_exit_join', -1) >= -1 else -1 if hide_exit_join == -1 or user.has_talked_since(hide_exit_join): if not jid.full: @@ -991,11 +984,14 @@ class PrivateTab(ChatTab): self.commands['unquery'] = (self.command_unquery, _("Usage: /unquery\nUnquery: close the tab"), None) self.commands['part'] = (self.command_unquery, _("Usage: /part\nPart: close the tab"), None) self.resize() + self.on = True def completion(self): self.complete_commands(self.input) def command_say(self, line): + if not self.on: + return msg = self.core.xmpp.make_message(self.get_name()) msg['type'] = 'chat' if line.find('\x19') == -1: @@ -1006,7 +1002,7 @@ class PrivateTab(ChatTab): if config.get('send_chat_states', 'true') == 'true' and self.remote_wants_chatstates is not False: msg['chat_state'] = 'active' msg.send() - self.core.add_message_to_text_buffer(self.get_room(), line, None, self.core.own_nick) + self.core.add_message_to_text_buffer(self.get_room(), line, None, self.core.own_nick or self.get_room().own_nick) logger.log_message(JID(self.get_name()).bare, self.core.own_nick, line) self.cancel_paused_delay() self.text_win.refresh(self._room) @@ -1057,12 +1053,13 @@ class PrivateTab(ChatTab): if key in self.key_func: self.key_func[key]() return False - empty_before = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) self.input.do_command(key) + if not self.on: + return False empty_after = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) tab = self.core.get_tab_by_name(JID(self.get_room().name).bare, MucTab) if tab and tab.get_room().joined: - self.send_composing_chat_state(empty_before, empty_after) + self.send_composing_chat_state(empty_after) return False def on_lose_focus(self): @@ -1113,6 +1110,22 @@ class PrivateTab(ChatTab): self.get_room().add_message(_('\x191%(spec)s \x193%(nick)s\x195 has left the room') % {'nick':from_nick.replace('"', '\\"'), 'spec':theme.CHAR_QUIT.replace('"', '\\"')}) else: self.get_room().add_message(_('\x191%(spec)s \x193%(nick)s\x195 has left the room (%(status)s)"') % {'nick':from_nick.replace('"', '\\"'), 'spec':theme.CHAR_QUIT, 'status': status_message.replace('"', '\\"')}) + self.deactivate() + self.refresh() + + def user_rejoined(self, nick): + """ + The user (or at least someone with the same nick) came back in the MUC + """ + self.get_room().add_message('\x194%(spec)s \x193%(nick)s\x195 joined the room' % {'nick':nick, 'spec':theme.CHAR_JOIN}) + self.activate() + self.refresh() + + def activate(self): + self.on = True + + def deactivate(self): + self.on = False class RosterInfoTab(Tab): """ @@ -1546,10 +1559,9 @@ class ConversationTab(ChatTab): if key in self.key_func: self.key_func[key]() return False - empty_before = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) self.input.do_command(key) empty_after = self.input.get_text() == '' or (self.input.get_text().startswith('/') and not self.input.get_text().startswith('//')) - self.send_composing_chat_state(empty_before, empty_after) + self.send_composing_chat_state(empty_after) return False def on_lose_focus(self): diff --git a/src/theme.py b/src/theme.py index 2b09cc57..e4a92cb3 100644 --- a/src/theme.py +++ b/src/theme.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Define the variables (colors and some other stuff) that are diff --git a/src/timed_events.py b/src/timed_events.py index 335fc6be..fa6503df 100644 --- a/src/timed_events.py +++ b/src/timed_events.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ To use these, just use core.add_timed_event(event) diff --git a/src/user.py b/src/user.py index 6f5290cb..e77be817 100644 --- a/src/user.py +++ b/src/user.py @@ -1,18 +1,9 @@ -# Copyright 2010-2011 Le Coz Florent <louiz@louiz.org> +# Copyright 2010-2011 Florent Le Coz <louiz@louiz.org> # # This file is part of Poezio. # # Poezio is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, version 3 of the License. -# -# Poezio is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Poezio. If not, see <http://www.gnu.org/licenses/>. +# it under the terms of the MIT license. See the COPYING file. """ Define the user class. |