diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-23 13:52:57 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2012-07-23 13:52:57 +0000 |
commit | 89c5b2369413025e1fe7dfe5c5d0bf3bedd8558d (patch) | |
tree | 18f09394ce3b811e3df7d15de747e842000bd4ad /plugins/XSoundNotify/SoundNotifyDataStorage.cpp | |
parent | a9580df150d799246eaecbf3c1fb5cecf9f8ab49 (diff) |
git-svn-id: http://svn.miranda-ng.org/main/trunk@1123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/XSoundNotify/SoundNotifyDataStorage.cpp')
-rw-r--r-- | plugins/XSoundNotify/SoundNotifyDataStorage.cpp | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/plugins/XSoundNotify/SoundNotifyDataStorage.cpp b/plugins/XSoundNotify/SoundNotifyDataStorage.cpp deleted file mode 100644 index bd1b90df52..0000000000 --- a/plugins/XSoundNotify/SoundNotifyDataStorage.cpp +++ /dev/null @@ -1,74 +0,0 @@ -#include "SoundNotifyDataStorage.h"
-#include <m_database.h>
-#include <m_protocols.h>
-#include "xsn_utils.h"
-//#include "DebugLogger.hpp"
-
-SoundNotifyDataStorage::SoundNotifyDataStorage(PLUGINLINK * pl) : pluginLink(pl)
-{
-
-}
-
-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];
- xsn_string 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()));
-}
-
-xsn_string SoundNotifyDataStorage::getContactId(HANDLE contact, const ModuleString & module, const ProtocolString & proto)
-{
- auto it = _registeredProtocols.find(proto);
- if (it == _registeredProtocols.end())
- return xsn_string();
- return it->second(contact, module);
-}
-
-ProtocolTable & SoundNotifyDataStorage::getData()
-{
- return _protocolTable;
-}
-
-void SoundNotifyDataStorage::registerProtocols()
-{
- _registeredProtocols["ICQ"] = &getIcqContactId;
- _registeredProtocols["JABBER"] = &getJabberContactId;
-}
|