summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-20 17:25:41 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-07-20 17:25:41 +0000
commitbb92c63a2c050ec9042327ba62ea5b9e06b45720 (patch)
tree4bc2f3760fc5bd03e04ed612c878ab6df8011b59
parenta63c733d6915cf9ffecac519a997bf341101178a (diff)
downloadpoezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.tar.gz
poezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.tar.bz2
poezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.tar.xz
poezio-bb92c63a2c050ec9042327ba62ea5b9e06b45720.zip
fix backspace key, error messages not displayed, and other stuff
-rw-r--r--src/common.py30
-rw-r--r--src/connection.py8
-rw-r--r--src/gui.py1
-rw-r--r--src/poezio.py32
4 files changed, 37 insertions, 34 deletions
diff --git a/src/common.py b/src/common.py
index 456f73e5..b71f84fc 100644
--- a/src/common.py
+++ b/src/common.py
@@ -33,6 +33,7 @@
"""
various useful functions
"""
+
from datetime import datetime, timedelta
import base64
import os
@@ -45,35 +46,6 @@ import select
import errno
import time
-class MyStdErr(object):
- def __init__(self, fd):
- """
- Change sys.stderr to something like /dev/null
- to disable any printout on the screen that would
- mess everything
- """
- self.old_stderr = sys.stderr
- sys.stderr = fd
- def restaure(self):
- """
- Restaure the good ol' sys.stderr, because we need
- it in order to print the tracebacks
- """
- sys.stderr = self.old_stderr
-
-my_stderr = MyStdErr(open('/dev/null', 'a'))
-
-def exception_handler(type_, value, trace):
- """
- on any traceback: exit ncurses and print the traceback
- then exit the program
- """
- my_stderr.restaure()
- curses.endwin()
- curses.echo()
- traceback.print_exception(type_, value, trace, None, sys.stderr)
- sys.exit(2)
-
import xmpp
def debug(string):
diff --git a/src/connection.py b/src/connection.py
index 7871c45d..8faf0125 100644
--- a/src/connection.py
+++ b/src/connection.py
@@ -31,7 +31,7 @@ import xmpp
from config import config
from logging import logger
from handler import Handler
-from common import jid_get_node, jid_get_domain, is_jid_the_same, exception_handler
+from common import jid_get_node, jid_get_domain, is_jid_the_same
class Connection(threading.Thread):
"""
@@ -142,6 +142,9 @@ class Connection(threading.Thread):
"""
fro = presence.getFrom()
toj = presence.getAttr('to')
+ if presence.getType() == 'error':
+ self.error_message(presence)
+ return
if fro == toj: # own presence
self.online = 2
self.jid = toj
@@ -153,9 +156,6 @@ class Connection(threading.Thread):
"""
if not connection:
return
- if presence.getType() == 'error':
- self.error_message(presence)
- return
self.handler.emit('room-presence', stanza=presence)
raise xmpp.protocol.NodeProcessed
diff --git a/src/gui.py b/src/gui.py
index 62c56bc8..102ccb44 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -104,6 +104,7 @@ class Gui(object):
"KEY_BTAB": self.last_words_completion,
"KEY_RESIZE": self.resize_window,
"KEY_BACKSPACE": self.window.input.key_backspace,
+ '^?': self.window.input.key_backspace,
'^J': self.execute,
'\n': self.execute,
'^D': self.window.input.key_dc,
diff --git a/src/poezio.py b/src/poezio.py
index 6a5dc435..a73924d8 100644
--- a/src/poezio.py
+++ b/src/poezio.py
@@ -24,10 +24,40 @@ Starting point of poezio. Launches both the Connection and Gui
import sys
import traceback
import curses
-from common import MyStdErr, exception_handler
+
+class MyStdErr(object):
+ def __init__(self, fd):
+ """
+ Change sys.stderr to something like /dev/null
+ to disable any printout on the screen that would
+ mess everything
+ """
+ self.old_stderr = sys.stderr
+ sys.stderr = fd
+ def restaure(self):
+ """
+ Restaure the good ol' sys.stderr, because we need
+ it in order to print the tracebacks
+ """
+ sys.stderr = self.old_stderr
+
+my_stderr = MyStdErr(open('/dev/null', 'a'))
+
+def exception_handler(type_, value, trace):
+ """
+ on any traceback: exit ncurses and print the traceback
+ then exit the program
+ """
+ my_stderr.restaure()
+ curses.endwin()
+ curses.echo()
+ traceback.print_exception(type_, value, trace, None, sys.stderr)
+ sys.exit(2)
sys.excepthook = exception_handler
+import common
+
from connection import Connection
from multiuserchat import MultiUserChat
from config import config