def __init__(self): log("Initializing Skype API", INFO) self.skype = Skype4Py.Skype() self.skype.Timeout = 500 if not isSkypeRunning() and settings.get_start_skype_cmd_params(): os.system("skype "+settings.get_start_skype_cmd_params()) else: self.skype.Client.Start(Minimized=True) log("Waiting for Skype Process", INFO) while True: output = commands.getoutput('ps -A | grep skype' ) if 'skype' in output.replace('skype-wrapper', ''): break log("Attaching skype-wrapper to Skype process", INFO) while True: time.sleep(4) try: self.skype.Attach(Wait=True) break except: # we tell the parent process that the skype couldn't attached sys.exit(2) log("Attached complete", INFO) time.sleep(2) self.skype.Client.Minimize() self.name_mappings = {} self.unread_conversations = {} # we will store all outdated messages here, anything not here will get net notified self.conversations = {} # store all the users online for notifying if they're on self.usersonline = {} # stor all file transfers self.filetransfers = {} self.incomingfilecount = 0 self.cb_show_conversation = None self.cb_show_indicator = None self.cb_user_status_change = None self.cb_log_message = None self.cb_read_within_skype = None self.cb_log_transfer = None self.telepathy_presence = self.getPresence() if self.telepathy_presence: self.skype.ChangeUserStatus(SKYPESTATUS[self.telepathy_presence]) self.skype_presence = self.skype.CurrentUserStatus if not settings.get_notify_on_initializing(): self.initOnlineUserList() gobject.timeout_add(CB_INTERVALS, self.checkUnreadMessages) gobject.timeout_add(CB_INTERVALS, self.checkOnlineUsers) gobject.timeout_add(CB_INTERVALS, self.checkOnlineStatus) gobject.timeout_add(CB_INTERVALS, self.checkFileTransfers)
def __init__(self): log("Initializing Skype API", INFO) self.skype = Skype4Py.Skype() #register events self.skype.RegisterEventHandler('MessageStatus', self.MessageStatus) self.skype.RegisterEventHandler('OnlineStatus', self.OnlineStatus) self.skype.RegisterEventHandler('FileTransferStatusChanged', self.FileTransferStatusChanged) self.skype.Timeout = 500 if not isSkypeRunning(): if settings.get_start_skype_cmd_params(): log("Starting Skype with extra params", INFO) subprocess.Popen(shlex.split("skype "+settings.get_start_skype_cmd_params())) else: log("Starting Skype", INFO) self.skype.Client.Start(Minimized=True) log("Waiting for Skype Process", INFO) while True: output = commands.getoutput('ps -A | grep skype' ) if 'skype' in output.replace('skype-wrapper', ''): break log("Attaching skype-wrapper to Skype process", INFO) while True: try: self.skype.Attach(Wait=True) break except: # we tell the parent process that the skype couldn't attached log("Failed to attach skype-wrapper to Skype process", WARNING) sys.exit(2) log("Attached complete", INFO) #self.skype.Timeout = 30000 self.skype.Client.Minimize() self.name_mappings = {} self.unread_conversations = {} # we will store all outdated messages here, anything not here will get net notified self.conversations = {} # store all the users online for notifying if they're on self.usersonline = {} # stor all file transfers self.filetransfers = {} self.incomingfilecount = 0 self.cb_show_conversation = None self.cb_show_indicator = None self.cb_user_status_change = None self.cb_log_message = None self.cb_read_within_skype = None self.cb_log_transfer = None self.telepathy_presence = self.getPresence() if self.telepathy_presence: self.skype.ChangeUserStatus(SKYPESTATUS[self.telepathy_presence]) self.skype_presence = self.skype.CurrentUserStatus if not settings.get_notify_on_initializing(): self.initOnlineUserList() self.messageupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkUnreadMessages) self.onlineuserupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkOnlineUsers) self.onlinepresenceupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkOnlineStatus) self.filetransferupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkFileTransfers)
def __init__(self): log("Initializing Skype API", INFO) self.skype = Skype4Py.Skype() #register events self.skype.RegisterEventHandler('MessageStatus', self.MessageStatus) self.skype.RegisterEventHandler('OnlineStatus', self.OnlineStatus) self.skype.RegisterEventHandler('FileTransferStatusChanged', self.FileTransferStatusChanged) self.skype.Timeout = 500 if not isSkypeRunning(): if settings.get_start_skype_cmd_params(): log("Starting Skype with extra params", INFO) subprocess.Popen( shlex.split("skype " + settings.get_start_skype_cmd_params())) else: log("Starting Skype", INFO) self.skype.Client.Start(Minimized=True) log("Waiting for Skype Process", INFO) while True: output = commands.getoutput('ps -A | grep skype') if 'skype' in output.replace('skype-wrapper', ''): break log("Attaching skype-wrapper to Skype process", INFO) while True: try: self.skype.Attach(Wait=True) break except: # we tell the parent process that the skype couldn't attached log("Failed to attach skype-wrapper to Skype process", WARNING) sys.exit(2) log("Attached complete", INFO) #self.skype.Timeout = 30000 self.skype.Client.Minimize() self.name_mappings = {} self.unread_conversations = {} # we will store all outdated messages here, anything not here will get net notified self.conversations = {} # store all the users online for notifying if they're on self.usersonline = {} # stor all file transfers self.filetransfers = {} self.incomingfilecount = 0 self.cb_show_conversation = None self.cb_show_indicator = None self.cb_user_status_change = None self.cb_log_message = None self.cb_read_within_skype = None self.cb_log_transfer = None self.telepathy_presence = self.getPresence() if self.telepathy_presence: self.skype.ChangeUserStatus(SKYPESTATUS[self.telepathy_presence]) self.skype_presence = self.skype.CurrentUserStatus if not settings.get_notify_on_initializing(): self.initOnlineUserList() self.messageupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkUnreadMessages) self.onlineuserupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkOnlineUsers) self.onlinepresenceupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkOnlineStatus) self.filetransferupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkFileTransfers)
def __init__(self): log("Initializing Skype API", INFO) self.skype = Skype4Py.Skype(None, Transport='x11') self.call_ringing = 0 self.calls_ringing_started = False #register events self.skype.RegisterEventHandler('MessageStatus', self.MessageStatus) self.skype.RegisterEventHandler('OnlineStatus', self.OnlineStatus) self.skype.RegisterEventHandler('FileTransferStatusChanged', self.FileTransferStatusChanged) self.skype.RegisterEventHandler('CallStatus', self.CallStatus) self.skype.Timeout = 500 if not isSkypeRunning(): if settings.get_start_skype_cmd_params(): log("Starting Skype with extra params", INFO) subprocess.Popen(shlex.split("skype "+settings.get_start_skype_cmd_params())) else: if not helpers.isSkypeWrapperDesktopOnUnityLauncher(): log("Starting Skype process", INFO) subprocess.Popen(shlex.split("skype")) else: log("Starting Skype", INFO) self.skype.Client.Start(Minimized=True) log("Waiting for Skype Process", INFO) while True: if isSkypeRunning(): break log("Attaching skype-wrapper to Skype process", INFO) while True: try: # don't know if its our authorization request but we will wait our turn if not helpers.isAuthorizationRequestOpen(): self.skype.Attach(Wait=True) break else: log("Authorization dialog still open", INFO) sys.exit(2) except: # we tell the parent process that the skype couldn't attached log("Failed to attach skype-wrapper to Skype process", WARNING) sys.exit(2) log("Attached complete", INFO) #self.skype.Timeout = 30000 unitylauncher.launcher.SkypeAgent = self.skype.Client unitylauncher.launcher.skype = self.skype unitylauncher.launcher.redrawQuicklist() self.skype.Client.Minimize() self.name_mappings = {} self.unread_conversations = {} # we will store all outdated messages here, anything not here will get net notified self.conversations = {} # store all the users online for notifying if they're on self.usersonline = {} # stor all file transfers self.filetransfers = {} self.incomingfilecount = 0 # store all calls current self.calls = {} self.cb_show_conversation = None self.cb_show_indicator = None self.cb_user_status_change = None self.cb_log_message = None self.cb_read_within_skype = None self.cb_log_transfer = None self.initSkypeFirstStart() self.messageupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkUnreadMessages) self.onlineuserupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkOnlineUsers) self.onlinepresenceupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkOnlineStatus) self.filetransferupdatepending = True GObject.timeout_add(CB_INTERVALS, self.checkFileTransfers)