How to use the hangups.ConversationList function in hangups

To help you get started, we’ve selected a few hangups examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github elamperti / bastardbot / bot / bastardbot.py View on Github external
def __on_connect(self, initial_data):
        """Handle connecting for the first time."""
        
        self.__log.info("Bot is connected")

        # FIXME: temporaly workaround to grab self id
        self.__id = initial_data.self_entity.id_.gaia_id

        self.__users = hangups.UserList(
            initial_data.self_entity, 
            initial_data.entities,
            initial_data.conversation_participants
        )
        self.__conversations = hangups.ConversationList(
            self.__client,
            initial_data.conversation_states,
            self.__users
        )
        #self.__sync_conversations() # FIXME disabled this for debugging

        self.__conversations.on_message.add_observer(self.__on_message)
github elamperti / bastardbot / bot / botwrapper.py View on Github external
def __on_connect(self, initial_data):
        """Handle connecting for the first time."""
        self.output('BW: connected')

        # FIXME: temporaly workaround to grab self id
        self.__id = initial_data.self_entity.id_.gaia_id

        self.__users = hangups.UserList(
            initial_data.self_entity, 
            initial_data.entities,
            initial_data.conversation_participants
        )
        self.__conversations = hangups.ConversationList(
            self.__client,
            initial_data.conversation_states,
            self.__users
        )
        self.__conversations.on_message.add_observer(self.__on_message)
github xmikos / qhangups / qhangups / qhangups.py View on Github external
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()
github elamperti / bastardbot / bot / bot.py View on Github external
def __on_connect(self, initial_data):
        """ Handle connection """
        self.__log.debug("Bot connected")
        
        self.__id = initial_data.self_entity.id_.gaia_id

        self.__user_list = hangups.UserList(self.__client, 
                                            initial_data.self_entity,
                                            initial_data.entities,
                                            initial_data.conversation_participants)
        
        self.__conversation_list = hangups.ConversationList(self.__client,
                                                            initial_data.conversation_states,
                                                            self.__user_list,
                                                            initial_data.sync_timestamp)
        
        self.__conversation_list.on_event.add_observer(self.__on_conversation_event)
                
        # create known conversation
        self.__log.debug('Loading initial conversations:')
        for conversation in self.__conversation_list.get_all():
            self.__brain.register_conversation(get_conv_name(conversation, truncate=True), conversation.id_)
            self.__log.debug('  {} ({})'
                             .format(get_conv_name(conversation, truncate=True), conversation.id_))
        # create known users
        self.__log.debug('Loading initial users:')
        for user in self.__user_list.get_all():
            self.__brain.register_user(full_name=user.full_name,
github elamperti / bastardbot / bastard.py View on Github external
def __on_connect(self, initial_data):
        """Handle connecting for the first time."""
        print ("Connected!")
        
        # FIXME: temporaly workaround to grab self id
        self.__id = initial_data.self_entity.id_.gaia_id

        self.__users = hangups.UserList(
            initial_data.self_entity, 
            initial_data.entities,
            initial_data.conversation_participants
        )
        self.__conversations = hangups.ConversationList(
            self.__client,
            initial_data.conversation_states,
            self.__users
        )
        self.__conversations.on_message.add_observer(self.__on_message)

        print("Loading initial conversations")
        for conversation in self.__conversations.get_all():
            self.__add_conversation(conversation)
            for message in conversation.chat_messages:
                self.__add_message(message)
        print("Conversations loaded!")   
        #print("Debug!")
github xmikos / hangupsbot / hangupsbot / hangupsbot.py View on Github external
def _on_connect(self, initial_data):
        """Handle connecting for the first time"""
        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)

        print(_('Conversations:'))
        for c in self.list_conversations():
            print('  {} ({})'.format(get_conv_name(c, truncate=True), c.id_))
        print()
github hangoutsbot / hangoutsbot / hangupsbot / hangupsbot.py View on Github external
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)