Re: mail notification using tinymail



Hi Steve,
Thanks for detail.

If you don't mind it possible to get your console based application for my reference.

Regards,
Vij

On Mon, Aug 2, 2010 at 10:13 PM, Steve Rosen <stevenmichaelrosen gmail com> wrote:
Hi Vij,

You will need to create your own class to "monitor" changes
in the folder you are interested in (like the inbox folder) -
you can use the "tny-folder-monitor" class as an example of
what to do.

I had the same problem when developing my own console
application that uses the tinymail library - but you CAN do
it - it's just not totally obvious from the documentation or
the code examples - you need to just study the code for some
of the implementations (I looked at Tmut source code, for
example), to get a better feel for what you need to do.

The simplest thing you can do (I believe) is to create your
own class that is similar to the TnyFolderMonitor class, and
then you'll want to override the "update" method of the
TnyFolderObserver class that your class will be derived from.

Then, YOUR update method will be called when the folder you
are monitoring has some kind of change (either new emails
showing up - or existing emails being removed - expunged -
from that folder).  When your update method is called for
any of those folder changes, you can then do some callback
to your application to let it know that either new headers
have been added to the folder, or existing headers have been
removed from the folder.

For the class that you create, you can have its "new" method
include some callbacks that your application provides to be
informed when the folder changes due to new headers or removed
headers.

Don't forget to make sure your new class is thread-safe!

For the class that I developed, its "new" method also passed in
a pointer to my higher-level c++ object that created the "c" object,
since I needed to callback a static "c" function from my "c" class -
and the callback needed to cast the pointer back to the correct c++
object so it could update the approppriate data structures in the
correct c++ object that had initially created the "c" object - a
little complicated, but it works just fine!  You many not have this
complication, depending on what you are developing.

All in all, I have found using the tinymail library a little bit
non-intuitive at first, but once you start to grasp the overall
architecture, it makes perfect sense and is actually fairly easy
to use - the developers did a very good job of layering and also
partitioning the logic that is needed to develope a very nice
email client - kudos to them for that!  But the documentation is,
shall we say, a little bit lacking.  However, the code is pretty
clean - and not very difficult to follow - you just have to spend
a little bit of time reading code and drawing a few diagrams!

Hope this helped you...

- Steve Rosen


evolution test wrote:
Hello,
I want to know how to get new mail arrival information automatically by using tinymail.

I am looking for api used by tinymail for the above feature or what is the logic i need to used to get same functionality.

NOTE : it will be same like mail-notification plugin in evolution.

Cheers,
Vij



_______________________________________________ tinymail-devel-list mailing list tinymail-devel-list gnome org http://mail.gnome.org/mailman/listinfo/tinymail-devel-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]