summaryrefslogtreecommitdiff
path: root/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2013-04-04 19:00:03 +0000
committerKirill Volinsky <mataes2007@gmail.com>2013-04-04 19:00:03 +0000
commitc814aae8a9ba7f85996792b9c283fcd6605e11ff (patch)
tree480da7d4b69ba386c28dbe717105d741df8f85eb /plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp
parent5729f9c9a82d120cfd4a7eeb8b7297ac52a8332b (diff)
added support of all accounts (not only icq and jabber)
not use atl can play mp3 and others (bass_interface.dll required) plugin settings moved to options added relative path support git-svn-id: http://svn.miranda-ng.org/main/trunk@4306 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp')
-rw-r--r--plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp70
1 files changed, 0 insertions, 70 deletions
diff --git a/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp b/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp
deleted file mode 100644
index d7fca9638f..0000000000
--- a/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp
+++ /dev/null
@@ -1,70 +0,0 @@
-#include "Common.h"
-
-SoundNotifyDataStorage::SoundNotifyDataStorage()
-{
-
-}
-
-void SoundNotifyDataStorage::init()
-{
- initModuleConvertTable(_moduleTable);
- registerProtocols();
-
- HANDLE contact = (HANDLE)CallService(MS_DB_CONTACT_FINDFIRST,0,0);
- for(; contact; contact = (HANDLE)CallService(MS_DB_CONTACT_FINDNEXT,(WPARAM)contact,0))
- {
- try
- {
- addContact(contact);
- }
- catch (...)
- {
- // log
- }
- }
-}
-
-void SoundNotifyDataStorage::commit()
-{
- for (auto it = _protocolTable.begin(), end = _protocolTable.end(); it != end; ++it)
- for (auto user = it->second.begin(), userEnd = it->second.end(); user != userEnd; ++user)
- if (user->second->isSoundChanged())
- {
- if (user->second->soundPath().empty())
- DBDeleteContactSetting(user->second->contact(), XSN_ModuleInfo::name(), XSN_ModuleInfo::soundSetting());
- else
- DBWriteContactSettingTString(user->second->contact(), XSN_ModuleInfo::name(), XSN_ModuleInfo::soundSetting(), user->second->soundPath().c_str());
- }
-}
-
-void SoundNotifyDataStorage::addContact(HANDLE contact)
-{
- ModuleString module = getContactModule(contact);
- ProtocolString proto = _moduleTable[module];
- std::tstring user = getContactId(contact, module, proto);
- if (user.empty())
- return ;
-
- XSN_Variant sound;
- DBGetContactSettingTString(contact, XSN_ModuleInfo::name(), XSN_ModuleInfo::soundSetting(), &sound);
- _protocolTable[proto][user] = SoundNotifyDataPtr(new SoundNotifyData(contact, module, sound.toString()));
-}
-
-std::tstring SoundNotifyDataStorage::getContactId(HANDLE contact, const ModuleString &module, const ProtocolString &proto)
-{
- auto it = _registeredProtocols.find(proto);
- if (it == _registeredProtocols.end())
- return std::tstring();
- return it->second(contact, module);
-}
-
-ProtocolTable & SoundNotifyDataStorage::getData()
-{
- return _protocolTable;
-}
-
-void SoundNotifyDataStorage::registerProtocols()
-{
- _registeredProtocols["ICQ"] = &getIcqContactId;
- _registeredProtocols["JABBER"] = &getJabberContactId;
-}