From 89c5b2369413025e1fe7dfe5c5d0bf3bedd8558d Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Mon, 23 Jul 2012 13:52:57 +0000 Subject: git-svn-id: http://svn.miranda-ng.org/main/trunk@1123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/XSoundNotify/DebugLogger.hpp | 91 ------------- plugins/XSoundNotify/EventProcessor.cpp | 84 ------------ plugins/XSoundNotify/EventProcessor.h | 27 ---- plugins/XSoundNotify/README | 1 - plugins/XSoundNotify/SettingsDialog.cpp | 124 ------------------ plugins/XSoundNotify/SettingsDialog.h | 60 --------- plugins/XSoundNotify/SoundNotifyData.cpp | 37 ------ plugins/XSoundNotify/SoundNotifyData.h | 33 ----- plugins/XSoundNotify/SoundNotifyDataStorage.cpp | 74 ----------- plugins/XSoundNotify/SoundNotifyDataStorage.h | 34 ----- plugins/XSoundNotify/XSoundNotify.rc | Bin 5494 -> 0 bytes plugins/XSoundNotify/resource.h | Bin 1556 -> 0 bytes plugins/XSoundNotify/testplug.vcxproj | 167 ------------------------ plugins/XSoundNotify/xsn_main.cpp | 122 ----------------- plugins/XSoundNotify/xsn_types.cpp | 32 ----- plugins/XSoundNotify/xsn_types.h | 33 ----- plugins/XSoundNotify/xsn_utils.cpp | 60 --------- plugins/XSoundNotify/xsn_utils.h | 18 --- 18 files changed, 997 deletions(-) delete mode 100644 plugins/XSoundNotify/DebugLogger.hpp delete mode 100644 plugins/XSoundNotify/EventProcessor.cpp delete mode 100644 plugins/XSoundNotify/EventProcessor.h delete mode 100644 plugins/XSoundNotify/README delete mode 100644 plugins/XSoundNotify/SettingsDialog.cpp delete mode 100644 plugins/XSoundNotify/SettingsDialog.h delete mode 100644 plugins/XSoundNotify/SoundNotifyData.cpp delete mode 100644 plugins/XSoundNotify/SoundNotifyData.h delete mode 100644 plugins/XSoundNotify/SoundNotifyDataStorage.cpp delete mode 100644 plugins/XSoundNotify/SoundNotifyDataStorage.h delete mode 100644 plugins/XSoundNotify/XSoundNotify.rc delete mode 100644 plugins/XSoundNotify/resource.h delete mode 100644 plugins/XSoundNotify/testplug.vcxproj delete mode 100644 plugins/XSoundNotify/xsn_main.cpp delete mode 100644 plugins/XSoundNotify/xsn_types.cpp delete mode 100644 plugins/XSoundNotify/xsn_types.h delete mode 100644 plugins/XSoundNotify/xsn_utils.cpp delete mode 100644 plugins/XSoundNotify/xsn_utils.h (limited to 'plugins/XSoundNotify') diff --git a/plugins/XSoundNotify/DebugLogger.hpp b/plugins/XSoundNotify/DebugLogger.hpp deleted file mode 100644 index 3b2c5a5fc1..0000000000 --- a/plugins/XSoundNotify/DebugLogger.hpp +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef _GRS_DEBUG_LOGGER_H -#define _GRS_DEBUG_LOGGER_H - -#include -#include -#include -#include - -/** - * Простой логгер, который можно использовать в любом месте для вывода отладочной информации - * При выводе обычного сообщения надо использовать макрос GRS_DEBUG_LOG - * Для вывода сложного сообщения с использованием операторов ввода/вывода макрос GRS_DEBUG_FORMAT_LOG - * Лог сохраняется в рабочем каталоге под именем : grs_debug.log - */ - -namespace grs -{ - -class DebugLogger -{ -public: - class Except : public std::exception - { - public: - virtual const char * what() const throw() { return "pizda rulu"; } - }; - - DebugLogger() - { - try - { - _strm.open("D:\\grs_debug.log", std::ios::app); - } - catch (...) - { - throw Except(); - } - if (!_strm.is_open()) - throw Except(); - - log("Logger started"); - } - - void log(const std::string & str, const char * fileStr = 0, int line = 0) - { - if (!_strm.is_open()) - return ; - - time_t t(time(0)); - struct tm * timeinfo; - timeinfo = localtime (&t); - char timeStr[9]; - strftime (timeStr, 9, "%H:%M:%S", timeinfo); - _strm << "[" << timeStr << "] "; - if (fileStr) - _strm << fileStr << ":" << line<<" "; - _strm <<"# "<< str << std::endl; - } - - static DebugLogger * instance() - { - //static DebugLogger * logger = 0; - static std::auto_ptr loggerPtr; - if (loggerPtr.get() == 0) - loggerPtr.reset(new DebugLogger()); - return loggerPtr.get(); - } - -private: - std::ofstream _strm; -}; - -} - -#define GRS_DEBUG_FORMAT_LOG(data) {\ - grs::DebugLogger * l = grs::DebugLogger::instance();\ - if (l != 0) \ - {\ - std::stringstream strm;\ - strm << data;\ - l->log(strm.str(), __FILE__, __LINE__);\ - }\ - } - -#define GRS_DEBUG_LOG(data) {\ - grs::DebugLogger * l = grs::DebugLogger::instance();\ - if (l != 0)\ - l->log(data, __FILE__, __LINE__);\ - } - -#endif diff --git a/plugins/XSoundNotify/EventProcessor.cpp b/plugins/XSoundNotify/EventProcessor.cpp deleted file mode 100644 index 6a97b6b125..0000000000 --- a/plugins/XSoundNotify/EventProcessor.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "EventProcessor.h" -#include -#include "m_protocols.h" -#include -#include "DebugLogger.hpp" - -// static area - -static std::unique_ptr XSN_EventProcessorPtr; - -void XSN_EventProcessor::make(PLUGINLINK * pl) -{ - XSN_EventProcessorPtr.reset(new XSN_EventProcessor(pl)); -} - -XSN_EventProcessor & XSN_EventProcessor::instance() -{ - return *XSN_EventProcessorPtr; -} - -// class methods - -XSN_EventProcessor::XSN_EventProcessor(PLUGINLINK * pl) : pluginLink(pl) -{ - -} - -void XSN_EventProcessor::process(WPARAM wParam, LPARAM lParam) -{ - if (!wParam || !lParam || !isReceiveMessage(lParam)) - return ; - try - { - MessageBox(0, "Receive message", "INFO", MB_OK); - /*GRS_DEBUG_LOG("Receive message"); - HANDLE contact = (HANDLE)wParam; - MessageBox(0, "Get protocol", "INFO", MB_OK); - GRS_DEBUG_LOG("Protocol : "); - xsn_string proto = getProtocol(wParam); - MessageBox(0, "Protocol is", proto.c_str(), MB_OK); - GRS_DEBUG_FORMAT_LOG(proto) - //xsn_string nick = getNick(wParam, proto.c_str()); - XSN_Variant sound; - DBGetContactSettingTString(contact, proto.c_str(), "XSNPlugin_sound", &sound); - if (!sound.empty()) - { - GRS_DEBUG_LOG("Sound for user exist"); - GRS_DEBUG_FORMAT_LOG("Playing sound : " << sound.ptszVal << ", for user : " << getNick(wParam, proto.c_str())); - PlaySound(sound.toString().c_str(), nullptr, SND_FILENAME | SND_ASYNC); - }*/ - } - catch (std::runtime_error &) - { - //MessageBoxA(0, e.what(), "Runtime error", MB_OK); - } - catch (...) - { - //MessageBoxA(0, "Unknown error occured", "Exception", MB_OK); - } -} - -bool XSN_EventProcessor::isReceiveMessage(LPARAM event) -{ - DBEVENTINFO info ={ sizeof(info) }; - CallService(MS_DB_EVENT_GET, event, (LPARAM)&info); - - // TODO : rec msg flag : 16, send msg flag : 18 - WTF? - // return (info.eventType == EVENTTYPE_MESSAGE) && (info.flags & DBEF_READ); - // It's condition work well - magic? - return !(((info.eventType != EVENTTYPE_MESSAGE) && !(info.flags & DBEF_READ)) || (info.flags & DBEF_SENT)); -} - -xsn_string XSN_EventProcessor::getProtocol(WPARAM contact) -{ - char *pszProto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, contact, 0); - return xsn_string(pszProto); -} - -xsn_string XSN_EventProcessor::getNick(WPARAM contact, LPCTSTR protocol) -{ - XSN_Variant nick; - DBGetContactSettingTString((HANDLE)contact, protocol, "Nick", &nick); - return nick.toString(); -} diff --git a/plugins/XSoundNotify/EventProcessor.h b/plugins/XSoundNotify/EventProcessor.h deleted file mode 100644 index 6de14f8f98..0000000000 --- a/plugins/XSoundNotify/EventProcessor.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef __XSN_EVENT_PROCESSOR -#define __XSN_EVENT_PROCESSOR - -#include -#include "xsn_types.h" -#include - - -class XSN_EventProcessor -{ -public: - static void make(PLUGINLINK * pl); - static XSN_EventProcessor & instance(); - - void process(WPARAM wParam, LPARAM lParam); - -protected: - XSN_EventProcessor(PLUGINLINK * pl); - - bool isReceiveMessage(LPARAM event); - xsn_string getProtocol(WPARAM contact); - xsn_string getNick(WPARAM contact, LPCTSTR protocol); - - PLUGINLINK * pluginLink; -}; - -#endif diff --git a/plugins/XSoundNotify/README b/plugins/XSoundNotify/README deleted file mode 100644 index d855b95460..0000000000 --- a/plugins/XSoundNotify/README +++ /dev/null @@ -1 +0,0 @@ -Choose release mode (debug mode not configured) and configure Visual Studio environment for boost and WTL libraries include/libs paths diff --git a/plugins/XSoundNotify/SettingsDialog.cpp b/plugins/XSoundNotify/SettingsDialog.cpp deleted file mode 100644 index 69b64d776f..0000000000 --- a/plugins/XSoundNotify/SettingsDialog.cpp +++ /dev/null @@ -1,124 +0,0 @@ -#include "SettingsDialog.h" -//#include "DebugLogger.hpp" - -template -T * GetComboBoxData(CComboBox & ctrl) -{ - return (T*)(ctrl.GetItemData(ctrl.GetCurSel())); -} - -SettingsDialog::SettingsDialog(SoundNotifyDataStorage & storage) : _dataStorage(storage) -{ - -} - -BOOL SettingsDialog::PreTranslateMessage(MSG* pMsg) -{ - return ::IsDialogMessage(m_hWnd, pMsg); -} - -LRESULT SettingsDialog::onInitDialog(UINT, WPARAM, LPARAM, BOOL&) -{ - _userCombo = GetDlgItem(IDC_COMBO_USERS); - _protoCombo = GetDlgItem(IDC_COMBO_PROTO); - _chooseButton = GetDlgItem(IDC_BUTTON_CHOOSE_SOUND); - _resetButton = GetDlgItem(IDC_BUTTON_RESET_SOUND); - _playButton = GetDlgItem(IDC_BUTTON_TEST_PLAY); - _soundLabel = GetDlgItem(IDC_LABEL_SOUND); - - auto & protocols = _dataStorage.getData(); - for (auto it = protocols.begin(), end = protocols.end(); it != end; ++it) - addProtocolItem(*it); - - _userCombo.EnableWindow(0); - GetDlgItem(IDC_BUTTON_CHOOSE_SOUND).EnableWindow(0); - GetDlgItem(IDC_BUTTON_RESET_SOUND).EnableWindow(0); - GetDlgItem(IDC_BUTTON_TEST_PLAY).EnableWindow(0); - return TRUE; -} - -LRESULT SettingsDialog::onOk(WORD, WORD wID, HWND, BOOL&) -{ - EndDialog(wID); - return 0; -} - -LRESULT SettingsDialog::onCancel(WORD, WORD wID, HWND, BOOL&) -{ - EndDialog(wID); - return 0; -} - -LRESULT SettingsDialog::onSelectProtocol(WORD, WORD, HWND, BOOL&) -{ - _userCombo.ResetContent(); - auto data = GetComboBoxData(_protoCombo); - for (auto it = data->second.begin(), end = data->second.end(); it != end; ++it) - { - int id = _userCombo.AddString(it->first.c_str()); - _userCombo.SetItemData(id, (DWORD_PTR)(&(*it))); - } - _userCombo.EnableWindow(TRUE); - _playButton.EnableWindow(FALSE); - _resetButton.EnableWindow(FALSE); - _chooseButton.EnableWindow(FALSE); - _soundLabel.SetWindowText(TEXT("")); - return 0; -} - -LRESULT SettingsDialog::onSelectUser(WORD, WORD, HWND, BOOL &) -{ - auto user = GetComboBoxData(_userCombo); - _chooseButton.EnableWindow(TRUE); - - BOOL soundSelected = !user->second->soundPath().empty(); - _resetButton.EnableWindow(soundSelected); - _playButton.EnableWindow(soundSelected); - setSoundLabelText(user->second->soundPath().c_str()); - - return 0; -} - -LRESULT SettingsDialog::onChooseSound(WORD, WORD, HWND , BOOL&) -{ - CFileDialog fileDlg(1, 0, 0, OFN_FILEMUSTEXIST, TEXT("WAV files\0*.wav\0\0")); - if (fileDlg.DoModal() != IDOK) - return 0; - - setSoundLabelText(fileDlg.m_szFileName); - auto user = GetComboBoxData(_userCombo); - user->second->setSound(xsn_string(fileDlg.m_szFileName)); - _resetButton.EnableWindow(TRUE); - _playButton.EnableWindow(TRUE); - return 0; -} - -LRESULT SettingsDialog::onResetSound(WORD, WORD wID, HWND , BOOL&) -{ - auto user = GetComboBoxData(_userCombo); - user->second->setSound(xsn_string()); - _resetButton.EnableWindow(FALSE); - _playButton.EnableWindow(FALSE); - _soundLabel.SetWindowText(TEXT("")); - return 0; -} - -LRESULT SettingsDialog::onTestPlay(WORD, WORD wID, HWND , BOOL&) -{ - auto user = GetComboBoxData(_userCombo); - PlaySound(user->second->soundPath().c_str(), nullptr, SND_FILENAME | SND_ASYNC); - return 0; -} - -void SettingsDialog::setSoundLabelText(LPCTSTR text) -{ - _soundLabel.SetWindowText(PathFindFileName(text)); -} - -void SettingsDialog::addProtocolItem(ProtocolTable::value_type & value) -{ - wchar_t protocol[30]; - mbstowcs(protocol, value.first.c_str(), 30); - int idx = _protoCombo.AddString(protocol); - _protoCombo.SetItemData(idx, (DWORD_PTR)(&value)); -} diff --git a/plugins/XSoundNotify/SettingsDialog.h b/plugins/XSoundNotify/SettingsDialog.h deleted file mode 100644 index c68503a6e8..0000000000 --- a/plugins/XSoundNotify/SettingsDialog.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef __XSN_SETTINGS_DIALOG_H -#define __XSN_SETTINGS_DIALOG_H - -#include -#include -#include -#include -#include -#include "resource.h" -#include "SoundNotifyDataStorage.h" - -class SettingsDialog : public CDialogImpl -{ -private: - CComboBox _userCombo; - CComboBox _protoCombo; - CButton _chooseButton; - CButton _resetButton; - CButton _playButton; - CStatic _soundLabel; - SoundNotifyDataStorage & _dataStorage; - -public: - SettingsDialog(SoundNotifyDataStorage & dataStorage); - virtual ~SettingsDialog() {} - static BOOL DlgProcCluiOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); - -public: - enum {IDD = IDD_DIALOG1}; - - BEGIN_MSG_MAP(SettingsDialog) - MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog) - COMMAND_HANDLER(IDC_COMBO_PROTO, CBN_SELCHANGE, onSelectProtocol) - COMMAND_HANDLER(IDC_COMBO_USERS, CBN_SELCHANGE, onSelectUser) - COMMAND_ID_HANDLER(IDOK, onOk) - COMMAND_ID_HANDLER(IDCANCEL, onCancel) - COMMAND_ID_HANDLER(IDC_BUTTON_CHOOSE_SOUND, onChooseSound) - COMMAND_ID_HANDLER(IDC_BUTTON_RESET_SOUND, onResetSound) - COMMAND_ID_HANDLER(IDC_BUTTON_TEST_PLAY, onTestPlay) - END_MSG_MAP() - - virtual BOOL PreTranslateMessage(MSG* pMsg); - -protected: - LRESULT onInitDialog(UINT, WPARAM, LPARAM, BOOL&); - - LRESULT onOk(WORD, WORD, HWND, BOOL&); - LRESULT onCancel(WORD, WORD, HWND, BOOL &); - LRESULT onSelectProtocol(WORD, WORD, HWND, BOOL&); - LRESULT onSelectUser(WORD, WORD, HWND, BOOL &); - LRESULT onChooseSound(WORD, WORD, HWND , BOOL&); - LRESULT onResetSound(WORD, WORD, HWND , BOOL&); - LRESULT onTestPlay(WORD, WORD, HWND , BOOL&); - - void addProtocolItem(ProtocolTable::value_type & value); - - void setSoundLabelText(LPCTSTR text); -}; - -#endif diff --git a/plugins/XSoundNotify/SoundNotifyData.cpp b/plugins/XSoundNotify/SoundNotifyData.cpp deleted file mode 100644 index 1876db6ba0..0000000000 --- a/plugins/XSoundNotify/SoundNotifyData.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "SoundNotifyData.h" - -SoundNotifyData::SoundNotifyData() : _contact(0), _soundChanged(false) -{ - -} - -SoundNotifyData::SoundNotifyData(HANDLE contact, const ModuleString & module, const xsn_string & sound) : - _contact(contact), _soundPath(sound), _soundChanged(false) -{ -} - -void SoundNotifyData::setSound(const xsn_string & sound) -{ - _soundChanged = true; - _soundPath = sound; -} - -HANDLE SoundNotifyData::contact() const -{ - return _contact; -} - -const xsn_string & SoundNotifyData::soundPath() const -{ - return _soundPath; -} - -const ModuleString & SoundNotifyData::module() const -{ - return _module; -} - -bool SoundNotifyData::isSoundChanged() const -{ - return _soundChanged; -} diff --git a/plugins/XSoundNotify/SoundNotifyData.h b/plugins/XSoundNotify/SoundNotifyData.h deleted file mode 100644 index 18cb4844a4..0000000000 --- a/plugins/XSoundNotify/SoundNotifyData.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XSN_DATA_H -#define __XSN_DATA_H - -#include -#include "xsn_types.h" -#include - -class SoundNotifyData -{ -public: - SoundNotifyData(); - SoundNotifyData(HANDLE contact, const ModuleString & module, const xsn_string & sound); - - void setSound(const xsn_string & sound); - - HANDLE contact() const; - const xsn_string & soundPath() const; - const ModuleString & module() const; - bool isSoundChanged() const; - -private: - HANDLE _contact; - ModuleString _module; - xsn_string _soundPath; - bool _soundChanged; -}; -typedef std::shared_ptr SoundNotifyDataPtr; - -typedef std::unordered_map UserDataTable; -typedef std::unordered_map ProtocolTable; -typedef std::unordered_map ModuleConvertTable; - -#endif 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 -#include -#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; -} diff --git a/plugins/XSoundNotify/SoundNotifyDataStorage.h b/plugins/XSoundNotify/SoundNotifyDataStorage.h deleted file mode 100644 index 7dbf03c494..0000000000 --- a/plugins/XSoundNotify/SoundNotifyDataStorage.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef _XSN_DATA_STORAGE -#define _XSN_DATA_STORAGE - -#include "SoundNotifyData.h" -#include -#include - -class SoundNotifyDataStorage -{ -public: - SoundNotifyDataStorage(PLUGINLINK * pl); - - void init(); - void commit(); - - ProtocolTable & getData(); - -protected: - void addContact(HANDLE contact); - xsn_string getContactId(HANDLE contact, const ModuleString & module, const ProtocolString & proto); - void registerProtocols(); - -private: - PLUGINLINK * pluginLink; - - ProtocolTable _protocolTable; - ModuleConvertTable _moduleTable; - - typedef boost::function getContactIdFunc; - typedef std::unordered_map RegisteredProtocols; - RegisteredProtocols _registeredProtocols; -}; - -#endif diff --git a/plugins/XSoundNotify/XSoundNotify.rc b/plugins/XSoundNotify/XSoundNotify.rc deleted file mode 100644 index ab42834a08..0000000000 Binary files a/plugins/XSoundNotify/XSoundNotify.rc and /dev/null differ diff --git a/plugins/XSoundNotify/resource.h b/plugins/XSoundNotify/resource.h deleted file mode 100644 index fcd39e7cf3..0000000000 Binary files a/plugins/XSoundNotify/resource.h and /dev/null differ diff --git a/plugins/XSoundNotify/testplug.vcxproj b/plugins/XSoundNotify/testplug.vcxproj deleted file mode 100644 index ebd0a0009f..0000000000 --- a/plugins/XSoundNotify/testplug.vcxproj +++ /dev/null @@ -1,167 +0,0 @@ -п»ї - - - - Debug - Win32 - - - Release - Win32 - - - - - - XSoundNotify - - - - DynamicLibrary - false - MultiByte - - - DynamicLibrary - false - Unicode - - - - - - - - - - - - - - - .\Release\ - .\Release\ - false - E:\Programming\libs\WTL\Include;$(IncludePath) - - - .\Debug\ - .\Debug\ - true - - - - MultiThreaded - OnlyExplicitInline - true - true - MaxSpeed - true - Level3 - e:\Programming\libs\boost_1_46_1\;../../include;%(AdditionalIncludeDirectories) - _CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;%(PreprocessorDefinitions) - .\Release\ - .\Release\testplug.pch - .\Release\ - .\Release\ - - - true - NDEBUG;%(PreprocessorDefinitions) - .\Release\testplug.tlb - true - Win32 - - - 0x0809 - NDEBUG;%(PreprocessorDefinitions) - - - true - .\Release\testplug.bsc - - - true - true - Console - release/xsoundnotify.dll - .\Release\testplug.lib - odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) - e:\Programming\libs\wxWidgets-2.9.3\lib\vc_lib\;%(AdditionalLibraryDirectories) - - - - - MultiThreadedDebug - Default - false - Disabled - true - Level3 - true - EditAndContinue - e:\Programming\libs\wxWidgets-2.9.3\include\msvc\;e:\Programming\libs\wxWidgets-2.9.3\include\;../../include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;XSOUNDNOTIFY_EXPORTS;%(PreprocessorDefinitions) - .\Debug\ - .\Debug\testplug.pch - .\Debug\ - .\Debug\ - EnableFastChecks - - - true - _DEBUG;%(PreprocessorDefinitions) - .\Debug\testplug.tlb - true - Win32 - - - 0x0809 - _DEBUG;%(PreprocessorDefinitions) - - - true - .\Debug\testplug.bsc - - - true - true - true - Console - .\Debug\xsoundnotify.dll - .\Debug\xsoundnotify.lib - wxmsw29u_adv.lib;wxmsw29u_core.lib;wxbase29u.lib;wxtiff.lib;wxjpeg.lib;wxpng.lib;wxzlib.lib;wxregexu.lib;wxexpat.lib;odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies) - - - e:\Programming\libs\wxWidgets-2.9.3\lib\vc_lib\;%(AdditionalLibraryDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/plugins/XSoundNotify/xsn_main.cpp b/plugins/XSoundNotify/xsn_main.cpp deleted file mode 100644 index ebcf029143..0000000000 --- a/plugins/XSoundNotify/xsn_main.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* -Miranda plugin template, originally by Richard Hughes -http://miranda-icq.sourceforge.net/ - -This file is placed in the public domain. Anybody is free to use or -modify it as they wish with no restriction. -There is no warranty. -*/ - -#include "SettingsDialog.h" - -#include -#include -#include -#include -#include -#include -#include -#include "xsn_utils.h" -//#include "DebugLogger.hpp" - -HINSTANCE hInst; -PLUGINLINK *pluginLink; -HANDLE AddEventHook; - -PLUGININFOEX pluginInfo = { - sizeof(PLUGININFOEX), // Размер стуктуры - "XSoundNotify", // Короткое имя плагинв - PLUGIN_MAKE_VERSION(1,0,0,0), // Версия плагина - "Provides extended options for sound notifications", // Описание плагина - "Roman Torsten", // Автор - "rs_torsten-public@yahoo.com", // Адресс автора - "© 2011 Copyright", // Копирайт - "https://plus.google.com/117081718640940130539", // Адресс сайта разработчика плагина - 0, - 0, - {0x8b86253, 0xec6e, 0x4d09, { 0xb7, 0xa9, 0x64, 0xac, 0xdf, 0x6, 0x27, 0xb8 }} //{08B86253-EC6E-4d09-B7A9-64ACDF0627B8} -}; - -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) -{ - hInst = hinstDLL; - return TRUE; -} - -static int PluginMenuCommand(WPARAM wParam,LPARAM lParam) -{ - try - { - SoundNotifyDataStorage storage(pluginLink); - storage.init(); - SettingsDialog dlg(storage); - if (dlg.DoModal() == IDOK) - storage.commit(); - } - catch (...) - { - MessageBox(0, TEXT("Unknown error occured while configuring"), TEXT("XSoundNotify Error"), MB_OK | MB_ICONERROR); - } - - return 0; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -extern "C" __declspec(dllexport) const MUUID interfaces[] = {MIID_TESTPLUGIN, MIID_LAST}; -extern "C" __declspec(dllexport) const MUUID* MirandaPluginInterfaces(void) -{ - return interfaces; -} - -INT processEvent(WPARAM wParam, LPARAM lParam) -{ - try - { - if (!isReceiveMessage(lParam)) - return 0; - - xsn_string sound = getContactSound((HANDLE)wParam); - if (!sound.empty()) - PlaySound(sound.c_str(), nullptr, SND_ASYNC | SND_FILENAME); - } - catch (std::exception & ) - { - // log - } - catch (...) - { - // log - } - - return 0; -} - -extern "C" int __declspec(dllexport) Load(PLUGINLINK *link) -{ - CLISTMENUITEM mi; - - pluginLink=link; - CreateServiceFunction("XSoundNotify/MenuCommand", PluginMenuCommand); - ZeroMemory(&mi,sizeof(mi)); - mi.cbSize=sizeof(mi); - mi.position=-0x7FFFFFFF; - mi.flags=0; - mi.hIcon=LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - mi.pszName=LPGEN("&XSoundNotify Plugin"); - mi.pszService="XSoundNotify/MenuCommand"; - CallService(MS_CLIST_ADDMAINMENUITEM,0,(LPARAM)&mi); - AddEventHook = HookEvent(ME_DB_EVENT_ADDED, processEvent); - - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - UnhookEvent(AddEventHook); - return 0; -} - diff --git a/plugins/XSoundNotify/xsn_types.cpp b/plugins/XSoundNotify/xsn_types.cpp deleted file mode 100644 index da0cc5b3f9..0000000000 --- a/plugins/XSoundNotify/xsn_types.cpp +++ /dev/null @@ -1,32 +0,0 @@ -#include "xsn_types.h" - -XSN_Variant::XSN_Variant() -{ - ptszVal = nullptr; -} - -XSN_Variant::~XSN_Variant() -{ - if (ptszVal) - DBFreeVariant(this); -} - -xsn_string XSN_Variant::toString() const -{ - return ptszVal == nullptr ? xsn_string() : xsn_string(ptszVal); -} - -bool XSN_Variant::empty() const -{ - return ptszVal == nullptr; -} - -const char * XSN_ModuleInfo::name() -{ - return "XSoundNotify"; -} - -const char * XSN_ModuleInfo::soundSetting() -{ - return "XSNPlugin_sound"; -} diff --git a/plugins/XSoundNotify/xsn_types.h b/plugins/XSoundNotify/xsn_types.h deleted file mode 100644 index 43f4434fea..0000000000 --- a/plugins/XSoundNotify/xsn_types.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __XSN_TYPES -#define __XSN_TYPES - -#include -#include -#include -#include - -#ifndef UNICODE - typedef std::string xsn_string; -#else - typedef std::wstring xsn_string; -#endif - -typedef std::string ModuleString; -typedef std::string ProtocolString; - -struct XSN_Variant : DBVARIANT -{ - XSN_Variant(); - ~XSN_Variant(); - - xsn_string toString() const; - bool empty() const; -}; - -struct XSN_ModuleInfo -{ - static const char * name(); - static const char * soundSetting(); -}; - -#endif diff --git a/plugins/XSoundNotify/xsn_utils.cpp b/plugins/XSoundNotify/xsn_utils.cpp deleted file mode 100644 index d597776e8d..0000000000 --- a/plugins/XSoundNotify/xsn_utils.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include "xsn_utils.h" -#include -#include - -void initModuleConvertTable(ModuleConvertTable & table) -{ - int number = 0; - // may be need to free PROTOACCOUNT, but did't found information about it - PROTOACCOUNT ** accounts; - ProtoEnumAccounts(&number, &accounts); - for (int i = 0; i < number; ++i) - table[ModuleString(accounts[i]->szModuleName)] = ProtocolString(accounts[i]->szProtoName); -} - -bool isReceiveMessage(LPARAM event) -{ - DBEVENTINFO info = { sizeof(info) }; - CallService(MS_DB_EVENT_GET, event, (LPARAM)&info); - // i don't understand why it works and how it works, but it works correctly - practice way (методом тыка) - // so, i think correct condition would be : eventType == EVENTTYPE_MESSAGE && info.flags & DBEF_READ, but it really isn't - return !(((info.eventType != EVENTTYPE_MESSAGE) && !(info.flags & DBEF_READ)) || (info.flags & DBEF_SENT)); -} - -xsn_string getContactSound(HANDLE contact) -{ - XSN_Variant sound; - DBGetContactSettingTString(contact, XSN_ModuleInfo::name(), XSN_ModuleInfo::soundSetting(), &sound); - return sound.toString(); -} - -ModuleString getContactModule(HANDLE contact) -{ - char * proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)contact, 0); - if (proto == nullptr) - throw std::runtime_error("MS_PROTO_GETCONTACTBASEPROTO failed"); - return ModuleString(proto); -} - -xsn_string getIcqContactId(HANDLE contact, const ModuleString & module) -{ - XSN_Variant nick; - DBGetContactSettingTString(contact, module.c_str(), "CustomNick", &nick); - if (nick.empty()) - DBGetContactSettingTString(contact, module.c_str(), "Nick", &nick); - DWORD uin = DBGetContactSettingDword(contact, module.c_str(), "UIN", 0); - xsn_string uinStr = boost::lexical_cast(uin); - if (nick.empty()) - return uinStr; - return nick.toString() + TEXT(" (") + uinStr + TEXT(")"); -} - -xsn_string getJabberContactId(HANDLE contact, const ModuleString & module) -{ - XSN_Variant jid, nick; - DBGetContactSettingTString(contact, module.c_str(), "jid", &jid); - DBGetContactSettingTString(contact, "CList", "MyHandle", &nick); - if (nick.empty()) - return jid.toString(); - return nick.toString() + TEXT(" (") + jid.toString() + TEXT(")"); -} diff --git a/plugins/XSoundNotify/xsn_utils.h b/plugins/XSoundNotify/xsn_utils.h deleted file mode 100644 index 66bdef2526..0000000000 --- a/plugins/XSoundNotify/xsn_utils.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef _XSN_UTILS_H -#define _XSN_UTILS_H - -#include "xsn_types.h" -#include "SoundNotifyData.h" - -void initModuleConvertTable(ModuleConvertTable & table); - -bool isReceiveMessage(LPARAM event); - -xsn_string getContactSound(HANDLE contact); -ModuleString getContactModule(HANDLE contact); - -xsn_string getIcqContactId(HANDLE contact, const ModuleString & module); -xsn_string getJabberContactId(HANDLE contact, const ModuleString & module); - - -#endif -- cgit v1.2.3