author | Alberto Bertogli
<albertogli@telpin.com.ar> 2005-05-12 18:35:54 UTC |
committer | Alberto Bertogli
<albertogli@telpin.com.ar> 2005-05-12 18:35:54 UTC |
parent | 7e69be7887b0944fd49e0dc7a884755d3c7f66c0 |
msn | +46 | -7 |
msnrc.sample | +3 | -0 |
utils/msnlog.vim | +3 | -1 |
diff --git a/msn b/msn index 308f670..d6cd056 100644 --- a/msn +++ b/msn @@ -494,6 +494,8 @@ def log_msg(email, type, msg, mtime = 0, users = []): out += '*** ' + msg + '\n' elif type == 'multi': out += '+++ ' + msg + '\n' + elif type == 'realnick': + out += '--- ' + msg + '\n' fd = open(file, 'a') fd.write(out) @@ -1248,13 +1250,21 @@ def cb_iln(md, type, tid, params): t = params.split(' ') status = msnlib.reverse_status[t[0]] email = t[1] + rnick = urllib.unquote(t[2]) nick = md.users[email].nick ctime = time.strftime('%I:%M:%S%p', now()) + printl('\r%s ' % ctime, c.blue) printl(nick, c.blue, 1) - printl(' changed status to ', c.magenta) - printl('%s\n' % status, c.magenta, 1) + printl(' is ', c.magenta) + printl('%s' % status, c.magenta, 1) log_msg(email, 'status', status) + if config["show nick changes"]: + printl(' with realnick ', c.magenta) + printl('%s' % rnick, c.magenta, 1) + log_msg(email, 'realnick', rnick) + printl('\n') + msncb.cb_iln(md, type, tid, params) m.cb.iln = cb_iln @@ -1262,13 +1272,36 @@ def cb_nln(md, type, tid, params): status = msnlib.reverse_status[tid] t = params.split(' ') email = t[0] + if len(params) > 1: + rnick = urllib.unquote(t[1]) + else: + rnick = '' + nick = md.users[email].nick + realnick = md.users[email].realnick ctime = time.strftime('%I:%M:%S%p', now()) - printl('\r%s ' % ctime, c.blue) - printl(nick, c.blue, 1) - printl(' changed status to ', c.magenta) - printl('%s\n' % status, c.magenta, 1) - log_msg(email, 'status', status) + + if tid != md.users[email].status: + printl('\r%s ' % ctime, c.blue) + printl(nick, c.blue, 1) + printl(' changed status to ', c.magenta) + printl('%s' % status, c.magenta, 1) + log_msg(email, 'status', status) + # if we don't know the realnick yet, include it in the same line + if not realnick and config["show nick changes"]: + printl(' with realnick ', c.magenta) + printl('%s' % rnick, c.magenta, 1) + log_msg(email, 'realnick', rnick) + printl("\n") + + if realnick and rnick and realnick != rnick \ + and config["show nick changes"]: + printl("\r%s " % ctime, c.blue) + printl(nick, c.blue, 1) + printl(' changed the realnick to ', c.magenta) + printl('%s\n' % rnick, c.magenta, 1) + log_msg(email, 'realnick', rnick) + msncb.cb_nln(md, type, tid, params) m.cb.nln = cb_nln @@ -1642,6 +1675,12 @@ elif config['log history'] != 'yes': if not config.has_key('history directory'): config['history directory'] = os.environ['HOME'] + '/.msn/history' +# show nick changes +if not config.has_key('show nick changes'): + config['show nick changes'] = 0 +elif config['show nick changes'] != 'yes': + config['show nick changes'] = 0 + # auto away time if not config.has_key('auto away'): config['auto away'] = 0 diff --git a/msnrc.sample b/msnrc.sample index ccb32ca..f606fc8 100644 --- a/msnrc.sample +++ b/msnrc.sample @@ -34,6 +34,9 @@ log history = yes # defaults to $HOME/.msn/history history directory = /home/myself/.msn/history +# show changes in real nicks +show nick changes = no + # number of seconds after, if no command was received, we set automatically # away. defaults to 0, which disables it. auto away = 0 diff --git a/utils/msnlog.vim b/utils/msnlog.vim index 800ec75..a5ac399 100644 --- a/utils/msnlog.vim +++ b/utils/msnlog.vim @@ -14,8 +14,9 @@ syntax case ignore syntax match mlogMultiStr "^\t.*$" syntax match mlogIMsg "<<< .*$" syntax match mlogOMsg ">>> .*$" -syntax match mlogStatus ".*\*\*\* .*$" +syntax match mlogStatus "\*\*\* .*$" syntax match mlogMchat "+++ .*$" +syntax match mlogRnick "--- .*$" syntax match mlogDate "^../.../.... ..:..:.." @@ -24,6 +25,7 @@ hi mlogIMsg ctermfg=green hi mlogOMsg ctermfg=cyan hi mlogStatus ctermfg=yellow hi mlogMchat ctermfg=yellow +hi mlogRnick ctermfg=yellow hi mlogMultiStr ctermfg=magenta