diff options
-rw-r--r-- | plugins/XSoundNotify/src/Common.h | 3 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/SettingsDialog.cpp | 4 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/SoundNotifyData.cpp | 6 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/SoundNotifyData.h | 12 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp | 6 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/SoundNotifyDataStorage.h | 6 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/xsn_main.cpp | 2 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/xsn_types.cpp | 4 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/xsn_types.h | 12 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/xsn_utils.cpp | 12 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/xsn_utils.h | 8 |
11 files changed, 36 insertions, 39 deletions
diff --git a/plugins/XSoundNotify/src/Common.h b/plugins/XSoundNotify/src/Common.h index 7fd7dca140..491410d233 100644 --- a/plugins/XSoundNotify/src/Common.h +++ b/plugins/XSoundNotify/src/Common.h @@ -1,5 +1,6 @@ #include <windows.h>
+#include <string>
#include <unordered_map>
#include <atlbase.h>
@@ -8,6 +9,7 @@ #include <atldlgs.h>
#include <newpluginapi.h>
+#include <m_system_cpp.h>
#include <m_database.h>
#include <m_protocols.h>
#include <m_langpack.h>
@@ -15,7 +17,6 @@ #include <m_skin.h>
#include <boost/function.hpp>
-#include <boost/lexical_cast.hpp>
#include "resource.h"
#include "Version.h"
diff --git a/plugins/XSoundNotify/src/SettingsDialog.cpp b/plugins/XSoundNotify/src/SettingsDialog.cpp index 151e07225e..3184bccdc7 100644 --- a/plugins/XSoundNotify/src/SettingsDialog.cpp +++ b/plugins/XSoundNotify/src/SettingsDialog.cpp @@ -86,7 +86,7 @@ LRESULT SettingsDialog::onChooseSound(WORD, WORD, HWND , BOOL&) setSoundLabelText(fileDlg.m_szFileName);
auto user = GetComboBoxData<UserDataTable::value_type>(_userCombo);
- user->second->setSound(xsn_string(fileDlg.m_szFileName));
+ user->second->setSound(std::tstring(fileDlg.m_szFileName));
_resetButton.EnableWindow(TRUE);
_playButton.EnableWindow(TRUE);
return 0;
@@ -95,7 +95,7 @@ LRESULT SettingsDialog::onChooseSound(WORD, WORD, HWND , BOOL&) LRESULT SettingsDialog::onResetSound(WORD, WORD wID, HWND , BOOL&)
{
auto user = GetComboBoxData<UserDataTable::value_type>(_userCombo);
- user->second->setSound(xsn_string());
+ user->second->setSound(std::tstring());
_resetButton.EnableWindow(FALSE);
_playButton.EnableWindow(FALSE);
_soundLabel.SetWindowText(TEXT(""));
diff --git a/plugins/XSoundNotify/src/SoundNotifyData.cpp b/plugins/XSoundNotify/src/SoundNotifyData.cpp index 29723384c7..ec153d26c4 100644 --- a/plugins/XSoundNotify/src/SoundNotifyData.cpp +++ b/plugins/XSoundNotify/src/SoundNotifyData.cpp @@ -5,12 +5,12 @@ SoundNotifyData::SoundNotifyData() : _contact(0), _soundChanged(false) }
-SoundNotifyData::SoundNotifyData(HANDLE contact, const ModuleString & module, const xsn_string & sound) :
+SoundNotifyData::SoundNotifyData(HANDLE contact, const ModuleString & module, const std::tstring &sound) :
_contact(contact), _soundPath(sound), _soundChanged(false)
{
}
-void SoundNotifyData::setSound(const xsn_string & sound)
+void SoundNotifyData::setSound(const std::tstring &sound)
{
_soundChanged = true;
_soundPath = sound;
@@ -21,7 +21,7 @@ HANDLE SoundNotifyData::contact() const return _contact;
}
-const xsn_string & SoundNotifyData::soundPath() const
+const std::tstring & SoundNotifyData::soundPath() const
{
return _soundPath;
}
diff --git a/plugins/XSoundNotify/src/SoundNotifyData.h b/plugins/XSoundNotify/src/SoundNotifyData.h index 13076f76e2..13cc354b3d 100644 --- a/plugins/XSoundNotify/src/SoundNotifyData.h +++ b/plugins/XSoundNotify/src/SoundNotifyData.h @@ -5,24 +5,24 @@ class SoundNotifyData {
public:
SoundNotifyData();
- SoundNotifyData(HANDLE contact, const ModuleString & module, const xsn_string & sound);
+ SoundNotifyData(HANDLE contact, const ModuleString &module, const std::tstring &sound);
- void setSound(const xsn_string & sound);
+ void setSound(const std::tstring &sound);
HANDLE contact() const;
- const xsn_string & soundPath() const;
- const ModuleString & module() const;
+ const std::tstring &soundPath() const;
+ const ModuleString &module() const;
bool isSoundChanged() const;
private:
HANDLE _contact;
ModuleString _module;
- xsn_string _soundPath;
+ std::tstring _soundPath;
bool _soundChanged;
};
typedef std::shared_ptr<SoundNotifyData> SoundNotifyDataPtr;
-typedef std::unordered_map<xsn_string, SoundNotifyDataPtr> UserDataTable;
+typedef std::unordered_map<std::tstring, SoundNotifyDataPtr> UserDataTable;
typedef std::unordered_map<ProtocolString, UserDataTable> ProtocolTable;
typedef std::unordered_map<ModuleString, ProtocolString> ModuleConvertTable;
diff --git a/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp b/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp index 93a81bfed6..d7fca9638f 100644 --- a/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp +++ b/plugins/XSoundNotify/src/SoundNotifyDataStorage.cpp @@ -41,7 +41,7 @@ void SoundNotifyDataStorage::addContact(HANDLE contact) {
ModuleString module = getContactModule(contact);
ProtocolString proto = _moduleTable[module];
- xsn_string user = getContactId(contact, module, proto);
+ std::tstring user = getContactId(contact, module, proto);
if (user.empty())
return ;
@@ -50,11 +50,11 @@ void SoundNotifyDataStorage::addContact(HANDLE contact) _protocolTable[proto][user] = SoundNotifyDataPtr(new SoundNotifyData(contact, module, sound.toString()));
}
-xsn_string SoundNotifyDataStorage::getContactId(HANDLE contact, const ModuleString & module, const ProtocolString & proto)
+std::tstring SoundNotifyDataStorage::getContactId(HANDLE contact, const ModuleString &module, const ProtocolString &proto)
{
auto it = _registeredProtocols.find(proto);
if (it == _registeredProtocols.end())
- return xsn_string();
+ return std::tstring();
return it->second(contact, module);
}
diff --git a/plugins/XSoundNotify/src/SoundNotifyDataStorage.h b/plugins/XSoundNotify/src/SoundNotifyDataStorage.h index 52d5c307a0..68c7d996f9 100644 --- a/plugins/XSoundNotify/src/SoundNotifyDataStorage.h +++ b/plugins/XSoundNotify/src/SoundNotifyDataStorage.h @@ -9,18 +9,18 @@ public: void init();
void commit();
- ProtocolTable & getData();
+ ProtocolTable &getData();
protected:
void addContact(HANDLE contact);
- xsn_string getContactId(HANDLE contact, const ModuleString & module, const ProtocolString & proto);
+ std::tstring getContactId(HANDLE contact, const ModuleString &module, const ProtocolString &proto);
void registerProtocols();
private:
ProtocolTable _protocolTable;
ModuleConvertTable _moduleTable;
- typedef boost::function<xsn_string (HANDLE contact, const ModuleString & module)> getContactIdFunc;
+ typedef boost::function<std::tstring (HANDLE contact, const ModuleString &module)> getContactIdFunc;
typedef std::unordered_map<ProtocolString, getContactIdFunc> RegisteredProtocols;
RegisteredProtocols _registeredProtocols;
};
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index 5bd0c3b530..1a0aaf82fe 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -62,7 +62,7 @@ INT processEvent(WPARAM wParam, LPARAM lParam) if (!isReceiveMessage(lParam))
return 0;
- xsn_string sound = getContactSound((HANDLE)wParam);
+ std::tstring sound = getContactSound((HANDLE)wParam);
if (!sound.empty())
PlaySound(sound.c_str(), nullptr, SND_ASYNC | SND_FILENAME);
}
diff --git a/plugins/XSoundNotify/src/xsn_types.cpp b/plugins/XSoundNotify/src/xsn_types.cpp index 0c831ef4d6..25dd96b15a 100644 --- a/plugins/XSoundNotify/src/xsn_types.cpp +++ b/plugins/XSoundNotify/src/xsn_types.cpp @@ -11,9 +11,9 @@ XSN_Variant::~XSN_Variant() DBFreeVariant(this);
}
-xsn_string XSN_Variant::toString() const
+std::tstring XSN_Variant::toString() const
{
- return ptszVal == nullptr ? xsn_string() : xsn_string(ptszVal);
+ return ptszVal == nullptr ? std::tstring() : std::tstring(ptszVal);
}
bool XSN_Variant::empty() const
diff --git a/plugins/XSoundNotify/src/xsn_types.h b/plugins/XSoundNotify/src/xsn_types.h index e6c7cdda49..b88f152fb5 100644 --- a/plugins/XSoundNotify/src/xsn_types.h +++ b/plugins/XSoundNotify/src/xsn_types.h @@ -1,12 +1,6 @@ #ifndef __XSN_TYPES
#define __XSN_TYPES
-#ifndef UNICODE
- typedef std::string xsn_string;
-#else
- typedef std::wstring xsn_string;
-#endif
-
typedef std::string ModuleString;
typedef std::string ProtocolString;
@@ -15,14 +9,14 @@ struct XSN_Variant : DBVARIANT XSN_Variant();
~XSN_Variant();
- xsn_string toString() const;
+ std::tstring toString() const;
bool empty() const;
};
struct XSN_ModuleInfo
{
- static const char * name();
- static const char * soundSetting();
+ static const char *name();
+ static const char *soundSetting();
};
#endif
diff --git a/plugins/XSoundNotify/src/xsn_utils.cpp b/plugins/XSoundNotify/src/xsn_utils.cpp index 1e0ad8c57d..a4808dd775 100644 --- a/plugins/XSoundNotify/src/xsn_utils.cpp +++ b/plugins/XSoundNotify/src/xsn_utils.cpp @@ -19,7 +19,7 @@ bool isReceiveMessage(LPARAM event) return !(((info.eventType != EVENTTYPE_MESSAGE) && !(info.flags & DBEF_READ)) || (info.flags & DBEF_SENT));
}
-xsn_string getContactSound(HANDLE contact)
+std::tstring getContactSound(HANDLE contact)
{
XSN_Variant sound;
DBGetContactSettingTString(contact, XSN_ModuleInfo::name(), XSN_ModuleInfo::soundSetting(), &sound);
@@ -28,26 +28,28 @@ xsn_string getContactSound(HANDLE contact) ModuleString getContactModule(HANDLE contact)
{
- char * proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)contact, 0);
+ 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)
+std::tstring 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);
+ TCHAR tmpuin[10];
+ _itot_s(uin, tmpuin, 10);
+ std::tstring uinStr = tmpuin;
if (nick.empty())
return uinStr;
return nick.toString() + TEXT(" (") + uinStr + TEXT(")");
}
-xsn_string getJabberContactId(HANDLE contact, const ModuleString & module)
+std::tstring getJabberContactId(HANDLE contact, const ModuleString &module)
{
XSN_Variant jid, nick;
DBGetContactSettingTString(contact, module.c_str(), "jid", &jid);
diff --git a/plugins/XSoundNotify/src/xsn_utils.h b/plugins/XSoundNotify/src/xsn_utils.h index 5c2a519c7c..b0d2b60411 100644 --- a/plugins/XSoundNotify/src/xsn_utils.h +++ b/plugins/XSoundNotify/src/xsn_utils.h @@ -1,15 +1,15 @@ #ifndef _XSN_UTILS_H
#define _XSN_UTILS_H
-void initModuleConvertTable(ModuleConvertTable & table);
+void initModuleConvertTable(ModuleConvertTable &table);
bool isReceiveMessage(LPARAM event);
-xsn_string getContactSound(HANDLE contact);
+std::tstring getContactSound(HANDLE contact);
ModuleString getContactModule(HANDLE contact);
-xsn_string getIcqContactId(HANDLE contact, const ModuleString & module);
-xsn_string getJabberContactId(HANDLE contact, const ModuleString & module);
+std::tstring getIcqContactId(HANDLE contact, const ModuleString &module);
+std::tstring getJabberContactId(HANDLE contact, const ModuleString &module);
#endif
|