summaryrefslogtreecommitdiff
path: root/src/gui.py
diff options
context:
space:
mode:
authorlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-05 22:24:23 +0000
committerlouiz@4325f9fc-e183-4c21-96ce-0ab188b42d13 <louiz@4325f9fc-e183-4c21-96ce-0ab188b42d13>2010-08-05 22:24:23 +0000
commitb7f87a52db0e8be80695e50ba6a19e7711c91c36 (patch)
tree49625d0c43c4951db0612479e7ac38e852500077 /src/gui.py
parent27c1cee035abcff01d06f8138fb669e24d169080 (diff)
downloadpoezio-b7f87a52db0e8be80695e50ba6a19e7711c91c36.tar.gz
poezio-b7f87a52db0e8be80695e50ba6a19e7711c91c36.tar.bz2
poezio-b7f87a52db0e8be80695e50ba6a19e7711c91c36.tar.xz
poezio-b7f87a52db0e8be80695e50ba6a19e7711c91c36.zip
fixed #1661
Diffstat (limited to 'src/gui.py')
-rw-r--r--src/gui.py26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/gui.py b/src/gui.py
index 2d2d7c22..1568efca 100644
--- a/src/gui.py
+++ b/src/gui.py
@@ -41,6 +41,18 @@ from message import Message
from keyboard import read_char
from common import is_jid_the_same, jid_get_domain, is_jid
+# http://xmpp.org/extensions/xep-0045.html#errorstatus
+ERROR_AND_STATUS_CODES = {
+ '401': 'A password is required',
+ '403': 'You are banned from the room',
+ '404': 'The room does\'nt exist',
+ '405': 'Your are not allowed to create a new room',
+ '406': 'A reserved nick must be used',
+ '407': 'You are not in the member list',
+ '409': 'This nickname is already in use or has been reserved',
+ '503': 'The maximum number of users has been reached',
+ }
+
def doupdate():
curses.doupdate()
@@ -338,16 +350,24 @@ class Gui(object):
if not error:
return
room = self.get_room_by_name(room)
+ if not room:
+ room = self.get_room_by_name('Info')
code = error.getAttr('code')
typ = error.getAttr('type')
- if error.getTag('text'):
- body = error.getTag('text').getData()
+ # if error.getTag('text'):
+ # body = error.getTag('text').getData()
+ # else: # No description of the error is provided in the stanza
+ # # If it's a standard error, use our own messages
+ if code in ERROR_AND_STATUS_CODES.keys():
+ body = ERROR_AND_STATUS_CODES[code]
else:
body = _('Unknown error')
self.add_message_to_room(room, _('Error: %(code)s-%(msg)s: %(body)s' %
{'msg':msg, 'code':code, 'body':body}))
if code == '401':
- room.add(_('To provide a password in order to join the room, type "/join / password" (replace "password" by the real password)'))
+ self.add_message_to_room(room, _('To provide a password in order to join the room, type "/join / password" (replace "password" by the real password)'))
+ if code == '409':
+ self.add_message_to_room(room, _('You can join the room with specifying an other nick, by typing "/join /other_nick"'))
self.refresh_window()
def private_message(self, stanza):