diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2016-01-20 19:11:39 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2016-01-20 19:11:39 +0000 |
commit | 553f922a7f1d56d0132b9e2dd2f01a9606a11108 (patch) | |
tree | d6b4900efdcf6ffe59b421dc2045324bfb80b7c6 /plugins/IEView/src | |
parent | 57b80b65d310667d22faa05906eaf4458f977483 (diff) |
IEView: code optimization
git-svn-id: http://svn.miranda-ng.org/main/trunk@16129 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/IEView/src')
-rw-r--r-- | plugins/IEView/src/IEView.cpp | 49 | ||||
-rw-r--r-- | plugins/IEView/src/IEView.h | 2 | ||||
-rw-r--r-- | plugins/IEView/src/external_funcs.cpp | 45 | ||||
-rw-r--r-- | plugins/IEView/src/external_funcs.h | 4 | ||||
-rw-r--r-- | plugins/IEView/src/stdafx.h | 1 |
5 files changed, 51 insertions, 50 deletions
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp index 4caa80c9f4..464d787c4b 100644 --- a/plugins/IEView/src/IEView.cpp +++ b/plugins/IEView/src/IEView.cpp @@ -437,47 +437,6 @@ STDMETHODIMP IEView::GetIDsOfNames(REFIID riid, OLECHAR **rgszNames, size_t cNam return S_OK;
}
-HRESULT IE_db_get(DISPPARAMS *pDispParams, VARIANT *pVarResult)
-{
- if (pDispParams->cArgs == 3 && pDispParams && pVarResult)
- {
- MCONTACT hContact = pDispParams->rgvarg[2].vt == VT_INT ? pDispParams->rgvarg[2].intVal : NULL;
- BSTR szModule = pDispParams->rgvarg[1].vt == VT_BSTR ? pDispParams->rgvarg[1].bstrVal : NULL;
- BSTR szSetting = pDispParams->rgvarg[0].vt == VT_BSTR ? pDispParams->rgvarg[0].bstrVal : NULL;
-
- DBVARIANT dbv = { 0 };
-
- db_get(hContact, _T2A((TCHAR*)szModule), _T2A((TCHAR*)szSetting), &dbv);
-
- switch (dbv.type)
- {
- case DBVT_BYTE:
- pVarResult->bVal = dbv.bVal;
- pVarResult->vt = VT_BOOL;
- break;
- case DBVT_WCHAR:
- pVarResult->vt = VT_BSTR;
- pVarResult->bstrVal = ::SysAllocString(dbv.pwszVal);
- break;
- case DBVT_UTF8:
- pVarResult->vt = VT_BSTR;
- pVarResult->bstrVal = ::SysAllocString(ptrW(mir_utf8decodeW(dbv.pszVal)));
- break;
- case DBVT_ASCIIZ:
- pVarResult->vt = VT_BSTR;
- pVarResult->bstrVal = ::SysAllocString(_A2T(dbv.pszVal));
- break;
- case DBVT_DWORD:
- pVarResult->vt = VT_INT;
- pVarResult->intVal = dbv.dVal;
- }
-
-
- return S_OK;
- }
- return E_INVALIDARG;
-}
-
STDMETHODIMP IEView::Invoke(DISPID dispIdMember,
REFIID riid,
LCID lcid,
@@ -491,7 +450,7 @@ STDMETHODIMP IEView::Invoke(DISPID dispIdMember, switch (dispIdMember)
{
case DISPID_JS_DB_GET:
- return IE_db_get(pDispParams, pVarResult);
+ return External::db_get(pDispParams, pVarResult);
}
return DISP_E_MEMBERNOTFOUND;
@@ -786,12 +745,6 @@ STDMETHODIMP IEView::GetZoneMappings(DWORD, IEnumString **, DWORD) return INET_E_DEFAULT_ACTION;
}
-STDMETHODIMP IEView::SayHello()
-{
- MessageBox(NULL, L"Hello", L"Hello", MB_YESNO);
- return S_OK;
-}
-
IHTMLDocument2* IEView::getDocument()
{
CComPtr<IDispatch> dispatch;
diff --git a/plugins/IEView/src/IEView.h b/plugins/IEView/src/IEView.h index 18f060a57e..d1679b244b 100644 --- a/plugins/IEView/src/IEView.h +++ b/plugins/IEView/src/IEView.h @@ -513,8 +513,6 @@ private: STDMETHOD(SetZoneMapping)(DWORD dwZone, LPCWSTR lpszPattern, DWORD dwFlags);
STDMETHOD(GetZoneMappings)(DWORD dwZone, IEnumString **ppenumString, DWORD dwFlags);
- STDMETHOD(SayHello)();
-
IHTMLDocument2 *getDocument();
WCHAR* getHrefFromAnchor(CComPtr<IHTMLElement> element);
WCHAR* getSelection();
diff --git a/plugins/IEView/src/external_funcs.cpp b/plugins/IEView/src/external_funcs.cpp new file mode 100644 index 0000000000..26f07d490e --- /dev/null +++ b/plugins/IEView/src/external_funcs.cpp @@ -0,0 +1,45 @@ +#include "stdafx.h"
+
+namespace External
+{
+ HRESULT db_get(DISPPARAMS *pDispParams, VARIANT *pVarResult)
+ {
+ if (pDispParams->cArgs == 3 && pDispParams && pVarResult)
+ {
+ MCONTACT hContact = pDispParams->rgvarg[2].vt == VT_INT ? pDispParams->rgvarg[2].intVal : NULL;
+ BSTR szModule = pDispParams->rgvarg[1].vt == VT_BSTR ? pDispParams->rgvarg[1].bstrVal : NULL;
+ BSTR szSetting = pDispParams->rgvarg[0].vt == VT_BSTR ? pDispParams->rgvarg[0].bstrVal : NULL;
+
+ DBVARIANT dbv = { 0 };
+
+ db_get(hContact, _T2A((TCHAR*)szModule), _T2A((TCHAR*)szSetting), &dbv);
+
+ switch (dbv.type)
+ {
+ case DBVT_BYTE:
+ pVarResult->bVal = dbv.bVal;
+ pVarResult->vt = VT_BOOL;
+ break;
+ case DBVT_WCHAR:
+ pVarResult->vt = VT_BSTR;
+ pVarResult->bstrVal = ::SysAllocString(dbv.pwszVal);
+ break;
+ case DBVT_UTF8:
+ pVarResult->vt = VT_BSTR;
+ pVarResult->bstrVal = ::SysAllocString(ptrW(mir_utf8decodeW(dbv.pszVal)));
+ break;
+ case DBVT_ASCIIZ:
+ pVarResult->vt = VT_BSTR;
+ pVarResult->bstrVal = ::SysAllocString(_A2T(dbv.pszVal));
+ break;
+ case DBVT_DWORD:
+ pVarResult->vt = VT_INT;
+ pVarResult->intVal = dbv.dVal;
+ }
+
+
+ return S_OK;
+ }
+ return E_INVALIDARG;
+ }
+}
\ No newline at end of file diff --git a/plugins/IEView/src/external_funcs.h b/plugins/IEView/src/external_funcs.h new file mode 100644 index 0000000000..173274a0ce --- /dev/null +++ b/plugins/IEView/src/external_funcs.h @@ -0,0 +1,4 @@ +namespace External
+{
+ HRESULT db_get(DISPPARAMS *pDispParams, VARIANT *pVarResult);
+}
\ No newline at end of file diff --git a/plugins/IEView/src/stdafx.h b/plugins/IEView/src/stdafx.h index c12a6df4a4..51e408cf01 100644 --- a/plugins/IEView/src/stdafx.h +++ b/plugins/IEView/src/stdafx.h @@ -70,6 +70,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "MUCCHTMLBuilder.h"
#include "Template.h"
#include "TextToken.h"
+#include "external_funcs.h"
#define ieviewModuleName "IEVIEW"
|