def update_chats!
      assert!
      callback = Callback.new
      
      collected = 0
      collect_done = Proc.new do |id, data, count|
        collected += 1
        @chats << TelegramChat.new(self, data)
        callback.trigger(:success) if collected == count
      end
      collect = Proc.new do |id, count|
        @connection.communicate(['chat_info', "chat\##{id}"]) do |success, data|
          collect_done.call(id, data, count) if success
        end
      end

      @chats = []
      @connection.communicate('dialog_list') do |success, data|
        if success and data.class == Array
          chatsize = data.count { |chat| chat['peer_type'] == 'chat' }
          data.each do |chat|
            if chat['peer_type'] == 'chat'
              collect.call(chat['peer_id'], chatsize)
            elsif chat['peer_type'] == 'user'
              @chats << TelegramChat.new(self, chat)
            end
          end
          callback.trigger(:success) if chatsize == 0
        else
          raise "Couldn't fetch the dialog(chat) list."
        end
      end
      callback
    end
def update_chats!
      assert!
      callback = Callback.new
      
      collected = 0
      collect_done = Proc.new do |id, data, count|
        collected += 1
        @chats << TelegramChat.new(self, data)
        callback.trigger(:success) if collected == count
      end
      collect = Proc.new do |id, count|
        @connection.communicate(['chat_info', "chat\##{id}"]) do |success, data|
          collect_done.call(id, data, count) if success
        end
      end

      @chats = []
      @connection.communicate('dialog_list') do |success, data|
        if success and data.class == Array
          chatsize = data.count { |chat| chat['peer_type'] == 'chat' }
          data.each do |chat|
            if chat['peer_type'] == 'chat'
              collect.call(chat['peer_id'], chatsize)
            elsif chat['peer_type'] == 'user'
              @chats << TelegramChat.new(self, chat)
            end
          end
          callback.trigger(:success) if chatsize == 0
        else
          raise "Couldn't fetch the dialog(chat) list."
        end
      end
      callback
    end
Update user chats

 @api private