summaryrefslogtreecommitdiff
path: root/protocols/MRA/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-11 14:01:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-11 14:01:25 +0000
commit773421e8ba17637d994088c393d406226b516a30 (patch)
tree130c0bf529e30f493ae4f2abbe1230d31fecdeed /protocols/MRA/src
parent3fc8b6f686262e8a595fc10b2bd947526ca77bdc (diff)
- m_hNetlibUser moved to PROTO_INTERFACE;
- unified protocol loggers git-svn-id: http://svn.miranda-ng.org/main/trunk@6435 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/MRA/src')
-rw-r--r--protocols/MRA/src/MraMPop.cpp2
-rw-r--r--protocols/MRA/src/MraMRIMProxy.cpp6
-rw-r--r--protocols/MRA/src/MraProto.h5
-rw-r--r--protocols/MRA/src/MraRTFMsg.cpp2
-rw-r--r--protocols/MRA/src/MraSendCommand.cpp4
-rw-r--r--protocols/MRA/src/Mra_functions.cpp18
-rw-r--r--protocols/MRA/src/Mra_proto.cpp86
7 files changed, 51 insertions, 72 deletions
diff --git a/protocols/MRA/src/MraMPop.cpp b/protocols/MRA/src/MraMPop.cpp
index 022ede41e2..0c2c529f31 100644
--- a/protocols/MRA/src/MraMPop.cpp
+++ b/protocols/MRA/src/MraMPop.cpp
@@ -126,7 +126,7 @@ DWORD CMraProto::MraMPopSessionQueueStart(HANDLE hMPopSessionQueue)
szEmail.MakeLower();
szUrl.Format(MRA_MPOP_AUTH_URL, szEmail, pmpsqMPopSessionQueue->lpszMPOPKey, pmpsqi->lpszUrl);
CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)szUrl.c_str());
- DebugLogA("Opening URL: %s\n", szUrl);
+ debugLogA("Opening URL: %s\n", szUrl);
}
mir_free(pmpsqi);
}
diff --git a/protocols/MRA/src/MraMRIMProxy.cpp b/protocols/MRA/src/MraMRIMProxy.cpp
index f081596605..a285696590 100644
--- a/protocols/MRA/src/MraMRIMProxy.cpp
+++ b/protocols/MRA/src/MraMRIMProxy.cpp
@@ -165,16 +165,16 @@ DWORD CMraProto::MraMrimProxyConnect(HANDLE hMraMrimProxyData, HANDLE *phConnect
bContinue = FALSE;
}
else // not all packet received, continue receiving
- DebugLogA("Not all packet received, continue receiving\n");
+ debugLogA("Not all packet received, continue receiving\n");
}
else { // bad packet
- DebugLogA("Bad packet\n");
+ debugLogA("Bad packet\n");
_ASSERT(false);
bContinue = FALSE;
}
}
else // packet too small, continue receiving
- DebugLogA("Packet to small, continue receiving\n");
+ debugLogA("Packet to small, continue receiving\n");
}
else { // disconnected
dwRetErrorCode = GetLastError();
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index c7483ca40a..325b8d1409 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -172,7 +172,7 @@ struct CMraProto : public PROTO<CMraProto>
HANDLE hSendQueueHandle, hFilesQueueHandle, hMPopSessionQueue;
- HANDLE m_hNetlibUser, m_heNudgeReceived;
+ HANDLE m_heNudgeReceived;
HANDLE m_hThreadWorker;
HANDLE m_hConnection;
DWORD m_dwThreadWorkerLastPingTime, m_dwNextPingSendTickTime, m_dwPingPeriod;
@@ -198,9 +198,6 @@ struct CMraProto : public PROTO<CMraProto>
CRITICAL_SECTION csCriticalSectionSend;
- void DebugLogA(LPCSTR szFormat, ...);
- void DebugLogW(LPCWSTR szFormat, ...);
-
HANDLE AddToListByEmail(LPCTSTR plpsEMail, LPCTSTR plpsNick, LPCTSTR plpsFirstName, LPCTSTR plpsLastName, DWORD dwFlags);
DWORD MraMessage(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &wszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize);
diff --git a/protocols/MRA/src/MraRTFMsg.cpp b/protocols/MRA/src/MraRTFMsg.cpp
index 55e2fdf185..03401631c6 100644
--- a/protocols/MRA/src/MraRTFMsg.cpp
+++ b/protocols/MRA/src/MraRTFMsg.cpp
@@ -235,7 +235,7 @@ DWORD CMraProto::MraConvertToRTFW(const CMStringW &wszMessage, CMStringA &szMess
memmove(lpszMessageRTFCur, PAR, sizeof(PAR));lpszMessageRTFCur += (sizeof(PAR)-1);
memmove(lpszMessageRTFCur, CRLF, sizeof(CRLF));lpszMessageRTFCur += (sizeof(CRLF)-1);
memmove(lpszMessageRTFCur, "}", 2);lpszMessageRTFCur += 2;
- DebugLogA("%s\n", szMessageRTF);
+ debugLogA("%s\n", szMessageRTF);
return NO_ERROR;
}
diff --git a/protocols/MRA/src/MraSendCommand.cpp b/protocols/MRA/src/MraSendCommand.cpp
index 27519820ce..74ab849a29 100644
--- a/protocols/MRA/src/MraSendCommand.cpp
+++ b/protocols/MRA/src/MraSendCommand.cpp
@@ -73,7 +73,7 @@ public:
DWORD CMraProto::MraMessage(BOOL bAddToQueue, HANDLE hContact, DWORD dwAckType, DWORD dwFlags, const CMStringA &szEmail, const CMStringW &lpwszMessage, LPBYTE lpbMultiChatData, size_t dwMultiChatDataSize)
{
- DebugLogA("Sending message: flags %08x, to '%S', message '%S'\n", dwFlags, szEmail, lpwszMessage);
+ debugLogA("Sending message: flags %08x, to '%S', message '%S'\n", dwFlags, szEmail, lpwszMessage);
DWORD dwRet = 0;
LPSTR lpszMessageConverted = (LPSTR)lpwszMessage.GetString();
@@ -508,7 +508,7 @@ DWORD CMraProto::MraSendPacket(HANDLE m_hConnection, DWORD dwCMDNum, DWORD dwTyp
pmaHeader->msg = dwType;// Тип пакета
pmaHeader->dlen = dwDataSize;// Длина данных
- DebugLogA("Sending packet %08x\n", dwType);
+ debugLogA("Sending packet %08x\n", dwType);
memcpy(lpbData+sizeof(mrim_packet_header_t), lpData, dwDataSize);
return Netlib_Send(m_hConnection, (LPSTR)lpbData, (dwDataSize+sizeof(mrim_packet_header_t)), 0);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index ccc499466d..1e7b335c67 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -1539,21 +1539,3 @@ 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);
-}
diff --git a/protocols/MRA/src/Mra_proto.cpp b/protocols/MRA/src/Mra_proto.cpp
index e085e8cc41..5821b7d073 100644
--- a/protocols/MRA/src/Mra_proto.cpp
+++ b/protocols/MRA/src/Mra_proto.cpp
@@ -329,13 +329,13 @@ DWORD CMraProto::MraNetworkDispatcher()
dwRcvBuffSizeUsed = dwDataCurrentBuffSizeUsed;
dwDataCurrentBuffOffset = 0;
}
- DebugLogW(L"Not all packet received, continue receiving\n");
+ debugLogW(L"Not all packet received, continue receiving\n");
break;
}
}
// bad packet
else {
- DebugLogW(L"Bad packet\n");
+ debugLogW(L"Bad packet\n");
dwDataCurrentBuffOffset = 0;
dwRcvBuffSizeUsed = 0;
break;
@@ -343,7 +343,7 @@ DWORD CMraProto::MraNetworkDispatcher()
}
// packet to small, continue receiving
else {
- DebugLogW(L"Packet to small, continue receiving\n");
+ debugLogW(L"Packet to small, continue receiving\n");
memmove(lpbBufferRcv, (lpbBufferRcv+dwDataCurrentBuffOffset), dwDataCurrentBuffSizeUsed);
dwRcvBuffSizeUsed = dwDataCurrentBuffSizeUsed;
dwDataCurrentBuffOffset = 0;
@@ -514,14 +514,14 @@ bool CMraProto::CmdUserInfo(BinBuffer &buf)
}
}
else if (szString == "connect.xml") {
- DebugLogA(szString);
+ debugLogA(szString);
buf >> szStringW;
- DebugLogW(szStringW);
+ debugLogW(szStringW);
}
else if (szString == "micblog.show_title") {
- DebugLogA(szString);
+ debugLogA(szString);
buf >> szStringW;
- DebugLogW(szStringW);
+ debugLogW(szStringW);
}
else if (szString == "micblog.status.id") {
buf >> szString;
@@ -822,7 +822,7 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf)
// read headers name
for (unsigned i = 0; i < dwFieldsNum; i++) {
buf >> pmralpsFields[i];
- DebugLogA("%s ", pmralpsFields[i]);
+ debugLogA("%s ", pmralpsFields[i]);
}
while (!buf.eof()) {
@@ -971,7 +971,7 @@ bool CMraProto::CmdAnketaInfo(int seq, BinBuffer &buf)
}
else {// for DEBUG ONLY
buf >> val;
- DebugLogA("%s = %s\n", fld, val);
+ debugLogA("%s = %s\n", fld, val);
}
}
}
@@ -1101,7 +1101,7 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
int iGroupMode = getByte("GroupMode", 100);
- DebugLogA("Groups: %s\n", szGroupMask);
+ debugLogA("Groups: %s\n", szGroupMask);
DWORD dwID = 0;
for (DWORD i = 0; i < dwGroupsCount; i++) { //groups handle
DWORD dwControlParam = 0, dwGroupFlags;
@@ -1132,23 +1132,23 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
Clist_CreateGroup(0, wszGroupName);
}
- DebugLogW(L"'%s', flags: %lu (", wszGroupName, dwGroupFlags);
- if (dwGroupFlags & CONTACT_FLAG_REMOVED) DebugLogA("CONTACT_FLAG_REMOVED, ");
- if (dwGroupFlags & CONTACT_FLAG_GROUP) DebugLogA("CONTACT_FLAG_GROUP, ");
- if (dwGroupFlags & CONTACT_FLAG_INVISIBLE) DebugLogA("CONTACT_FLAG_INVISIBLE, ");
- if (dwGroupFlags & CONTACT_FLAG_VISIBLE) DebugLogA("CONTACT_FLAG_VISIBLE, ");
- if (dwGroupFlags & CONTACT_FLAG_IGNORE) DebugLogA("CONTACT_FLAG_IGNORE, ");
- if (dwGroupFlags & CONTACT_FLAG_SHADOW) DebugLogA("CONTACT_FLAG_SHADOW, ");
- if (dwGroupFlags & CONTACT_FLAG_AUTHORIZED) DebugLogA("CONTACT_FLAG_AUTHORIZED, ");
- if (dwGroupFlags & CONTACT_FLAG_MULTICHAT) DebugLogA("CONTACT_FLAG_MULTICHAT, ");
- if (dwGroupFlags & CONTACT_FLAG_UNICODE_NAME) DebugLogA("CONTACT_FLAG_UNICODE_NAME, ");
- if (dwGroupFlags & CONTACT_FLAG_PHONE) DebugLogA("CONTACT_FLAG_PHONE, ");
- DebugLogA(")");
+ debugLogW(L"'%s', flags: %lu (", wszGroupName, dwGroupFlags);
+ if (dwGroupFlags & CONTACT_FLAG_REMOVED) debugLogA("CONTACT_FLAG_REMOVED, ");
+ if (dwGroupFlags & CONTACT_FLAG_GROUP) debugLogA("CONTACT_FLAG_GROUP, ");
+ if (dwGroupFlags & CONTACT_FLAG_INVISIBLE) debugLogA("CONTACT_FLAG_INVISIBLE, ");
+ if (dwGroupFlags & CONTACT_FLAG_VISIBLE) debugLogA("CONTACT_FLAG_VISIBLE, ");
+ if (dwGroupFlags & CONTACT_FLAG_IGNORE) debugLogA("CONTACT_FLAG_IGNORE, ");
+ if (dwGroupFlags & CONTACT_FLAG_SHADOW) debugLogA("CONTACT_FLAG_SHADOW, ");
+ if (dwGroupFlags & CONTACT_FLAG_AUTHORIZED) debugLogA("CONTACT_FLAG_AUTHORIZED, ");
+ if (dwGroupFlags & CONTACT_FLAG_MULTICHAT) debugLogA("CONTACT_FLAG_MULTICHAT, ");
+ if (dwGroupFlags & CONTACT_FLAG_UNICODE_NAME) debugLogA("CONTACT_FLAG_UNICODE_NAME, ");
+ if (dwGroupFlags & CONTACT_FLAG_PHONE) debugLogA("CONTACT_FLAG_PHONE, ");
+ debugLogA(")");
}
dwID++;
}
- DebugLogA("Contacts: %s\n", szContactMask);
+ debugLogA("Contacts: %s\n", szContactMask);
dwID = 20;
while (!buf.eof()) {
DWORD dwControlParam = 0;
@@ -1242,34 +1242,34 @@ bool CMraProto::CmdClist2(BinBuffer &buf)
if (fieldType == 's') {
buf >> szString;
if (szString.GetLength()) {
- DebugLogA("%s ", szString);
+ debugLogA("%s ", szString);
}
}
else if (fieldType == 'u') {
char szBuff[50];
mir_snprintf(szBuff, SIZEOF(szBuff), "%lu, ", dwTemp);//;
- DebugLogA("%s ", szBuff);
+ debugLogA("%s ", szBuff);
}
else _CrtDbgBreak();
}
}
- DebugLogA("ID: %lu, Group id: %lu, %s: flags: %lu (", dwID, dwGroupID, szEmail, dwContactFlag);
- if (dwContactFlag & CONTACT_FLAG_REMOVED) DebugLogA("CONTACT_FLAG_REMOVED, ");
- if (dwContactFlag & CONTACT_FLAG_GROUP) DebugLogA("CONTACT_FLAG_GROUP, ");
- if (dwContactFlag & CONTACT_FLAG_INVISIBLE) DebugLogA("CONTACT_FLAG_INVISIBLE, ");
- if (dwContactFlag & CONTACT_FLAG_VISIBLE) DebugLogA("CONTACT_FLAG_VISIBLE, ");
- if (dwContactFlag & CONTACT_FLAG_IGNORE) DebugLogA("CONTACT_FLAG_IGNORE, ");
- if (dwContactFlag & CONTACT_FLAG_SHADOW) DebugLogA("CONTACT_FLAG_SHADOW, ");
- if (dwContactFlag & CONTACT_FLAG_AUTHORIZED) DebugLogA("CONTACT_FLAG_AUTHORIZED, ");
- if (dwContactFlag & CONTACT_FLAG_MULTICHAT) DebugLogA("CONTACT_FLAG_MULTICHAT, ");
- if (dwContactFlag & CONTACT_FLAG_UNICODE_NAME) DebugLogA("CONTACT_FLAG_UNICODE_NAME, ");
- if (dwContactFlag & CONTACT_FLAG_PHONE) DebugLogA("CONTACT_FLAG_PHONE, ");
- DebugLogA(")");
-
- DebugLogA(": server flags: %lu (", dwContactSeverFlags);
- if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED) DebugLogA("CONTACT_INTFLAG_NOT_AUTHORIZED, ");
- DebugLogA(")");
+ debugLogA("ID: %lu, Group id: %lu, %s: flags: %lu (", dwID, dwGroupID, szEmail, dwContactFlag);
+ if (dwContactFlag & CONTACT_FLAG_REMOVED) debugLogA("CONTACT_FLAG_REMOVED, ");
+ if (dwContactFlag & CONTACT_FLAG_GROUP) debugLogA("CONTACT_FLAG_GROUP, ");
+ if (dwContactFlag & CONTACT_FLAG_INVISIBLE) debugLogA("CONTACT_FLAG_INVISIBLE, ");
+ if (dwContactFlag & CONTACT_FLAG_VISIBLE) debugLogA("CONTACT_FLAG_VISIBLE, ");
+ if (dwContactFlag & CONTACT_FLAG_IGNORE) debugLogA("CONTACT_FLAG_IGNORE, ");
+ if (dwContactFlag & CONTACT_FLAG_SHADOW) debugLogA("CONTACT_FLAG_SHADOW, ");
+ if (dwContactFlag & CONTACT_FLAG_AUTHORIZED) debugLogA("CONTACT_FLAG_AUTHORIZED, ");
+ if (dwContactFlag & CONTACT_FLAG_MULTICHAT) debugLogA("CONTACT_FLAG_MULTICHAT, ");
+ if (dwContactFlag & CONTACT_FLAG_UNICODE_NAME) debugLogA("CONTACT_FLAG_UNICODE_NAME, ");
+ if (dwContactFlag & CONTACT_FLAG_PHONE) debugLogA("CONTACT_FLAG_PHONE, ");
+ debugLogA(")");
+
+ debugLogA(": server flags: %lu (", dwContactSeverFlags);
+ if (dwContactSeverFlags & CONTACT_INTFLAG_NOT_AUTHORIZED) debugLogA("CONTACT_INTFLAG_NOT_AUTHORIZED, ");
+ debugLogA(")");
// add/modify contact
if (dwGroupID != 103)//***deb filtering phone/sms contats
@@ -1498,7 +1498,7 @@ bool CMraProto::MraCommandDispatcher(mrim_packet_header_t *pmaHeader)
HANDLE hContact = NULL;
LPBYTE pByte;
- DebugLogA("Received packet %x\n", pmaHeader->msg);
+ debugLogA("Received packet %x\n", pmaHeader->msg);
BinBuffer buf((LPBYTE)pmaHeader + sizeof(mrim_packet_header_t), pmaHeader->dlen);
@@ -1683,7 +1683,7 @@ DWORD CMraProto::MraRecvCommand_Message(DWORD dwTime, DWORD dwFlags, CMStringA &
}
}
- DebugLogA("Processing message: %08X, from '%s', text '%S'\n", dwFlags, plpsFrom.c_str(), wszMessage.c_str());
+ debugLogA("Processing message: %08X, from '%s', text '%S'\n", dwFlags, plpsFrom.c_str(), wszMessage.c_str());
// processing
if (dwFlags & (MESSAGE_FLAG_SMS | MESSAGE_SMS_DELIVERY_REPORT)) {// SMS //if (IsPhone(plpsFrom->lpszData, plpsFrom->dwSize))