diff options
author | mathieui <mathieui@mathieui.net> | 2013-06-09 12:56:51 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2013-06-09 12:56:51 +0200 |
commit | 9d5fddf5bad0e94f3945488e4174b7a8ade58f57 (patch) | |
tree | a4777dbb8fe679c094cf1e830a9e6448abe4593a /src | |
parent | 71b6404b04f64a8973ef0b9f8bba4c7aca3106a1 (diff) | |
download | poezio-9d5fddf5bad0e94f3945488e4174b7a8ade58f57.tar.gz poezio-9d5fddf5bad0e94f3945488e4174b7a8ade58f57.tar.bz2 poezio-9d5fddf5bad0e94f3945488e4174b7a8ade58f57.tar.xz poezio-9d5fddf5bad0e94f3945488e4174b7a8ade58f57.zip |
Use the new format in the roster log too (ref #2311)
(and add the pep events and invites to it)
Diffstat (limited to 'src')
-rw-r--r-- | src/core.py | 13 | ||||
-rw-r--r-- | src/logger.py | 5 |
2 files changed, 17 insertions, 1 deletions
diff --git a/src/core.py b/src/core.py index e3c89aa9..a7c302dc 100644 --- a/src/core.py +++ b/src/core.py @@ -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( diff --git a/src/logger.py b/src/logger.py index b26393da..635f0985 100644 --- a/src/logger.py +++ b/src/logger.py @@ -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 |