Changeset 4b0092e for skype/skyped.py


Ignore:
Timestamp:
2008-07-12T20:10:31Z (16 years ago)
Author:
Miklos Vajna <vmiklos@…>
Branches:
master
Children:
6af3e14
Parents:
9033a0a
Message:

skyped: send periodically a 'PING' to the client

also ignore the 'PONG' output from it (so don't forward it to skype)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • skype/skyped.py

    r9033a0a r4b0092e  
    6464                return True
    6565
    66 def idle_handler(skype):
     66def skype_idle_handler(skype):
    6767        try:
    6868                c = skype.skype.Command("PING", Block=True)
     
    7070        except Skype4Py.SkypeAPIError, s:
    7171                dprint("Warning, pinging Skype failed (%s)." % (s))
     72        return True
     73
     74def bitlbee_idle_handler(skype):
     75        if options.conn:
     76                try:
     77                        e = "PING"
     78                        options.conn.send("%s\n" % e)
     79                except Exception, s:
     80                        dprint("Warning, sending '%s' failed (%s)." % (e, s))
     81                        options.conn.close()
    7282        return True
    7383
     
    162172
    163173        def send(self, msg_text):
    164                 if not len(msg_text):
     174                if not len(msg_text) or msg_text == "PONG":
    165175                        return
    166176                e = msg_text.decode(locale.getdefaultlocale()[1])
     
    273283        except Skype4Py.SkypeAPIError, s:
    274284                sys.exit("%s. Are you sure you have started Skype?" % s)
    275         gobject.timeout_add(2000, idle_handler, skype)
     285        gobject.timeout_add(2000, skype_idle_handler, skype)
     286        gobject.timeout_add(60000, bitlbee_idle_handler, skype)
    276287        gobject.MainLoop().run()
Note: See TracChangeset for help on using the changeset viewer.