Esempio n. 1
0
        public async Task SyncRecentConversationsAsync()
        {
            SyncRecentConversationsRequest request = new SyncRecentConversationsRequest()
            {
                request_header = RequestHeaderBody
            };


            using (HttpResponseMessage message = await _client.PostProtoJson("conversations/syncrecentconversations", _api_key, request))
            {
                SyncRecentConversationsResponse response = await message.Content.ReadAsProtoJson <SyncRecentConversationsResponse>();

                _active_conversations = response.conversation_state.ToDictionary(c => c.conversation_id.id, c => c);


                // check if contacts are loaded
                if (_contacts == null || _contacts.Count == 0)
                {
                    string[] participants_id = response.conversation_state.SelectMany(c => c.conversation.current_participant.Select(p => p.gaia_id)).Distinct().Where(p => p != CurrentUser.id.gaia_id).ToArray();
                    await GetEntityByIdAsync(participants_id);
                }

                if (OnConversationHistoryReceived != null)
                {
                    OnConversationHistoryReceived(this, _active_conversations.Values.ToList());
                }
            }
        }
Esempio n. 2
0
        public void SyncRecentConversations()
        {
            SyncRecentConversationsRequest request = new SyncRecentConversationsRequest()
            {
                request_header = RequestHeaderBody
            };


            HttpResponseMessage message = _client.PostProtoJson("conversations/syncrecentconversations", request);

            if (ConversationHistoryLoaded != null)
            {
                SyncRecentConversationsResponse response = message.Content.ReadAsProtoJson <SyncRecentConversationsResponse>();
                _active_conversations = response.conversation_state.ToDictionary(c => c.conversation_id.id, c => new WTalk.Model.Conversation(c));
                ConversationHistoryLoaded(this, _active_conversations.Values.ToList());
            }
        }
Esempio n. 3
0
        public void SyncRecentConversations()
        {
            SyncRecentConversationsRequest request = new SyncRecentConversationsRequest()
            {
                request_header = RequestHeaderBody
            };


            HttpResponseMessage message = _client.PostProtoJson(_api_key, "conversations/syncrecentconversations", request);

            if (ConversationHistoryLoaded != null)
            {
                SyncRecentConversationsResponse response = message.Content.ReadAsProtoJson <SyncRecentConversationsResponse>();

                ConversationHistoryLoaded(this, response.conversation_state);
                _active_conversation_ids = response.conversation_state.Select(c => c.conversation_id.id).ToList();
            }
        }