Shoutbox

OnEvent_MyDisplayPictureChange Event Handler - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: OnEvent_MyDisplayPictureChange Event Handler (/showthread.php?tid=76893)

OnEvent_MyDisplayPictureChange Event Handler by mynetx on 08-20-2007 at 01:14 PM

Does anybody know an event handler for this, or is the only way to detect a display picture change a Timer while comparing the current picture file size with a copy created on last run of Timer?

Thank you for your replies,
mynetx


RE: OnEvent_MyDisplayPictureChange Event Handler by MeEtc on 08-20-2007 at 01:43 PM

code:
function getdp(){
   try{ return Messenger.MyDisplayPicture; }
   catch(e){ return ''; }
}

function OnEvent_Timer(id){
   if (id == 'dp'){
      if(getdp() != <variable for DP location>){
         <variable for DP location> = getdp();
         <other code for DP change>
      }
      MsgPlus.AddTimer('dp', 30000);
   }
}

RE: OnEvent_MyDisplayPictureChange Event Handler by Spunky on 08-20-2007 at 01:46 PM

The file size would be an inacurrate way of doing things... Just been looking to see if the Messenger.MyDisplayPicture uses distinguishable filenames, but it says not to store them for future use so I don't think thats reliable either


RE: OnEvent_MyDisplayPictureChange Event Handler by mynetx on 08-20-2007 at 01:47 PM

@MeEtc:
This is exactly what I'm doing right now, but I was wondering if there were an easier solution, maybe using some kind of event handler for display picture changing.

@SpunkyLoveMuff:
The file names are the originals from Messenger. Even if the picture is updated by the user (or by another script), the file name won't change, whereas if you compare the bytes, it is very unlikely that two different images have the same size.

/edit:
It was very strange for me to find event handlers for just every kind of user information change, but not for the display picture... *-)


RE: OnEvent_MyDisplayPictureChange Event Handler by Patchou on 08-20-2007 at 02:19 PM

I'm sorry, I cannot provide an event handler for this right now... when I can add one, I will.


RE: RE: OnEvent_MyDisplayPictureChange Event Handler by XP1 on 01-19-2009 at 07:23 AM

quote:
Originally posted by Patchou
I'm sorry, I cannot provide an event handler for this right now... when I can add one, I will.
Now that the new Messenger Plus! Live for WLM 2009 is almost finalized, is Patchou ready for adding this?

Sorry for bumping, but I would really like an OnEvent_MyDisplayPictureChange event handler.

I don't want this tread to be forgotten.
Patchou, can you put this feature on your to-do list so you won't forget? :)
RE: OnEvent_MyDisplayPictureChange Event Handler by mynetx on 01-19-2009 at 04:02 PM

quote:
Originally posted by XP1
can you put this feature on your to-do list so you won't forget?
XP1,

I've put my suggestion on an internal list now, so that it won't be forgotten. Thanks for reminding!
Remember though that it might still not be possible to add the Event Handler, depending on the internal APIs and possible hooks. :)
RE: OnEvent_MyDisplayPictureChange Event Handler by CookieRevised on 01-19-2009 at 08:46 PM

quote:
Originally posted by mynetx
@SpunkyLoveMuff:
The file names are the originals from Messenger. Even if the picture is updated by the user (or by another script), the file name won't change, whereas if you compare the bytes, it is very unlikely that two different images have the same size.
Dunno if I understood you correctly, but the chance that two different DPs have the same filesize IS likely. So, this is not a good way to see if there is another DP.

The only foolproof method you have and need to implement is comparing the file hash with the hash of the previous DP (of that _same_ user; important!). In essence, comparing the file byte per byte...

A faster method would be to check the filechange date and time. Though this isn't as accurate as comparing byte per byte by the use of a hash (the datetime can be changed by the user using 3rd party software and other Windows APIs), it is maybe accurate enough in most cases.

;)
RE: RE: OnEvent_MyDisplayPictureChange Event Handler by XP1 on 01-20-2009 at 01:09 AM

quote:
Originally posted by mynetx
XP1,

I've put my suggestion on an internal list now, so that it won't be forgotten. Thanks for reminding!
Thanks.

quote:
Originally posted by CookieRevised
A faster method would be to check the filechange date and time. Though this isn't as accurate as comparing byte per byte by the use of a hash (the datetime can be changed by the user using 3rd party software and other Windows APIs), it is maybe accurate enough in most cases.
Yeah, this won't be accurate when someone zips up display pictures into an archive that strips away the date and time information. Thus, when the archive is extracted, all of the dates / times are re-set to the same current date / time (or pre-defined date / time set at archive creation).

Using file hashes is probably the best way to go.
RE: OnEvent_MyDisplayPictureChange Event Handler by mynetx on 01-20-2009 at 09:18 AM

I have thrown together a small demo script providing you the event handler OnEvent_MyDisplayPictureChange. Read the _main.js inside the script pack; it contains commented code so you see what it does. It works with the MD5 hash of the display picture.