Beter handling of status codes. See #3270.

http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
This commit is contained in:
Julien Pivotto 2007-07-19 11:54:15 +00:00
parent 0314f23aa4
commit 97d5ffdb7d
2 changed files with 20 additions and 2 deletions

View File

@ -1213,6 +1213,7 @@ class Interface:
def handle_event_gc_config_change(self, account, array): def handle_event_gc_config_change(self, account, array):
#('GC_CONFIG_CHANGE', account, (jid, statusCode)) statuscode is a list #('GC_CONFIG_CHANGE', account, (jid, statusCode)) statuscode is a list
# http://www.xmpp.org/extensions/xep-0045.html#roomconfig-notify # http://www.xmpp.org/extensions/xep-0045.html#roomconfig-notify
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
jid = array[0] jid = array[0]
statusCode = array[1] statusCode = array[1]
@ -1224,6 +1225,13 @@ class Interface:
return return
changes = [] changes = []
if '102' in statusCode:
changes.append(_('Room now shows unavailable member'))
if '103' in statusCode:
changes.append(_('room now does not show unavailable members'))
if '104' in statusCode:
changes.append(\
_('A non-privacy-related room configuration change has occurred'))
if '170' in statusCode: if '170' in statusCode:
changes.append(_('Room logging is now enabled')) changes.append(_('Room logging is now enabled'))
if '171' in statusCode: if '171' in statusCode:
@ -1234,8 +1242,6 @@ class Interface:
changes.append(_('Room is now semi-anonymous')) changes.append(_('Room is now semi-anonymous'))
if '174' in statusCode: if '174' in statusCode:
changes.append(_('Room is now fully-anonymous')) changes.append(_('Room is now fully-anonymous'))
if '104' in statusCode:
changes.append(_('Room configuration has changed'))
for change in changes: for change in changes:
gc_control.print_conversation(change) gc_control.print_conversation(change)

View File

@ -886,8 +886,20 @@ class GroupchatControl(ChatControlBase):
affiliation = 'none' affiliation = 'none'
fake_jid = self.room_jid + '/' + nick fake_jid = self.room_jid + '/' + nick
newly_created = False newly_created = False
# statusCode
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
if '100' in statusCode:
self.print_conversation(\
_('Any occupant is allowed to see your full JID'))
if '170' in statusCode: if '170' in statusCode:
self.print_conversation(_('Room logging is enabled')) self.print_conversation(_('Room logging is enabled'))
if '201' in statusCode:
self.print_conversation(_('A new room has been created'))
if '210' in statusCode:
self.print_conversation(\
_('The server has assigned or modified your roomnick'))
if show in ('offline', 'error'): if show in ('offline', 'error'):
if '307' in statusCode: if '307' in statusCode:
if actor is None: # do not print 'kicked by None' if actor is None: # do not print 'kicked by None'