]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
stats plugin: stats_notify_path can now specify path to the stats-mail FIFO
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 15 Apr 2016 11:51:42 +0000 (14:51 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 18 Apr 2016 17:23:30 +0000 (20:23 +0300)
src/plugins/stats/stats-plugin.c

index fa65bb8c344b40e0df0d1de55ed7199cd13a98f3..283817b0bdaedfed2f322ce5be6932ed0842bc73 100644 (file)
@@ -18,7 +18,7 @@
    Must be smaller than MAIL_SESSION_IDLE_TIMEOUT_MSECS in stats server */
 #define SESSION_STATS_FORCE_REFRESH_SECS (5*60)
 #define REFRESH_CHECK_INTERVAL 100
-#define MAIL_STATS_SOCKET_NAME "stats-mail"
+#define MAIL_STATS_FIFO_NAME "stats-mail"
 
 struct stats_storage {
        union mail_storage_module_context module_ctx;
@@ -379,8 +379,11 @@ static void stats_user_created(struct mail_user *user)
        }
 
        if (global_stats_conn == NULL) {
-               path = t_strconcat(user->set->base_dir,
-                                  "/"MAIL_STATS_SOCKET_NAME, NULL);
+               path = mail_user_plugin_getenv(user, "stats_notify_path");
+               if (path == NULL)
+                       path = MAIL_STATS_FIFO_NAME;
+               if (path[0] != '/')
+                       path = t_strconcat(user->set->base_dir, "/", path, NULL);
                global_stats_conn = stats_connection_create(path);
        }
        stats_connection_ref(global_stats_conn);