sort dialog messages