Forget about checking the files, XML, etc...
You should not check the files, instead you should check the registry for the sound names.
----
The files aren't saved with the name of the sound but with their ID, so if you check on the files you also need to process the contents of each sound and read out the MP3 id tags. This is waaaaay too much work and can take a long time, and it's a very very long way of doing things
Simply check the registry. In this way, you also would be certain that you check the correct library, since a sound library can be private and it can be global. Also, you would only check the sounds of your current Messenger-account, not the account of someone else. And finally, the same for sounds which you have in your library but not physically on disc (anymore). Those wouldn't have been found if you just checked the files.
Bottom line:
1) First you need to check for the regisrty key
SoundsPrivateDB in the user's registry settings:
HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\user's email\Preferences
If the DWORD value of this key is set to
1, then go to step 3
2) The user has a global/shared sound library. So you need to enumerate all the sounds found in:
HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\GlobalSettings\CustSounds
Proceed to step 4
3) The user has a private sound library. So you need to enumerate all the sounds found in:
HKEY_CURRENT_USER\Software\Patchou\Messenger Plus! Live\user's email\CustSounds
4) Enumerate all the sounds.
This means you need to read every subkey (You need to do this using the Windows registry APIs or using the WMI object type library (a bit easier), this can not be done using the standard or build-in methods).
The subkey's name is the ID of the sound.
Within this subkey you find a registry key named "
Name".
It is this registry key which you need to read out and compare with the text you have recieved from your contacts.
Remember that just a part of the name is already enough for Plus! to find the sound. But it must be at least 2 characters long.
So if your contact has send "bingo" and you have a sound named "this is the bingo song", you would have a match. (The last match encountered will be played, unless there is somewhere a full match).
Eg: you have sounds with the names (encountered in this order in the registry (not the sound library window, that doesn't matter)):
"bongabonga song"
"Bingo"
"This is the bingo song"
If the user sends "bingo" then the sound named "Bingo" must be send by its ID. Because although it is part of the name of the last sound encountered, it is the full name of the second sound, and that takes priority.
If the user sends "song" then the sound named "This is the bingo song" must be send by its ID. Because it is the last sound which has bingo as part of its name.
Either use that method (sending sounds by ID), or... let the matching be done by Plus! itself and only check if the text recieved is somewhere in any of the "Name" keys of the sounds, if so, send the sound by using the /sound command and using the text recieved from the contact....
5) Determine if you found a match or not and execute the /sound command.... BUT,
always first check if you can actually send something back to the chat window with
ChatWnd::EditChangeAllowed. This is very often forgotten when using
SendMessage, but it is very important.