diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.py | 13 | ||||
-rw-r--r-- | src/gui.py | 26 | ||||
-rw-r--r-- | src/multiuserchat.py | 10 | ||||
-rw-r--r-- | src/poezio.py | 3 | ||||
-rw-r--r-- | src/window.py | 14 |
5 files changed, 52 insertions, 14 deletions
diff --git a/src/connection.py b/src/connection.py index d7b1ac6a..4abe2d5b 100644 --- a/src/connection.py +++ b/src/connection.py @@ -23,13 +23,16 @@ Defines the Connection class from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset, gettext as _) +# from os.path import isfile +# if isfile('../locale/poezio.pot'): +# localedir = '../locale' +# else: +# localedir = '/usr/share/locale' -bindtextdomain('poezio') -textdomain('poezio') -bind_textdomain_codeset('poezio', 'utf-8') -import locale -locale.setlocale(locale.LC_ALL, '') +# bindtextdomain('poezio', localedir) +# textdomain('poezio') +# bind_textdomain_codeset('poezio', 'utf-8') import sys @@ -19,13 +19,22 @@ from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset, gettext as _) +from os.path import isfile -bindtextdomain('poezio') -textdomain('poezio') -bind_textdomain_codeset('poezio', 'utf-8') +from time import sleep + +# if isfile('../locale/poezio.pot'): +# localedir = '../locale' +# else: +# localedir = '/usr/share/locale' + +# bindtextdomain('poezio', localedir) +# textdomain('poezio') +# bind_textdomain_codeset('poezio', 'utf-8') + +# import locale +# locale.setlocale(locale.LC_ALL, '') -import locale -locale.setlocale(locale.LC_ALL, '') import sys import curses @@ -824,5 +833,12 @@ class Gui(object): """ /quit """ + if len(args): + msg = ' '.join(args) + else: + msg = None + if msg: + self.muc.disconnect(self.rooms, msg) + sleep(0.2) # :( self.reset_curses() sys.exit() diff --git a/src/multiuserchat.py b/src/multiuserchat.py index 4eaa696c..be4d2277 100644 --- a/src/multiuserchat.py +++ b/src/multiuserchat.py @@ -179,6 +179,16 @@ class MultiUserChat(object): pres.setStatus(msg) self.connection.send(pres) + def disconnect(self, rooms, msg): + """ + """ + for room in rooms: + if room.jid is None and room.joined: + pres = Presence(to='%s' % room.name, + typ='unavailable') + pres.setStatus(msg) + self.connection.send(pres) + def on_disconnect(self): """Called at disconnection""" for room in self.rooms: diff --git a/src/poezio.py b/src/poezio.py index 3e6d4fef..dc714a4f 100644 --- a/src/poezio.py +++ b/src/poezio.py @@ -23,6 +23,9 @@ Starting point of poezio. Launches both the Connection and Gui import sys +# import locale +# locale.setlocale(locale.LC_ALL, '') + # disable any printout (this would mess the display) # sys.stdout = open('/dev/null', 'w') sys.stderr = open('errors', 'w') diff --git a/src/window.py b/src/window.py index 879151c3..8532e541 100644 --- a/src/window.py +++ b/src/window.py @@ -20,10 +20,16 @@ from gettext import (bindtextdomain, textdomain, bind_textdomain_codeset, gettext as _) +from os.path import isfile -bindtextdomain('poezio') -textdomain('poezio') -bind_textdomain_codeset('poezio', 'utf-8') +# if isfile('../locale/poezio.pot'): +# localedir = '../locale' +# else: +# localedir = '/usr/share/locale' + +# bindtextdomain('poezio', localedir) +# textdomain('poezio') +# bind_textdomain_codeset('poezio', 'utf-8') import locale locale.setlocale(locale.LC_ALL, '') @@ -167,7 +173,7 @@ class RoomInfo(Win): break (y, x) = self.win.getyx() try: - self.win.addstr(y, x-1, '] '+ current.name.encode('utf-8') , curses.color_pair(1)) + self.win.addstr(y, x-1, '] '+ current.name.encode('utf-8'), curses.color_pair(1)) except: pass while True: |