From 5916627ab5480c8d118dabba060994bbc3a1f2b8 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Sun, 28 Aug 2022 11:56:46 -0400 Subject: [PATCH 01/11] mailbox-count.cabal: update to v0.0.6. --- mailbox-count.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailbox-count.cabal b/mailbox-count.cabal index f9fb400..99dedae 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: mailbox-count -version: 0.0.5 +version: 0.0.6 author: Michael Orlitzky maintainer: Michael Orlitzky license: AGPL-3.0-only -- 2.43.2 From e67045a56b353610cc34f0043982bddb99e69caf Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Apr 2024 17:43:44 -0400 Subject: [PATCH 02/11] makefile: disable -Wmissing-kind-signatures This requires a GHC extension to fix. --- makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/makefile b/makefile index 3f3584c..76b3c83 100644 --- a/makefile +++ b/makefile @@ -10,6 +10,7 @@ HCFLAGS += -Weverything \ -Wno-prepositive-qualified-module \ -Wno-missing-safe-haskell-mode \ -Wno-missing-deriving-strategies \ + -Wno-missing-kind-signatures \ -rtsopts \ -threaded -- 2.43.2 From ffbd11deecf29fb7464fde3c3f20ef984f3e5916 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Apr 2024 17:44:14 -0400 Subject: [PATCH 03/11] src/Configuration.hs: add space around ++ --- src/Configuration.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Configuration.hs b/src/Configuration.hs index 7e15a74..9b7be96 100644 --- a/src/Configuration.hs +++ b/src/Configuration.hs @@ -45,7 +45,7 @@ instance Default Configuration where where def_summary_query = "SELECT domain,COUNT(username) " ++ "FROM mailbox " ++ - "GROUP BY domain "++ + "GROUP BY domain " ++ "ORDER BY domain;" def_detail_query = "SELECT domain,username " ++ -- 2.43.2 From 75c881f82720ebe7829f27d526ce7240f69b024c Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Apr 2024 17:46:06 -0400 Subject: [PATCH 04/11] mailbox-count.cabal: http -> https --- mailbox-count.cabal | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mailbox-count.cabal b/mailbox-count.cabal index 99dedae..763dc7b 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -23,7 +23,7 @@ description: Mailbox-count produces a simple count of mailboxes that exist per-domain in some SQL database. The default queries are compatible - with the schema used by PostfixAdmin , + with the schema used by PostfixAdmin , but it is possible to supply your own queries via the @--summary-query@ and @--detail-query@ options. @@ -216,5 +216,5 @@ test-suite doctests source-repository head type: git - location: http://gitweb.michael.orlitzky.com/mailbox-count.git + location: https://gitweb.michael.orlitzky.com/mailbox-count.git branch: master -- 2.43.2 From 76770ee0db8d1f979c2c2f2e4f93761919fd306e Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Apr 2024 17:46:46 -0400 Subject: [PATCH 05/11] mailbox-count.cabal: indent the "maintainer" field with spaces --- mailbox-count.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailbox-count.cabal b/mailbox-count.cabal index 763dc7b..57886dc 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -2,7 +2,7 @@ cabal-version: 3.0 name: mailbox-count version: 0.0.6 author: Michael Orlitzky -maintainer: Michael Orlitzky +maintainer: Michael Orlitzky license: AGPL-3.0-only license-file: doc/LICENSE bug-reports: mailto:michael@orlitzky.com -- 2.43.2 From aafb10aa08adfdf2658242ef67ae570b1188c3e5 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Apr 2024 17:48:38 -0400 Subject: [PATCH 06/11] mailbox-count.cabal: add new homepage field --- mailbox-count.cabal | 1 + 1 file changed, 1 insertion(+) diff --git a/mailbox-count.cabal b/mailbox-count.cabal index 57886dc..7c9b626 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -5,6 +5,7 @@ author: Michael Orlitzky maintainer: Michael Orlitzky license: AGPL-3.0-only license-file: doc/LICENSE +homepage: https://michael.orlitzky.com/code/mailbox-count.xhtml bug-reports: mailto:michael@orlitzky.com category: Mail, Utils build-type: Simple -- 2.43.2 From 3e2b5ea5ae69ff531d8a177fd993d6a37e9ebc22 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Apr 2024 17:51:17 -0400 Subject: [PATCH 07/11] doc/COPYING,mailbox-count.cabal: use AGPL-3+, include COPYING --- doc/COPYING | 15 +++++++++++++++ mailbox-count.cabal | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 doc/COPYING diff --git a/doc/COPYING b/doc/COPYING new file mode 100644 index 0000000..8c86f05 --- /dev/null +++ b/doc/COPYING @@ -0,0 +1,15 @@ +mailbox-count: count mailboxes in a SQL database +Copyright (C) 2024 Michael Orlitzky + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see . diff --git a/mailbox-count.cabal b/mailbox-count.cabal index 7c9b626..c495ca2 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -3,18 +3,19 @@ name: mailbox-count version: 0.0.6 author: Michael Orlitzky maintainer: Michael Orlitzky -license: AGPL-3.0-only +license: AGPL-3.0-or-later license-file: doc/LICENSE homepage: https://michael.orlitzky.com/code/mailbox-count.xhtml bug-reports: mailto:michael@orlitzky.com category: Mail, Utils build-type: Simple extra-source-files: + doc/COPYING doc/mailbox-countrc.example doc/man1/mailbox-count.1 test/fixtures/postfixadmin.sqlite3 synopsis: - Count mailboxes in a SQL database. + Count mailboxes in a SQL database description: /Usage/: -- 2.43.2 From 5a89b4b3bfe057e3bf7fd3b7aee5424b02513090 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Thu, 25 Apr 2024 17:56:12 -0400 Subject: [PATCH 08/11] mailbox-count.cabal: trim the description I don't want to maintain two copies any more. --- mailbox-count.cabal | 126 ++++---------------------------------------- 1 file changed, 9 insertions(+), 117 deletions(-) diff --git a/mailbox-count.cabal b/mailbox-count.cabal index c495ca2..756ed41 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -17,127 +17,19 @@ extra-source-files: synopsis: Count mailboxes in a SQL database description: - /Usage/: - - @ - mailbox-count [OPTIONS] - @ - - Mailbox-count produces a simple count of mailboxes that exist + mailbox-count produces a simple count of mailboxes that exist per-domain in some SQL database. The default queries are compatible - with the schema used by PostfixAdmin , - but it is possible to supply your own queries via the @--summary-query@ - and @--detail-query@ options. + with the [PostfixAdmin](https://postfixadmin.sourceforge.net/) + schema, but it is possible to supply your own queries. The summary report lists each domain, along with the number of - mailboxes owned by that domain. The order is determined by the summary - query, which lists the domains alphabetically by default. - - The default detail report shows the same, but also contains a list of - each individual mailbox (again in alphabetical order) belonging to the - domains. - - /Input/: - - None. - - /Output/: - - Either a summary, or detailed report (with @--detail@) of the - number of mailboxes per-domain contained in the database. - - /Options/: - - * \--database - - The name of the database (or file, if SQLite) to which we should - connect. - - Default: The name of the current user (Postgres only). - - * \--detail - - Produce a detailed report listing all mailboxes by domain. - - * \--detail-query - - SQL query used to produce the detail report. This should return the - set of all (domain, username) pairs. See the default value for an - example. - - Default: \"SELECT domain,username FROM mailbox ORDER BY domain;\" - - * \--host - - Hostname where the database is located (Postgres-only). - - Default: None, a UNIX domain socket connection is attempted - (Postgres only) - - * \--password - - Password used to connect to the database (Postgres-only). - - Default: None (assumes passwordless authentication) - - * \--port - - Port number used to connect to the database (Postgres-only). - - Default: None, a UNIX domain socket connection is attempted - (Postgres only) - - * \--summary-query - - SQL query used to produce the summary report. This should return - (domain, user count) pairs. See the default value for an - example. - - Default: \"SELECT domain,COUNT(username) FROM mailbox GROUP BY domain - ORDER BY domain;\" - - * \--username - - Username used to connect to the database (Postgres-only). - - Default: The current user - - /Examples/: - - The default summary report: - - @ - $ mailbox-count --database=postfixadmin.sqlite3 - Summary (number of mailboxes per domain) - \---------------------------------------- - example.com: 3 - example.invalid: 1 - example.net: 2 - example.org: 1 - @ - - The more detailed report: - - @ - $ mailbox-count --detail --database=postfixadmin.sqlite3 - Detail (list of all mailboxes by domain) - \---------------------------------------- - example.com (3): - user1 - user3 - user5 - - example.invalid (1): - user7 - - example.net (2): - user2 - user4 - - example.org (1): - user6 - @ + mailboxes owned by that domain. The order is determined by the + summary query, which lists the domains alphabetically by + default. The default detail report shows the same, but also contains + a list of each individual mailbox (again in alphabetical order) + belonging to the domains. + A full set of options and examples can be found in the man page. executable mailbox-count -- 2.43.2 From f8118fa34e4ee147822e28900545b06804c2b037 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 26 Apr 2024 07:57:55 -0400 Subject: [PATCH 09/11] mailbox-count.cabal: bump version to 0.0.7 --- mailbox-count.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailbox-count.cabal b/mailbox-count.cabal index 756ed41..44cffb7 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: mailbox-count -version: 0.0.6 +version: 0.0.7 author: Michael Orlitzky maintainer: Michael Orlitzky license: AGPL-3.0-or-later -- 2.43.2 From 25e04a3969445e05d9aede59ead0a883a27efccb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 26 Apr 2024 08:06:27 -0400 Subject: [PATCH 10/11] doc/man1/mailbox-count.1: mention the configuration file --- doc/man1/mailbox-count.1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/doc/man1/mailbox-count.1 b/doc/man1/mailbox-count.1 index 0c59240..b0e3bbe 100644 --- a/doc/man1/mailbox-count.1 +++ b/doc/man1/mailbox-count.1 @@ -76,6 +76,15 @@ Username used to connect to the database (Postgres-only). Default: The current user +.SH CONFIGURATION FILE + +Any of the options above can be placed in a configuration file rather +than passed on the command line. An example config file +\fIdoc/mailbox-countrc.example\fR is included with the source. You can +edit it and rename it to either \fI$sysconfdir/mailbox-countrc\fR or +\fI~/.mailbox-countrc\fR. The variable \fI$sysconfdir\fR is determined +at build time and is typically \fI/etc\fR on UNIX systems. + .SH EXAMPLES .IP \[bu] 2 -- 2.43.2 From 1a05cc434726cc669fab65b517c6666203dcd8bb Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Fri, 26 Apr 2024 08:07:00 -0400 Subject: [PATCH 11/11] mailbox-count.cabal: bump to version 0.0.8 --- mailbox-count.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mailbox-count.cabal b/mailbox-count.cabal index 44cffb7..5ca9b54 100644 --- a/mailbox-count.cabal +++ b/mailbox-count.cabal @@ -1,6 +1,6 @@ cabal-version: 3.0 name: mailbox-count -version: 0.0.7 +version: 0.0.8 author: Michael Orlitzky maintainer: Michael Orlitzky license: AGPL-3.0-or-later -- 2.43.2