def init_skype4py(): if sys.platform.startswith('linux'): skype = Skype4Py.Skype( Transport=os.environ.get('SKYPE_API_TRANSPORT', 'x11')) else: skype = Skype4Py.Skype() return skype
def __init__(self, *args, **kwds): # begin wxGlade: MyFrame.__init__ kwds["style"] = wx.DEFAULT_FRAME_STYLE wx.Frame.__init__(self, *args, **kwds) self.contacts = wx.ListCtrl(self, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.__set_properties() self.__do_layout() # end wxGlade # When the user dbl-clicks on a list item, # on_contact_clicked method will be called. self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.on_contact_clicked, self.contacts) # Create the Skype object. try: # Try using the DBus transport on Linux. Pass glib # mainloop to Skype4Py so it will use the wxPython # application glib mainloop to handle notifications # from Skype. from dbus.mainloop.glib import DBusGMainLoop self.skype = Skype4Py.Skype(Transport='dbus', MainLoop=DBusGMainLoop()) except ImportError: # If the DBus couldn't be imported, use default # settings. This will work on Windows too. self.skype = Skype4Py.Skype() # Add columns to the contacts list control. self.contacts.InsertColumn(0, 'FullName', width=170) self.contacts.InsertColumn(1, 'Handle', width=130) self.contacts.InsertColumn(2, 'Country') # Create a list of Skype contacts sorted by their # FullNames. friends = list(self.skype.Friends) def fullname_lower(a, b): return -(a.FullName.lower() < b.FullName.lower()) friends.sort(fullname_lower) # Add contacts to the list control. for user in friends: i = self.contacts.InsertStringItem(sys.maxint, user.FullName) self.contacts.SetStringItem(i, 1, user.Handle) self.contacts.SetStringItem(i, 2, user.Country) # When a user is focused in the Skype client, we will # focus it in our contact list too. self.skype.OnContactsFocused = \ self.on_skype_contact_focused
def __init__(self, conditions, schedules=[]): try: self.skype = Skype4Py.Skype(Transport=TRANSPORT) except TypeError: self.skype = Skype4Py.Skype() self.skype.Attach() self.skype.OnMessageStatus = self.receive_handler self.conditions = conditions self.queue = Queue.Queue() self.schedules = schedules self.ignores = []
def start(self): if sys.platform == "linux2": self.skype = Skype4Py.Skype(Transport='x11') else: # OSX self.skype = Skype4Py.Skype() logger.debug("Attaching to Skype") self.skype.Attach() logger.debug("Skype API connection established") self.skype.OnMessageStatus = self.handleMessages self.cacheChats()
def group_message(topic, text): client = Skype4Py.Skype() client.Attach() for i in client.ActiveChats: if len(i._GetMembers()) > 2 and i.Topic == topic: i.SendMessage(text)
def group_message_true(name, text): client = Skype4Py.Skype() client.Attach() for i in client.ActiveChats: if len(i._GetMembers()) > 2 and i.Name == name: i.SendMessage(text)
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): self.skype = Skype4Py.Skype() self.skype.OnMessageStatus = self.on_message # 自動ログインとかできない限り多分意味はない if self.skype.Client.IsRunning == False: skype.client.Start() self.skype.Attach()
def main(): skype = Skype4Py.Skype(Transport='x11') skype.OnMessageStatus = handler skype.Attach() while True: time.sleep(10)
def __init__(self): try: self.skype=Skype4Py.Skype() self.skype.Attach() print 'skype initialization is ok' except: print 'some thing wrong with skype'
def Connect(self): self.skype = Skype4Py.Skype(Events=self) if not 'OnMessageEdited' in dir(self.skype): raise Exception( 'Patched Skype4Py is not installed, see README.txt') self.skype.FriendlyName = 'MessageRemovedBot' self.skype.Attach()
def __init__(self, rx_callback=None, conn_callback=None): self.rx_callback = rx_callback self.conn_callback = conn_callback s = Skype.Skype() log("Attaching event handler") s.RegisterEventHandler('ApplicationDatagram', self.ApplicationDatagram) s.RegisterEventHandler('ApplicationConnecting', self.ApplicationConnecting) s.RegisterEventHandler('ApplicationStreams', self.ApplicationStreams) log("Attaching to Skype program") s.Attach() self.s = s if args.name: self.name = args.name else: rand = random.randrange(0, 1 << 30) self.name = "test%d" % rand self.app = self.s.Application(self.name) self.app.Create() self.running = True log("Created application %s" % (self.name)) self.stream_for_user = {} self.pending_users = []
def __init__(self, config): super(SkypeBackend, self).__init__(config) self.bot_config.SKYPE_ACCEPT_CONTACT_REQUESTS = getattr( config, 'SKYPE_ACCEPT_CONTACT_REQUESTS', True) self.skype = Skype4Py.Skype() self.skype.OnMessageStatus = self._message_event_handler self.skype.OnUserAuthorizationRequestReceived = self._contact_request_event_handler self.md_converter = text()
def __init__(self): self.skype = Skype4Py.Skype(Events=self) self.skype.FriendlyName = "Skype Bot" global lastAttached self.skype.Attach(Wait=False) lastAttached = time.mktime(localtime()) global chat chat = self.skype.Chat(chatname)
def __init__(self): import Skype4Py skype = None self.msg = None self.topic = 'Lean Lab - Wishlists' self.skype = Skype4Py.Skype() self.skype.Attach()
def setup_skype(self): self.skype = Skype4Py.Skype() self.skype.Attach() self.skype.OnMessageStatus = lambda *a, **kw: self.on_skype_message( *a, **kw) self.skype.OnCallStatus = lambda *a, **kw: self.on_skype_call(*a, **kw) self.skype_chat = self.skype.Chat(settings.SKYPE_CHAT_NAME) self.log('Attached to Skype')
def start(self): if sys.platform == "linux2": self.skype = Skype4Py.Skype(Transport='x11') else: # OSX self.skype = Skype4Py.Skype() logger.debug("Attaching to Skype") self.skype.Attach() logger.debug("Skype API connection established") self.skype.OnMessageStatus = self.handleMessages self.cacheChats() # XXX: Might need refactoring logic here how master handler is registered self.handler = handlers.CommandHandler(self)
def __init__(self): print("Setting up link to Skype") #Set up Skype #Need to have Skype running first, then click on "allow to access skype" #message in there when this program starts self.sconn = Skype4Py.Skype(Transport='x11') self.sconn.FriendlyName = "Skype_chat_trawler" self.sconn.Attach()
def __init__(self, mock): global options if not mock: self.skype = Skype4Py.Skype() self.skype.OnNotify = self.recv if not options.dont_start_skype: self.skype.Client.Start() else: self.skype = MockedSkype(mock)
def connectToSkype(): global g_skype print("connectToSkype") try: g_skype = Skype4Py.Skype() g_skype.Attach() except Exception: print("Failed to attach to skype.") quit()
def sms_mood(username): client = Skype4Py.Skype() client.Attach() for i in client.Friends: if i._GetHandle() == username: moodtext = i._GetMoodText() solo_message(username, moodtext)
def __init__(self): ''' Initial login ''' print 'Start Initial...' self.skype = Skype4Py.Skype() self.Attach() print 'Finish Initial...' print 'Hello,', self.skype.CurrentUser.FullName
def __init__(self): self.Skype = Skype4Py.Skype() self.Skype.Attach() logging.getLogger('Skype4Py').setLevel(logging.INFO) logging.basicConfig(format='%(asctime)s %(message)s', level=logging.DEBUG) logging.info("Skypebot connected with login %s", self.Skype.CurrentUser.Handle) self.Skype.OnAttachmentStatus = self.AttachmentStatus self.Skype.OnMessageStatus = self.MessageStatus self.Skype.OnCallStatus = self.CallStatus self.Skype.OnCallInputStatusChanged = self.CallInputStatusChanged
def __init__(self): # The ISmsMessage we are trying to send self.message = None # To poll until the SMS has been actually sent self.done = False self.count_success_delivered = 0 self.api = Skype4Py.Skype(Events=self) self.api.FriendlyName = appname self.api.Attach() # Attach to Skype client
def __init__(self, relay, mock=False, dont_start_skype=False): if not mock: self.skype = Skype4Py.Skype() self.skype.RegisterEventHandler('Notify', self.recv) self.skype.RegisterEventHandler('Reply', self.recv) if not dont_start_skype: self.skype.Client.Start() else: self.skype = MockedSkype(mock) self.mock, self.dont_start_skype = mock, dont_start_skype self.relay = relay self.log = logging.getLogger('skyped.api')
def __init__(self, chats_to_follow, message_listeners=()): '''creates a new SykpeListner object which will follow the chats specified in chats_to_follow (tuple) and look for the given regular expressions specified in key_expresssions (dict), if an expression was matched, the corresponding listener method given in the dictionary will be called''' self.chats_to_follow = chats_to_follow self.message_listeners = message_listeners self.hook = sky.Skype() self.hook.OnAttachmentStatus = self.attachment_status_change
class SkypeBot: skype = Skype4Py.Skype() # Connect the Skype object to the Skype client. skype.Attach() # Obtain some information from the client and print it out. print('Your full name:', skype.CurrentUser.FullName) print('Your contacts:') for user in skype.Friends: print(' ', user.FullName)
def get_client(self): """ Reveice Skype4Py.Skype instance ** Maybe launch Skype if not launched? """ #skype = Skype4Py.Skype(Events=self, Api=SkypeAPI({})) skype = Skype4Py.Skype(Events=self) if not skype.Client.IsRunning: skype.Client.Start() return skype
def main(): skype = Skype4Py.Skype() skype.Attach() topic = unicode(ROOM, 'utf-8') msg_head = unicode(messageHead(), 'utf-8') msg_body = unicode(messageBody(nextday()), 'utf-8') chat = selectChatFromBookmark(skype, topic) if chat is None: print 'ブックマークが見つかりません' else: chat.SendMessage(msg_head) time.sleep(10) chat.SendMessage(msg_body)
def main(): skype = Skype4Py.Skype() skype.Attach() topic = unicode(ROOM, 'utf-8') max_count_msg = unicode(createMaxCountMessage(), 'utf-8') chat = selectChatFromBookmark(skype, topic) if chat is None: print 'ブックマークが見つかりません' else: if _DEBUG_: print createMaxCountMessage() else: chat.SendMessage(max_count_msg)