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

Raising events during getmessages #53

Open
piher opened this issue Mar 16, 2012 · 7 comments
Open

Raising events during getmessages #53

piher opened this issue Mar 16, 2012 · 7 comments

Comments

@piher
Copy link
Contributor

piher commented Mar 16, 2012

Hi,

Not really an issue, just a very quick question : why not raising an event in getmessages every time a message has been fetched ?

@andyedinborough
Copy link
Owner

Hmmm. Seems like something that could be done fairly easily in any code that uses the API by creating a simple wrapper. In trying to keep this thing as simple as possible, I'd need a really good reason for it to part of the base code.

@piher
Copy link
Contributor Author

piher commented Mar 16, 2012

I may be saying something very naive because I've never learned about wrappers but as an example when calling GetMessages(0,2000,....) i thought it would be of great comfort to trigger an event right after x.add(mail). (so we actually know what's going on inside)
Is that possible with a wrapper ?

@andyedinborough
Copy link
Owner

I think some tracing is in order... I'll be thinking about the best way to implement this.

@piher
Copy link
Contributor Author

piher commented Mar 20, 2012

I'm sure that would be great. Just FYI, what I did for my personal use was to create a gotMsg event that is raised after x.add(mail), referencing the msg for saving or diplaying purposes, and added a boolean CancellationPending checked at every loop in getmessages to allow a (very) quick cancellation. So far it's been working great for what I need.

@andyedinborough
Copy link
Owner

I've been meaning to get back to this. I think the best solution is Trace -- http://support.microsoft.com/kb/815788. Various points can be set to call the trace method and when you need to, you can create a TraceListener to see what's happening. Thoughts? What all points would you like to see a trace event fired? Connect, Login, each iteration of GetMessages...

@piher
Copy link
Contributor Author

piher commented Apr 9, 2012

Well, that would be great for testing purposes.
But actually I was not really thinking about testing, more of a new functionnality.
Indeed, I developped a small thunderbird-like email client and when I want to download the whole mailbox the memory usage would grow a lot whereas I don't even need the thousands of mails to be stored in a list since I save them one-by-one.
Raising an event at each message allowed me to write a sub that does the same thing as getmessages but "returns" every message one by one.

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

No branches or pull requests

3 participants
@andyedinborough @piher and others