fixes a crash on shlex.

parent 6018d243
......@@ -38,6 +38,7 @@ from config import config
from tab import MucTab, InfoTab, PrivateTab, RosterInfoTab
from user import User
from room import Room
from roster import Roster
from message import Message
from text_buffer import TextBuffer
from keyboard import read_char
......@@ -74,7 +75,7 @@ class Gui(object):
self.init_curses(self.stdscr)
self.xmpp = xmpp
default_tab = InfoTab(self.stdscr, "Info") if self.xmpp.anon\
else RosterInfoTab(self.stdscr, "Roster")
else RosterInfoTab(self.stdscr, self.xmpp.roster)
self.tabs = [default_tab]
# a unique buffer used to store global informations
# that are displayed in almost all tabs, in an
......
......@@ -384,8 +384,8 @@ class RosterInfoTab(Tab):
self.input.resize(1, self.width, self.height-1, 0, stdscr, self.visible)
def refresh(self, tabs, informations):
self.v_separator.refresh()
self.roster_win.refresh(self.roster)
self.v_separator.refresh()
self.info_win.refresh(informations)
self.tab_win.refresh(tabs, tabs[0])
self.input.refresh()
......
......@@ -439,8 +439,9 @@ class TextWin(Win):
try:
splitted = shlex.split(txt)
except ValueError:
txt = txt.replace('"', '')
splitted = shlex.split(txt)
from common import debug
debug('SHLEX FAILED on: [%s]\n' % (txt,))
splitted = 'shlex failed here. See debug'.split()
for word in splitted:
if word in list(special_words.keys()):
self.addstr(word, curses.color_pair(special_words[word]))
......@@ -876,22 +877,6 @@ class Input(Win):
def clear_text(self):
self.win.erase()
# class RosterWin(Win):
# def __init__(self, height, width, y, x, parent_win, visible):
# Win.__init__(self, height, width, y, x, parent_win)
# self.visible = visible
# def resize(self, height, width, y, x, stdscr, visible):
# self._resize(height, width, y, x, stdscr)
# self.visible = visible
# def refresh(self, roster):
# g_lock.acquire()
# self.win.erase()
# self.addnstr('teub', 4)
# self.win.refresh()
# g_lock.release()
class VerticalSeparator(Win):
"""
Just a one-column window, with just a line in it, that is
......@@ -919,8 +904,6 @@ class VerticalSeparator(Win):
self.rewrite_line()
class RosterWin(Win):
"""
"""
def __init__(self, height, width, y, x, parent_win, visible):
self.visible = visible
Win.__init__(self, height, width, y, x, parent_win)
......@@ -928,12 +911,15 @@ class RosterWin(Win):
def resize(self, height, width, y, x, stdscr, visible):
self._resize(height, width, y, x, stdscr)
self.visible = visible
def refresh(self, roster=None):
def refresh(self, roster):
"""
We get the roster object
"""
if not self.visible or not roster:
from common import debug
debug('anus%s, %s' % (roster, self.visible))
if not self.visible:
return
g_lock.acquire()
self.win.erase()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment