示例#1
0
def theCLI():
    client = Skype()
    client.Attach()
    if (len(sys.argv)<2) or (sys.argv[1] == "-o") or (sys.argv[1] == "--online"):
        for u in client.Friends:
          if u.OnlineStatus == 'ONLINE':
                print '\033[1;31mUser:\t\t\033[1;m', u.FullName
                print '\033[1;36mStatus:\t\033[1;m \t%s\n' % u.OnlineStatus
    elif (len(sys.argv)<2) or (sys.argv[1] == "-h") or (sys.argv[1] == "--help"):
        print ('\nUSAGE: %s -s [user] [message:] --> (--send) send encrypted message passing arguments') % (__file__)
        print '-o, --online -->  print all users online'
        print '-v, --version --> print version and exit'
        print '-h, --help --> print this help\n'
    elif (len(sys.argv)<3) or (sys.argv[1] == "-c") or (sys.argv[1] == "--call"):
        user = sys.argv[2]
        client.PlaceCall(user)
    elif (len(sys.argv)<2) or (sys.argv[1] == "-v") or (sys.argv[1] == "--version"):
        print '\ncryptogpg-skype -- Version 0.01'
        print 'Developed by Simone Lombardi'
        print 'Released under the term of MIT License\n\n'
    elif (len(sys.argv)<2) or (sys.argv[1] == "-r") or (sys.argv[1] == "--retrieve"):
        client.OnMessageStatus = getMessage
        x = ''
        while not x == ":q":
            x = raw_input('')
    elif  (len(sys.argv)<4) or (sys.argv[1] == "-s") or (sys.argv[1] == "--send"):
        user = sys.argv[2]
        message = ' '.join(sys.argv[3:])
        gpg = getGPG()
        encrypted_data = gpg.encrypt(message, '*****@*****.**')
        client.SendMessage(user, encrypted_data)
        print 'Message sent: ', message
        print '\n\nEncrypted message: ', encrypted_data
    else:
        print 'No option selected'
 def __init__(self):
   if platform.system() == 'Windows':
     skype = Skype()
   else:
     skype = Skype(Transport='x11')
   skype.Attach()
   self.chat = skype.Chat(SKYPE_CHAT)
   skype.OnMessageStatus = self.MessageStatus