Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keys: add ReadKeys() and UnreadKeys() #2

Closed
wants to merge 1 commit into from

Conversation

vbatts
Copy link

@vbatts vbatts commented Dec 13, 2014

as well as making the Keys() return the collection of both read and unread

Signed-off-by: Vincent Batts vbatts@hashbangbash.com

as well as making the Keys() return the collection of both read and unread

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
@vbatts vbatts changed the title keys: add Read() and UnreadKeys() keys: add ReadKeys() and UnreadKeys() Dec 13, 2014
@luksen
Copy link
Owner

luksen commented Dec 14, 2014

Hey, thanks for taking an interest! But I don't think this change is a good idea. The current interface enforces the semantic that once the application knows about new messages, they should be in cur. The only reason to get message keys without the move is to violate that.

Also, as it is now, the returned keys won't be of any use since Filename doesn't search new.

@luksen luksen closed this Dec 14, 2014
@vbatts
Copy link
Author

vbatts commented Dec 14, 2014

but how are you supposed to access/count/know-of new messages? Even while writing the simplest of tools to show unread count, I could not find a way to access that information.

@luksen
Copy link
Owner

luksen commented Dec 14, 2014

The information whether a user has seen/read a message is encoded in the flags. So to count those you have to call Unseen to make sure all messages are known to the application. And then go through all keys returned by Keys and use Flags to count those that have S set.

A long running application can use Unseen to incrementally update its internal state, but for small tools it makes sense to just call it once at the start.

@luksen
Copy link
Owner

luksen commented Jan 18, 2018

@vbatts: I added UnseenCount(). It might address your problem. (Haven't really tested it, so there might be kinks)

@vbatts
Copy link
Author

vbatts commented Jan 18, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants