error code for MUC support

This commit is contained in:
Yann Leboulanger 2004-09-06 15:30:44 +00:00
parent f78acc3bf1
commit c56fb5d532
2 changed files with 31 additions and 9 deletions

View File

@ -84,7 +84,7 @@ class GajimCore:
try:
modObj = self.hub.newPlugin(mod)
except:
print _("The plugin %s cannot be launched")
print _("The plugin %s cannot be launched" % mod)
if not modObj:
print _("The plugin %s is already launched" % mod)
return
@ -238,13 +238,35 @@ class GajimCore:
self.hub.sendPlugin('UNSUBSCRIBED', self.connexions[con], \
prs.getFrom().getBasic())
elif typ == 'error':
errmsg = ''
for child in prs._node.getChildren():
if child.getName() == 'error':
errmsg = child.getData()
break
self.hub.sendPlugin('NOTIFY', self.connexions[con], \
(prs.getFrom().getBasic(), 'error', errmsg, \
errmsg = prs.getError()
errcode = prs.getErrorCode()
if errcode == '400': #Bad Request : JID Malformed or Private message when not allowed
pass
elif errcode == '401': #No Password Provided
pass
elif errcode == '403': #forbidden : User is Banned
# Unauthorized Subject Change
# Attempt by Mere Member to Invite Others to a Members-Only Room
# Configuration Access to Non-Owner
# Attempt by Non-Owner to Modify Owner List
# Attempt by Non-Owner to Modify Admin List
# Destroy Request Submitted by Non-Owner
pass
elif errcode == '404': #item not found : Room Does Not Exist
pass
elif errcode == '405': #Not allowed : Attempt to Kick Moderator, Admin, or Owner
# Attempt to Ban an Admin or Owner
# Attempt to Revoke Voice from an Admin, Owner, or User with a Higher Affiliation
# Attempt to Revoke Moderator Privileges from an Admin or Owner
pass
elif errcode == '407': #registration required : User Is Not on Member List
#
pass
elif errcode == '409': #conflict : Nick Conflict
self.hub.sendPlugin('WARNING', None, errmsg)
else:
self.hub.sendPlugin('NOTIFY', self.connexions[con], \
(prs.getFrom().getBasic(), 'error', errmsg, \
prs.getFrom().getResource(), prio))
# END presenceCB

View File

@ -1883,7 +1883,7 @@ class plugin:
self.roster.on_message(jid, array[1], account)
def handle_event_msgerror(self, account, array):
#('MSG', account, (user, error_code, error_msg, msg))
#('MSGERROR', account, (user, error_code, error_msg, msg))
jid = string.split(array[0], '/')[0]
if string.find(jid, "@") <= 0:
jid = string.replace(jid, '@', '')