Automatic Refresh for local Maildir's mail counts?

Linux-Fan <Ma_Sys.ma-S0/[email protected]> Fri, 30 Dec 2016 23:53:14 +0100
Newsgroups gmane.mail.cone
Message-ID <[email protected]>
--===============8936998574412988117==
Content-Type: multipart/signed; micalg=pgp-sha256;
	boundary="Sig_/ombgb9mmUlobSf_09Dy/KJ3";
	protocol="application/pgp-signature"

--Sig_/ombgb9mmUlobSf_09Dy/KJ3
Content-Type: multipart/mixed; boundary="MP_/bq+CcLCZ4E.qR8JJS.R/ehR"

--MP_/bq+CcLCZ4E.qR8JJS.R/ehR
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Dear Cone users,

In [1] I asked if it might be possible to add a means of filtering
accross account boundaries to Cone in order to be able to replicate
my mail setup with it. I have understood it does not work that way
because moving across accounts is conceptually different from moving
inside the same account.

Still, I have not given up on trying to configure Cone in a way I could
use it as my mail client: While I did not try to amend Cone's filtering
system to work across server boundaries, I have thought of another
solution to the problem: In order to have filtering across account
boundaries, I could use an external program to process incoming e-mails
and then only read (and write) them in Cone.

The setup is intended to look something like this

  Offlineimap               Filtering tool=C2=B9        Cone
  ---------------------     ------------------     ---------------------
  Downloads mails and   --> Moves mails inside --> Is used to read from
  uploads changes to an     a local Maildir        the local Maildir and
  IMAP Server               structure              send via SMTP.

Now in order for this to work as I expect it, Cone needs to
automatically update the e-mail counts from local Maildirs to display
the changes made externally via Offlineimap and the filtering tool.

As far as I understand, there is an option called `/noop=3DN` [2] to
poll IMAP accounts. I tried to use that (testing with an IMAP account),
but it did not automatically tell me `... unread` after receiving a new
mail until I opened and closed the folder again?

Alternatively, I have tried to implement a refresh via a `SIGUSR1` to
Cone by collapsing and expanding the currently selected subtree. This is
a hack and while it does something similar to what I want (if the
correct entry is selected, it refreshes the mail counters), it does not
do it right: It depends on the current selection and it marks all
folders (as if they were highlighted by the cursor) for reasons unknown
to me :)

Now my question is: Is there a recommended way to achieve automatic
updating of (new-)mail counters for offline accounts / e-mail data
processed by a separate tool? If not, is there a chance of getting the
`/noop=3DN` thing to work with local Maildirs making it update
e-mail counts without interaction or is there a chance of implementing a
`SIGUSR1` to refresh in a more sensible way than I did?

In order to illustrate what I am thinking about, I have attached my
patch to enhance cone-0.92 with a hacky `SIGUSR1` support. If you think
it might be a good idea to rewrite the patch to apply to the newest
Cone version, I will try to do that. However, I do not think that
my hack is the way to go with respect to the issue I want to solve.

=C2=B9) I do not know which filtering tool to use, yet.

TIA and Yours Sincerely
Linux-Fan

[1] https://sourceforge.net/p/courier/mailman/message/35086282/
[2] http://www.courier-mta.org/cone/cone06newaccount.html

--=20
http://masysma.lima-city.de/

--MP_/bq+CcLCZ4E.qR8JJS.R/ehR
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment; filename=patch_cone.txt

diff -r cone-0.92/cone/cone.C cone-0.92_new/cone/cone.C
425a426,434
> // BEGIN MASYSMA CHANGED CODE
> static CursesHierarchy* masysmaHptr =3D NULL;
> static void masysmaUpdate(int arg0)
> {
> 	if(masysmaHptr !=3D NULL)
> 		masysmaHptr->masysmaRefreshAllFolders();
> }
> // END MASYSMA CHANGED CODE
>=20
431a441
> 	masysmaHptr =3D &hierarchy_screen; // MASYSMA CHANGED
476a487,488
>=20
> 	masysmaHptr =3D NULL;
1187a1200
> 	signal(SIGUSR1, masysmaUpdate);
diff -r cone-0.92/cone/curseshierarchy.C cone-0.92_new/cone/curseshierarchy=
.C
987a988,1009
> // BEGIN MASYSMA CHANGED CODE
> void CursesHierarchy::masysmaCloseOpen(Hierarchy::Folder* f)
> {
> 	if(f !=3D NULL) {
> 		closeSubFolders(f);
> 		openSubFolders(f);
> 		for(std::vector<Hierarchy::Entry*>::const_iterator it =3D
> 					f->begin(); it !=3D f->end(); it++)
> 			masysmaCloseOpen((*it)->toFolder());
> 	}
> }
>=20
> void CursesHierarchy::masysmaRefreshAllFolders()
> {
> 	Hierarchy::Folder* f =3D getCurrentFolder();
> 	if(f !=3D NULL) {
> 		masysmaCloseOpen(f);
> 		visible(f);
> 	}
> }
> // END MASYSMA CHANGED CODE
>=20
990a1013,1020
>=20
> 	// BEGIN MASYSMA CHANGED CODE
> 	if(key =3D=3D 'j') {
> 		masysmaRefreshAllFolders();
> 		return true;
> 	}
> 	// END MASYSMA CHANGED CODE
>=20
diff -r cone-0.92/cone/curseshierarchy.H cone-0.92_new/cone/curseshierarchy=
.H
124a125,132
>=20
> // BEGIN MASYSMA CHANGED CODE
> public:
> 	void masysmaRefreshAllFolders();
> private:
> 	void masysmaCloseOpen(Hierarchy::Folder* f);
> // END MASYSMA CHANGED CODE
>=20

--MP_/bq+CcLCZ4E.qR8JJS.R/ehR--

--Sig_/ombgb9mmUlobSf_09Dy/KJ3
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJYZuVeAAoJEPhJcO2yngi1NdEQAICwVn7sF93GVzu6vmMqkQhJ
ifgaDtiR4VaZEKUid9pMTSd6uEJKZUmwvV4kEKY76tGCSfEm47VjkX64A5r7c73u
7rJJEcrHuIXLD+zD2PZVlqyvBOk+NI80gz84VgYL9zgZC062UKWoHxpUCuNNmJzA
xIIlth/dJQtQIpTH7nuInkeA2Nn/CGOk6o5Z8ptOkUSq4EA4FTNWd6onReO4E2BN
yWvKa2Hf6HReT0nz5Cb2fBe245jbQ5+Otk7zs0WYgFetuqtabnA6lGQyhM2WaumY
AyZgIecMfB4r7v43qi0nX8SkpNwwvF2sA/cqUmoPAy/tH8bvB5jdttQWkr5sXMJO
WWdgq1xIhtDkHmizbK0eKQAYdGciI6S/v4xDjeZvjFEuiHhCH1NxfvwOrGYyxYFD
VJMU+KxVqMZU+UrilXjHSRpRbIVO4/IUIphiMFzcMLh02X955cUsVJiMLoe6tiG4
KQJfKRv5Wtqzo1pWAWVX/bl3PYKUSzWHapYOj0Bi/rDRmwOBDYZMN4r+o+CdwJ7W
PvWtQx6NptAtZG5vCDm+sTV0eMgP3pi0dLBebdHDXItQSJYGiS9n523P94dN+oZ+
gZEMOKg9tyq524Snc83dh8rGEf+JMgaCn8mpDAgzHdXll2FiLZlRerZCEecom2kb
uODZiwg7EBVJSi2vVHmE
=Um32
-----END PGP SIGNATURE-----

--Sig_/ombgb9mmUlobSf_09Dy/KJ3--


--===============8936998574412988117==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
--===============8936998574412988117==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Courier-cone mailing list
[email protected]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-cone

--===============8936998574412988117==--