diff options
author | George Hazan <george.hazan@gmail.com> | 2012-11-20 14:33:10 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-11-20 14:33:10 +0000 |
commit | 83fa989e4ec503c4a8e82c097d4d464ff5495184 (patch) | |
tree | 85b67826287db1d6d4fe726c8fdd1c6311387c59 /protocols/MRA | |
parent | 28de716d3ad748ffb6ee5987991ec011cdc63aa1 (diff) |
- PS_GETCUSTOMSTATUSEX service for Jabber;
- further code cleaning.
git-svn-id: http://svn.miranda-ng.org/main/trunk@2393 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA')
-rw-r--r-- | protocols/MRA/src/Mra_svcs.cpp | 90 |
1 files changed, 43 insertions, 47 deletions
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp index a845a88d89..46175c5bfc 100644 --- a/protocols/MRA/src/Mra_svcs.cpp +++ b/protocols/MRA/src/Mra_svcs.cpp @@ -875,69 +875,65 @@ INT_PTR CMraProto::MraSetXStatusEx(WPARAM wParam, LPARAM lParam) INT_PTR CMraProto::MraGetXStatusEx(WPARAM wParam, LPARAM lParam)
{
- INT_PTR iRet = 1;
HANDLE hContact = (HANDLE)wParam;
CUSTOM_STATUS *pData = (CUSTOM_STATUS*)lParam;
- if (pData->cbSize >= sizeof(CUSTOM_STATUS)) {
- DWORD dwXStatus;
+ if (pData->cbSize < sizeof(CUSTOM_STATUS))
+ return 1;
- iRet = 0;
+ // fill status member
+ if (pData->flags & CSSF_MASK_STATUS)
+ *pData->status = m_iXStatus;
- // fill status member
- if (pData->flags & CSSF_MASK_STATUS)
- *pData->status = m_iXStatus;
-
- // fill status name member
- if (pData->flags & CSSF_MASK_NAME) {
- if (pData->flags & CSSF_DEFAULT_NAME) {
- dwXStatus = (pData->wParam == NULL) ? m_iXStatus : *pData->wParam;
- if ( IsXStatusValid(dwXStatus)) {
- if (pData->flags & CSSF_UNICODE)
- lstrcpynW(pData->pwszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX+1));
- else {
- size_t dwStatusTitleSize = lstrlenW( lpcszXStatusNameDef[dwXStatus] );
- if (dwStatusTitleSize>STATUS_TITLE_MAX) dwStatusTitleSize = STATUS_TITLE_MAX;
+ // fill status name member
+ if (pData->flags & CSSF_MASK_NAME) {
+ if (pData->flags & CSSF_DEFAULT_NAME) {
+ DWORD dwXStatus = (pData->wParam == NULL) ? m_iXStatus : *pData->wParam;
+ if ( !IsXStatusValid(dwXStatus))
+ return 1;
- WideCharToMultiByte(MRA_CODE_PAGE, 0, lpcszXStatusNameDef[dwXStatus], (DWORD)dwStatusTitleSize, pData->pszName, MAX_PATH, NULL, NULL );
- (*((CHAR*)(pData->pszName+dwStatusTitleSize))) = 0;
- }
- }
- else iRet = 1;
- }
+ if (pData->flags & CSSF_UNICODE)
+ lstrcpynW(pData->pwszName, lpcszXStatusNameDef[dwXStatus], (STATUS_TITLE_MAX+1));
else {
- if (pData->flags & CSSF_UNICODE)
- mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, pData->pwszName, (STATUS_TITLE_MAX+1), NULL);
- else
- mraGetStaticStringA(hContact, DBSETTING_XSTATUSNAME, pData->pszName, (STATUS_TITLE_MAX+1), NULL);
+ size_t dwStatusTitleSize = lstrlenW( lpcszXStatusNameDef[dwXStatus] );
+ if (dwStatusTitleSize>STATUS_TITLE_MAX) dwStatusTitleSize = STATUS_TITLE_MAX;
+
+ WideCharToMultiByte(MRA_CODE_PAGE, 0, lpcszXStatusNameDef[dwXStatus], (DWORD)dwStatusTitleSize, pData->pszName, MAX_PATH, NULL, NULL );
+ (*((CHAR*)(pData->pszName+dwStatusTitleSize))) = 0;
}
}
-
- // fill status message member
- if (pData->flags & CSSF_MASK_MESSAGE) {
- char szSetting[100];
- mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dMsg", m_iXStatus);
+ else {
if (pData->flags & CSSF_UNICODE)
- mraGetStaticStringW(hContact, szSetting, pData->pwszMessage, (STATUS_DESC_MAX+1), NULL);
+ mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, pData->pwszName, (STATUS_TITLE_MAX+1), NULL);
else
- mraGetStaticStringA(hContact, szSetting, pData->pszMessage, (STATUS_DESC_MAX+1), NULL);
+ mraGetStaticStringA(hContact, DBSETTING_XSTATUSNAME, pData->pszName, (STATUS_TITLE_MAX+1), NULL);
}
+ }
- if (pData->flags & CSSF_DISABLE_UI)
- if (pData->wParam)
- *pData->wParam = bHideXStatusUI;
+ // fill status message member
+ if (pData->flags & CSSF_MASK_MESSAGE) {
+ char szSetting[100];
+ mir_snprintf(szSetting, SIZEOF(szSetting), "XStatus%dMsg", m_iXStatus);
+ if (pData->flags & CSSF_UNICODE)
+ mraGetStaticStringW(hContact, szSetting, pData->pwszMessage, (STATUS_DESC_MAX+1), NULL);
+ else
+ mraGetStaticStringA(hContact, szSetting, pData->pszMessage, (STATUS_DESC_MAX+1), NULL);
+ }
- if (pData->flags & CSSF_STATUSES_COUNT)
- if (pData->wParam)
- *pData->wParam = MRA_XSTATUS_COUNT-1;
+ if (pData->flags & CSSF_DISABLE_UI)
+ if (pData->wParam)
+ *pData->wParam = bHideXStatusUI;
- //**deb можно оптимизировать, данный параметр возможно уже был вычислен при получении самих текстов
- if (pData->flags & CSSF_STR_SIZES) {
- if (pData->wParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, NULL, 0, (size_t*)pData->wParam);
- if (pData->lParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSMSG, NULL, 0, (size_t*)pData->lParam);
- }
+ if (pData->flags & CSSF_STATUSES_COUNT)
+ if (pData->wParam)
+ *pData->wParam = MRA_XSTATUS_COUNT-1;
+
+ //**deb можно оптимизировать, данный параметр возможно уже был вычислен при получении самих текстов
+ if (pData->flags & CSSF_STR_SIZES) {
+ if (pData->wParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSNAME, NULL, 0, (size_t*)pData->wParam);
+ if (pData->lParam) mraGetStaticStringW(hContact, DBSETTING_XSTATUSMSG, NULL, 0, (size_t*)pData->lParam);
}
- return iRet;
+ return 0;
}
INT_PTR CMraProto::MraGetXStatusIcon(WPARAM wParam, LPARAM lParam)
|