From 00b254e12b16cf2dfcbaa4ef564a5d5cf70172ee Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan.bosch@open-xchange.com>
Date: Sat, 9 Nov 2024 14:25:22 +0100
Subject: [PATCH] managesieve: managesieve-capabilities - Avoid retrieving
 capabilities more than once

Also make code cleaner and consistent.
---
 src/managesieve/managesieve-capabilities.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/managesieve/managesieve-capabilities.c b/src/managesieve/managesieve-capabilities.c
index ddac5a4d0..cc70e521a 100644
--- a/src/managesieve/managesieve-capabilities.c
+++ b/src/managesieve/managesieve-capabilities.c
@@ -64,7 +64,7 @@ void managesieve_capabilities_dump(void)
 	const struct plugin_settings *global_plugin_settings;
 	struct sieve_environment svenv;
 	struct sieve_instance *svinst;
-	const char *notify_cap;
+	const char *sieve_cap, *notify_cap;
 
 	/* Read plugin settings */
 
@@ -83,15 +83,13 @@ void managesieve_capabilities_dump(void)
 
 	/* Dump capabilities */
 
+	sieve_cap = sieve_get_capabilities(svinst, NULL);
 	notify_cap = sieve_get_capabilities(svinst, "notify");
 
 	if (notify_cap == NULL)
-		printf("SIEVE: %s\n", sieve_get_capabilities(svinst, NULL));
-	else {
-		printf("SIEVE: %s, NOTIFY: %s\n",
-		       sieve_get_capabilities(svinst, NULL),
-		       sieve_get_capabilities(svinst, "notify"));
-	}
+		printf("SIEVE: %s\n", sieve_cap);
+	else
+		printf("SIEVE: %s, NOTIFY: %s\n", sieve_cap, notify_cap);
 
 	settings_free(global_plugin_settings);
 	sieve_deinit(&svinst);
-- 
GitLab