show role and affiliation in groupchat correctly. fixes #3871
This commit is contained in:
parent
bcc39c4e1c
commit
15b9b3e1c2
1 changed files with 36 additions and 8 deletions
|
@ -1017,6 +1017,15 @@ 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
|
||||||
|
nick_jid = nick
|
||||||
|
|
||||||
|
# Set to true if role or affiliation have changed
|
||||||
|
right_changed = False
|
||||||
|
|
||||||
|
if jid:
|
||||||
|
# delete ressource
|
||||||
|
simple_jid = gajim.get_jid_without_resource(jid)
|
||||||
|
nick_jid += ' (%s)' % simple_jid
|
||||||
|
|
||||||
# statusCode
|
# statusCode
|
||||||
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
|
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
|
||||||
|
@ -1173,11 +1182,36 @@ class GroupchatControl(ChatControlBase):
|
||||||
# save sha in mem NOW
|
# save sha in mem NOW
|
||||||
con.vcard_shas[fake_jid] = avatar_sha
|
con.vcard_shas[fake_jid] = avatar_sha
|
||||||
|
|
||||||
|
actual_affiliation = gc_c.affiliation
|
||||||
|
if affiliation != actual_affiliation:
|
||||||
|
if actor:
|
||||||
|
st = _('** Affiliation of %(nick)s has been set to '
|
||||||
|
'%(affiliation)s by %(actor)s' % {'nick': nick_jid,
|
||||||
|
'affiliation': affiliation, 'actor': actor}
|
||||||
|
else:
|
||||||
|
st = _('** Affiliation of %(nick)s has been set to '
|
||||||
|
'%(affiliation)s' % {'nick': nick_jid,
|
||||||
|
'affiliation': affiliation}
|
||||||
|
if reason:
|
||||||
|
st += ' (%s)' % reason
|
||||||
|
self.print_conversation(st, tim=tim)
|
||||||
|
right_changed = True
|
||||||
actual_role = self.get_role(nick)
|
actual_role = self.get_role(nick)
|
||||||
if role != actual_role:
|
if role != actual_role:
|
||||||
self.remove_contact(nick)
|
self.remove_contact(nick)
|
||||||
self.add_contact_to_roster(nick, show, role,
|
self.add_contact_to_roster(nick, show, role,
|
||||||
affiliation, status, jid)
|
affiliation, status, jid)
|
||||||
|
if actor:
|
||||||
|
st = _('** Role of %(nick)s has been set to %(role)s by '
|
||||||
|
'%(actor)s' % {'nick': nick_jid, 'role': role,
|
||||||
|
'actor': actor}
|
||||||
|
else:
|
||||||
|
st = _('** Role of %(nick)s has been set to %(role)s' % {
|
||||||
|
'nick': nick_jid, 'role': role}
|
||||||
|
if reason:
|
||||||
|
st += ' (%s)' % reason
|
||||||
|
self.print_conversation(st, tim=tim)
|
||||||
|
right_changed = True
|
||||||
else:
|
else:
|
||||||
if gc_c.show == show and gc_c.status == status and \
|
if gc_c.show == show and gc_c.status == status and \
|
||||||
gc_c.affiliation == affiliation: # no change
|
gc_c.affiliation == affiliation: # no change
|
||||||
|
@ -1186,9 +1220,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
gc_c.affiliation = affiliation
|
gc_c.affiliation = affiliation
|
||||||
gc_c.status = status
|
gc_c.status = status
|
||||||
self.draw_contact(nick)
|
self.draw_contact(nick)
|
||||||
if (time.time() - self.room_creation) > 30 and \
|
if (time.time() - self.room_creation) > 30 and nick != self.nick and \
|
||||||
nick != self.nick and (not statusCode or \
|
(not statusCode or '303' not in statusCode) and not right_changed:
|
||||||
'303' not in statusCode):
|
|
||||||
st = ''
|
st = ''
|
||||||
print_status = None
|
print_status = None
|
||||||
for bookmark in gajim.connections[self.account].bookmarks:
|
for bookmark in gajim.connections[self.account].bookmarks:
|
||||||
|
@ -1197,11 +1230,6 @@ class GroupchatControl(ChatControlBase):
|
||||||
break
|
break
|
||||||
if not print_status:
|
if not print_status:
|
||||||
print_status = gajim.config.get('print_status_in_muc')
|
print_status = gajim.config.get('print_status_in_muc')
|
||||||
nick_jid = nick
|
|
||||||
if jid:
|
|
||||||
# delete ressource
|
|
||||||
simple_jid = gajim.get_jid_without_resource(jid)
|
|
||||||
nick_jid += ' (%s)' % simple_jid
|
|
||||||
if show == 'offline':
|
if show == 'offline':
|
||||||
if nick in self.attention_list:
|
if nick in self.attention_list:
|
||||||
self.attention_list.remove(nick)
|
self.attention_list.remove(nick)
|
||||||
|
|
Loading…
Add table
Reference in a new issue