Mercurial > hg
comparison mcabber/contrib/filter_statusmsg.py @ 1119:c68b3c9f616e
Merge Franky's contrib scripts
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sat, 06 Jan 2007 12:15:28 +0100 |
parents | 71422d407a34 |
children | c31b1c41929c |
comparison
equal
deleted
inserted
replaced
1116:14e458020e23 | 1119:c68b3c9f616e |
---|---|
1 #!/usr/bin/env python | |
2 # This script can be used to delete status messages from history files. | |
3 # | |
4 # If you want to clean all histories from status messages: | |
5 # $ for i in ~/.mcabber/histo/*; do ./filter_statusmsg.py $i > foo; mv foo $i; done | |
6 # | |
7 # Frank Zschockelt, 05.01.2007 | |
8 import sys | |
9 | |
10 if(len(sys.argv) != 2): | |
11 print "usage:",sys.argv[0],"history > history_without_status" | |
12 sys.exit(0) | |
13 file=open(sys.argv[1], "r") | |
14 lines=file.readlines() | |
15 file.close() | |
16 | |
17 i=0 | |
18 while(i<len(lines)): | |
19 l=int(lines[i][22:25]) | |
20 if(lines[i][0] != 'S'): | |
21 for s in lines[i:i+l+1]: | |
22 print s, | |
23 i+=l+1 |