~mike6d696b65/cit200/Cit200

« back to all changes in this revision

Viewing changes to python/online.py

  • Committer: mike6d696b65 at gmail
  • Date: 2011-03-23 03:05:47 UTC
  • Revision ID: mike6d696b65@gmail.com-20110323030547-kenpipgx3n3lz75u
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# ----------------------------------------------------------------------------------------------------
 
3
#  Python / Skype4Py example that sets user's online status to Do Not Disturb
 
4
#
 
5
 
 
6
import sys
 
7
import Skype4Py
 
8
 
 
9
# ----------------------------------------------------------------------------------------------------
 
10
# Fired on attachment status change. If attachment to API is successful,
 
11
# this function sets skype.CurrentUserStatus to 'DND'.
 
12
 
 
13
def OnAttach(status):
 
14
    print 'API attachment status: ' + skype.Convert.AttachmentStatusToText(status)
 
15
 
 
16
    if status == Skype4Py.apiAttachAvailable:
 
17
        skype.Attach()
 
18
 
 
19
    if status == Skype4Py.apiAttachSuccess:
 
20
        print 'Setting online status to online'
 
21
        skype.CurrentUserStatus = 'online';
 
22
 
 
23
# ----------------------------------------------------------------------------------------------------
 
24
# Fired on user's online status change. Prints out new status.
 
25
 
 
26
def OnUserStatus(status):
 
27
    print 'User status has changed to ' + status
 
28
 
 
29
 
 
30
# ----------------------------------------------------------------------------------------------------
 
31
# Creating instance of Skype object, assigning handler functions and attaching to Skype.
 
32
 
 
33
skype = Skype4Py.Skype()
 
34
skype.OnAttachmentStatus = OnAttach
 
35
skype.OnUserStatus = OnUserStatus
 
36
 
 
37
print 'Connecting to Skype..'
 
38
skype.Attach()
 
39
 
 
40
# ----------------------------------------------------------------------------------------------------
 
41
# Looping until user types 'exit'
 
42
Cmd = '';
 
43
#while not Cmd == 'exit':
 
44
#    Cmd = raw_input('');