print real jid in gc status and in logs when we know it. Fixes #1940

This commit is contained in:
Yann Leboulanger 2006-07-24 13:42:35 +00:00
parent 93f813e7e0
commit ea82b1dcc1
2 changed files with 17 additions and 6 deletions

View file

@ -1345,8 +1345,7 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
if not self.last_history_line.has_key(jid): if not self.last_history_line.has_key(jid):
return return
self.dispatch('GC_MSG', (frm, msgtxt, tim)) self.dispatch('GC_MSG', (frm, msgtxt, tim))
if self.name not in no_log_for and jid in self.last_history_line \ if self.name not in no_log_for and not int(float(time.mktime(tim))) <= \
and not int(float(time.mktime(tim))) <= \
self.last_history_line[jid] and msgtxt: self.last_history_line[jid] and msgtxt:
gajim.logger.write('gc_msg', frm, msgtxt, tim = tim) gajim.logger.write('gc_msg', frm, msgtxt, tim = tim)
elif mtype == 'chat': # it's type 'chat' elif mtype == 'chat': # it's type 'chat'
@ -1478,7 +1477,16 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
if not ptype or ptype == 'unavailable': if not ptype or ptype == 'unavailable':
if gajim.config.get('log_contact_status_changes') and self.name\ if gajim.config.get('log_contact_status_changes') and self.name\
not in no_log_for and jid_stripped not in no_log_for: not in no_log_for and jid_stripped not in no_log_for:
gajim.logger.write('gcstatus', who, status, show) gc_c = gajim.contacts.get_gc_contact(self.name, jid_stripped, resource)
st = status or ''
if gc_c:
jid = gc_c.jid
else:
jid = prs.getJid()
if jid:
# we know real jid, save it in db
st += ' (%s)' % jid
gajim.logger.write('gcstatus', who, st, show)
if avatar_sha: if avatar_sha:
if self.vcard_shas.has_key(who): if self.vcard_shas.has_key(who):
if avatar_sha != self.vcard_shas[who]: if avatar_sha != self.vcard_shas[who]:

View file

@ -902,15 +902,18 @@ class GroupchatControl(ChatControlBase):
break break
if print_status is None: if print_status is None:
print_status = gajim.config.get('print_status_in_muc') print_status = gajim.config.get('print_status_in_muc')
nick_jid = nick
if jid:
nick_jid += ' (%s)' % jid
if show == 'offline' and print_status in ('all', 'in_and_out'): if show == 'offline' and print_status in ('all', 'in_and_out'):
st = _('%s has left') % nick st = _('%s has left') % nick_jid
if reason: if reason:
st += ' [%s]' % reason st += ' [%s]' % reason
else: else:
if newly_created and print_status in ('all', 'in_and_out'): if newly_created and print_status in ('all', 'in_and_out'):
st = _('%s has joined the room') % nick st = _('%s has joined the room') % nick_jid
elif print_status == 'all': elif print_status == 'all':
st = _('%s is now %s') % (nick, helpers.get_uf_show(show)) st = _('%s is now %s') % (nick_jid, helpers.get_uf_show(show))
if st: if st:
if status: if status:
st += ' (' + status + ')' st += ' (' + status + ')'