Notify() & NotifyAccount() methods being called repeatedly

Writing and using PopTray plug-ins

Moderators: KY Dave, jojobear99, Rdsok

Locked
User avatar
jskinner
Groupie
Posts: 55
Joined: Wed Mar 09, 2005 9:25 pm
Contact:

Notify() & NotifyAccount() methods being called repeatedly

Post by jskinner » Fri Mar 11, 2005 6:39 am

I have a small Messenger style pop-up notification plug-in that I have been working on. I'm having a problem with the PopTray API though. It appears that Notify() is being called three times rather than just once when doing a mail query. Likewise NotifyAccount is being called 3xNumberOfAccounts rather than just the Number of accounts defined.
This is causing me lots of trouble since its causes my window to display too many times.

Here is my setup: 1 new message waiting and two accounts defined. When doing a single message check I see the following methods being called:

2005/03/10 23:34:03 MessageCheck From(srdorey) Subject(Re: Hi)
2005/03/10 23:34:03 MessageBody
2005/03/10 23:34:03 NotifyAccount istop.com Mail(1) Unread(1) New(1)
2005/03/10 23:34:03 NotifyAccount Hotmail Mail(0) Unread(0) New(0)
2005/03/10 23:34:03 Notify Mail(1) Unread(1) New(1)
2005/03/10 23:34:03 NotifyAccount istop.com Mail(1) Unread(1) New(1)
2005/03/10 23:34:03 NotifyAccount Hotmail Mail(0) Unread(0) New(0)
2005/03/10 23:34:03 Notify Mail(1) Unread(1) New(1)
2005/03/10 23:34:12 NotifyAccount istop.com Mail(1) Unread(1) New(1)
2005/03/10 23:34:12 NotifyAccount Hotmail Mail(0) Unread(0) New(0)
2005/03/10 23:34:12 Notify Mail(1) Unread(1) New(1)

The first two calls to Notify() and NotifyAccount() happen one right after the other but the third takes a few seconds before being called again.

Has anyone else seen this behavior ?

Thanks, -James

PS If you would like a sneak peak at the plug-in you can download it from http://james.istop.com/NotifyMessengerPopup.dll You can monitor the file NotifyMessengerPopup.log in the PopTray directory to see the behavior I am describing

User avatar
Renier
Site Admin
Posts: 1957
Joined: Mon Oct 15, 2001 12:54 pm
Location: Cape Town, South-Africa
Contact:

Post by Renier » Fri Mar 11, 2005 1:16 pm

As far as I remember the Notify procedure is called from the UpdateTrayIcon method in PopTray. What is probably happening is that PopTray updates the icon multiple times (especially when the reset tray icon option is on), and that causes this behaviour.

Unfortunately I don't have a lot of time to look at this right now. So either you have to code around it (if possible), or you can look at the PopTray source and try to fix it from there.

As I said in the other thread, this code is very much untested because you guys are the first that are writing notify plug-ins (except for my simple examples).

User avatar
jskinner
Groupie
Posts: 55
Joined: Wed Mar 09, 2005 9:25 pm
Contact:

Post by jskinner » Fri Mar 11, 2005 3:50 pm

I had a look at the code and yes the problem does appear to be that the Notify() and NotifyAccount() APIs being called from in the UpdateTrayIcon method. UpdateTrayIcon is call from a few different places so behavior is not very predictable.

I would recommend the following changes:

NotifyPluginExecute moved to TfrmPopMain.CheckAllMail
NotifyPluginExecuteAccount moved to TfrmPopMain.CheckMail

I believe that this should do the trick but since I don't have Delphi I can't verify it.

My plugin is not very usable with all these extra calls. I also have a Microsoft Windows Media Center Edtion 2005 plugin planned once this problem is fixed.

User avatar
Renier
Site Admin
Posts: 1957
Joined: Mon Oct 15, 2001 12:54 pm
Location: Cape Town, South-Africa
Contact:

Post by Renier » Fri Mar 11, 2005 6:07 pm

Yes, but remember that the Notify method must also be called when the user views a message. So that the plugin can know that this is no longer a new message.

User avatar
Renier
Site Admin
Posts: 1957
Joined: Mon Oct 15, 2001 12:54 pm
Location: Cape Town, South-Africa
Contact:

Post by Renier » Mon Jul 04, 2005 6:16 pm

I have changed the way that the notify methods gets called in PopTray 3.2 (beta 1). Please see this produces better results, and let me know.

User avatar
jskinner
Groupie
Posts: 55
Joined: Wed Mar 09, 2005 9:25 pm
Contact:

Post by jskinner » Wed Oct 12, 2005 2:28 am

Renier wrote:I have changed the way that the notify methods gets called in PopTray 3.2 (beta 1). Please see this produces better results, and let me know.
Yes preliminary testing appears to confirm that the notify methods to indeed get called in a predictable manner now. That great news, thanks for fixing this.

Locked

Who is online

Users browsing this forum: No registered users and 1 guest