summaryrefslogtreecommitdiff
path: root/protocols/MRA/src/Mra_functions.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-09 15:12:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-09 15:12:22 +0000
commitfaf22fc165caf88e561b78752aab4a1704c89086 (patch)
treeeced99885a9e49e2dc093df2e25e8a3a2cc8225e /protocols/MRA/src/Mra_functions.cpp
parent30eda997b099947ea38c17d547950edc4a5af8eb (diff)
- fix for moving contact to another group;
- home made debug functions replaced with their CRT analogs git-svn-id: http://svn.miranda-ng.org/main/trunk@6417 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src/Mra_functions.cpp')
-rw-r--r--protocols/MRA/src/Mra_functions.cpp38
1 files changed, 23 insertions, 15 deletions
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 2f2bbeb346..35c4e610c1 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -307,7 +307,6 @@ DWORD CMraProto::MraMoveContactToGroup(HANDLE hContact, DWORD dwGroupID, LPCTSTR
break;
}
- DWORD dwContactFlags = CONTACT_FLAG_UNICODE_NAME | CONTACT_FLAG_GROUP;
if (p == NULL) {
if (m_groups.getCount() == 20)
return 0;
@@ -317,16 +316,15 @@ DWORD CMraProto::MraMoveContactToGroup(HANDLE hContact, DWORD dwGroupID, LPCTSTR
if (m_groups.find((MraGroupItem*)&id) == NULL)
break;
- dwContactFlags |= (id << 24);
+ DWORD dwContactFlags = CONTACT_FLAG_UNICODE_NAME | CONTACT_FLAG_GROUP | (id << 24);
p = new MraGroupItem(id, dwContactFlags, ptszName);
m_groups.insert(p);
MraAddContact(NULL, dwContactFlags, 0, ptszName, p->m_name);
}
- else dwContactFlags |= (p->m_id << 24);
if (dwGroupID != p->m_id) {
- setDword("GroupID", p->m_id);
- MraModifyContact(hContact, 0, &dwContactFlags, &p->m_id);
+ setDword(hContact, "GroupID", p->m_id);
+ MraModifyContact(hContact, 0, 0, &p->m_id);
}
return p->m_id;
}
@@ -1463,14 +1461,6 @@ static DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplac
{
DWORD dwRetErrorCode = NO_ERROR;
- #ifdef _DEBUG //check tables
- for (size_t i = 0;i<dwReplaceItemsCount;i++)
- {
- if (lstrlen((LPTSTR)plpInReplaceItems[i]) != (pdwInReplaceItemsCounts[i]/sizeof(TCHAR))) DebugBreak();
- if (lstrlen((LPTSTR)plpOutReplaceItems[i]) != (pdwOutReplaceItemsCounts[i]/sizeof(TCHAR))) DebugBreak();
- }
- #endif
-
LPBYTE *plpbtFounded = (LPBYTE*)mir_calloc((sizeof(LPBYTE)*dwReplaceItemsCount));
if (plpbtFounded) {
LPBYTE lpbtOutBuffCur, lpbtInBuffCur, lpbtInBuffCurPrev, lpbtOutBuffMax;
@@ -1507,12 +1497,12 @@ static DWORD ReplaceInBuff(LPVOID lpInBuff, size_t dwInBuffSize, size_t dwReplac
}
else {
dwRetErrorCode = ERROR_BUFFER_OVERFLOW;
- DebugBreak();
+ _CrtDbgBreak();
break;
}
}
else {// сюда по идее никогда не попадём, на всякий случай.
- DebugBreak();
+ _CrtDbgBreak();
break;
}
}
@@ -1549,3 +1539,21 @@ CMStringW EncodeXML(const CMStringW &lptszMessage)
ReplaceInBuff((void*)lptszMessage.GetString(), lptszMessage.GetLength()*sizeof(TCHAR), SIZEOF(lpszXMLTags), (LPVOID*)lpszXMLSymbols, (size_t*)dwXMLSymbolsCount, (LPVOID*)lpszXMLTags, (size_t*)dwXMLTagsCount, ret);
return ret;
}
+
+void CMraProto::DebugLogA(LPCSTR szFormat, ...)
+{
+ char buf[4096];
+ va_list args;
+ va_start(args, szFormat);
+ vsprintf_s(buf, sizeof(buf), szFormat, args);
+ CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)buf);
+}
+
+void CMraProto::DebugLogW(LPCWSTR szFormat, ...)
+{
+ WCHAR buf[4096];
+ va_list args;
+ va_start(args, szFormat);
+ vswprintf_s(buf, SIZEOF(buf), szFormat, args);
+ CallService(MS_NETLIB_LOGW, (WPARAM)m_hNetlibUser, (LPARAM)buf);
+}