~wgrant/papyon/master

« back to all changes in this revision

Viewing changes to test.py

  • Committer: Youness Alaoui
  • Date: 2009-03-12 21:03:22 UTC
  • Revision ID: git-v1:0cef59fdd769b467b8a26ac22b8e7bd52598f9c0
test.py sends a webcam request to a contact

Show diffs side-by-side

added added

removed removed

Lines of Context:
84
84
        return False
85
85
 
86
86
    def start_conversation(self):
87
 
        contacts = self.address_book.contacts.\
88
 
                search_by_presence(pymsn.Presence.ONLINE)
89
 
        for c in self.address_book.contacts:
90
 
            if c.account == "@hotmail.com":
91
 
                print "Fetching space of : %s with cid %s\n" % (c.display_name, c.cid)
92
 
                self.spaces_service.get_contact_card(c)
93
 
 
94
 
        if len(contacts) == 0:
95
 
            print "No online contacts"
96
 
            return True
97
 
        else:
98
 
            for contact in contacts:
99
 
                if contact.account == "johann.prieur@gmail.com":
100
 
                    print "Inviting %s for a conversation" % contact.display_name
101
 
                    self.conv = pymsn.Conversation(self, [contact])
102
 
                    self._convo_events = AnnoyingConversation(self.conv)
103
 
            return False
 
87
        global peer
 
88
 
 
89
        for state in [pymsn.Presence.ONLINE, \
 
90
                          pymsn.Presence.BUSY, \
 
91
                          pymsn.Presence.IDLE, \
 
92
                          pymsn.Presence.AWAY, \
 
93
                          pymsn.Presence.BE_RIGHT_BACK, \
 
94
                          pymsn.Presence.ON_THE_PHONE, \
 
95
                          pymsn.Presence.OUT_TO_LUNCH]:
 
96
            print "Trying %s" % state
 
97
            contacts = self.address_book.contacts.\
 
98
                search_by_presence(state)
 
99
 
 
100
            if len(contacts) == 0:
 
101
                print "No %s contacts" % state
 
102
            else:
 
103
                for contact in contacts:
 
104
                    print "%s is %s" % (contact.display_name, state)
 
105
                    if contact.account == peer:
 
106
                        print "Inviting %s for a webcam" % contact.display_name
 
107
                        self._webcam_handler._create_new_send_session(contact)
 
108
                        
 
109
                        return False
 
110
 
 
111
        return True
104
112
 
105
113
def main():
106
114
    import sys
107
115
    import getpass
108
116
    import signal
109
117
 
 
118
    global peer
 
119
 
110
120
    if "--http" in sys.argv:
111
121
        http_mode = True
112
122
        sys.argv.remove('--http')
123
133
    else:
124
134
        passwd = sys.argv[2]
125
135
 
 
136
    if len(sys.argv) < 4:
 
137
        peer = raw_input('Send webcam to : ')
 
138
    else:
 
139
        peer = sys.argv[3]
 
140
 
126
141
    mainloop = gobject.MainLoop(is_running=True)
127
142
 
128
143
    def quit():