Advertisement
maurobaraldi

Edit Ekiga account settings with Python.

Mar 13th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. #
  4. # Change Ekiga users settings.
  5. # Author: Mauro Baraldi <mauro.baraldi@gmail.com>
  6. # Date: 13/03/2012
  7. # Usage: python ekiga.py <file_path> <username> <extension> <password>
  8. # XML conf file commonly found in Linux on /home/<user>/.gconf/apps/ekiga/protocols/%gconf.xml
  9. # Developed to use as LDAP script to load VoIP settings automatcally
  10. # License: LGPL
  11.  
  12. if __name__ == '__main__':
  13.     from sys import argv
  14.  
  15.     filename, username, extension, password = argv[1:5]
  16.     #print username, extension, password
  17.     with open(filename,'r') as o:
  18.             original = o.readlines()
  19.  
  20.     with open(filename,'w') as new:
  21.         for linha in original:
  22.             if linha.__contains__('<stringvalue>'):
  23.                 replace = linha.split('|')
  24.                 replace[3] = username
  25.                 replace[7] = extension
  26.                 replace[8] = extension
  27.                 replace[9] = password
  28.                 new.write('|'.join(replace))
  29.             else:
  30.                 new.write(linha)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement