summaryrefslogtreecommitdiff
path: root/protocols/MRA/src/Mra_functions.cpp
diff options
context:
space:
mode:
authorRozhuk Ivan <rozhuk.im@gmail.com>2014-12-14 12:43:21 +0000
committerRozhuk Ivan <rozhuk.im@gmail.com>2014-12-14 12:43:21 +0000
commit5e85f48b85b54342b8bb472c10c5593abbb8b1eb (patch)
treec4a711d7da004557bb38c7bd9626fe77c727d96f /protocols/MRA/src/Mra_functions.cpp
parent515d2dbbe4b223757a6bbe838b329e0d045a6a36 (diff)
mra: w4 fixs
git-svn-id: http://svn.miranda-ng.org/main/trunk@11401 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Mra_functions.cpp')
-rw-r--r--protocols/MRA/src/Mra_functions.cpp152
1 files changed, 78 insertions, 74 deletions
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 11f3e8d2a2..154eed96dc 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -29,10 +29,10 @@ LRESULT CALLBACK MessageEditSubclassProc(HWND hwnd, UINT msg, WPARAM wParam, LPA
CMStringA MraGetSelfVersionString()
{
WORD v[4];
- CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
- LPSTR lpszSecIM = ServiceExists("SecureIM/IsContactSecured") ? " + SecureIM" : "";
+ LPSTR lpszSecIM = ServiceExists("SecureIM/IsContactSecured") ? " + SecureIM" : "";
CMStringA szSelfVersion;
+ CallService(MS_SYSTEM_GETFILEVERSION, 0, (LPARAM)v);
szSelfVersion.Format("Miranda NG %lu.%lu.%lu.%lu Unicode (MRA v%lu.%lu.%lu.%lu)%s, version: %lu.%lu",
v[0], v[1], v[2], v[3], __FILEVERSION_STRING, lpszSecIM, PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR);
return szSelfVersion;
@@ -631,7 +631,7 @@ DWORD CMraProto::MraSetContactStatus(MCONTACT hContact, DWORD dwNewStatus)
return dwOldStatus;
}
-void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &pszSubject, bool force_display)
+void CMraProto::MraUpdateEmailStatus(const CMStringA &pszFrom, const CMStringA &pszSubject, DWORD dwDate, DWORD dwUIDL, bool force_display)
{
BOOL bTrayIconNewMailNotify;
WCHAR szStatusText[MAX_SECONDLINE];
@@ -1142,9 +1142,10 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w
{
DWORD dwFlags;
DWORDLONG dwBlogStatusID;
-
TCHAR szBuff[MICBLOG_STATUS_MAX];
+
GetDlgItemText(hWndDlg, IDC_MSG_TO_SEND, szBuff, SIZEOF(szBuff));
+
if (dat->hContact) {
dwFlags = (MRIM_BLOG_STATUS_REPLY | MRIM_BLOG_STATUS_NOTIFY);
@@ -1156,7 +1157,8 @@ INT_PTR CALLBACK SendReplyBlogStatusDlgProc(HWND hWndDlg, UINT message, WPARAM w
}
else {
dwFlags = MRIM_BLOG_STATUS_UPDATE;
- if (IsDlgButtonChecked(hWndDlg, IDC_CHK_NOTIFY)) dwFlags |= MRIM_BLOG_STATUS_NOTIFY;
+ if (IsDlgButtonChecked(hWndDlg, IDC_CHK_NOTIFY))
+ dwFlags |= MRIM_BLOG_STATUS_NOTIFY;
dwBlogStatusID = 0;
}
dat->ppro->MraChangeUserBlogStatus(dwFlags, szBuff, dwBlogStatusID);
@@ -1224,83 +1226,85 @@ DWORD GetYears(CONST PSYSTEMTIME pcstSystemTime)
DWORD FindFile(LPWSTR lpszFolder, DWORD dwFolderLen, LPWSTR lpszFileName, DWORD dwFileNameLen, LPWSTR lpszRetFilePathName, DWORD dwRetFilePathLen, DWORD *pdwRetFilePathLen)
{
- if (!lpszFolder || !dwFolderLen || !lpszFileName || !dwFileNameLen)
- return ERROR_INVALID_HANDLE;
-
- TCHAR szPath[32768];
- DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen;
- RECURSION_DATA_STACK_ITEM *prdsiItems;
-
- if (dwFolderLen == -1) dwFolderLen = mir_wstrlen(lpszFolder);
- if (dwFileNameLen == -1) dwFileNameLen = mir_wstrlen(lpszFileName);
-
- dwRecDeepCurPos = 0;
- dwRecDeepAllocated = RECURSION_DATA_STACK_ITEMS_MIN;
- prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
- if (prdsiItems == NULL)
- return GetLastError();
-
- DWORD dwRetErrorCode = ERROR_FILE_NOT_FOUND;
- dwPathLen = dwFolderLen;
- memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR)));
- if (szPath[(dwPathLen - 1)] != '\\') {
- szPath[dwPathLen] = '\\';
- dwPathLen++;
- }
- szPath[dwPathLen] = 0;
- mir_tstrcat(szPath, _T("*.*"));
-
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0;
- prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
- if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) {
- do {
- dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen;
-
- while (dwRetErrorCode == ERROR_FILE_NOT_FOUND && FindNextFile(prdsiItems[dwRecDeepCurPos].hFind, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData)) {
- if (prdsiItems[dwRecDeepCurPos].w32fdFindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {// folder
- if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL)
- if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) {
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1);
- memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR)));
- mir_tstrcat(szPath, _T("\\*.*"));
- dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen;
-
- dwRecDeepCurPos++;
- if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space
- dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN;
- prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
- if (prdsiItems == NULL) {
- dwRecDeepCurPos = 0;
- dwRetErrorCode = GetLastError();
- break;
+ DWORD dwRetErrorCode;
+
+ if (lpszFolder && dwFolderLen && lpszFileName && dwFileNameLen) {
+ TCHAR szPath[32768];
+ DWORD dwPathLen, dwRecDeepAllocated, dwRecDeepCurPos, dwFilePathLen;
+ RECURSION_DATA_STACK_ITEM *prdsiItems;
+
+ if (dwFolderLen == -1) dwFolderLen = mir_wstrlen(lpszFolder);
+ if (dwFileNameLen == -1) dwFileNameLen = mir_wstrlen(lpszFileName);
+
+ dwRecDeepCurPos = 0;
+ dwRecDeepAllocated = RECURSION_DATA_STACK_ITEMS_MIN;
+ prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_calloc(dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
+ if (prdsiItems) {
+ dwPathLen = dwFolderLen;
+ memcpy(szPath, lpszFolder, (dwPathLen*sizeof(WCHAR)));
+ if (szPath[(dwPathLen - 1)] != '\\') {
+ szPath[dwPathLen] = '\\';
+ dwPathLen++;
+ }
+ szPath[dwPathLen] = 0;
+ mir_tstrcat(szPath, _T("*.*"));
+
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = 0;
+ prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
+ if (prdsiItems[dwRecDeepCurPos].hFind != INVALID_HANDLE_VALUE) {
+ dwRetErrorCode = ERROR_FILE_NOT_FOUND;
+ do {
+ dwPathLen -= prdsiItems[dwRecDeepCurPos].dwFileNameLen;
+
+ while (dwRetErrorCode == ERROR_FILE_NOT_FOUND && FindNextFile(prdsiItems[dwRecDeepCurPos].hFind, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData)) {
+ if (prdsiItems[dwRecDeepCurPos].w32fdFindFileData.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY) {// folder
+ if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T("."), 1) != CSTR_EQUAL)
+ if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, _T(".."), 2) != CSTR_EQUAL) {
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = (mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName) + 1);
+ memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, (prdsiItems[dwRecDeepCurPos].dwFileNameLen*sizeof(WCHAR)));
+ mir_tstrcat(szPath, _T("\\*.*"));
+ dwPathLen += prdsiItems[dwRecDeepCurPos].dwFileNameLen;
+
+ dwRecDeepCurPos++;
+ if (dwRecDeepCurPos == dwRecDeepAllocated) { // need more space
+ dwRecDeepAllocated += RECURSION_DATA_STACK_ITEMS_MIN;
+ prdsiItems = (RECURSION_DATA_STACK_ITEM*)mir_realloc(prdsiItems, dwRecDeepAllocated*sizeof(RECURSION_DATA_STACK_ITEM));
+ if (prdsiItems == NULL) {
+ dwRecDeepCurPos = 0;
+ dwRetErrorCode = GetLastError();
+ break;
+ }
+ }
+ prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
}
}
- prdsiItems[dwRecDeepCurPos].hFind = FindFirstFileEx(szPath, FindExInfoStandard, &prdsiItems[dwRecDeepCurPos].w32fdFindFileData, FindExSearchNameMatch, NULL, 0);
- }
- }
- else {// file
- if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) {
- prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName);
- memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR)));
- dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen);
-
- if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen;
- if (lpszRetFilePathName && dwRetFilePathLen) {
- dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen);
- memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR)));
+ else {// file
+ if (CompareString(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), NORM_IGNORECASE, prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, -1, lpszFileName, dwFileNameLen) == CSTR_EQUAL) {
+ prdsiItems[dwRecDeepCurPos].dwFileNameLen = mir_wstrlen(prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName);
+ memcpy((szPath + dwPathLen), prdsiItems[dwRecDeepCurPos].w32fdFindFileData.cFileName, ((prdsiItems[dwRecDeepCurPos].dwFileNameLen + 1)*sizeof(WCHAR)));
+ dwFilePathLen = (dwPathLen + prdsiItems[dwRecDeepCurPos].dwFileNameLen);
+
+ if (pdwRetFilePathLen) (*pdwRetFilePathLen) = dwFilePathLen;
+ if (lpszRetFilePathName && dwRetFilePathLen) {
+ dwFilePathLen = min(dwFilePathLen, dwRetFilePathLen);
+ memcpy(lpszRetFilePathName, szPath, ((dwFilePathLen + 1)*sizeof(WCHAR)));
+ }
+
+ dwRetErrorCode = NO_ERROR;
+ }
}
-
- dwRetErrorCode = NO_ERROR;
}
+
+ if (prdsiItems) FindClose(prdsiItems[dwRecDeepCurPos].hFind);
+ dwRecDeepCurPos--;
}
+ while (dwRecDeepCurPos != -1);
}
-
- if (prdsiItems) FindClose(prdsiItems[dwRecDeepCurPos].hFind);
- dwRecDeepCurPos--;
+ mir_free(prdsiItems);
}
- while (dwRecDeepCurPos != -1);
+ else dwRetErrorCode = GetLastError();
}
- mir_free(prdsiItems);
+ else dwRetErrorCode = ERROR_INVALID_HANDLE;
return dwRetErrorCode;
}