Mercurial > hg
comparison mcabber/contrib/filter_statusmsg.py @ 1118:71422d407a34
Added filter_statusmsg.py to contrib
author | Frank Zschockelt <jdev@freakysoft.de> |
---|---|
date | Fri, 05 Jan 2007 17:41:42 +0100 |
parents | |
children | c31b1c41929c |
comparison
equal
deleted
inserted
replaced
1117:de14c419b323 | 1118:71422d407a34 |
---|---|
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 |