summaryrefslogtreecommitdiff
path: root/src/core.py
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2011-11-07 21:08:30 +0100
committermathieui <mathieui@mathieui.net>2011-11-07 21:08:30 +0100
commit0bfabab8344ec19f8f612fd27e7db7bee1dd9d1d (patch)
tree8e6eb05109fc7b76e66e983779be0ebe752a4488 /src/core.py
parentf4201bf7549e6c62d4475f6bc0a3e87130eb0b43 (diff)
parent305e5ed40d129843a774f14990cf6f46d8c6e1a8 (diff)
downloadpoezio-0bfabab8344ec19f8f612fd27e7db7bee1dd9d1d.tar.gz
poezio-0bfabab8344ec19f8f612fd27e7db7bee1dd9d1d.tar.bz2
poezio-0bfabab8344ec19f8f612fd27e7db7bee1dd9d1d.tar.xz
poezio-0bfabab8344ec19f8f612fd27e7db7bee1dd9d1d.zip
Merge branch 'plugins' of https://git.louiz.org/poezio into plugins
Diffstat (limited to 'src/core.py')
-rw-r--r--src/core.py20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/core.py b/src/core.py
index 27f5ca03..f92e2730 100644
--- a/src/core.py
+++ b/src/core.py
@@ -51,6 +51,7 @@ from text_buffer import TextBuffer
from keyboard import read_char
from theming import get_theme
from fifo import Fifo
+from windows import g_lock
# http://xmpp.org/extensions/xep-0045.html#errorstatus
ERROR_AND_STATUS_CODES = {
@@ -73,8 +74,6 @@ possible_show = {'available':None,
'xa':'xa'
}
-resize_lock = threading.Lock()
-
Status = collections.namedtuple('Status', 'show message')
class Core(object):
@@ -177,6 +176,8 @@ class Core(object):
self.timed_events = set()
+ self.connected_events = {}
+
self.autoload_plugins()
def autoload_plugins(self):
@@ -209,18 +210,21 @@ class Core(object):
'Just press Ctrl-n.' \
))
self.refresh_window()
+
def resize_global_information_win(self):
"""
Resize the global_information_win only once at each resize.
"""
- self.information_win.resize(self.information_win_size, tabs.Tab.width,
- tabs.Tab.height - 2 - self.information_win_size, 0)
+ with g_lock:
+ self.information_win.resize(self.information_win_size, tabs.Tab.width,
+ tabs.Tab.height - 2 - self.information_win_size, 0)
def resize_global_info_bar(self):
"""
Resize the GlobalInfoBar only once at each resize
"""
- self.tab_win.resize(1, tabs.Tab.width, tabs.Tab.height - 2, 0)
+ with g_lock:
+ self.tab_win.resize(1, tabs.Tab.width, tabs.Tab.height - 2, 0)
def on_exception(self, typ, value, trace):
"""
@@ -561,7 +565,7 @@ class Core(object):
if not body:
return
tab.add_message(body, time=None, nickname=nick_from,
- forced_user=self.get_tab_by_name(room_from, tabs.MucTab).get_user_by_name(nick_from))
+ forced_user=self.get_tab_by_name(room_from, tabs.MucTab).get_user_by_name(nick_from))
conversation = self.get_tab_by_name(jid.full, tabs.PrivateTab)
if conversation and conversation.remote_wants_chatstates is None:
if message['chat_state']:
@@ -709,7 +713,7 @@ class Core(object):
tabs.Tab.resize(self.stdscr)
self.resize_global_information_win()
self.resize_global_info_bar()
- with resize_lock:
+ with g_lock:
for tab in self.tabs:
if config.get('lazy_resize', 'true') == 'true':
tab.need_resize = True
@@ -1047,7 +1051,7 @@ class Core(object):
if tab.get_user_by_name(nick_from) and\
tab.get_user_by_name(nick_from) in tab.ignores:
return
- self.events.trigger('muc_mg', message)
+ self.events.trigger('muc_msg', message)
body = xhtml.get_body_from_message_stanza(message)
if body:
date = date if delayed == True else None