view mcabber/contrib/filter_statusmsg.py @ 1128:ac9c89f6cb51

Support for invitations to muc rooms According to section "7.5" ("Inviting Another User to a Room") of the xep 0045 (about multi user chat), someone can invite you to a room. But it seems mcabber ignore this, so I have coded the missing support. [Patch slightly modified by Mikael]
author misc@mandriva.org
date Sat, 20 Jan 2007 18:41:13 +0100
parents 71422d407a34
children c31b1c41929c
line wrap: on
line source

#!/usr/bin/env python
# This script can be used to delete status messages from history files.
#
# If you want to clean all histories from status messages:
# $ for i in ~/.mcabber/histo/*; do ./filter_statusmsg.py $i > foo; mv foo $i; done
#
# Frank Zschockelt, 05.01.2007
import sys

if(len(sys.argv) != 2):
  print "usage:",sys.argv[0],"history > history_without_status"
  sys.exit(0)
file=open(sys.argv[1], "r")
lines=file.readlines()
file.close()

i=0
while(i<len(lines)):
  l=int(lines[i][22:25])
  if(lines[i][0] != 'S'):
    for s in lines[i:i+l+1]:
      print s,
  i+=l+1