summaryrefslogtreecommitdiff
path: root/plugins/WinterSpeak/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-10 08:04:30 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-10 08:04:30 +0000
commitddba4ede6b451d0cfcd0d32b5180fbd0689966bf (patch)
tree5d74f37a7013d13b92c182628d6b68a58e148ae4 /plugins/WinterSpeak/src
parentc39340bf493a1745a41317bbf937fc7eb6cbb26a (diff)
- HANDLE hContact => HCONTACT
- GCF_* prefix was added to chat constants to avoid name conflicts git-svn-id: http://svn.miranda-ng.org/main/trunk@8078 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WinterSpeak/src')
-rw-r--r--plugins/WinterSpeak/src/ConfigDatabase.cpp10
-rw-r--r--plugins/WinterSpeak/src/ConfigDatabase.h31
-rw-r--r--plugins/WinterSpeak/src/DialogConfigActive.cpp6
-rw-r--r--plugins/WinterSpeak/src/DialogConfigActive.h2
-rw-r--r--plugins/WinterSpeak/src/SpeakAnnounce.cpp2
-rw-r--r--plugins/WinterSpeak/src/SpeakAnnounce.h2
-rw-r--r--plugins/WinterSpeak/src/SpeakConfig.cpp11
-rw-r--r--plugins/WinterSpeak/src/SpeakConfig.h36
-rw-r--r--plugins/WinterSpeak/src/main.cpp6
9 files changed, 51 insertions, 55 deletions
diff --git a/plugins/WinterSpeak/src/ConfigDatabase.cpp b/plugins/WinterSpeak/src/ConfigDatabase.cpp
index 64af1e35f4..0184e7e5d0 100644
--- a/plugins/WinterSpeak/src/ConfigDatabase.cpp
+++ b/plugins/WinterSpeak/src/ConfigDatabase.cpp
@@ -47,7 +47,7 @@ void ConfigDatabase::setActiveFlag(ActiveFlag flag, bool state)
}
//------------------------------------------------------------------------------
-ConfigDatabase::act ConfigDatabase::getActiveUser(HANDLE user) const
+ConfigDatabase::act ConfigDatabase::getActiveUser(HCONTACT user) const
{
ActiveUsersMap::const_iterator iter = m_active_users.find(user);
@@ -69,7 +69,7 @@ ConfigDatabase::act ConfigDatabase::getActiveUser(HANDLE user) const
}
//------------------------------------------------------------------------------
-void ConfigDatabase::setActiveUser(HANDLE user, act state)
+void ConfigDatabase::setActiveUser(HCONTACT user, act state)
{
m_active_users[user].status = state.status;
m_active_users[user].message = state.message;
@@ -89,10 +89,8 @@ void ConfigDatabase::load()
m_welcome_msg = DBGetContactSettingString(SPEAK, WELCOME_MSG, L"Welcome to Miranda");
// iterate through all the users and add them to the list if active
- HANDLE contact = db_find_first();
-
- while (NULL != contact)
- {
+ HCONTACT contact = db_find_first();
+ while (NULL != contact) {
m_active_users[contact].status = (db_get_b(contact, SPEAK, ACTIVE_STATE, true) != 0);
m_active_users[contact].message = (db_get_b(contact, SPEAK, ACTIVE_MSG, true) != 0);
diff --git a/plugins/WinterSpeak/src/ConfigDatabase.h b/plugins/WinterSpeak/src/ConfigDatabase.h
index 5682abf0f0..da8b46dc8f 100644
--- a/plugins/WinterSpeak/src/ConfigDatabase.h
+++ b/plugins/WinterSpeak/src/ConfigDatabase.h
@@ -26,13 +26,13 @@ public:
bool message;
};
- typedef std::map<HANDLE, act> ActiveUsersMap;
+ typedef std::map<HCONTACT, act> ActiveUsersMap;
//--------------------------------------------------------------------------
// Description : get/set the voice description
//--------------------------------------------------------------------------
- VoiceDesc getVoiceDesc() const { return m_voice_desc; }
- void setVoiceDesc(const VoiceDesc &desc) { m_voice_desc = desc; }
+ VoiceDesc getVoiceDesc() const { return m_voice_desc; }
+ void setVoiceDesc(const VoiceDesc &desc) { m_voice_desc = desc; }
//--------------------------------------------------------------------------
// Description : get/set the welcome message
@@ -43,37 +43,36 @@ public:
//--------------------------------------------------------------------------
// Description : get/set an status flags
//--------------------------------------------------------------------------
- bool getActiveFlag(ActiveFlag flag) const;
+ bool getActiveFlag(ActiveFlag flag) const;
void setActiveFlag(ActiveFlag flag, bool state);
//--------------------------------------------------------------------------
// Description : get/set the user active flag
//--------------------------------------------------------------------------
- act getActiveUser(HANDLE user) const;
- void setActiveUser(HANDLE user, act state);
- ActiveUsersMap getActiveUsers() const { return m_active_users; }
-
+ act getActiveUser(HCONTACT user) const;
+ void setActiveUser(HCONTACT user, act state);
+ ActiveUsersMap getActiveUsers() const { return m_active_users; }
+
//--------------------------------------------------------------------------
// Description : load/save the settings from the miranda database
//--------------------------------------------------------------------------
void load();
void save();
- private:
+private:
//--------------------------------------------------------------------------
// Description : For some reason this isn't implemented in miranda yet
// Just get a string from the db
- // Parameters : szModule - the entrys' module
- // szSetting - the entrys' setting
- // def - default string if entry doesn't exist
+ // Parameters : szModule - the entrys' module
+ // szSetting - the entrys' setting
+ // def - default string if entry doesn't exist
//--------------------------------------------------------------------------
static std::wstring DBGetContactSettingString(const char *szModule,
const char *szSetting, const WCHAR *def);
- VoiceDesc m_voice_desc;
- unsigned int m_active_flags;
+ VoiceDesc m_voice_desc;
+ unsigned int m_active_flags;
std::wstring m_welcome_msg;
//std::string m_welcome_msg;
- ActiveUsersMap m_active_users;
+ ActiveUsersMap m_active_users;
};
-
diff --git a/plugins/WinterSpeak/src/DialogConfigActive.cpp b/plugins/WinterSpeak/src/DialogConfigActive.cpp
index 5d20b91586..8c59b83fca 100644
--- a/plugins/WinterSpeak/src/DialogConfigActive.cpp
+++ b/plugins/WinterSpeak/src/DialogConfigActive.cpp
@@ -255,7 +255,7 @@ void DialogConfigActive::SetAllContactIcons(HWND hwndList, HWND window) {
ConfigDatabase::ActiveUsersMap::const_iterator iter;
for (iter = active_users.begin(); iter != active_users.end(); ++iter)
{
- HANDLE hContact = iter->first;
+ HCONTACT hContact = iter->first;
if(hContact == 0) {
} else {
@@ -331,7 +331,7 @@ void DialogConfigActive::save(HWND window)
m_db.setActiveFlag(ConfigDatabase::ActiveFlag_FreeForChat, (IsDlgButtonChecked(window, IDC_ACTIVE_FREEFORCHAT) != 0));
m_db.setActiveFlag(ConfigDatabase::ActiveFlag_Invisible, (IsDlgButtonChecked(window, IDC_ACTIVE_INVISIBLE) != 0));
- for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
+ for (HCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendDlgItemMessage(window, IDC_ACTIVE_USERS, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem)
SaveItemMask(GetDlgItem(window, IDC_ACTIVE_USERS), hContact, hItem);
@@ -342,7 +342,7 @@ void DialogConfigActive::save(HWND window)
m_db.save();
}
-void DialogConfigActive::SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem) {
+void DialogConfigActive::SaveItemMask(HWND hwndList, HCONTACT hContact, HANDLE hItem) {
ConfigDatabase::act mask;
mask.message = true;
mask.status = true;
diff --git a/plugins/WinterSpeak/src/DialogConfigActive.h b/plugins/WinterSpeak/src/DialogConfigActive.h
index 8dbbbd43a9..f1b428972b 100644
--- a/plugins/WinterSpeak/src/DialogConfigActive.h
+++ b/plugins/WinterSpeak/src/DialogConfigActive.h
@@ -38,7 +38,7 @@ class DialogConfigActive : public MirandaDialog
void SetIconsForColumn(HWND hwndList, HANDLE hItem, HANDLE hItemAll, int iColumn, int iImage);
void SetAllChildIcons(HWND hwndList, HANDLE hFirstItem, int iColumn, int iImage);
void SetListGroupIcons(HWND hwndList, HANDLE hFirstItem, HANDLE hParentItem, int *groupChildCount);
- void SaveItemMask(HWND hwndList, HANDLE hContact, HANDLE hItem);
+ void SaveItemMask(HWND hwndList, HCONTACT hContact, HANDLE hItem);
static DialogConfigActive *m_instance;
ConfigDatabase &m_db;
diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.cpp b/plugins/WinterSpeak/src/SpeakAnnounce.cpp
index 2b9855f61b..e9120f20eb 100644
--- a/plugins/WinterSpeak/src/SpeakAnnounce.cpp
+++ b/plugins/WinterSpeak/src/SpeakAnnounce.cpp
@@ -72,7 +72,7 @@ void SpeakAnnounce::statusChange(DBCONTACTWRITESETTING *write_setting, HANDLE us
}
//------------------------------------------------------------------------------
-void SpeakAnnounce::incomingEvent(HANDLE user, HANDLE event)
+void SpeakAnnounce::incomingEvent(HCONTACT user, HANDLE event)
{
if (m_event_info.isValidEvent(event))
{
diff --git a/plugins/WinterSpeak/src/SpeakAnnounce.h b/plugins/WinterSpeak/src/SpeakAnnounce.h
index ff681e6fdb..e4980a292a 100644
--- a/plugins/WinterSpeak/src/SpeakAnnounce.h
+++ b/plugins/WinterSpeak/src/SpeakAnnounce.h
@@ -17,7 +17,7 @@ class SpeakAnnounce
//--------------------------------------------------------------------------
// Description : handle an event
//--------------------------------------------------------------------------
- void incomingEvent(HANDLE user, HANDLE event);
+ void incomingEvent(HCONTACT user, HANDLE event);
//--------------------------------------------------------------------------
// Description : handle a protocol state change
diff --git a/plugins/WinterSpeak/src/SpeakConfig.cpp b/plugins/WinterSpeak/src/SpeakConfig.cpp
index 40c9d48dbe..605b120f92 100644
--- a/plugins/WinterSpeak/src/SpeakConfig.cpp
+++ b/plugins/WinterSpeak/src/SpeakConfig.cpp
@@ -33,13 +33,13 @@ void SpeakConfig::update(Subject &subject)
}
//------------------------------------------------------------------------------
-bool SpeakConfig::status(const std::wstring &sentence, HANDLE user) {
+bool SpeakConfig::status(const std::wstring &sentence, HCONTACT user) {
return say(sentence, user, false);
}
-bool SpeakConfig::message(const std::wstring &sentence, HANDLE user) {
+bool SpeakConfig::message(const std::wstring &sentence, HCONTACT user) {
return say(sentence, user, true);
}
-bool SpeakConfig::say(const std::wstring &sentence, HANDLE user, bool message)
+bool SpeakConfig::say(const std::wstring &sentence, HCONTACT user, bool message)
{
if (!m_tts.get()){
return false;
@@ -89,11 +89,10 @@ bool SpeakConfig::say(const std::wstring &sentence, HANDLE user, bool message)
// if its a user say, then check the users status
if (active)
{
- if(message) {
+ if(message)
active = m_db.getActiveUser(user).message;
- } else {
+ else
active = m_db.getActiveUser(user).status;
- }
}
}
diff --git a/plugins/WinterSpeak/src/SpeakConfig.h b/plugins/WinterSpeak/src/SpeakConfig.h
index e1a4cb421a..6894eecfb3 100644
--- a/plugins/WinterSpeak/src/SpeakConfig.h
+++ b/plugins/WinterSpeak/src/SpeakConfig.h
@@ -8,34 +8,34 @@ class TextToSpeech;
class SpeakConfig : public Observer
{
- public:
+public:
SpeakConfig(HINSTANCE instance);
- virtual ~SpeakConfig();
+ virtual ~SpeakConfig();
- //--------------------------------------------------------------------------
- // Description : Called by a subject that this observer is observing
- // to signify a change in state
- // Parameters : subject - the subject that changed
- //--------------------------------------------------------------------------
- virtual void update(Subject &subject);
+ //--------------------------------------------------------------------------
+ // Description : Called by a subject that this observer is observing
+ // to signify a change in state
+ // Parameters : subject - the subject that changed
+ //--------------------------------------------------------------------------
+ virtual void update(Subject &subject);
//--------------------------------------------------------------------------
// Description : speak a sentence
// Parameters : sentence - the sentence to speak
- // user - the user to associate the say with
- // NULL = ignore user
+ // user - the user to associate the say with
+ // NULL = ignore user
// Returns : true - speak successful
// false - speak failed
//--------------------------------------------------------------------------
- bool status(const std::wstring &sentence, HANDLE user = NULL);
- bool message(const std::wstring &sentence, HANDLE user = NULL);
- bool say(const std::wstring &sentence, HANDLE user, bool message);
+ bool status(const std::wstring &sentence, HCONTACT user = NULL);
+ bool message(const std::wstring &sentence, HCONTACT user = NULL);
+ bool say(const std::wstring &sentence, HCONTACT user, bool message);
- private:
- HINSTANCE m_instance;
+private:
+ HINSTANCE m_instance;
ConfigDatabase m_db;
- std::auto_ptr<TextToSpeech> m_tts;
- DialogConfigEngine m_dialog_engine;
- DialogConfigActive m_dialog_active;
+ std::auto_ptr<TextToSpeech> m_tts;
+ DialogConfigEngine m_dialog_engine;
+ DialogConfigActive m_dialog_active;
}; \ No newline at end of file
diff --git a/plugins/WinterSpeak/src/main.cpp b/plugins/WinterSpeak/src/main.cpp
index 56e7665459..e20c0fa113 100644
--- a/plugins/WinterSpeak/src/main.cpp
+++ b/plugins/WinterSpeak/src/main.cpp
@@ -31,12 +31,12 @@ PLUGININFOEX pluginInfo={
//-----------------------------------------------------------------------------
INT_PTR status(WPARAM wParam, LPARAM lParam)
{
- return g_speak_config->status(reinterpret_cast<WCHAR *>(lParam), reinterpret_cast<HANDLE>(wParam));
+ return g_speak_config->status(reinterpret_cast<WCHAR *>(lParam), reinterpret_cast<HCONTACT>(wParam));
}
INT_PTR message(WPARAM wParam, LPARAM lParam)
{
- return g_speak_config->message(reinterpret_cast<WCHAR *>(lParam), reinterpret_cast<HANDLE>(wParam));
+ return g_speak_config->message(reinterpret_cast<WCHAR *>(lParam), reinterpret_cast<HCONTACT>(wParam));
}
//-----------------------------------------------------------------------------
@@ -56,7 +56,7 @@ int eventStatusChange(WPARAM wParam, LPARAM lParam)
//-----------------------------------------------------------------------------
int eventMessageAdded(WPARAM wParam, LPARAM lParam)
{
- g_speak_announce->incomingEvent(reinterpret_cast<HANDLE>(wParam), reinterpret_cast<HANDLE>(lParam));
+ g_speak_announce->incomingEvent(reinterpret_cast<HCONTACT>(wParam), reinterpret_cast<HANDLE>(lParam));
return 0;
}