示例#1
0
    def _on_connect(self, initial_data):
        """Handle connecting for the first time"""
        print('Connected!')
        self._message_handler = Handlers.MessageHandler(
            self, command_char=self._command_char)

        self._user_list = hangups.UserList(
            self._client, initial_data.self_entity, initial_data.entities,
            initial_data.conversation_participants)
        self._conv_list = hangups.ConversationList(
            self._client, initial_data.conversation_states, self._user_list,
            initial_data.sync_timestamp)
        self._conv_list.on_event.add_observer(self._on_event)

        print('Conversations:')
        for c in self.list_conversations():
            print('  %s (%s)' %
                  (unidecode(get_conv_name(c, truncate=True)), c.id_))
        print()

        msg = "I'm alive!"
        for c in self.list_conversations():
            try:
                welcome_enabled = self.config['conversations'][
                    c.id_]['welcome_enabled']
            except KeyError:
                welcome_enabled = False
            if welcome_enabled:
                self.send_message_segments(c,
                                           [hangups.ChatMessageSegment(msg)])
示例#2
0
 def _on_hangups_connect(self, initial_data):
     """Called when hangups successfully auths with hangouts."""
     self._user_list = hangups.UserList(
         self._hangups, initial_data.self_entity, initial_data.entities,
         initial_data.conversation_participants)
     self._conv_list = hangups.ConversationList(
         self._hangups, initial_data.conversation_states, self._user_list,
         initial_data.sync_timestamp)
     self._conv_list.on_event.add_observer(self._on_hangups_event)
     logger.info('Hangups connected. Connect your IRC clients!')
示例#3
0
    def on_connect(self, data):
        print("on_connect")
        self.users = hangups.UserList(self.client, data.self_entity, data.entities, data.conversation_participants)
        
        self.convs = hangups.ConversationList(self.client, data.conversation_states, self.users, data.sync_timestamp)
        
        self.user_id = self.get_user_id()


        if self.connectMsg:
            self.send_msg(self.connectMsg["id"], self.connectMsg["msg"])
示例#4
0
    def _on_connect(self, initial_data):
        """Handle connecting for the first time"""
        print('Connected!')
        self._message_handler = handlers.MessageHandler(self)

        self._user_list = hangups.UserList(
            self._client, initial_data.self_entity, initial_data.entities,
            initial_data.conversation_participants)
        self._conv_list = hangups.ConversationList(
            self._client, initial_data.conversation_states, self._user_list,
            initial_data.sync_timestamp)
        self._conv_list.on_event.add_observer(self._on_event)
示例#5
0
 def _on_connect(self, client):
     """Handle connecting for the first time."""
     self._conv_list = hangups.ConversationList(self._client)
     self._user_list = hangups.UserList(self._client)
     self._notifier = Notifier(self._client, self._conv_list)
     # show the conversation menu
     conv_picker = ConversationPickerWidget(self._conv_list,
                                            self.on_select_conversation)
     self._tabbed_window = TabbedWindowWidget(self._keys)
     self._tabbed_window.set_tab(conv_picker, switch=True,
                                 title='Conversations')
     self._urwid_loop.widget = self._tabbed_window
示例#6
0
    def _on_connect(self, initial_data):
        """Handle connecting for the first time"""
        self._user_list = hangups.UserList(
            self._client, initial_data.self_entity, initial_data.entities,
            initial_data.conversation_participants)

        self._conv_list = hangups.ConversationList(
            self._client, initial_data.conversation_states, self._user_list,
            initial_data.sync_timestamp)

        self._conv_list.on_event.add_observer(self._on_event)

        for addon in self._addons:
            addon.on_connect(initial_data, self._user_list, self._conv_list)

        report('Connected!')
示例#7
0
    def _on_connect(self, initial_data):
        """Handle connecting for the first time"""
        print('Connected!')
        self._message_handler = hangupsbot.handlers.MessageHandler(self)

        self._user_list = hangups.UserList(
            self._client, initial_data.self_entity, initial_data.entities,
            initial_data.conversation_participants)
        self._conv_list = hangups.ConversationList(
            self._client, initial_data.conversation_states, self._user_list,
            initial_data.sync_timestamp)
        self._conv_list.on_event.add_observer(self._on_event)

        print('Conversations:')
        for c in self.list_conversations():
            print('  {} ({})'.format(get_conv_name(c, truncate=True), c.id_))
        print()
示例#8
0
    def _on_connect(self, initial_data):
        print("CONNECTED!!!!!!")
        self._user_list = hangups.UserList(
            self._client, initial_data.self_entity, initial_data.entities,
            initial_data.conversation_participants)

        for i in self._user_list._user_dict:
            user = self._user_list._user_dict[i]
            handle = self.create_handle(telepathy.HANDLE_TYPE_CONTACT,
                                        user.id_)
            self._user_map[user.id_] = handle

        self._conversation_list = hangups.ConversationList(
            self._client, initial_data.conversation_states, self._user_list,
            initial_data.sync_timestamp)

        self.StatusChanged(telepathy.CONNECTION_STATUS_CONNECTED,
                           telepathy.CONNECTION_STATUS_REASON_REQUESTED)
示例#9
0
 def _on_connect(self, initial_data):
     """Handle connecting for the first time."""
     self._user_list = hangups.UserList(
         self._client, initial_data.self_entity, initial_data.entities,
         initial_data.conversation_participants)
     self._conv_list = hangups.ConversationList(
         self._client, initial_data.conversation_states, self._user_list,
         initial_data.sync_timestamp)
     self._conv_list.on_event.add_observer(self._on_event)
     self._notifier = Notifier(self._conv_list)
     # show the conversation menu
     conv_picker = ConversationPickerWidget(self._conv_list,
                                            self.on_select_conversation)
     self._tabbed_window = TabbedWindowWidget(self._keys, self._on_quit)
     self._tabbed_window.set_tab(conv_picker,
                                 switch=True,
                                 title='Conversations')
     self._urwid_loop.widget = self._tabbed_window
示例#10
0
    def on_connect(self, initial_data):
        """Handle connecting for the first time (callback)"""
        print('Connected')
        self.user_list = hangups.UserList(
            self.client, initial_data.self_entity, initial_data.entities,
            initial_data.conversation_participants)
        self.conv_list = hangups.ConversationList(
            self.client, initial_data.conversation_states, self.user_list,
            initial_data.sync_timestamp)
        self.conv_list.on_event.add_observer(self.on_event)

        # Setup notifications
        self.notifier = Notifier(self.conv_list)

        # Setup conversations window
        self.messages_dialog.init_conversations(self.client, self.conv_list)

        # Setup conversations list window and show it
        self.conversations_dialog.init_conversations(self.client,
                                                     self.conv_list)
        self.conversations_dialog.show()
示例#11
0
def _on_connect(initial_data):
    print("connected")
    global user_list
    global conversation_list

    user_list = hangups.UserList(client, initial_data.self_entity,
                                 initial_data.entities,
                                 initial_data.conversation_participants)

    conversation_list = hangups.ConversationList(
        client, initial_data.conversation_states, user_list,
        initial_data.sync_timestamp)

    conversation_list.on_event.add_observer(on_conversation_list_event)

    for x in user_list._user_dict:
        print("ROSTER: " + user_list._user_dict[x].full_name)

    for conv in conversation_list.get_all():
        print("active conv", conv.name, conv.users)
        conv.on_event.add_observer(on_conversation_event)
示例#12
0
    def _on_connect(self, initial_data):
        """Handle connecting for the first time"""
        print(_('Connected!'))
        self._handlers = handlers.EventHandler(self)

        try:
            # hangups-201504090500
            self._user_list = yield from hangups.user.build_user_list(
                self._client, initial_data
            )
        except AttributeError:
            # backward-compatibility: pre hangups-201504090500
            self._user_list = hangups.UserList(self._client,
                                               initial_data.self_entity,
                                               initial_data.entities,
                                               initial_data.conversation_participants)

        self._conv_list = hangups.ConversationList(self._client,
                                                   initial_data.conversation_states,
                                                   self._user_list,
                                                   initial_data.sync_timestamp)
        self._conv_list.on_event.add_observer(self._on_event)

        self._load_plugins()