1 print('****************************************************************************');
2 print('SkypeKit Python Wrapper Tutorial: Retrieving Inbox Conversation List');
3 print('****************************************************************************');
4
5
6
7
8
9
10
11
12
13
14 import sys;
15 import keypair;
16 from time import sleep;
17
18 sys.path.append(keypair.distroRoot + '/ipc/python');
19 sys.path.append(keypair.distroRoot + '/interfaces/skype/python');
20
21 try:
22 import Skype;
23 except ImportError:
24 raise SystemExit('Program requires Skype and skypekit modules');
25
26
27
28
29 if len(sys.argv) != 3:
30 print('Usage: python conversations.py <skypename> <password>');
31 sys.exit();
32
33 accountName = sys.argv[1];
34 accountPsw = sys.argv[2];
35 loggedIn = False;
36
37
38
39
40 try:
41 MySkype = Skype.GetSkype(keypair.keyFileName);
42 MySkype.Start();
43 except Exception:
44 raise SystemExit('Unable to create Skype instance');
45
46
47
48
49
51 global loggedIn;
52 if property_name == 'status':
53 if self.status == 'LOGGED_IN':
54 loggedIn = True;
55 print('Login complete.');
56
57 Skype.Account.OnPropertyChange = AccountOnChange;
58
59
60
61
62 account = MySkype.GetAccount(accountName);
63
64 print('Logging in with ' + accountName);
65 account.LoginWithPassword(accountPsw, False, False);
66
67 while loggedIn == False:
68 sleep(1);
69
70
71
72 convList = MySkype.GetConversationList('INBOX_CONVERSATIONS');
73
74
75
76
77
78 print('Found ' + str(len(convList)) + ' conversations.');
79 N = 1;
80 for c in convList:
81 unread = c.unconsumed_suppressed_messages + c.unconsumed_normal_messages + c.unconsumed_elevated_messages;
82 print(str(N) + '. ' + c.displayname + ' (type = ' + c.type + ') unread messages: ' + str(unread));
83 N = N + 1;
84
85 raw_input('Press ENTER to continue');
86 print('Exiting..');
87 MySkype.stop();
88