def __init__(self, opts): self.logger = logging.getLogger('Skype4Py.api.posix_dbus.SkypeAPI') SkypeAPIBase.__init__(self) self.run_main_loop = opts.pop('RunMainLoop', True) system_bus = opts.pop('UseSystemBus', False) finalize_opts(opts) self.skype_in = self.skype_out = self.dbus_name_owner_watch = None # initialize glib multithreading support gobject.threads_init() dbus.glib.threads_init() # dbus-python calls object.__init__() with arguments passed to SessionBus(), # this throws a warning on newer Python versions; here we suppress it warnings.simplefilter('ignore') try: if system_bus: bus = dbus.SystemBus else: bus = dbus.SessionBus self.bus = bus(mainloop=DBusGMainLoop()) finally: warnings.simplefilter('default') if self.run_main_loop: self.mainloop = gobject.MainLoop()
def close(self): if self.hwnd: windll.user32.PostMessageA(self.hwnd, WM_QUIT, 0, 0) while self.hwnd: time.sleep(0.01) self.skype = None SkypeAPIBase.close(self)
def __init__(self, opts): self.logger = logging.getLogger('Skype4Py.api.posix_x11.SkypeAPI') SkypeAPIBase.__init__(self) finalize_opts(opts) # initialize threads if not done already by the user threads_init(gtk=False) # init Xlib display self.disp = x11.XOpenDisplay(None) if not self.disp: raise SkypeAPIError('Could not open XDisplay') self.win_root = x11.XDefaultRootWindow(self.disp) self.win_self = x11.XCreateSimpleWindow(self.disp, self.win_root, 100, 100, 100, 100, 1, 0, 0) x11.XSelectInput(self.disp, self.win_root, PropertyChangeMask) self.win_skype = self.get_skype() ctrl = 'SKYPECONTROLAPI_MESSAGE' self.atom_msg = x11.XInternAtom(self.disp, ctrl, False) self.atom_msg_begin = x11.XInternAtom(self.disp, ctrl + '_BEGIN', False) self.loop_event = threading.Event() self.loop_timeout = 0.0001 self.loop_break = False
def __init__(self, opts): self.logger = logging.getLogger('Skype4Py.api.darwin.SkypeAPI') SkypeAPIBase.__init__(self) self.run_main_loop = opts.pop('RunMainLoop', True) finalize_opts(opts) self.center = CFDistributedNotificationCenter() self.is_available = False self.client_id = -1
def close(self): if self.run_main_loop: self.mainloop.quit() self.skype_in = self.skype_out = None if self.dbus_name_owner_watch is not None: self.bus.remove_signal_receiver(self.dbus_name_owner_watch) self.dbus_name_owner_watch = None SkypeAPIBase.close(self)
def __init__(self, opts): self.logger = logging.getLogger('Skype4Py.api.windows.SkypeAPI') SkypeAPIBase.__init__(self) finalize_opts(opts) self.window_class = None self.hwnd = None self.skype = None self.wait = False self.SkypeControlAPIDiscover = windll.user32.RegisterWindowMessageA('SkypeControlAPIDiscover') self.SkypeControlAPIAttach = windll.user32.RegisterWindowMessageA('SkypeControlAPIAttach') windll.user32.GetWindowLongA.restype = c_ulong
def __init__(self, opts): self.logger = logging.getLogger("Skype4Py.api.posix_x11.SkypeAPI") SkypeAPIBase.__init__(self) finalize_opts(opts) # initialize threads if not done already by the user threads_init(gtk=False) # init Xlib display self.disp = x11.XOpenDisplay(None) if not self.disp: raise SkypeAPIError("Could not open XDisplay") self.win_root = x11.XDefaultRootWindow(self.disp) self.win_self = x11.XCreateSimpleWindow(self.disp, self.win_root, 100, 100, 100, 100, 1, 0, 0) x11.XSelectInput(self.disp, self.win_root, PropertyChangeMask) self.win_skype = self.get_skype() ctrl = "SKYPECONTROLAPI_MESSAGE" self.atom_msg = x11.XInternAtom(self.disp, ctrl, False) self.atom_msg_begin = x11.XInternAtom(self.disp, ctrl + "_BEGIN", False) self.loop_event = threading.Event() self.loop_timeout = 0.0001 self.loop_break = False
def close(self): self.loop_break = True self.loop_event.set() while self.isAlive(): time.sleep(0.01) SkypeAPIBase.close(self)
def set_friendly_name(self, friendly_name): SkypeAPIBase.set_friendly_name(self, friendly_name) if self.attachment_status == apiAttachSuccess: # reattach with the new name self.set_attachment_status(apiAttachUnknown) self.attach()
def __init__(self): SkypeAPIBase.__init__(self) self.queue = []
def close(self): if hasattr(self, 'loop'): self.loop.stop() self.client_id = -1 SkypeAPIBase.close(self)
def set_friendly_name(self, friendly_name): SkypeAPIBase.set_friendly_name(self, friendly_name) if self.skype_out: self.send_command(Command('NAME %s' % friendly_name))
def set_friendly_name(self, friendly_name): SkypeAPIBase.set_friendly_name(self, friendly_name) if self.skype: self.send_command(Command("NAME %s" % friendly_name))