summaryrefslogtreecommitdiff
path: root/plugins/XSoundNotify
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-07-23 13:52:57 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-07-23 13:52:57 +0000
commit89c5b2369413025e1fe7dfe5c5d0bf3bedd8558d (patch)
tree18f09394ce3b811e3df7d15de747e842000bd4ad /plugins/XSoundNotify
parenta9580df150d799246eaecbf3c1fb5cecf9f8ab49 (diff)
git-svn-id: http://svn.miranda-ng.org/main/trunk@1123 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/XSoundNotify')
-rw-r--r--plugins/XSoundNotify/DebugLogger.hpp91
-rw-r--r--plugins/XSoundNotify/EventProcessor.cpp84
-rw-r--r--plugins/XSoundNotify/EventProcessor.h27
-rw-r--r--plugins/XSoundNotify/README1
-rw-r--r--plugins/XSoundNotify/SettingsDialog.cpp124
-rw-r--r--plugins/XSoundNotify/SettingsDialog.h60
-rw-r--r--plugins/XSoundNotify/SoundNotifyData.cpp37
-rw-r--r--plugins/XSoundNotify/SoundNotifyData.h33
-rw-r--r--plugins/XSoundNotify/SoundNotifyDataStorage.cpp74
-rw-r--r--plugins/XSoundNotify/SoundNotifyDataStorage.h34
-rw-r--r--plugins/XSoundNotify/XSoundNotify.rcbin5494 -> 0 bytes
-rw-r--r--plugins/XSoundNotify/resource.hbin1556 -> 0 bytes
-rw-r--r--plugins/XSoundNotify/testplug.vcxproj167
-rw-r--r--plugins/XSoundNotify/xsn_main.cpp122
-rw-r--r--plugins/XSoundNotify/xsn_types.cpp32
-rw-r--r--plugins/XSoundNotify/xsn_types.h33
-rw-r--r--plugins/XSoundNotify/xsn_utils.cpp60
-rw-r--r--plugins/XSoundNotify/xsn_utils.h18
18 files changed, 0 insertions, 997 deletions
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 <fstream>
-#include <sstream>
-#include <ctime>
-#include <memory>
-
-/**
- * Простой логгер, который можно использовать в любом месте для вывода отладочной информации
- * При выводе обычного сообщения надо использовать макрос 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<DebugLogger> 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 <m_database.h>
-#include "m_protocols.h"
-#include <memory>
-#include "DebugLogger.hpp"
-
-// static area
-
-static std::unique_ptr<XSN_EventProcessor> 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 <windows.h>
-#include "xsn_types.h"
-#include <newpluginapi.h>
-
-
-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 <typename T>
-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<ProtocolTable::value_type>(_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<UserDataTable::value_type>(_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<UserDataTable::value_type>(_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<UserDataTable::value_type>(_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<UserDataTable::value_type>(_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 <atlbase.h>
-#include <atlwin.h>
-#include <atlapp.h>
-#include <atlctrls.h>
-#include <atldlgs.h>
-#include "resource.h"
-#include "SoundNotifyDataStorage.h"
-
-class SettingsDialog : public CDialogImpl<SettingsDialog>
-{
-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 <unordered_map>
-#include "xsn_types.h"
-#include <windows.h>
-
-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<SoundNotifyData> SoundNotifyDataPtr;
-
-typedef std::unordered_map<xsn_string, SoundNotifyDataPtr> UserDataTable;
-typedef std::unordered_map<ProtocolString, UserDataTable> ProtocolTable;
-typedef std::unordered_map<ModuleString, ProtocolString> 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 <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;
-}
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 <newpluginapi.h>
-#include <boost/function.hpp>
-
-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<xsn_string (HANDLE contact, const ModuleString & module)> getContactIdFunc;
- typedef std::unordered_map<ProtocolString, getContactIdFunc> RegisteredProtocols;
- RegisteredProtocols _registeredProtocols;
-};
-
-#endif
diff --git a/plugins/XSoundNotify/XSoundNotify.rc b/plugins/XSoundNotify/XSoundNotify.rc
deleted file mode 100644
index ab42834a08..0000000000
--- a/plugins/XSoundNotify/XSoundNotify.rc
+++ /dev/null
Binary files differ
diff --git a/plugins/XSoundNotify/resource.h b/plugins/XSoundNotify/resource.h
deleted file mode 100644
index fcd39e7cf3..0000000000
--- a/plugins/XSoundNotify/resource.h
+++ /dev/null
Binary files 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 @@
-п»ї<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <SccProjectName />
- <SccLocalPath />
- <ProjectName>XSoundNotify</ProjectName>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseOfMfc>false</UseOfMfc>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- <Import Project="$(VCTargetsPath)Microsoft.Cpp.UpgradeFromVC60.props" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>.\Release\</OutDir>
- <IntDir>.\Release\</IntDir>
- <LinkIncremental>false</LinkIncremental>
- <IncludePath>E:\Programming\libs\WTL\Include;$(IncludePath)</IncludePath>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>.\Debug\</OutDir>
- <IntDir>.\Debug\</IntDir>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
- <StringPooling>true</StringPooling>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <Optimization>MaxSpeed</Optimization>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <WarningLevel>Level3</WarningLevel>
- <AdditionalIncludeDirectories>e:\Programming\libs\boost_1_46_1\;../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;TESTPLUG_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AssemblerListingLocation>.\Release\</AssemblerListingLocation>
- <PrecompiledHeaderOutputFile>.\Release\testplug.pch</PrecompiledHeaderOutputFile>
- <ObjectFileName>.\Release\</ObjectFileName>
- <ProgramDataBaseFileName>.\Release\</ProgramDataBaseFileName>
- </ClCompile>
- <Midl>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <TypeLibraryName>.\Release\testplug.tlb</TypeLibraryName>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <TargetEnvironment>Win32</TargetEnvironment>
- </Midl>
- <ResourceCompile>
- <Culture>0x0809</Culture>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ResourceCompile>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>.\Release\testplug.bsc</OutputFile>
- </Bscmake>
- <Link>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <LinkDLL>true</LinkDLL>
- <SubSystem>Console</SubSystem>
- <OutputFile>release/xsoundnotify.dll</OutputFile>
- <ImportLibrary>.\Release\testplug.lib</ImportLibrary>
- <AdditionalDependencies>odbc32.lib;odbccp32.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>e:\Programming\libs\wxWidgets-2.9.3\lib\vc_lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <InlineFunctionExpansion>Default</InlineFunctionExpansion>
- <FunctionLevelLinking>false</FunctionLevelLinking>
- <Optimization>Disabled</Optimization>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <WarningLevel>Level3</WarningLevel>
- <MinimalRebuild>true</MinimalRebuild>
- <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
- <AdditionalIncludeDirectories>e:\Programming\libs\wxWidgets-2.9.3\include\msvc\;e:\Programming\libs\wxWidgets-2.9.3\include\;../../include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;XSOUNDNOTIFY_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AssemblerListingLocation>.\Debug\</AssemblerListingLocation>
- <PrecompiledHeaderOutputFile>.\Debug\testplug.pch</PrecompiledHeaderOutputFile>
- <ObjectFileName>.\Debug\</ObjectFileName>
- <ProgramDataBaseFileName>.\Debug\</ProgramDataBaseFileName>
- <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
- </ClCompile>
- <Midl>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <TypeLibraryName>.\Debug\testplug.tlb</TypeLibraryName>
- <MkTypLibCompatible>true</MkTypLibCompatible>
- <TargetEnvironment>Win32</TargetEnvironment>
- </Midl>
- <ResourceCompile>
- <Culture>0x0809</Culture>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- </ResourceCompile>
- <Bscmake>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <OutputFile>.\Debug\testplug.bsc</OutputFile>
- </Bscmake>
- <Link>
- <SuppressStartupBanner>true</SuppressStartupBanner>
- <LinkDLL>true</LinkDLL>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <SubSystem>Console</SubSystem>
- <OutputFile>.\Debug\xsoundnotify.dll</OutputFile>
- <ImportLibrary>.\Debug\xsoundnotify.lib</ImportLibrary>
- <AdditionalDependencies>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)</AdditionalDependencies>
- <IgnoreSpecificDefaultLibraries>
- </IgnoreSpecificDefaultLibraries>
- <AdditionalLibraryDirectories>e:\Programming\libs\wxWidgets-2.9.3\lib\vc_lib\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="SettingsDialog.cpp" />
- <ClCompile Include="SoundNotifyData.cpp" />
- <ClCompile Include="SoundNotifyDataStorage.cpp" />
- <ClCompile Include="xsn_main.cpp" />
- <ClCompile Include="xsn_types.cpp" />
- <ClCompile Include="xsn_utils.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="DebugLogger.hpp" />
- <ClInclude Include="SettingsDialog.h" />
- <ClInclude Include="resource.h" />
- <ClInclude Include="SoundNotifyData.h" />
- <ClInclude Include="SoundNotifyDataStorage.h" />
- <ClInclude Include="xsn_types.h" />
- <ClInclude Include="xsn_utils.h" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="XSoundNotify.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
- <ProjectExtensions>
- <VisualStudio>
- <UserProperties RESOURCE_FILE="XSoundNotify.rc" />
- </VisualStudio>
- </ProjectExtensions>
-</Project> \ 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 <windows.h>
-#include <newpluginapi.h>
-#include <m_langpack.h>
-#include <m_clist.h>
-#include <m_skin.h>
-#include <m_database.h>
-#include <m_protocols.h>
-#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 <string>
-#include <windows.h>
-#include <newpluginapi.h>
-#include <m_database.h>
-
-#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 <m_protocols.h>
-#include <boost/lexical_cast.hpp>
-
-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<xsn_string>(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