示例#1
0
 def _on_hangups_connect(self):
     """Called when hangups successfully auths with hangouts."""
     self._user_list, self._conv_list = (
         yield from hangups.build_user_conversation_list(self._hangups)
     )
     self._conv_list.on_event.add_observer(self._on_hangups_event)
     logger.info('Hangups connected. Connect your IRC clients!')
示例#2
0
 def _on_connect(self):
     """Handle connecting for the first time"""
     self.logger.info('Connected to Hangouts')
     self._retry = 0
     self._user_list, self._conv_list = (
         yield from hangups.build_user_conversation_list(self._client))
     self._conv_list.on_event.add_observer(self._on_event)
示例#3
0
 def _on_hangups_connect(self):
     """Called when hangups successfully auths with hangouts."""
     self._user_list, self._conv_list = (
         yield from hangups.build_user_conversation_list(self._hangups))
     self._conv_list.on_event.add_observer(self._on_hangups_event)
     logger.info('Hangups connected.')
     for client in self.clients.values():
         client.tell_nick(util.get_nick(self._user_list._self_user))
示例#4
0
    def on_connect(self):
        """Handle connecting for the first time (callback)"""
        # print('Connected')
        self.user_list, self.conv_list = yield from hangups.build_user_conversation_list( self.client )

        yield from self.parse_command()
        yield from self.parse_optional_command()

        self.quit()
示例#5
0
    def on_connect(self):
        """Handle connecting for the first time (callback)"""
        # print('Connected')
        self.user_list, self.conv_list = yield from hangups.build_user_conversation_list(
            self.client)

        yield from self.parse_command()
        yield from self.parse_optional_command()

        self.quit()
示例#6
0
    def _on_hangups_connect(self):
        """Called when hangups successfully auths with hangouts."""
        logger.info('Hangups connected...')
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._hangups))

        for conv in self._conv_list.get_all():
            util.conversation_to_channel(conv)

        self._conv_list.on_event.add_observer(self._on_hangups_event)
        logger.info('Hangups connected. Connect your IRC clients!')
示例#7
0
    def _on_connect(self):
        """Handle connecting for the first time"""
        print(_('Connected!'))
        self._retry = 0
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client))
        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
文件: server.py 项目: cjones/pickups
    def _on_hangups_connect(self):
        """Called when hangups successfully auths with hangouts."""
        logger.info('Hangups connected...')
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._hangups)
        )

        for conv in self._conv_list.get_all():
            util.conversation_to_channel(conv)

        self._conv_list.on_event.add_observer(self._on_hangups_event)
        logger.info('Hangups connected. Connect your IRC clients!')
示例#9
0
    def _get_conversations(self):
        print("Retrieving conversations:")
        #Get users and conversations
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client))

        #Show conversations id.
        for conversation in self._conv_list.get_all():
            print("\tConversation found:", conversation.id_)

        #Disconnect
        asyncio. async (self._disconnect())
示例#10
0
    def _on_connect(self):
        """Handle connecting for the first time"""
        print(_('Connected!'))
        self._retry = 0
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client)
        )
        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()
示例#11
0
文件: client.py 项目: vladamatena/h2x
    def onConnect(self):
        print("Connected!")
        self.state = State.connected
        self.h2x.sendPresence(self.jid, "available", "Online")

        self.userList, self.convList = (yield from hangups.build_user_conversation_list(self.client))
        self.convList.on_event.add_observer(self.onEvent)

        yield from self.updateParticipantPresence()

        self.stateUpdate()

        # Test presence setting
        print("Trying to set presence")
示例#12
0
    def _on_connect(self):
        """Handle connecting for the first time."""
        print("Client connected.")
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client)
        )
        self._conv_list.on_event.add_observer(self._on_event)
        if not self._disable_notifier:
            self._notifier = Notifier(self._conv_list)

        # Start Swift server
        handlers = (self._client, self._conv_list)
        swift = Swift(*handlers)
        self.bank = Bank(*handlers, swift=swift)
示例#13
0
    def _on_connect(self):
        """Handle connecting for the first time."""
        print("Client connected.")
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client))
        self._conv_list.on_event.add_observer(self._on_event)
        if not self._disable_notifier:
            self._notifier = Notifier(self._conv_list)

        donald = Trumpisms()

        # Start Swift server
        handlers = (self._client, self._conv_list)
        swift = Swift(*handlers)
        self.bank = Bank(*handlers, swift=swift, donald=donald)
示例#14
0
    def _on_connect(self):
        """Handle connecting for the first time."""
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client)
        )
        self._conv_list.on_event.add_observer(self._on_event)

        # show the conversation menu
        conv_picker = ConversationPickerWidget(self._conv_list,
                                               self.on_select_conversation,
                                               self._keys)
        self._tabbed_window = TabbedWindowWidget(self._keys)
        self._tabbed_window.set_tab(conv_picker, switch=True,
                                    title='Conversations')
        self._urwid_loop.widget = self._tabbed_window
示例#15
0
 def _get_conversation(self):
     logging.debug("Retrieving conversation...")
     #Get users and conversations
     self._user_list, self._conv_list = (
         yield from hangups.build_user_conversation_list(self._client))
     #Get specific conversation defined in configuration
     self._conversation = self._conv_list.get(
         ConfigurationReader._conversation_id)
     if (self._conversation == None):
         sys.exit("Conversation with id '",
                  ConfigurationReader._conversation_id, "' not found")
     logging.debug("Conversation found!")
     self.connected = True
     self._conversation.on_event.add_observer(
         self._conversation_event_launched)
示例#16
0
    def _on_connect(self):
        """Handle connecting for the first time."""
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client)
        )
        self._conv_list.on_event.add_observer(self._on_event)

        # show the conversation menu
        conv_picker = ConversationPickerWidget(self._conv_list,
                                               self.on_select_conversation,
                                               self._keys)
        self._tabbed_window = TabbedWindowWidget(self._keys)
        self._tabbed_window.set_tab(conv_picker, switch=True,
                                    title='Conversations')
        self._urwid_loop.widget = self._tabbed_window
示例#17
0
def listen_events(client, _):
    global user_list, conv_list
    global event_queue

    user_list, conv_list = (yield from
                            hangups.build_user_conversation_list(client))
    #print("my user id");
    #print(user_list._self_user.id_);
    conv_list.on_event.add_observer(on_event)

    #print(client._client_id);
    #print(client._email);
    #hangups.client.
    #print(json.dumps({"cmd":"status", "status":"ready"}))
    #print(hangups.user.)

    while 1:
        try:
            msgtxt = yield from async_input()
            msgtxt = msgtxt.strip()

            # TOOD: take conversation id from other side
            msgJson = json.loads(msgtxt)
            conv = conv_list.get(msgJson['conversation_id'])
            #print("ok, I got: " + msgtxt)

            if msgJson['cmd'] == 'sendmessage':
                segments = hangups.ChatMessageSegment.from_str(
                    msgJson['msgbody'])
                asyncio.ensure_future(conv.send_message(
                    segments)).add_done_callback(_on_message_sent)
            elif msgJson['cmd'] == 'sendimage':
                segments = []
                image_file = yield from download_image(msgJson['url'])
                # deduplicate
                image_file.name += '_mx_' + MIME_EXT.get(
                    msgJson['mimetype'], '.unk')
                if not image_file:
                    raise Exception("Invalid image url")
                asyncio.ensure_future(
                    conv.send_message(
                        segments, image_file=image_file)).add_done_callback(
                            _on_message_sent)
            else:
                raise Exception("Invalid cmd specified!")

        except Exception as error:
            print(repr(error))
示例#18
0
def sync_recent_conversations(client, _):
    user_list, conversation_list = (
        yield from hangups.build_user_conversation_list(client))
    all_users = user_list.get_all()
    all_conversations = conversation_list.get_all(include_archived=True)

    print('{} known users'.format(len(all_users)))
    for user in all_users:
        print('    {}: {}'.format(user.full_name, user.id_.gaia_id))

    print('{} known conversations'.format(len(all_conversations)))
    for conversation in all_conversations:
        if conversation.name:
            name = conversation.name
        else:
            name = 'Unnamed conversation ({})'.format(conversation.id_)
        print('    {}'.format(name))
def extract_scale_inputs(client, _):
    _, conversation_list = (yield from
                            hangups.build_user_conversation_list(client))
    all_conversations = conversation_list.get_all(include_archived=True)

    print('{} known conversations'.format(len(all_conversations)))
    entries = set()
    for conversation in all_conversations:
        if all(x.full_name == 'Daniel Boline' for x in conversation.users):
            oldest_event = None
            oldest_time = None
            for event in conversation.events:
                if oldest_time is None or event.timestamp < oldest_time:
                    oldest_event = event.id_
                    oldest_time = event.timestamp
            for _ in range(10):
                conversation.get_events(event_id=oldest_event)
                for event in conversation.events:
                    if event.timestamp < oldest_time:
                        oldest_event = event.id_
                        oldest_time = event.timestamp
                    if event.text[0].isnumeric() and event.text[-1].isnumeric(
                    ):
                        entries.add(
                            (event.text.strip(), event.timestamp.isoformat()))
    new_entries = {}
    for txt, tstmp in entries:
        tstmp = parse(tstmp).astimezone(est)
        try:
            if ':' in txt:
                weight, fat, water, muscle, bone = [
                    int(x) / 10. for x in txt.split(':')
                ]
            elif '=' in txt:
                weight, fat, water, muscle, bone = [
                    int(x) / 10. for x in txt.split('=')
                ]
                if muscle > 300.0:
                    muscle = muscle / 10.
        except ValueError:
            continue
        new_entry = ScaleEntry(tstmp.isoformat(), weight, fat, water, muscle,
                               bone)
        new_entries[tstmp.date().isoformat()] = new_entry
    insert_entries_into_spreadsheet(new_entries)
示例#20
0
    def on_connect(self):
        """Handle connecting for the first time (callback)"""
        print('Connected')

        self.user_list, self.conv_list = (
            yield from hangups.build_user_conversation_list(self.client)
        )
        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()
示例#21
0
def on_connect():
    """Handle connecting for the first time."""
    global client, disable_notifier, conv_list, user_list

    print("Building conversation and user list")
    user_list, conv_list = (
        yield from hangups.build_user_conversation_list(client)
    )

    print("Adding contacts")
    for user in sorted(user_list.get_all(), key=lambda u: u.full_name):
        user_data = {
            "id_": user.id_.chat_id,
            "name": user.full_name,
            "first_name": user.first_name,
            "photo_url": "https:" + user.photo_url if user.photo_url else None,
            "emails": user.emails,
        }
        if not user.is_self:
            pyotherside.send('add-contact', user_data)

    print("Added conversations observer")
    conv_list.on_event.add_observer(on_event)
    if not disable_notifier:
        notifier = Notifier(conv_list)

    convs = sorted(conv_list.get_all(), reverse=True,
                   key=lambda c: c.last_modified)

    print("Showing conversations")
    for conv in convs:
        conv_data = model.get_conv_data(conv)
        pyotherside.send('add-conversation', conv_data)
        ctrl = ConversationController(conv)
        ctrl.update_online_status()
        conv_controllers[conv.id_] = ctrl

    print("Setting presence")
    set_client_presence(True)

    pyotherside.send('show-conversations-page')
示例#22
0
    def on_connect(self):
        """Handle connecting for the first time (callback)"""
        print('Ho Connected')

        user_list, conv_list = (yield from
                                hangups.build_user_conversation_list(
                                    self.client))

        self.userIds = []
        for u in user_list.get_all():
            print(u.id_, u.first_name, u.full_name, u.photo_url, u.emails)
            self.userIds.append({
                "id": u.id_.chat_id,
                "first_name": u.first_name,
                "full_name": u.full_name
            })

        self.convIds = []
        for c in conv_list.get_all():
            print(c.users, dir(c.users))
            print(c.id_, c.name, [x.id_.chat_id for x in c.users])
            print(c.users, dir(c.users))
            print(c.id_, c.name, [x.id_.chat_id for x in c.users])
            self.convIds.append({
                "id": c.id_,
                "name": c.name,
                "users": [x.id_.chat_id for x in c.users]
            })
        print("Conversation list :", self.convIds)

        conv_list.on_event.add_observer(self.on_event)

        asyncio. async (
            self._send_messages())  # Or asyncio.ensure_future if using 3.4.3+

        yield from self.outQueue.put(
            json.dumps({
                "conversations": self.convIds,
                "users": self.userIds
            }))
        print("## Ho Connection handling done")
示例#23
0
    def _on_connect(self):
        """handle connection/reconnection"""

        logger.debug("connected")

        plugins.tracking.set_bot(self)
        command.set_tracking(plugins.tracking)
        command.set_bot(self)

        self.tags = tagging.tags(self)
        self._handlers = handlers.EventHandler(self)
        handlers.handler.set_bot(self) # shim for handler decorator

        """
        monkeypatch plugins go heere
        # plugins.load(self, "monkeypatch.something")
        use only in extreme circumstances e.g. adding new functionality into hangups library
        """

        #self._user_list = yield from hangups.user.build_user_list(self._client)

        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client)
        )

        self.conversations = yield from permamem.initialise_permanent_memory(self)

        plugins.load(self, "commands.plugincontrol")
        plugins.load(self, "commands.basic")
        plugins.load(self, "commands.tagging")
        plugins.load(self, "commands.permamem")
        plugins.load(self, "commands.convid")
        plugins.load(self, "commands.loggertochat")
        plugins.load_user_plugins(self)

        self._conv_list.on_event.add_observer(self._on_event)
        self._client.on_state_update.add_observer(self._on_status_changes)

        logger.info("bot initialised")
示例#24
0
    def _on_connect(self):
        """Handle connecting for the first time"""
        print(_('Connected!'))
        self._retry = 0
        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client))
        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()

        try:
            self.loop = asyncio.get_event_loop()
            if self.config['mqtt_server'] is not None:
                server = self.config['mqtt_server']
                port = int(self.config['mqtt_port'])
                subscribe_topic = self.config['mqtt_subscribe']
                publish_topic = self.config['mqtt_publish']
            else:
                server = "localhost"
                port = 1999
                subscribe_topic = "hangupsbot/inbox/#"
                publish_topic = "rpicenter/inbox/hangupsbot/"

            self.mqtt = mqtt(server=server,
                             port=port,
                             subscribe_topic=subscribe_topic,
                             publish_topic=publish_topic,
                             callback=self.reply)

            i = threading.Thread(target=self.mqtt.run)
            i.daemon = True
            i.start()
        except Exception as ex:
            print("MQTT Error: " + str(ex))
            if self.mqtt is not None: self.mqtt.cleanup()
    def _on_connect(self):
        """handle connection/reconnection"""

        logger.debug("connected")

        plugins.tracking.set_bot(self)
        command.set_tracking(plugins.tracking)
        command.set_bot(self)

        self.tags = tagging.tags(self)
        self._handlers = handlers.EventHandler(self)
        handlers.handler.set_bot(self)  # shim for handler decorator
        """
        monkeypatch plugins go heere
        # plugins.load(self, "monkeypatch.something")
        use only in extreme circumstances e.g. adding new functionality into hangups library
        """

        #self._user_list = yield from hangups.user.build_user_list(self._client)

        self._user_list, self._conv_list = (
            yield from hangups.build_user_conversation_list(self._client))

        self.conversations = yield from permamem.initialise_permanent_memory(
            self)

        plugins.load(self, "commands.plugincontrol")
        plugins.load(self, "commands.basic")
        plugins.load(self, "commands.tagging")
        plugins.load(self, "commands.permamem")
        plugins.load(self, "commands.convid")
        plugins.load(self, "commands.loggertochat")
        plugins.load_user_plugins(self)

        self._conv_list.on_event.add_observer(self._on_event)
        self._client.on_state_update.add_observer(self._on_status_changes)

        logger.info("bot initialised")
def extract_scale_inputs(client, _):
    _, conversation_list = (yield from hangups.build_user_conversation_list(client))
    all_conversations = conversation_list.get_all(include_archived=True)

    print('{} known conversations'.format(len(all_conversations)))
    entries = set()
    for conversation in all_conversations:
        if all(x.full_name == 'Daniel Boline' for x in conversation.users):
            oldest_event = None
            oldest_time = None
            for event in conversation.events:
                if oldest_time is None or event.timestamp < oldest_time:
                    oldest_event = event.id_
                    oldest_time = event.timestamp
            for _ in range(10):
                conversation.get_events(event_id=oldest_event)
                for event in conversation.events:
                    if event.timestamp < oldest_time:
                        oldest_event = event.id_
                        oldest_time = event.timestamp
                    if event.text[0].isnumeric() and event.text[-1].isnumeric():
                        entries.add((event.text.strip(), event.timestamp.isoformat()))
    new_entries = {}
    for txt, tstmp in entries:
        tstmp = parse(tstmp).astimezone(est)
        try:
            if ':' in txt:
                weight, fat, water, muscle, bone = [int(x) / 10. for x in txt.split(':')]
            elif '=' in txt:
                weight, fat, water, muscle, bone = [int(x) / 10. for x in txt.split('=')]
                if muscle > 300.0:
                    muscle = muscle / 10.
        except ValueError:
            continue
        new_entry = ScaleEntry(tstmp.isoformat(), weight, fat, water, muscle, bone)
        new_entries[tstmp.date().isoformat()] = new_entry
    insert_entries_into_spreadsheet(new_entries)
示例#27
0
	def initialize(self):
		self.users, self.conversations = yield from hangups.build_user_conversation_list(self.client)
示例#28
0
    def on_connect(self):
        """Hangouts is connected."""
        self.send_message_to_xmpp({'what': 'connected'})

        # Get the list of users and conversations
        self.user_list, self.conv_list = (
            yield from hangups.build_user_conversation_list(self.client)
        )

        #self.user_list.on_presence.add_observer(self.on_presence)

        self.conv_list.on_event.add_observer(self.on_event)
        self.conv_list.on_typing.add_observer(self.on_typing)

        # Query presence information for user list
        participant_ids = []
        for user_id in self.user_list._user_dict.keys():
            if user_id.gaia_id == '':
                continue
            participant_ids.append(hangouts_pb2.ParticipantId(gaia_id=user_id.gaia_id, chat_id=user_id.chat_id))

        presence_request = hangouts_pb2.QueryPresenceRequest(
            request_header=self.client.get_request_header(),
            participant_id=participant_ids,
            field_mask=[
                hangouts_pb2.FIELD_MASK_REACHABLE,
                hangouts_pb2.FIELD_MASK_AVAILABLE,
                hangouts_pb2.FIELD_MASK_DEVICE,
                hangouts_pb2.FIELD_MASK_MOOD])
        presence_response = yield from self.client.query_presence(presence_request)

        # Send user list to XMPP
        user_list_dict = {}
        for user in self.user_list.get_all():
            user_list_dict[user.id_.gaia_id] = {
                'chat_id': user.id_.chat_id,
                'gaia_id': user.id_.gaia_id,
                'first_name': user.first_name,
                'full_name': user.full_name,
                'is_self': user.is_self,
                'emails': list(user.emails) if user.emails is not None else [],
                'photo_url': user.photo_url,
                'status': 'unknown',
            }

        for presence_result in presence_response.presence_result:
            user_list_dict[presence_result.user_id.gaia_id]['status'] = presence_to_status(presence_result.presence)

        self.send_message_to_xmpp({'what': 'user_list', 'user_list': user_list_dict})

        # Send conversation list to XMPP
        conv_list_dict = {}
        for conv in self.conv_list.get_all():
            self.known_conservations.add(conv.id_)
            if conv._conversation.type == hangouts_pb2.CONVERSATION_TYPE_GROUP:
                user_list = {}
                self_gaia_id = None
                for user in conv.users:
                    user_list[user.id_.gaia_id] = user_list_dict[user.id_.gaia_id]['full_name']\
                        if user.id_.gaia_id in user_list_dict else user.id_.gaia_id
                    if user.is_self:
                        # XMPP needs to know which user is itself.
                        self_gaia_id = user.id_.gaia_id
                # If the conversation does not have a name, create one by joining the list of participants.
                conv_name = conv.name
                if conv_name is None:
                    conv_name = ', '.join(user_list.values())
                conv_list_dict[conv.id_] = {
                    'conv_id': conv.id_,
                    'topic': conv_name,
                    'user_list': user_list,
                    'self_id': self_gaia_id,
                }
        self.send_message_to_xmpp({'what': 'conv_list',
                                   'conv_list': conv_list_dict,
                                   'self_gaia': self.user_list._self_user.id_.gaia_id})
示例#29
0
me = hangups.Client(cookies)  #get user
me.connect()  #connect to chat

#print whether pyro is availible
print(me.query_presence(["pyrogue6"]))

#get id
requestID = me.get_client_generated_id()

conversations = me.get_conversation(requestID)
print("conversations:")
print(conversations)
print("------------")

#build list of conversations and users
user = hangups.build_user_conversation_list(me)
print(user)

# print(user.next())
# for u in user:
# 	print(u)
#print(users.get_all())

# for i in hangups.build_user_conversation_list(me):
# 	conversation_list = i
#-----------------------------------------------------------
# loop = asyncio.get_event_loop()
# task = loop.create_task(hangups.build_user_conversation_list(me))
# (ul,cl) = loop.run_until_complete(task)
# print()
# print("USER LIST:")
示例#30
0
 def _on_hangups_connect(self):
     """Called when hangups successfully auths with hangouts."""
     self._user_list, self._conv_list = (
         yield from hangups.build_user_conversation_list(self._hangups))
     self._conv_list.on_event.add_observer(self._on_hangups_event)
     logger.info('Hangups connected. Connect your IRC clients!')
    def on_connect(self):
        """Hangouts is connected."""
        self.send_message_to_xmpp({"what": "connected"})

        # Get the list of users and conversations
        self.user_list, self.conv_list = (yield from hangups.build_user_conversation_list(self.client))

        self.user_list.on_presence.add_observer(self.on_presence)
        self.conv_list.on_event.add_observer(self.on_event)
        self.conv_list.on_typing.add_observer(self.on_typing)

        # Query presence information for user list
        participant_ids = []
        for user_id in self.user_list._user_dict.keys():
            if user_id.gaia_id == "" or self.user_list._user_dict[user_id].participant_type != "gaia":
                continue
            participant_ids.append(hangouts_pb2.ParticipantId(gaia_id=user_id.gaia_id, chat_id=user_id.chat_id))

        presence_request = hangouts_pb2.QueryPresenceRequest(
            request_header=self.client.get_request_header(),
            participant_id=participant_ids,
            field_mask=[
                hangouts_pb2.FIELD_MASK_REACHABLE,
                hangouts_pb2.FIELD_MASK_AVAILABLE,
                hangouts_pb2.FIELD_MASK_DEVICE,
            ],
        )
        presence_response = yield from self.client.query_presence(presence_request)
        for presence_result in presence_response.presence_result:
            self.user_list.set_presence_from_presence_result(presence_result)

        # Send user list to XMPP
        user_list_dict = {}
        for user in self.user_list.get_all():
            user_list_dict[user.id_.gaia_id] = {
                "chat_id": user.id_.chat_id,
                "gaia_id": user.id_.gaia_id,
                "first_name": user.first_name,
                "full_name": user.unique_full_name,
                "is_self": user.is_self,
                "emails": user.emails._values if user.emails is not None else [],
                "phones": user.phones._values if user.phones is not None else [],
                "photo_url": user.photo_url,
                "status": presence_to_status(user.presence),
                "status_message": user.get_mood_message(),
            }
        self.send_message_to_xmpp({"what": "user_list", "user_list": user_list_dict})

        # Send conversation list to XMPP
        conv_list_dict = {}
        for conv in self.conv_list.get_all():
            self.known_conservations.add(conv.id_)
            if conv._conversation.type == hangouts_pb2.CONVERSATION_TYPE_GROUP:
                user_list = {}
                self_gaia_id = None
                for user in conv.users:
                    user_list[user.id_.gaia_id] = (
                        user_list_dict[user.id_.gaia_id]["full_name"]
                        if user.id_.gaia_id in user_list_dict
                        else user.id_.gaia_id
                    )
                    if user.is_self:
                        # XMPP needs to know which user is itself.
                        self_gaia_id = user.id_.gaia_id
                # If the conversation does not have a name, create one by joining the list of participants.
                conv_name = conv.name
                if conv_name is None:
                    conv_name = ", ".join(user_list.values())
                conv_list_dict[conv.id_sha1] = {
                    "conv_id": conv.id_sha1,
                    "topic": conv_name,
                    "user_list": user_list,
                    "self_id": self_gaia_id,
                }
        self.send_message_to_xmpp(
            {"what": "conv_list", "conv_list": conv_list_dict, "self_gaia": self.user_list._self_user.id_.gaia_id}
        )