buzz icon indicating copy to clipboard operation
buzz copied to clipboard

Outright not working :[

Open maltalef101 opened this issue 2 years ago • 10 comments

Starts and runs but even though I do get new email, it doesn't notify me about it.

How should I go about troubleshooting this?

No errors whatsoever.

maltalef101 avatar Oct 16 '21 20:10 maltalef101

Hmm, that's odd indeed. Buzz should notify you about emails that are in the IMAP NEW status, which means (from the spec):

Messages that have the \Recent flag set but not the \Seen flag.

If you look at the emails in another IMAP client, can you check the flags on the messages in your inbox and see if that matches? What output do you get in the logs?

jonhoo avatar Oct 24 '21 17:10 jonhoo

Even with a freshly recieved email Dovecot doesn't set the \Recent flag, only the \Seenone, at least that's what I can tell from the output of a doveadm fetch command. I'll look into that first.

I don't get any errors in stdout when its running, only some (I'm guessing) GTK errors about I don't even know what.

image

maltalef101 avatar Oct 25 '21 05:10 maltalef101

That's really weird, and sounds like a Dovecot bug if it's indeed the case :thinking:

jonhoo avatar Oct 26 '21 01:10 jonhoo

It does seem like a Dovecot bug, but the flag actually exists, and isn't stored like all the other regular flags? I'm really not sure about what's going on. I'm now trying with only my Gmail account in the buzz.toml config file to see if it actually works, but I'm pretty sure that it doesn't either.

Nonetheless, thank you very much for responding to an issue on a project that is not that actively developed. :]

maltalef101 avatar Oct 26 '21 02:10 maltalef101

I have the means to modify and rebuild the code, how would I go about debugging this? I am really not sure about how to check email flags on Gmail because I've spent so much time in Dovecot and roundcube that I don't use Gmail that much :P

maltalef101 avatar Oct 26 '21 02:10 maltalef101

@maltalef101 Sorry for the late reply! Best way to go is to set the debug flag in imap to true, which will show you all the client-server interactions. Then you could use something like wireshark to inspect what happens when a "regular" email client connects to your Dovecot server, and compare the two. Hopefully it should be visible what the difference in the queries is!

jonhoo avatar Nov 06 '21 19:11 jonhoo

I recently started investigating about this again and found out something interesting. The \Recent flag does not exist anymore, it's been deprecated since the release of RFC9051 in August of last year.

Take a look at Appendix E, item 12: (link)

RECENT response on SELECT/EXAMINE, \Recent flag, RECENT STATUS, and SEARCH NEW items are now deprecated.

This, obviously, was a surprise. I manually connected to my Dovecot instance and ran SEARCH NEW just seconds after receiving a message and the search came out empty. I have no idea how this type of functionality could be re-implemented not using the NEW status, now that it basically doesn't exist.

maltalef101 avatar Jan 09 '22 00:01 maltalef101

That's bizarre! Does the RFC outline why, and what the appropriate replacement is? Maybe we can look at what something like Thunderbird or K9 mail does?

jonhoo avatar Jan 26 '22 02:01 jonhoo

Hey. Looking into this again.

I haven't checked Thunderbird's or K9's implementation of push notifications, but I suspect it's implemented with IMAP's NOTIFY extension.

For the new messages delivered to or appended to the selected mailbox, the NOTIFY command can be used to request that a set of attributes be sent to the client in an unsolicited FETCH response. This allows a client to be a passive recipient of events and new mail and to be able to maintain full synchronisation without having to issue any subsequent commands except to modify the state of the mailbox on the server.

Having a connection that constantly listens for unsolicited FETCH responses with a given SEARCH pattern could be a good idea.

If the new/appended message is in the selected mailbox, the server notifies the client by sending an unsolicited EXISTS response, followed by an unsolicited FETCH response containing the information requested by the client. A FETCH response SHOULD NOT be generated for a new message created by the client on this particular connection, for instance, as the result of an APPEND or COPY command to the selected mailbox performed by the client itself. The server MAY also send a RECENT response, if the server marks the message as \Recent. Section 5.2

This looks really nice! Much of the hard work is already done by the server's IMAP implementation. I see that this project uses your Rust IMAP crate, ¿does it implement this extension?

maltalef101 avatar Oct 12 '22 04:10 maltalef101

It doesn't unfortunately. https://github.com/jonhoo/rust-imap/issues/63 would be the thing to keep an eye out for!

jonhoo avatar Oct 15 '22 20:10 jonhoo