Change the leave message on 333 MUC status
Following the discussion in https://prosody.im/issues/939, and in the prosody@ room, this patch reflects the fact that the 333 status is not a normal leave, and displays the following if it is included: > "badger has left the room due to an error (reason)" Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
ed0be7b57d
commit
42443fc01f
1 changed files with 13 additions and 6 deletions
|
@ -580,7 +580,7 @@ class MucTab(ChatTab):
|
||||||
# user quit
|
# user quit
|
||||||
elif typ == 'unavailable':
|
elif typ == 'unavailable':
|
||||||
self.on_user_leave_groupchat(user, jid, status, from_nick,
|
self.on_user_leave_groupchat(user, jid, status, from_nick,
|
||||||
from_room)
|
from_room, server_initiated)
|
||||||
# status change
|
# status change
|
||||||
else:
|
else:
|
||||||
self.on_user_change_status(user, from_nick, from_room, affiliation,
|
self.on_user_change_status(user, from_nick, from_room, affiliation,
|
||||||
|
@ -845,7 +845,8 @@ class MucTab(ChatTab):
|
||||||
}
|
}
|
||||||
self.add_message(kick_msg, typ=2)
|
self.add_message(kick_msg, typ=2)
|
||||||
|
|
||||||
def on_user_leave_groupchat(self, user, jid, status, from_nick, from_room):
|
def on_user_leave_groupchat(self, user, jid, status, from_nick, from_room,
|
||||||
|
server_initiated=False):
|
||||||
"""
|
"""
|
||||||
When an user leaves a groupchat
|
When an user leaves a groupchat
|
||||||
"""
|
"""
|
||||||
|
@ -869,29 +870,35 @@ class MucTab(ChatTab):
|
||||||
info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
|
info_col = dump_tuple(get_theme().COLOR_INFORMATION_TEXT)
|
||||||
spec_col = dump_tuple(get_theme().COLOR_QUIT_CHAR)
|
spec_col = dump_tuple(get_theme().COLOR_QUIT_CHAR)
|
||||||
|
|
||||||
|
error_leave_txt = ''
|
||||||
|
if server_initiated:
|
||||||
|
error_leave_txt = ' due to an error'
|
||||||
|
|
||||||
if not jid.full:
|
if not jid.full:
|
||||||
leave_msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}'
|
leave_msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}'
|
||||||
'%(nick)s\x19%(info_col)s} has left the '
|
'%(nick)s\x19%(info_col)s} has left the '
|
||||||
'room') % {
|
'room%(error_leave)s') % {
|
||||||
'nick': from_nick,
|
'nick': from_nick,
|
||||||
'color': color,
|
'color': color,
|
||||||
'spec': get_theme().CHAR_QUIT,
|
'spec': get_theme().CHAR_QUIT,
|
||||||
'info_col': info_col,
|
'info_col': info_col,
|
||||||
'color_spec': spec_col
|
'color_spec': spec_col,
|
||||||
|
'error_leave': error_leave_txt,
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
jid_col = dump_tuple(get_theme().COLOR_MUC_JID)
|
jid_col = dump_tuple(get_theme().COLOR_MUC_JID)
|
||||||
leave_msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}'
|
leave_msg = ('\x19%(color_spec)s}%(spec)s \x19%(color)s}'
|
||||||
'%(nick)s\x19%(info_col)s} (\x19%(jid_col)s}'
|
'%(nick)s\x19%(info_col)s} (\x19%(jid_col)s}'
|
||||||
'%(jid)s\x19%(info_col)s}) has left the '
|
'%(jid)s\x19%(info_col)s}) has left the '
|
||||||
'room') % {
|
'room%(error_leave)s') % {
|
||||||
'spec': get_theme().CHAR_QUIT,
|
'spec': get_theme().CHAR_QUIT,
|
||||||
'nick': from_nick,
|
'nick': from_nick,
|
||||||
'color': color,
|
'color': color,
|
||||||
'jid': jid.full,
|
'jid': jid.full,
|
||||||
'info_col': info_col,
|
'info_col': info_col,
|
||||||
'color_spec': spec_col,
|
'color_spec': spec_col,
|
||||||
'jid_col': jid_col
|
'jid_col': jid_col,
|
||||||
|
'error_leave': error_leave_txt,
|
||||||
}
|
}
|
||||||
if status:
|
if status:
|
||||||
leave_msg += ' (\x19o%s\x19%s})' % (status, info_col)
|
leave_msg += ' (\x19o%s\x19%s})' % (status, info_col)
|
||||||
|
|
Loading…
Reference in a new issue