Commit 9d5fddf5 authored by mathieui's avatar mathieui

Use the new format in the roster log too (ref #2311)

(and add the pep events and invites to it)
parent 71b6404b
......@@ -2652,6 +2652,7 @@ class Core(object):
self.information(msg, 'Info')
if 'invite' in config.get('beep_on', 'invite').split():
curses.beep()
logger.log_roster_change(inviter.full, 'invited you to %s' % jid.full)
self.pending_invites[jid.bare] = inviter.full
def on_groupchat_decline(self, decline):
......@@ -2794,6 +2795,9 @@ class Core(object):
else:
contact.gaming = {}
if contact.gaming:
logger.log_roster_change(contact.bare_jid, 'is playing %s' % (common.format_gaming_string(contact.gaming)))
if old_gaming != contact.gaming and config.get_by_tabname('display_gaming_notifications', 'false', contact.bare_jid) == 'true':
if contact.gaming:
self.information('%s is playing %s' % (contact.bare_jid, common.format_gaming_string(contact.gaming)), 'Gaming')
......@@ -2824,6 +2828,9 @@ class Core(object):
else:
contact.mood = ''
if contact.mood:
logger.log_roster_change(contact.bare_jid, 'has now the mood: %s' % contact.mood)
if old_mood != contact.mood and config.get_by_tabname('display_mood_notifications', 'false', contact.bare_jid) == 'true':
if contact.mood:
self.information('Mood from '+ contact.bare_jid + ': ' + contact.mood, 'Mood')
......@@ -2860,6 +2867,9 @@ class Core(object):
else:
contact.activity = ''
if contact.activity:
logger.log_roster_change(contact.bare_jid, 'has now the activity %s' % contact.activity)
if old_activity != contact.activity and config.get_by_tabname('display_activity_notifications', 'false', contact.bare_jid) == 'true':
if contact.activity:
self.information('Activity from '+ contact.bare_jid + ': ' + contact.activity, 'Activity')
......@@ -2891,6 +2901,9 @@ class Core(object):
else:
contact.tune = {}
if contact.tune:
logger.log_roster_change(message['from'].bare, 'is now listening to %s' % common.format_tune_string(contact.tune))
if old_tune != contact.tune and config.get_by_tabname('display_tune_notifications', 'false', contact.bare_jid) == 'true':
if contact.tune:
self.information(
......
......@@ -156,7 +156,10 @@ class Logger(object):
except IOError:
return False
try:
self.roster_logfile.write('%s %s %s\n' % (datetime.now().strftime('%d-%m-%y [%H:%M:%S]'), jid, message))
str_time = datetime.now().strftime('%Y%m%dT%H%M%SZ')
message = clean_text(message)
lines = str(message.count('\n')).zfill(3)
self.roster_logfile.write('MI %s %s %s %s\n' % (str_time, lines, jid, message))
self.roster_logfile.flush()
except:
return False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment