diff options
author | George Hazan <ghazan@miranda.im> | 2020-03-11 19:50:57 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-03-11 19:50:57 +0300 |
commit | e8fb7de563970da12871b83c0c5e84775fe71d2d (patch) | |
tree | 6ff2dadfba3045ca646fa903d2fe16ec0bfe32f2 /plugins/VoiceService/src | |
parent | 647b4697b51d8a3cf52b7c0312b6adc89e4cf395 (diff) |
Voice API: code cleaning
Diffstat (limited to 'plugins/VoiceService/src')
-rw-r--r-- | plugins/VoiceService/src/VoiceProvider.cpp | 21 | ||||
-rw-r--r-- | plugins/VoiceService/src/main.cpp | 2 | ||||
-rw-r--r-- | plugins/VoiceService/src/stdafx.h | 22 |
3 files changed, 19 insertions, 26 deletions
diff --git a/plugins/VoiceService/src/VoiceProvider.cpp b/plugins/VoiceService/src/VoiceProvider.cpp index b7a352036c..cbfcfa8f77 100644 --- a/plugins/VoiceService/src/VoiceProvider.cpp +++ b/plugins/VoiceService/src/VoiceProvider.cpp @@ -47,8 +47,8 @@ static int VoiceState(WPARAM wParam, LPARAM) return 0; call->AppendCallerID(in->hContact, - (in->flags & VOICE_UNICODE) ? in->pwszName : _A2T(in->pszName), - (in->flags & VOICE_UNICODE) ? in->pwszNumber : _A2T(in->pszNumber)); + (in->flags & VOICE_UNICODE) ? in->szName.w : _A2T(in->szName.a), + (in->flags & VOICE_UNICODE) ? in->szNumber.w : _A2T(in->szNumber.a)); call->secure = (in->flags & VOICE_SECURE) != 0; if (in->state == VOICE_STATE_RINGING && call->hContact != NULL) { @@ -74,18 +74,14 @@ static int VoiceState(WPARAM wParam, LPARAM) return 0; } -VoiceProvider::VoiceProvider(const char *name, const wchar_t *description, int flags, const char *icon) +VoiceProvider::VoiceProvider(const char *name, const wchar_t *description, int flags, HANDLE pIcon) : + hIcolib(pIcon) { strncpy(this->name, name, _countof(this->name)); this->name[_countof(this->name) - 1] = 0; lstrcpyn(this->description, description, _countof(this->description)); - if (icon == NULL) - this->icon[0] = 0; - else - lstrcpynA(this->icon, icon, _countof(this->icon)); - this->flags = flags; is_protocol = IsProtocol(name); canHold = (ProtoServiceExists(name, PS_VOICE_HOLDCALL) != 0); @@ -159,8 +155,8 @@ void VoiceProvider::Call(MCONTACT hContact, const wchar_t *number) HICON VoiceProvider::GetIcon() { - if (!IsEmptyA(icon)) - return IcoLib_GetIcon(icon); + if (hIcolib) + return IcoLib_GetIconByHandle(hIcolib); if (is_protocol) return Skin_LoadProtoIcon(name, ID_STATUS_ONLINE); @@ -170,9 +166,6 @@ HICON VoiceProvider::GetIcon() void VoiceProvider::ReleaseIcon(HICON hIcon) { - if (hIcon == NULL) - return; - - if (!IsEmptyA(icon)) + if (hIcolib) IcoLib_ReleaseIcon(hIcon); } diff --git a/plugins/VoiceService/src/main.cpp b/plugins/VoiceService/src/main.cpp index ce67916c9f..fd9062dfc2 100644 --- a/plugins/VoiceService/src/main.cpp +++ b/plugins/VoiceService/src/main.cpp @@ -30,7 +30,7 @@ PLUGININFOEX pluginInfoEx = __AUTHOR, __COPYRIGHT, __AUTHORWEB, - UNICODE_AWARE, + UNICODE_AWARE | STATIC_PLUGIN, { 0x1bfc449d, 0x8f6f, 0x4080, { 0x8f, 0x35, 0xf9, 0x40, 0xb3, 0xde, 0x12, 0x84 } } // {1BFC449D-8F6F-4080-8F35-F940B3DE1284} }; diff --git a/plugins/VoiceService/src/stdafx.h b/plugins/VoiceService/src/stdafx.h index d54bf5ac13..22408dfe48 100644 --- a/plugins/VoiceService/src/stdafx.h +++ b/plugins/VoiceService/src/stdafx.h @@ -97,24 +97,24 @@ class VoiceProvider { public: wchar_t description[256]; - char name[256]; - char icon[256]; - int flags; - bool is_protocol; + char name[256]; + HANDLE hIcolib; + int flags; + bool is_protocol; - VoiceProvider(const char *name, const wchar_t *description, int flags, const char *icon); + VoiceProvider(const char *name, const wchar_t *description, int flags, HANDLE hIcolib); ~VoiceProvider(); - bool CanCall(const wchar_t *number); - bool CanCall(MCONTACT hContact, BOOL now = TRUE); - void Call(MCONTACT hContact, const wchar_t *number); + bool CanCall(const wchar_t *number); + bool CanCall(MCONTACT hContact, BOOL now = TRUE); + void Call(MCONTACT hContact, const wchar_t *number); - bool CanHold(); + bool CanHold(); - bool CanSendDTMF(); + bool CanSendDTMF(); HICON GetIcon(); - void ReleaseIcon(HICON hIcon); + void ReleaseIcon(HICON hIcon); private: bool canHold; |