summaryrefslogtreecommitdiff
path: root/protocols/JabberG
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/JabberG
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/JabberG')
-rw-r--r--protocols/JabberG/res/jabber.rc4
-rw-r--r--protocols/JabberG/src/jabber_byte.cpp34
-rw-r--r--protocols/JabberG/src/jabber_caps.cpp8
-rw-r--r--protocols/JabberG/src/jabber_events.cpp8
-rw-r--r--protocols/JabberG/src/jabber_file.cpp76
-rw-r--r--protocols/JabberG/src/jabber_ft.cpp32
-rw-r--r--protocols/JabberG/src/jabber_ibb.cpp4
-rw-r--r--protocols/JabberG/src/jabber_iq.cpp4
-rw-r--r--protocols/JabberG/src/jabber_iq_handlers.cpp10
-rw-r--r--protocols/JabberG/src/jabber_iqid.cpp64
-rw-r--r--protocols/JabberG/src/jabber_iqid_muc.cpp14
-rw-r--r--protocols/JabberG/src/jabber_message_manager.cpp4
-rw-r--r--protocols/JabberG/src/jabber_misc.cpp12
-rw-r--r--protocols/JabberG/src/jabber_opt.cpp18
-rw-r--r--protocols/JabberG/src/jabber_proto.cpp42
-rw-r--r--protocols/JabberG/src/jabber_proto.h2
-rw-r--r--protocols/JabberG/src/jabber_svc.cpp8
-rw-r--r--protocols/JabberG/src/jabber_thread.cpp114
-rw-r--r--protocols/JabberG/src/jabber_userinfo.cpp6
-rw-r--r--protocols/JabberG/src/jabber_util.cpp13
-rw-r--r--protocols/JabberG/src/jabber_vcard.cpp12
-rw-r--r--protocols/JabberG/src/jabber_ws.cpp6
-rw-r--r--protocols/JabberG/src/jabber_zstream.cpp26
23 files changed, 254 insertions, 267 deletions
diff --git a/protocols/JabberG/res/jabber.rc b/protocols/JabberG/res/jabber.rc
index 79782e2b6a..307e2eea21 100644
--- a/protocols/JabberG/res/jabber.rc
+++ b/protocols/JabberG/res/jabber.rc
@@ -196,8 +196,8 @@ BEGIN
PUSHBUTTON "Search...",IDC_AGENT_SEARCH,171,100,50,14,NOT WS_VISIBLE | WS_DISABLED
GROUPBOX "Registered Jabber Transports",IDC_STATIC,7,128,280,99
CONTROL "List1",IDC_AGENT_TRANSPORT,"SysListView32",LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_NOSORTHEADER | WS_BORDER | WS_TABSTOP,13,142,267,60
- PUSHBUTTON "Log on",IDC_AGENT_LOGON,13,206,50,14,WS_DISABLED
- PUSHBUTTON "Log off",IDC_AGENT_LOGOFF,69,206,50,14,WS_DISABLED
+ PUSHBUTTON "debugLogA on",IDC_AGENT_LOGON,13,206,50,14,WS_DISABLED
+ PUSHBUTTON "debugLogA off",IDC_AGENT_LOGOFF,69,206,50,14,WS_DISABLED
PUSHBUTTON "Unregister",IDC_AGENT_UNREGISTER,125,206,50,14,WS_DISABLED
PUSHBUTTON "Register with a new service...",IDC_MANUAL_REGISTER,7,233,106,14
PUSHBUTTON "Close",IDCLOSE,237,233,50,14
diff --git a/protocols/JabberG/src/jabber_byte.cpp b/protocols/JabberG/src/jabber_byte.cpp
index e18ae8ab7a..f3e3c4d0ea 100644
--- a/protocols/JabberG/src/jabber_byte.cpp
+++ b/protocols/JabberG/src/jabber_byte.cpp
@@ -94,10 +94,10 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hConn, (LPARAM)&connInfo);
mir_sntprintf(szPort, SIZEOF(szPort), _T("%u"), connInfo.wPort);
- ppro->Log("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
+ ppro->debugLogA("bytestream_send_connection incoming connection accepted: %s", connInfo.szIpPort);
if ((item = ppro->ListGetItemPtr(LIST_BYTE, szPort)) == NULL) {
- ppro->Log("No bytestream session is currently active, connection closed.");
+ ppro->debugLogA("No bytestream session is currently active, connection closed.");
Netlib_CloseHandle(hConn);
return;
}
@@ -105,7 +105,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
jbt = item->jbt;
if ((buffer = (char*)mir_alloc(JABBER_NETWORK_BUFFER_SIZE)) == NULL) {
- ppro->Log("bytestream_send cannot allocate network buffer, connection closed.");
+ ppro->debugLogA("bytestream_send cannot allocate network buffer, connection closed.");
jbt->state = JBT_ERROR;
Netlib_CloseHandle(hConn);
if (jbt->hEvent != NULL) SetEvent(jbt->hEvent);
@@ -131,7 +131,7 @@ void JabberByteSendConnection(HANDLE hConn, DWORD /*dwRemoteIP*/, void* extra)
if (jbt->hConn)
Netlib_CloseHandle(jbt->hConn);
- ppro->Log("bytestream_send_connection closing connection");
+ ppro->debugLogA("bytestream_send_connection closing connection");
jbt->hConn = hListen;
mir_free(buffer);
@@ -146,7 +146,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
CJabberIqInfo *pInfo = NULL;
int nIqId = 0;
- Log("Thread started: type=bytestream_send");
+ debugLogA("Thread started: type=bytestream_send");
BOOL bDirect = m_options.BsDirect;
@@ -173,7 +173,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
mir_free(proxyJid);
if (jbt->state == JBT_ERROR && !bDirect) {
- Log("Bytestream proxy failure");
+ debugLogA("Bytestream proxy failure");
MsgPopup( pInfo->GetHContact(), TranslateT("Bytestream Proxy not available"), pInfo->GetReceiver());
jbt->ft->state = FT_DENIED;
(this->*jbt->pfnFinal)(FALSE, jbt->ft);
@@ -201,7 +201,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
nlb.wPort = 0; // Use user-specified incoming port ranges, if available
jbt->hConn = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hNetlibUser, (LPARAM)&nlb);
if (jbt->hConn == NULL) {
- Log("Cannot allocate port for bytestream_send thread, thread ended.");
+ debugLogA("Cannot allocate port for bytestream_send thread, thread ended.");
delete jbt;
return;
}
@@ -289,7 +289,7 @@ void CJabberProto::ByteSendThread(JABBER_BYTE_TRANSFER *jbt)
// stupid fix: wait for listening connection thread exit
Sleep(100);
delete jbt;
- Log("Thread ended: type=bytestream_send");
+ debugLogA("Thread ended: type=bytestream_send");
}
void CJabberProto::ByteInitiateResult(HXML iqNode, CJabberIqInfo *pInfo)
@@ -370,7 +370,7 @@ int CJabberProto::ByteSendParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* b
mir_free(szTargetJid);
char* szAuthString = mir_utf8encodeT(text);
- Log("Auth: '%s'", szAuthString);
+ debugLogA("Auth: '%s'", szAuthString);
if ((str = JabberSha1(szAuthString)) != NULL) {
for (i=0; i<40 && buffer[i+5]==str[i]; i++);
mir_free(str);
@@ -520,7 +520,7 @@ int CJabberProto::ByteSendProxyParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, ch
mir_free(szTargetJid);
char* szAuthString = mir_utf8encodeT(text);
- Log("Auth: '%s'", szAuthString);
+ debugLogA("Auth: '%s'", szAuthString);
char* szHash = JabberSha1(szAuthString);
strncpy((char*)(data+5), szHash, 40);
mir_free(szHash);
@@ -628,7 +628,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
port = (WORD)_ttoi(szPort);
replaceStrT(jbt->streamhostJID, str);
- Log("bytestream_recv connecting to %S:%d", szHost, port);
+ debugLogA("bytestream_recv connecting to %S:%d", szHost, port);
NETLIBOPENCONNECTION nloc = { 0 };
nloc.cbSize = sizeof(nloc);
nloc.szHost = mir_t2a(szHost);
@@ -637,7 +637,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
mir_free((void*)nloc.szHost);
if (hConn == NULL) {
- Log("bytestream_recv_connection connection failed (%d), try next streamhost", WSAGetLastError());
+ debugLogA("bytestream_recv_connection connection failed (%d), try next streamhost", WSAGetLastError());
continue;
}
@@ -661,11 +661,11 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
if (jbt->state == JBT_RECVING) validStreamhost = TRUE;
}
Netlib_CloseHandle(hConn);
- Log("bytestream_recv_connection closing connection");
+ debugLogA("bytestream_recv_connection closing connection");
}
if (jbt->state==JBT_ERROR || validStreamhost==TRUE)
break;
- Log("bytestream_recv_connection stream cannot be established, try next streamhost");
+ debugLogA("bytestream_recv_connection stream cannot be established, try next streamhost");
}
mir_free(buffer);
}
@@ -674,7 +674,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
(this->*jbt->pfnFinal)((jbt->state==JBT_DONE)?TRUE:FALSE, jbt->ft);
jbt->ft = NULL;
if ( !validStreamhost && szId && from) {
- Log("bytestream_recv_connection session not completed");
+ debugLogA("bytestream_recv_connection session not completed");
m_ThreadInfo->send( XmlNodeIq(_T("error"), szId, from)
<< XCHILD(_T("error")) << XATTRI(_T("code"), 404) << XATTR(_T("type"), _T("cancel"))
@@ -682,7 +682,7 @@ void __cdecl CJabberProto::ByteReceiveThread(JABBER_BYTE_TRANSFER *jbt)
}
delete jbt;
- Log("Thread ended: type=bytestream_recv");
+ debugLogA("Thread ended: type=bytestream_recv");
}
int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char* buffer, int datalen)
@@ -714,7 +714,7 @@ int CJabberProto::ByteReceiveParse(HANDLE hConn, JABBER_BYTE_TRANSFER *jbt, char
mir_free(szInitiatorJid);
mir_free(szTargetJid);
char* szAuthString = mir_utf8encodeT(text);
- Log("Auth: '%s'", szAuthString);
+ debugLogA("Auth: '%s'", szAuthString);
char* szHash = JabberSha1(szAuthString);
strncpy((char*)(data+5), szHash, 40);
mir_free(szHash);
diff --git a/protocols/JabberG/src/jabber_caps.cpp b/protocols/JabberG/src/jabber_caps.cpp
index e2397005b7..6b0a8b43bf 100644
--- a/protocols/JabberG/src/jabber_caps.cpp
+++ b/protocols/JabberG/src/jabber_caps.cpp
@@ -557,12 +557,12 @@ JabberCapsBits CJabberClientCapsManager::GetClientCaps(TCHAR *szNode, TCHAR *szV
CJabberClientCaps *pClient = FindClient(szNode);
if ( !pClient) {
Unlock();
- ppro->Log("CAPS: get no caps for: %S, %S", szNode, szVer);
+ ppro->debugLogA("CAPS: get no caps for: %S, %S", szNode, szVer);
return JABBER_RESOURCE_CAPS_UNINIT;
}
JabberCapsBits jcbCaps = pClient->GetPartialCaps(szVer);
Unlock();
- ppro->Log("CAPS: get caps %I64x for: %S, %S", jcbCaps, szNode, szVer);
+ ppro->debugLogA("CAPS: get caps %I64x for: %S, %S", jcbCaps, szNode, szVer);
return jcbCaps;
}
@@ -581,7 +581,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(const TCHAR *szNode, const TCHAR *s
}
BOOL bOk = pClient->SetPartialCaps(szVer, jcbCaps, nIqId);
Unlock();
- ppro->Log("CAPS: set caps %I64x for: %S, %S", jcbCaps, szNode, szVer);
+ ppro->debugLogA("CAPS: set caps %I64x for: %S, %S", jcbCaps, szNode, szVer);
return bOk;
}
@@ -596,7 +596,7 @@ BOOL CJabberClientCapsManager::SetClientCaps(int nIqId, JabberCapsBits jcbCaps)
CJabberClientCaps *pClient = m_pClients;
while (pClient) {
if (pClient->SetPartialCaps(nIqId, jcbCaps)) {
- ppro->Log("CAPS: set caps %I64x for iq %d", jcbCaps, nIqId);
+ ppro->debugLogA("CAPS: set caps %I64x for iq %d", jcbCaps, nIqId);
bOk = TRUE;
break;
}
diff --git a/protocols/JabberG/src/jabber_events.cpp b/protocols/JabberG/src/jabber_events.cpp
index 916fb3e9b7..29d84fe4e7 100644
--- a/protocols/JabberG/src/jabber_events.cpp
+++ b/protocols/JabberG/src/jabber_events.cpp
@@ -90,14 +90,14 @@ void __cdecl CJabberProto::OnRenameGroup(DBCONTACTWRITESETTING* cws, HANDLE hCon
if (cws->value.type == DBVT_DELETED) {
if (item->group != NULL) {
- Log("Group set to nothing");
+ debugLogA("Group set to nothing");
AddContactToRoster(item->jid, tszNick, NULL);
}
}
else {
TCHAR *p = sttSettingToTchar(cws);
if (cws->value.pszVal != NULL && lstrcmp(p, item->group)) {
- Log("Group set to %S", p);
+ debugLogA("Group set to %S", p);
if (p)
AddContactToRoster(item->jid, tszNick, p);
}
@@ -120,7 +120,7 @@ void __cdecl CJabberProto::OnRenameContact(DBCONTACTWRITESETTING* cws, HANDLE hC
ptrT newNick( sttSettingToTchar(cws));
if (newNick && lstrcmp(item->nick, newNick)) {
- Log("Renaming contact %S: %S -> %S", item->jid, item->nick, newNick);
+ debugLogA("Renaming contact %S: %S -> %S", item->jid, item->nick, newNick);
AddContactToRoster(item->jid, newNick, item->group);
}
}
@@ -134,7 +134,7 @@ void __cdecl CJabberProto::OnAddContactForever(DBCONTACTWRITESETTING *cws, HANDL
if (jid == NULL)
return;
- Log("Add %S permanently to list", jid);
+ debugLogA("Add %S permanently to list", jid);
ptrT nick( db_get_tsa(hContact, "CList", "MyHandle"));
if (nick == NULL)
nick = getTStringA(hContact, "Nick");
diff --git a/protocols/JabberG/src/jabber_file.cpp b/protocols/JabberG/src/jabber_file.cpp
index 7af86a90a7..b7556ca9af 100644
--- a/protocols/JabberG/src/jabber_file.cpp
+++ b/protocols/JabberG/src/jabber_file.cpp
@@ -30,7 +30,7 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft)
{
ThreadData info(this, JABBER_SESSION_NORMAL);
- Log("Thread started: type=file_receive server='%s' port='%d'", ft->httpHostName, ft->httpPort);
+ debugLogA("Thread started: type=file_receive server='%s' port='%d'", ft->httpHostName, ft->httpPort);
ft->type = FT_OOB;
@@ -41,7 +41,7 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft)
nloc.wPort = ft->httpPort;
info.s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
if (info.s == NULL) {
- Log("Connection failed (%d), thread ended", WSAGetLastError());
+ debugLogA("Connection failed (%d), thread ended", WSAGetLastError());
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
}
else {
@@ -52,13 +52,13 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft)
info.send(buffer, datalen);
ft->state = FT_CONNECTING;
- Log("Entering file_receive recv loop");
+ debugLogA("Entering file_receive recv loop");
datalen = 0;
while (ft->state != FT_DONE && ft->state != FT_ERROR) {
int recvResult, bytesParsed;
- Log("Waiting for data...");
+ debugLogA("Waiting for data...");
recvResult = info.recv(buffer+datalen, JABBER_NETWORK_BUFFER_SIZE-datalen);
if (recvResult <= 0)
break;
@@ -75,7 +75,7 @@ void __cdecl CJabberProto::FileReceiveThread(filetransfer *ft)
if (ft->state==FT_DONE || (ft->state==FT_RECEIVING && ft->std.currentFileSize < 0))
ft->complete();
- Log("Thread ended: type=file_receive server='%s'", ft->httpHostName);
+ debugLogA("Thread ended: type=file_receive server='%s'", ft->httpHostName);
}
delete ft;
}
@@ -96,13 +96,13 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
if ((str=(char*)mir_alloc(q-p+1)) != NULL) {
strncpy(str, p, q-p);
str[q-p] = '\0';
- Log("FT Got: %s", str);
+ debugLogA("FT Got: %s", str);
if (ft->state == FT_CONNECTING) {
// looking for "HTTP/1.1 200 OK"
if (sscanf(str, "HTTP/%*d.%*d %d %*s", &code)==1 && code==200) {
ft->state = FT_INITIALIZING;
ft->std.currentFileSize = -1;
- Log("Change to FT_INITIALIZING");
+ debugLogA("Change to FT_INITIALIZING");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_INITIALISING, ft, 0);
}
}
@@ -121,7 +121,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
}
ft->state = FT_RECEIVING;
ft->std.currentFileProgress = 0;
- Log("Change to FT_RECEIVING");
+ debugLogA("Change to FT_RECEIVING");
}
else if ((s=strchr(str, ':')) != NULL) {
*s = '\0';
@@ -155,7 +155,7 @@ int CJabberProto::FileReceiveParse(filetransfer *ft, char* buffer, int datalen)
else
writeSize = bufferSize;
if (_write(ft->fileId, p, writeSize) != writeSize) {
- Log("_write() error");
+ debugLogA("_write() error");
ft->state = FT_ERROR;
}
else {
@@ -184,11 +184,11 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
TCHAR szPort[10];
mir_sntprintf(szPort, SIZEOF(szPort), _T("%d"), connInfo.wPort);
- ppro->Log("File server incoming connection accepted: %s", connInfo.szIpPort);
+ ppro->debugLogA("File server incoming connection accepted: %s", connInfo.szIpPort);
JABBER_LIST_ITEM *item = ppro->ListGetItemPtr(LIST_FILE, szPort);
if (item == NULL) {
- ppro->Log("No file is currently served, file server connection closed.");
+ ppro->debugLogA("No file is currently served, file server connection closed.");
Netlib_CloseHandle(hConnection);
return;
}
@@ -196,11 +196,11 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
filetransfer *ft = item->ft;
JABBER_SOCKET slisten = ft->s;
ft->s = hConnection;
- ppro->Log("Set ft->s to %d (saving %d)", hConnection, slisten);
+ ppro->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
char* buffer = (char*)mir_alloc(JABBER_NETWORK_BUFFER_SIZE+1);
if (buffer == NULL) {
- ppro->Log("Cannot allocate network buffer, file server connection closed.");
+ ppro->debugLogA("Cannot allocate network buffer, file server connection closed.");
Netlib_CloseHandle(hConnection);
ft->state = FT_ERROR;
if (ft->hFileEvent != NULL)
@@ -208,7 +208,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
return;
}
- ppro->Log("Entering recv loop for this file connection... (ft->s is hConnection)");
+ ppro->debugLogA("Entering recv loop for this file connection... (ft->s is hConnection)");
int datalen = 0;
while (ft->state!=FT_DONE && ft->state!=FT_ERROR) {
int recvResult, bytesParsed;
@@ -219,7 +219,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
datalen += recvResult;
buffer[datalen] = '\0';
- ppro->Log("RECV:%s", buffer);
+ ppro->debugLogA("RECV:%s", buffer);
bytesParsed = ppro->FileSendParse(hConnection, ft, buffer, datalen);
if (bytesParsed < datalen)
@@ -227,10 +227,10 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
datalen -= bytesParsed;
}
- ppro->Log("Closing connection for this file transfer... (ft->s is now hBind)");
+ ppro->debugLogA("Closing connection for this file transfer... (ft->s is now hBind)");
Netlib_CloseHandle(hConnection);
ft->s = slisten;
- ppro->Log("ft->s is restored to %d", ft->s);
+ ppro->debugLogA("ft->s is restored to %d", ft->s);
if (ft->hFileEvent != NULL)
SetEvent(ft->hFileEvent);
mir_free(buffer);
@@ -238,7 +238,7 @@ void JabberFileServerConnection(JABBER_SOCKET hConnection, DWORD /*dwRemoteIP*/,
void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
{
- Log("Thread started: type=file_send");
+ debugLogA("Thread started: type=file_send");
ThreadData info(this, JABBER_SESSION_NORMAL);
ft->type = FT_OOB;
@@ -250,14 +250,14 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
nlb.wPort = 0; // Use user-specified incoming port ranges, if available
info.s = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hNetlibUser, (LPARAM)&nlb);
if (info.s == NULL) {
- Log("Cannot allocate port to bind for file server thread, thread ended.");
+ debugLogA("Cannot allocate port to bind for file server thread, thread ended.");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
delete ft;
return;
}
ft->s = info.s;
- Log("ft->s = %d", info.s);
+ debugLogA("ft->s = %d", info.s);
HANDLE hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
ft->hFileEvent = hEvent;
@@ -307,37 +307,37 @@ void __cdecl CJabberProto::FileServerThread(filetransfer *ft)
query << XCHILD(_T("desc"), ft->szDescription);
m_ThreadInfo->send(iq);
- Log("Waiting for the file to be sent...");
+ debugLogA("Waiting for the file to be sent...");
WaitForSingleObject(hEvent, INFINITE);
}
- Log("File sent, advancing to the next file...");
+ debugLogA("File sent, advancing to the next file...");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
}
CloseHandle(hEvent);
ft->hFileEvent = NULL;
- Log("Finish all files");
+ debugLogA("Finish all files");
}
ft->s = NULL;
- Log("ft->s is NULL");
+ debugLogA("ft->s is NULL");
ListRemove(LIST_FILE, szPort);
switch (ft->state) {
case FT_DONE:
- Log("Finish successfully");
+ debugLogA("Finish successfully");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
break;
case FT_DENIED:
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_DENIED, ft, 0);
break;
default: // FT_ERROR:
- Log("Finish with errors");
+ debugLogA("Finish with errors");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
break;
}
- Log("Thread ended: type=file_send");
+ debugLogA("Thread ended: type=file_send");
delete ft;
}
@@ -363,7 +363,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
}
strncpy(str, p, q-p);
str[q-p] = '\0';
- Log("FT Got: %s", str);
+ debugLogA("FT Got: %s", str);
if (ft->state == FT_CONNECTING) {
// looking for "GET filename.ext HTTP/1.1"
if ( !strncmp(str, "GET ", 4)) {
@@ -373,7 +373,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
ft->httpPath = mir_a2t(t);
JabberHttpUrlDecode(ft->httpPath);
ft->state = FT_INITIALIZING;
- Log("Change to FT_INITIALIZING");
+ debugLogA("Change to FT_INITIALIZING");
}
}
else { // FT_INITIALIZING
@@ -392,16 +392,16 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
if (ft->httpPath == NULL || lstrcmp(ft->httpPath, t)) {
if (ft->httpPath == NULL)
- Log("Requested file name does not matched (httpPath == NULL)");
+ debugLogA("Requested file name does not matched (httpPath == NULL)");
else
- Log("Requested file name does not matched ('%s' vs. '%s')", ft->httpPath, t);
+ debugLogA("Requested file name does not matched ('%s' vs. '%s')", ft->httpPath, t);
ft->state = FT_ERROR;
break;
}
- Log("Sending [%s]", ft->std.ptszFiles[ currentFile ]);
+ debugLogA("Sending [%s]", ft->std.ptszFiles[ currentFile ]);
_tstati64(ft->std.ptszFiles[ currentFile ], &statbuf); // file size in statbuf.st_size
if ((fileId = _topen(ft->std.ptszFiles[currentFile], _O_BINARY|_O_RDONLY)) < 0) {
- Log("File cannot be opened");
+ debugLogA("File cannot be opened");
ft->state = FT_ERROR;
mir_free(ft->httpPath);
ft->httpPath = NULL;
@@ -414,7 +414,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
ft->std.flags |= PFTS_SENDING;
ft->std.currentFileProgress = 0;
- Log("Sending file data...");
+ debugLogA("Sending file data...");
while ((numRead = _read(fileId, fileBuffer, 2048)) > 0) {
if (Netlib_Send(s, fileBuffer, numRead, 0) != numRead) {
@@ -428,7 +428,7 @@ int CJabberProto::FileSendParse(JABBER_SOCKET s, filetransfer *ft, char* buffer,
_close(fileId);
if (ft->state != FT_ERROR)
ft->state = FT_DONE;
- Log("Finishing this file...");
+ debugLogA("Finishing this file...");
mir_free(ft->httpPath);
ft->httpPath = NULL;
break;
@@ -457,7 +457,7 @@ filetransfer::filetransfer(CJabberProto* proto)
filetransfer::~filetransfer()
{
- ppro->Log("Destroying file transfer session %08p", this);
+ ppro->debugLogA("Destroying file transfer session %08p", this);
if ( !bCompleted)
ppro->ProtoBroadcastAck(std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, this, 0);
@@ -515,12 +515,12 @@ int filetransfer::create()
WaitForSingleObject(hWaitEvent, INFINITE);
if (fileId == -1) {
- ppro->Log("Saving to [%S]", std.tszCurrentFile);
+ ppro->debugLogA("Saving to [%S]", std.tszCurrentFile);
fileId = _topen(std.tszCurrentFile, _O_BINARY | _O_CREAT | _O_TRUNC | _O_WRONLY, _S_IREAD | _S_IWRITE);
}
if (fileId == -1)
- ppro->Log("Cannot create file '%S' during a file transfer", filefull);
+ ppro->debugLogA("Cannot create file '%S' during a file transfer", filefull);
else if (std.currentFileSize != 0)
_chsize(fileId, std.currentFileSize);
diff --git a/protocols/JabberG/src/jabber_ft.cpp b/protocols/JabberG/src/jabber_ft.cpp
index 811405828c..08c733c66a 100644
--- a/protocols/JabberG/src/jabber_ft.cpp
+++ b/protocols/JabberG/src/jabber_ft.cpp
@@ -30,7 +30,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void CJabberProto::FtCancel(filetransfer *ft)
{
- Log("Invoking JabberFtCancel()");
+ debugLogA("Invoking JabberFtCancel()");
// For file sending session that is still in si negotiation phase
if (m_iqManager.ExpireByUserData(ft))
@@ -41,7 +41,7 @@ void CJabberProto::FtCancel(filetransfer *ft)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
if (item->ft == ft) {
- Log("Canceling file receiving session while in si negotiation");
+ debugLogA("Canceling file receiving session while in si negotiation");
ListRemoveByIndex(i);
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
delete ft;
@@ -51,10 +51,10 @@ void CJabberProto::FtCancel(filetransfer *ft)
// For file transfer through bytestream
JABBER_BYTE_TRANSFER *jbt = ft->jbt;
if (jbt != NULL) {
- Log("Canceling bytestream session");
+ debugLogA("Canceling bytestream session");
jbt->state = JBT_ERROR;
if (jbt->hConn) {
- Log("Force closing bytestream session");
+ debugLogA("Force closing bytestream session");
Netlib_CloseHandle(jbt->hConn);
jbt->hConn = NULL;
}
@@ -66,7 +66,7 @@ void CJabberProto::FtCancel(filetransfer *ft)
// For file transfer through IBB
JABBER_IBB_TRANSFER *jibb = ft->jibb;
if (jibb != NULL) {
- Log("Canceling IBB session");
+ debugLogA("Canceling IBB session");
jibb->state = JIBB_ERROR;
m_iqManager.ExpireByUserData(jibb);
}
@@ -166,7 +166,7 @@ void CJabberProto::OnFtSiResult(HXML iqNode, CJabberIqInfo *pInfo)
ForkThread((MyThreadFunc)&CJabberProto::IbbSendThread, jibb);
} } } } } } }
else {
- Log("File transfer stream initiation request denied or failed");
+ debugLogA("File transfer stream initiation request denied or failed");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, pInfo->GetIqType() == JABBER_IQ_TYPE_ERROR ? ACKRESULT_DENIED : ACKRESULT_FAILED, ft, 0);
delete ft;
}
@@ -179,10 +179,10 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft)
char* buffer;
int numRead;
- Log("Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
+ debugLogA("Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
_tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
if ((fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY|_O_RDONLY)) < 0) {
- Log("File cannot be opened");
+ debugLogA("File cannot be opened");
return FALSE;
}
@@ -209,14 +209,14 @@ BOOL CJabberProto::FtSend(HANDLE hConn, filetransfer *ft)
BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft)
{
- Log("Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
+ debugLogA("Sending [%s]", ft->std.ptszFiles[ft->std.currentFileNumber]);
struct _stati64 statbuf;
_tstati64(ft->std.ptszFiles[ft->std.currentFileNumber], &statbuf); // file size in statbuf.st_size
int fd = _topen(ft->std.ptszFiles[ft->std.currentFileNumber], _O_BINARY|_O_RDONLY);
if (fd < 0) {
- Log("File cannot be opened");
+ debugLogA("File cannot be opened");
return FALSE;
}
@@ -251,7 +251,7 @@ BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft)
mir_free(encoded);
if (ft->jibb->state == JIBB_ERROR || ft->jibb->bStreamClosed || m_ThreadInfo->send(msg) == SOCKET_ERROR) {
- Log("JabberFtIbbSend unsuccessful exit");
+ debugLogA("JabberFtIbbSend unsuccessful exit");
_close(fd);
return FALSE;
}
@@ -270,7 +270,7 @@ BOOL CJabberProto::FtIbbSend(int blocksize, filetransfer *ft)
void CJabberProto::FtSendFinal(BOOL success, filetransfer *ft)
{
if ( !success) {
- Log("File transfer complete with error");
+ debugLogA("File transfer complete with error");
ProtoBroadcastAck(ft->std.hContact, ACKTYPE_FILE, ft->state == FT_DENIED ? ACKRESULT_DENIED : ACKRESULT_FAILED, ft, 0);
}
else {
@@ -443,7 +443,7 @@ BOOL CJabberProto::FtHandleBytestreamRequest(HXML iqNode, CJabberIqInfo *pInfo)
return TRUE;
}
- Log("File transfer invalid bytestream initiation request received");
+ debugLogA("File transfer invalid bytestream initiation request received");
return TRUE;
}
@@ -521,7 +521,7 @@ int CJabberProto::FtReceive(HANDLE, filetransfer *ft, char* buffer, int datalen)
if (remainingBytes > 0) {
int writeSize = (remainingBytes<datalen) ? remainingBytes : datalen;
if (_write(ft->fileId, buffer, writeSize) != writeSize) {
- Log("_write() error");
+ debugLogA("_write() error");
return -1;
}
@@ -537,10 +537,10 @@ int CJabberProto::FtReceive(HANDLE, filetransfer *ft, char* buffer, int datalen)
void CJabberProto::FtReceiveFinal(BOOL success, filetransfer *ft)
{
if (success) {
- Log("File transfer complete successfully");
+ debugLogA("File transfer complete successfully");
ft->complete();
}
- else Log("File transfer complete with error");
+ else debugLogA("File transfer complete with error");
delete ft;
}
diff --git a/protocols/JabberG/src/jabber_ibb.cpp b/protocols/JabberG/src/jabber_ibb.cpp
index 0c5ab25e2c..c95c22e2c5 100644
--- a/protocols/JabberG/src/jabber_ibb.cpp
+++ b/protocols/JabberG/src/jabber_ibb.cpp
@@ -87,7 +87,7 @@ void CJabberProto::OnIbbCloseResult(HXML, CJabberIqInfo *pInfo)
void CJabberProto::IbbSendThread(JABBER_IBB_TRANSFER *jibb)
{
- Log("Thread started: type=ibb_send");
+ debugLogA("Thread started: type=ibb_send");
jibb->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
jibb->bStreamInitialized = FALSE;
@@ -136,7 +136,7 @@ void CJabberProto::IbbSendThread(JABBER_IBB_TRANSFER *jibb)
void __cdecl CJabberProto::IbbReceiveThread(JABBER_IBB_TRANSFER *jibb)
{
- Log("Thread started: type=ibb_recv");
+ debugLogA("Thread started: type=ibb_recv");
filetransfer *ft = jibb->ft;
diff --git a/protocols/JabberG/src/jabber_iq.cpp b/protocols/JabberG/src/jabber_iq.cpp
index e5dbecfe31..6b084c0c3c 100644
--- a/protocols/JabberG/src/jabber_iq.cpp
+++ b/protocols/JabberG/src/jabber_iq.cpp
@@ -175,7 +175,7 @@ void CJabberIqManager::ExpireInfo(CJabberIqInfo *pInfo, void*)
if ((pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (pInfo->m_szFrom))
pInfo->m_hContact = ppro->HContactFromJID(pInfo->m_szFrom , 3);
- ppro->Log("Expiring iq id %d, sent to %S", pInfo->m_nIqId, pInfo->m_szReceiver ? pInfo->m_szReceiver : _T("server"));
+ ppro->debugLogA("Expiring iq id %d, sent to %S", pInfo->m_nIqId, pInfo->m_szReceiver ? pInfo->m_szReceiver : _T("server"));
pInfo->m_nIqType = JABBER_IQ_TYPE_FAIL;
(ppro->*(pInfo->m_pHandler))(NULL, pInfo);
@@ -344,7 +344,7 @@ BOOL CJabberIqManager::HandleIqPermanent(HXML pNode)
if ((pInfo->m_dwParamsToParse & JABBER_IQ_PARSE_HCONTACT) && (iqInfo.m_szFrom))
iqInfo.m_hContact = ppro->HContactFromJID(iqInfo.m_szFrom, 3);
- ppro->Log("Handling iq id %S, type %S, from %S", iqInfo.m_szId, szType, iqInfo.m_szFrom);
+ ppro->debugLogA("Handling iq id %S, type %S, from %S", iqInfo.m_szId, szType, iqInfo.m_szFrom);
if ((ppro->*(pInfo->m_pHandler))(pNode, &iqInfo))
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_iq_handlers.cpp b/protocols/JabberG/src/jabber_iq_handlers.cpp
index f769f5ed2e..06be6afd9c 100644
--- a/protocols/JabberG/src/jabber_iq_handlers.cpp
+++ b/protocols/JabberG/src/jabber_iq_handlers.cpp
@@ -511,7 +511,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
// invalid JID
if ( !bRetVal) {
- Log("<iq/> attempt to hack via roster push from %S", pInfo->GetFrom());
+ debugLogA("<iq/> attempt to hack via roster push from %S", pInfo->GetFrom());
return TRUE;
}
}
@@ -521,7 +521,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
const TCHAR *jid, *str, *name;
TCHAR *nick;
- Log("<iq/> Got roster push, query has %d children", xmlGetChildCount(queryNode));
+ debugLogA("<iq/> Got roster push, query has %d children", xmlGetChildCount(queryNode));
for (int i=0; ; i++) {
HXML itemNode = xmlGetChild(queryNode ,i);
if ( !itemNode)
@@ -584,7 +584,7 @@ BOOL CJabberProto::OnRosterPushRequest(HXML, CJabberIqInfo *pInfo)
else if ( !_tcscmp(str, _T("to"))) item->subscription = SUB_TO;
else if ( !_tcscmp(str, _T("from"))) item->subscription = SUB_FROM;
else item->subscription = SUB_NONE;
- Log("Roster push for jid=%S, set subscription to %S", jid, str);
+ debugLogA("Roster push for jid=%S, set subscription to %S", jid, str);
// subscription = remove is to remove from roster list
// but we will just set the contact to offline and not actually
// remove, so that history will be retained.
@@ -656,12 +656,12 @@ BOOL CJabberProto::OnIqRequestOOB(HXML, CJabberIqInfo *pInfo)
if (ft->httpHostName && ft->httpPath) {
TCHAR *desc = NULL;
- Log("Host=%s Port=%d Path=%s", ft->httpHostName, ft->httpPort, ft->httpPath);
+ debugLogA("Host=%s Port=%d Path=%s", ft->httpHostName, ft->httpPort, ft->httpPath);
if ((n = xmlGetChild(pInfo->GetChildNode(), "desc")) != NULL)
desc = (TCHAR*)xmlGetText(n);
TCHAR *str2;
- Log("description = %s", desc);
+ debugLogA("description = %s", desc);
if ((str2 = _tcsrchr(ft->httpPath, '/')) != NULL)
str2++;
else
diff --git a/protocols/JabberG/src/jabber_iqid.cpp b/protocols/JabberG/src/jabber_iqid.cpp
index 2145250b25..c8352f60b1 100644
--- a/protocols/JabberG/src/jabber_iqid.cpp
+++ b/protocols/JabberG/src/jabber_iqid.cpp
@@ -209,7 +209,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo *pInfo)
{
// RECVED: result of the request for authentication method
// ACTION: send account authentication information to log in
- Log("<iq/> iqIdGetAuth");
+ debugLogA("<iq/> iqIdGetAuth");
HXML queryNode;
const TCHAR *type;
@@ -233,7 +233,7 @@ void CJabberProto::OnIqResultGetAuth(HXML iqNode, CJabberIqInfo *pInfo)
else if (xmlGetChild(queryNode, "password") != NULL)
query << XCHILD(_T("password"), m_ThreadInfo->password);
else {
- Log("No known authentication mechanism accepted by the server.");
+ debugLogA("No known authentication mechanism accepted by the server.");
m_ThreadInfo->send("</stream:stream>");
return;
}
@@ -259,7 +259,7 @@ void CJabberProto::OnIqResultSetAuth(HXML iqNode, CJabberIqInfo *pInfo)
// RECVED: authentication result
// ACTION: if successfully logged in, continue by requesting roster list and set my initial status
- Log("<iq/> iqIdSetAuth");
+ debugLogA("<iq/> iqIdSetAuth");
if ((type=xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ( !lstrcmp(type, _T("result"))) {
@@ -288,9 +288,9 @@ void CJabberProto::OnIqResultBind(HXML iqNode, CJabberIqInfo *pInfo)
LPCTSTR szJid = XPathT(iqNode, "bind[@xmlns='urn:ietf:params:xml:ns:xmpp-bind']/jid");
if (szJid) {
if ( !_tcsncmp(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID)))
- Log("Result Bind: %S confirmed ", m_ThreadInfo->fullJID);
+ debugLogA("Result Bind: %S confirmed ", m_ThreadInfo->fullJID);
else {
- Log("Result Bind: %S changed to %S", m_ThreadInfo->fullJID, szJid);
+ debugLogA("Result Bind: %S changed to %S", m_ThreadInfo->fullJID, szJid);
_tcsncpy(m_ThreadInfo->fullJID, szJid, SIZEOF(m_ThreadInfo->fullJID));
}
}
@@ -342,7 +342,7 @@ void CJabberProto::GroupchatJoinByHContact(HANDLE hContact, bool autojoin)
void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqIdGetRoster");
+ debugLogA("<iq/> iqIdGetRoster");
TCHAR *szGroupDelimeter = (TCHAR *)pInfo->GetUserData();
if (pInfo->GetIqType() != JABBER_IQ_TYPE_RESULT) {
mir_free(szGroupDelimeter);
@@ -503,7 +503,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
HANDLE hNext = db_find_next(hContact, m_szModuleName);
ptrT jid( getTStringA(hContact, "jid"));
if (jid != NULL && !ListGetItemPtr(LIST_ROSTER, jid)) {
- Log("Syncing roster: preparing to delete %S (hContact=0x%x)", jid, hContact);
+ debugLogA("Syncing roster: preparing to delete %S (hContact=0x%x)", jid, hContact);
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
}
hContact = hNext;
@@ -512,7 +512,7 @@ void CJabberProto::OnIqResultGetRoster(HXML iqNode, CJabberIqInfo *pInfo)
EnableMenuItems(TRUE);
- Log("Status changed via THREADSTART");
+ debugLogA("Status changed via THREADSTART");
m_bModeMsgStatusChangePending = FALSE;
SetServerStatus(m_iDesiredStatus);
@@ -540,7 +540,7 @@ void CJabberProto::OnIqResultGetRegister(HXML iqNode, CJabberIqInfo*)
{
// RECVED: result of the request for (agent) registration mechanism
// ACTION: activate (agent) registration input dialog
- Log("<iq/> iqIdGetRegister");
+ debugLogA("<iq/> iqIdGetRegister");
HXML queryNode;
const TCHAR *type;
@@ -563,7 +563,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*)
{
// RECVED: result of registration process
// ACTION: notify of successful agent registration
- Log("<iq/> iqIdSetRegister");
+ debugLogA("<iq/> iqIdSetRegister");
const TCHAR *type, *from;
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
@@ -590,7 +590,7 @@ void CJabberProto::OnIqResultSetRegister(HXML iqNode, CJabberIqInfo*)
void CJabberProto::OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HANDLE hContact, BOOL& hasPhoto)
{
- Log("JabberIqResultGetVcardPhoto: %d", hasPhoto);
+ debugLogA("JabberIqResultGetVcardPhoto: %d", hasPhoto);
if (hasPhoto)
return;
@@ -611,24 +611,24 @@ void CJabberProto::OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HANDLE hCon
TCHAR szAvatarFileName[MAX_PATH];
GetAvatarFileName(hContact, szAvatarFileName, SIZEOF(szAvatarFileName));
- Log("Picture file name set to %S", szAvatarFileName);
+ debugLogA("Picture file name set to %S", szAvatarFileName);
HANDLE hFile = CreateFile(szAvatarFileName, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
return;
- Log("Writing %d bytes", bufferLen);
+ debugLogA("Writing %d bytes", bufferLen);
DWORD nWritten;
bool bRes = WriteFile(hFile, buffer, bufferLen, &nWritten, NULL) != 0;
CloseHandle(hFile);
if (!bRes)
return;
- Log("%d bytes written", nWritten);
+ debugLogA("%d bytes written", nWritten);
if (hContact == NULL) {
hasPhoto = TRUE;
CallService(MS_AV_SETMYAVATART, (WPARAM)m_szModuleName, (LPARAM)szAvatarFileName);
- Log("My picture saved to %S", szAvatarFileName);
+ debugLogA("My picture saved to %S", szAvatarFileName);
}
else {
ptrT jid( getTStringA(hContact, "jid"));
@@ -643,7 +643,7 @@ void CJabberProto::OnIqResultGetVcardPhoto(const TCHAR *jid, HXML n, HANDLE hCon
if (item->photoFileName && _tcscmp(item->photoFileName, szAvatarFileName))
DeleteFile(item->photoFileName);
replaceStrT(item->photoFileName, szAvatarFileName);
- Log("Contact's picture saved to %S", szAvatarFileName);
+ debugLogA("Contact's picture saved to %S", szAvatarFileName);
OnIqResultGotAvatar(hContact, o, szPicType);
}
}
@@ -670,7 +670,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo *pInfo)
TCHAR text[128];
DBVARIANT dbv;
- Log("<iq/> iqIdGetVcard");
+ debugLogA("<iq/> iqIdGetVcard");
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((jid = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
int id = JabberGetPacketID(iqNode);
@@ -702,12 +702,12 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo *pInfo)
size_t len = _tcslen(m_szJabberJID);
if ( !_tcsnicmp(jid, m_szJabberJID, len) && (jid[len]=='/' || jid[len]=='\0')) {
hContact = NULL;
- Log("Vcard for myself");
+ debugLogA("Vcard for myself");
}
else {
if ((hContact = HContactFromJID(jid)) == NULL)
return;
- Log("Other user's vcard");
+ debugLogA("Other user's vcard");
}
if ( !lstrcmp(type, _T("result"))) {
@@ -1138,7 +1138,7 @@ void CJabberProto::OnIqResultGetVcard(HXML iqNode, CJabberIqInfo *pInfo)
void CJabberProto::OnIqResultSetVcard(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqIdSetVcard");
+ debugLogA("<iq/> iqIdSetVcard");
if ( !xmlGetAttrValue(iqNode, _T("type")))
return;
@@ -1152,7 +1152,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo *pInfo)
int i, id;
JABBER_SEARCH_RESULT jsr;
- Log("<iq/> iqIdGetSearch");
+ debugLogA("<iq/> iqIdGetSearch");
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((id = JabberGetPacketID(iqNode)) == -1) return;
@@ -1169,7 +1169,7 @@ void CJabberProto::OnIqResultSetSearch(HXML iqNode, CJabberIqInfo *pInfo)
_tcsncpy(jsr.jid, jid, SIZEOF(jsr.jid));
jsr.jid[ SIZEOF(jsr.jid)-1] = '\0';
jsr.hdr.id = (TCHAR*)jid;
- Log("Result jid = %S", jid);
+ debugLogA("Result jid = %S", jid);
if ((n=xmlGetChild(itemNode , "nick")) != NULL && xmlGetText(n) != NULL)
jsr.hdr.nick = (TCHAR*)xmlGetText(n);
else
@@ -1202,7 +1202,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo *pInfo)
const TCHAR *type;
int id;
- Log("<iq/> iqIdGetExtSearch");
+ debugLogA("<iq/> iqIdGetExtSearch");
if ((type=xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((id = JabberGetPacketID(iqNode)) == -1) return;
@@ -1240,7 +1240,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo *pInfo)
if ( !lstrcmp(fieldName, _T("jid"))) {
_tcsncpy(jsr.jid, xmlGetText(n), SIZEOF(jsr.jid));
jsr.jid[SIZEOF(jsr.jid)-1] = '\0';
- Log("Result jid = %S", jsr.jid);
+ debugLogA("Result jid = %S", jsr.jid);
}
else if ( !lstrcmp(fieldName, _T("nickname")))
jsr.hdr.nick = (xmlGetText(n) != NULL) ? (TCHAR*)xmlGetText(n) : _T("");
@@ -1265,7 +1265,7 @@ void CJabberProto::OnIqResultExtSearch(HXML iqNode, CJabberIqInfo *pInfo)
void CJabberProto::OnIqResultSetPassword(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqIdSetPassword");
+ debugLogA("<iq/> iqIdSetPassword");
const TCHAR *type = xmlGetAttrValue(iqNode, _T("type"));
if (type == NULL)
@@ -1287,7 +1287,7 @@ void CJabberProto::OnIqResultDiscoAgentItems(HXML iqNode, void *userdata)
*/
void CJabberProto::OnIqResultGetVCardAvatar(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> OnIqResultGetVCardAvatar");
+ debugLogA("<iq/> OnIqResultGetVCardAvatar");
const TCHAR *from = xmlGetAttrValue(iqNode, _T("from"));
if (from == NULL)
@@ -1328,7 +1328,7 @@ void CJabberProto::OnIqResultGetClientAvatar(HXML iqNode, CJabberIqInfo *pInfo)
{
const TCHAR *type;
- Log("<iq/> iqIdResultGetClientAvatar");
+ debugLogA("<iq/> iqIdResultGetClientAvatar");
const TCHAR *from = xmlGetAttrValue(iqNode, _T("from"));
if (from == NULL)
@@ -1372,7 +1372,7 @@ void CJabberProto::OnIqResultGetServerAvatar(HXML iqNode, CJabberIqInfo *pInfo)
{
const TCHAR *type;
- Log("<iq/> iqIdResultGetServerAvatar");
+ debugLogA("<iq/> iqIdResultGetServerAvatar");
const TCHAR *from = xmlGetAttrValue(iqNode, _T("from"));
if (from == NULL)
@@ -1424,7 +1424,7 @@ void CJabberProto::OnIqResultGotAvatar(HANDLE hContact, HXML n, const TCHAR *mim
else if ( !lstrcmp(mimeType, _T("image/bmp"))) pictureType = PA_FORMAT_BMP;
else {
LBL_ErrFormat:
- Log("Invalid mime type specified for picture: %S", mimeType);
+ debugLogA("Invalid mime type specified for picture: %S", mimeType);
return;
} }
else if ((pictureType = ProtoGetBufferFormat(body, 0)) == PA_FORMAT_UNKNOWN)
@@ -1461,7 +1461,7 @@ LBL_ErrFormat:
char buffer[41];
setString(hContact, "AvatarSaved", bin2hex(digest, sizeof(digest), buffer));
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, HANDLE(&AI), NULL);
- Log("Broadcast new avatar: %s",AI.filename);
+ debugLogA("Broadcast new avatar: %s",AI.filename);
}
else ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, HANDLE(&AI), NULL);
}
@@ -1476,7 +1476,7 @@ void CJabberProto::OnIqResultDiscoBookmarks(HXML iqNode, CJabberIqInfo *pInfo)
// RECVED: list of bookmarks
// ACTION: refresh bookmarks dialog
- Log("<iq/> iqIdGetBookmarks");
+ debugLogA("<iq/> iqIdGetBookmarks");
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ( !lstrcmp(type, _T("result"))) {
@@ -1563,7 +1563,7 @@ void CJabberProto::OnIqResultSetBookmarks(HXML iqNode, CJabberIqInfo *pInfo)
// RECVED: server's response
// ACTION: refresh bookmarks list dialog
- Log("<iq/> iqIdSetBookmarks");
+ debugLogA("<iq/> iqIdSetBookmarks");
const TCHAR *type = xmlGetAttrValue(iqNode, _T("type"));
if (type == NULL)
diff --git a/protocols/JabberG/src/jabber_iqid_muc.cpp b/protocols/JabberG/src/jabber_iqid_muc.cpp
index bd9d9251af..03541de642 100644
--- a/protocols/JabberG/src/jabber_iqid_muc.cpp
+++ b/protocols/JabberG/src/jabber_iqid_muc.cpp
@@ -43,7 +43,7 @@ void CJabberProto::OnIqResultGetMuc(HXML iqNode, CJabberIqInfo *pInfo)
// RECVED: room config form
// ACTION: show the form
- Log("<iq/> iqIdGetMuc");
+ debugLogA("<iq/> iqIdGetMuc");
if ((type = xmlGetAttrValue(iqNode, _T("type"))) == NULL) return;
if ((from = xmlGetAttrValue(iqNode, _T("from"))) == NULL) return;
@@ -507,37 +507,37 @@ void CJabberProto::OnIqResultMucGetJidList(HXML iqNode, JABBER_MUC_JIDLIST_TYPE
void CJabberProto::OnIqResultMucGetVoiceList(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqResultMucGetVoiceList");
+ debugLogA("<iq/> iqResultMucGetVoiceList");
OnIqResultMucGetJidList(iqNode, MUC_VOICELIST);
}
void CJabberProto::OnIqResultMucGetMemberList(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqResultMucGetMemberList");
+ debugLogA("<iq/> iqResultMucGetMemberList");
OnIqResultMucGetJidList(iqNode, MUC_MEMBERLIST);
}
void CJabberProto::OnIqResultMucGetModeratorList(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqResultMucGetModeratorList");
+ debugLogA("<iq/> iqResultMucGetModeratorList");
OnIqResultMucGetJidList(iqNode, MUC_MODERATORLIST);
}
void CJabberProto::OnIqResultMucGetBanList(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqResultMucGetBanList");
+ debugLogA("<iq/> iqResultMucGetBanList");
OnIqResultMucGetJidList(iqNode, MUC_BANLIST);
}
void CJabberProto::OnIqResultMucGetAdminList(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqResultMucGetAdminList");
+ debugLogA("<iq/> iqResultMucGetAdminList");
OnIqResultMucGetJidList(iqNode, MUC_ADMINLIST);
}
void CJabberProto::OnIqResultMucGetOwnerList(HXML iqNode, CJabberIqInfo *pInfo)
{
- Log("<iq/> iqResultMucGetOwnerList");
+ debugLogA("<iq/> iqResultMucGetOwnerList");
OnIqResultMucGetJidList(iqNode, MUC_OWNERLIST);
}
diff --git a/protocols/JabberG/src/jabber_message_manager.cpp b/protocols/JabberG/src/jabber_message_manager.cpp
index ed33c1ccf3..b69fc5ed75 100644
--- a/protocols/JabberG/src/jabber_message_manager.cpp
+++ b/protocols/JabberG/src/jabber_message_manager.cpp
@@ -93,7 +93,7 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea
messageInfo.m_szChildTagName = szTagName;
messageInfo.m_szChildTagXmlns = szXmlns;
messageInfo.m_pUserData = pInfo->m_pUserData;
- messageInfo.m_szFrom = xmlGetAttrValue(node, _T("from")); // is necessary for ppro->Log() below, that's why we must parse it even if JABBER_MESSAGE_PARSE_FROM flag is not set
+ messageInfo.m_szFrom = xmlGetAttrValue(node, _T("from")); // is necessary for ppro->debugLogA() below, that's why we must parse it even if JABBER_MESSAGE_PARSE_FROM flag is not set
if (pInfo->m_dwParamsToParse & JABBER_MESSAGE_PARSE_ID_STR)
messageInfo.m_szId = xmlGetAttrValue(node, _T("id"));
@@ -105,7 +105,7 @@ bool CJabberMessageManager::HandleMessagePermanent(HXML node, ThreadData *pThrea
messageInfo.m_hContact = ppro->HContactFromJID(messageInfo.m_szFrom, 3);
if (messageInfo.m_szFrom)
- ppro->Log("Handling message from %S", messageInfo.m_szFrom);
+ ppro->debugLogA("Handling message from %S", messageInfo.m_szFrom);
if ((ppro->*(pInfo->m_pHandler))(node, pThreadData, &messageInfo))
return TRUE;
}
diff --git a/protocols/JabberG/src/jabber_misc.cpp b/protocols/JabberG/src/jabber_misc.cpp
index 1a50b27e70..86bebdf450 100644
--- a/protocols/JabberG/src/jabber_misc.cpp
+++ b/protocols/JabberG/src/jabber_misc.cpp
@@ -93,7 +93,7 @@ void CJabberProto::DBAddAuthRequest(const TCHAR *jid, const TCHAR *nick)
*pCurBlob = '\0'; //reason
db_event_add(NULL, &dbei);
- Log("Setup DBAUTHREQUEST with nick='%s' jid='%s'", szNick, szJid);
+ debugLogA("Setup DBAUTHREQUEST with nick='%s' jid='%s'", szNick, szJid);
mir_free(szJid);
mir_free(szNick);
@@ -138,7 +138,7 @@ HANDLE CJabberProto::DBCreateContact(const TCHAR *jid, const TCHAR *nick, BOOL t
db_set_b(hNewContact, "CList", "NotOnList", 1);
else
SendGetVcard(s);
- Log("Create Jabber contact jid=%S, nick=%S", s, nick);
+ debugLogA("Create Jabber contact jid=%S, nick=%S", s, nick);
DBCheckIsTransportedContact(s,hNewContact);
return hNewContact;
}
@@ -344,7 +344,7 @@ void CJabberProto::UpdateMirVer(JABBER_LIST_ITEM *item)
if ( !hContact)
return;
- Log("JabberUpdateMirVer: for jid %S", item->jid);
+ debugLogA("JabberUpdateMirVer: for jid %S", item->jid);
pResourceStatus p(NULL);
if (item->resourceMode == RSMODE_LASTSEEN)
@@ -364,7 +364,7 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, TCHAR *buf, int bufSi
// jabber:iq:version info requested and exists?
if (resource->m_dwVersionRequestTime && resource->m_tszSoftware) {
- Log("JabberUpdateMirVer: for iq:version rc %S: %S", resource->m_tszResourceName, resource->m_tszSoftware);
+ debugLogA("JabberUpdateMirVer: for iq:version rc %S: %S", resource->m_tszResourceName, resource->m_tszSoftware);
if ( !resource->m_tszSoftwareVersion || _tcsstr(resource->m_tszSoftware, resource->m_tszSoftwareVersion))
lstrcpyn(buf, resource->m_tszSoftware, bufSize);
else
@@ -372,13 +372,13 @@ void CJabberProto::FormatMirVer(pResourceStatus &resource, TCHAR *buf, int bufSi
}
// no version info and no caps info? set MirVer = resource name
else if ( !resource->m_tszCapsNode || !resource->m_tszCapsVer) {
- Log("JabberUpdateMirVer: for rc %S: %S", resource->m_tszResourceName, resource->m_tszResourceName);
+ debugLogA("JabberUpdateMirVer: for rc %S: %S", resource->m_tszResourceName, resource->m_tszResourceName);
if (resource->m_tszResourceName)
lstrcpyn(buf, resource->m_tszResourceName, bufSize);
}
// XEP-0115 caps mode
else {
- Log("JabberUpdateMirVer: for rc %S: %S#%S", resource->m_tszResourceName, resource->m_tszCapsNode, resource->m_tszCapsVer);
+ debugLogA("JabberUpdateMirVer: for rc %S: %S#%S", resource->m_tszResourceName, resource->m_tszCapsNode, resource->m_tszCapsVer);
int i;
diff --git a/protocols/JabberG/src/jabber_opt.cpp b/protocols/JabberG/src/jabber_opt.cpp
index 9fd5895529..f694cc2363 100644
--- a/protocols/JabberG/src/jabber_opt.cpp
+++ b/protocols/JabberG/src/jabber_opt.cpp
@@ -814,9 +814,9 @@ public:
m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Send messages slower, but with full acknowledgement"), m_proto->m_options.MsgAck);
m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Enable avatars"), m_proto->m_options.EnableAvatars);
- m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Log chat state changes"), m_proto->m_options.LogChatstates);
- m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Log presence subscription state changes"), m_proto->m_options.LogPresence);
- m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Log presence errors"), m_proto->m_options.LogPresenceErrors);
+ m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("debugLogA chat state changes"), m_proto->m_options.LogChatstates);
+ m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("debugLogA presence subscription state changes"), m_proto->m_options.LogPresence);
+ m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("debugLogA presence errors"), m_proto->m_options.LogPresenceErrors);
m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Enable user moods receiving"), m_proto->m_options.EnableUserMood);
m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Enable user tunes receiving"), m_proto->m_options.EnableUserTune);
m_otvOptions.AddOption(LPGENT("Messaging") _T("/") LPGENT("Enable user activity receiving"), m_proto->m_options.EnableUserActivity);
@@ -928,12 +928,12 @@ public:
m_otvOptions.AddOption(LPGENT("General") _T("/") LPGENT("Automatically join conferences on login"), m_proto->m_options.AutoJoinConferences);
m_otvOptions.AddOption(LPGENT("General") _T("/") LPGENT("Hide conference windows at startup"), m_proto->m_options.AutoJoinHidden);
m_otvOptions.AddOption(LPGENT("General") _T("/") LPGENT("Do not show multiuser chat invitations"), m_proto->m_options.IgnoreMUCInvites);
- m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Ban notifications"), m_proto->m_options.GcLogBans);
- m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Room configuration changes"), m_proto->m_options.GcLogConfig);
- m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Affiliation changes"), m_proto->m_options.GcLogAffiliations);
- m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Role changes"), m_proto->m_options.GcLogRoles);
- m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Status changes"), m_proto->m_options.GcLogStatuses);
- m_otvOptions.AddOption(LPGENT("Log events") _T("/") LPGENT("Don't notify history messages"), m_proto->m_options.GcLogChatHistory);
+ m_otvOptions.AddOption(LPGENT("debugLogA events") _T("/") LPGENT("Ban notifications"), m_proto->m_options.GcLogBans);
+ m_otvOptions.AddOption(LPGENT("debugLogA events") _T("/") LPGENT("Room configuration changes"), m_proto->m_options.GcLogConfig);
+ m_otvOptions.AddOption(LPGENT("debugLogA events") _T("/") LPGENT("Affiliation changes"), m_proto->m_options.GcLogAffiliations);
+ m_otvOptions.AddOption(LPGENT("debugLogA events") _T("/") LPGENT("Role changes"), m_proto->m_options.GcLogRoles);
+ m_otvOptions.AddOption(LPGENT("debugLogA events") _T("/") LPGENT("Status changes"), m_proto->m_options.GcLogStatuses);
+ m_otvOptions.AddOption(LPGENT("debugLogA events") _T("/") LPGENT("Don't notify history messages"), m_proto->m_options.GcLogChatHistory);
}
static CDlgBase *Create(void *param) { return new CDlgOptGc((CJabberProto *)param); }
diff --git a/protocols/JabberG/src/jabber_proto.cpp b/protocols/JabberG/src/jabber_proto.cpp
index f1004adeda..af4857d102 100644
--- a/protocols/JabberG/src/jabber_proto.cpp
+++ b/protocols/JabberG/src/jabber_proto.cpp
@@ -75,7 +75,7 @@ CJabberProto::CJabberProto(const char *aProtoName, const TCHAR *aUserName) :
m_szXmlStreamToBeInitialized = NULL;
- Log("Setting protocol/module name to '%s'", m_szModuleName);
+ debugLogA("Setting protocol/module name to '%s'", m_szModuleName);
// Jabber dialog list
m_windowList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
@@ -333,12 +333,12 @@ HANDLE CJabberProto::AddToListByJID(const TCHAR *newJid, DWORD flags)
HANDLE hContact;
TCHAR *jid, *nick;
- Log("AddToListByJID jid = %S", newJid);
+ debugLogA("AddToListByJID jid = %S", newJid);
if ((hContact=HContactFromJID(newJid)) == NULL) {
// not already there: add
jid = mir_tstrdup(newJid);
- Log("Add new jid to contact jid = %S", jid);
+ debugLogA("Add new jid to contact jid = %S", jid);
hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName);
setTString(hContact, "jid", jid);
@@ -384,7 +384,7 @@ HANDLE CJabberProto::AddToList(int flags, PROTOSEARCHRESULT* psr)
HANDLE __cdecl CJabberProto::AddToListByEvent(int flags, int /*iContact*/, HANDLE hDbEvent)
{
- Log("AddToListByEvent");
+ debugLogA("AddToListByEvent");
DBEVENTINFO dbei = { sizeof(dbei) };
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
@@ -442,7 +442,7 @@ int CJabberProto::Authorize(HANDLE hDbEvent)
char *lastName = firstName + strlen(firstName) + 1;
char *jid = lastName + strlen(lastName) + 1;
- Log("Send 'authorization allowed' to %S", jid);
+ debugLogA("Send 'authorization allowed' to %S", jid);
TCHAR *newJid = (dbei.flags & DBEF_UTF) ? mir_utf8decodeT(jid) : mir_a2t(jid);
@@ -454,7 +454,7 @@ int CJabberProto::Authorize(HANDLE hDbEvent)
JABBER_LIST_ITEM *item;
if ((item = ListGetItemPtr(LIST_ROSTER, newJid)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
- Log("Try adding contact automatically jid = %S", jid);
+ debugLogA("Try adding contact automatically jid = %S", jid);
if ((hContact = AddToListByJID(newJid, 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and JabberDbSettingChanged().
@@ -473,7 +473,7 @@ int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*)
if ( !m_bJabberOnline)
return 1;
- Log("Entering AuthDeny");
+ debugLogA("Entering AuthDeny");
DBEVENTINFO dbei = { sizeof(dbei) };
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == (DWORD)(-1))
@@ -497,7 +497,7 @@ int CJabberProto::AuthDeny(HANDLE hDbEvent, const TCHAR*)
char *lastName = firstName + strlen(firstName) + 1;
char *jid = lastName + strlen(lastName) + 1;
- Log("Send 'authorization denied' to %s", jid);
+ debugLogA("Send 'authorization denied' to %s", jid);
ptrT newJid(dbei.flags & DBEF_UTF ? mir_utf8decodeT(jid) : mir_a2t(jid));
m_ThreadInfo->send( XmlNode(_T("presence")) << XATTR(_T("to"), newJid) << XATTR(_T("type"), _T("unsubscribed")));
@@ -564,11 +564,11 @@ int __cdecl CJabberProto::FileCancel(HANDLE /*hContact*/, HANDLE hTransfer)
filetransfer *ft = (filetransfer*)hTransfer;
HANDLE hEvent;
- Log("Invoking FileCancel()");
+ debugLogA("Invoking FileCancel()");
if (ft->type == FT_OOB) {
if (ft->s) {
- Log("FT canceled");
- Log("Closing ft->s = %d", ft->s);
+ debugLogA("FT canceled");
+ debugLogA("Closing ft->s = %d", ft->s);
ft->state = FT_ERROR;
Netlib_CloseHandle(ft->s);
ft->s = NULL;
@@ -577,7 +577,7 @@ int __cdecl CJabberProto::FileCancel(HANDLE /*hContact*/, HANDLE hTransfer)
ft->hFileEvent = NULL;
SetEvent(hEvent);
}
- Log("ft->s is now NULL, ft->state is now FT_ERROR");
+ debugLogA("ft->s is now NULL, ft->state is now FT_ERROR");
}
}
else FtCancel(ft);
@@ -772,7 +772,7 @@ void __cdecl CJabberProto::BasicSearchThread(JABBER_SEARCH_BASIC *jsb)
HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
{
- Log("JabberBasicSearch called with lParam = '%s'", szJid);
+ debugLogA("JabberBasicSearch called with lParam = '%s'", szJid);
JABBER_SEARCH_BASIC *jsb;
if ( !m_bJabberOnline || (jsb=(JABBER_SEARCH_BASIC*)mir_alloc(sizeof(JABBER_SEARCH_BASIC))) == NULL)
@@ -801,7 +801,7 @@ HANDLE __cdecl CJabberProto::SearchBasic(const TCHAR *szJid)
}
else _tcsncpy(jsb->jid, szJid, SIZEOF(jsb->jid));
- Log("Adding '%s' without validation", jsb->jid);
+ debugLogA("Adding '%s' without validation", jsb->jid);
jsb->hSearch = SerialNext();
ForkThread((MyThreadFunc)&CJabberProto::BasicSearchThread, jsb);
return (HANDLE)jsb->hSearch;
@@ -997,7 +997,7 @@ HANDLE __cdecl CJabberProto::SendFile(HANDLE hContact, const TCHAR *szDescriptio
ft->fileSize = (unsigned __int64*) mir_calloc(sizeof(unsigned __int64) * ft->std.totalFiles);
for (i=j=0; i < ft->std.totalFiles; i++) {
if (_tstati64(ppszFiles[i], &statbuf))
- Log("'%s' is an invalid filename", ppszFiles[i]);
+ debugLogA("'%s' is an invalid filename", ppszFiles[i]);
else {
ft->std.ptszFiles[j] = mir_tstrdup(ppszFiles[i]);
ft->fileSize[j] = statbuf.st_size;
@@ -1038,11 +1038,11 @@ void __cdecl CJabberProto::SendMessageAckThread(void* param)
{
TFakeAckParams *par = (TFakeAckParams*)param;
Sleep(100);
- Log("Broadcast ACK");
+ debugLogA("Broadcast ACK");
ProtoBroadcastAck(par->hContact, ACKTYPE_MESSAGE,
par->msg ? ACKRESULT_FAILED : ACKRESULT_SUCCESS,
(HANDLE)par->msgid, (LPARAM) par->msg);
- Log("Returning from thread");
+ debugLogA("Returning from thread");
delete par;
}
@@ -1205,7 +1205,7 @@ int __cdecl CJabberProto::SetStatus(int iNewStatus)
int oldStatus = m_iStatus;
- Log("PS_SETSTATUS(%d)", iNewStatus);
+ debugLogA("PS_SETSTATUS(%d)", iNewStatus);
m_iDesiredStatus = iNewStatus;
if (iNewStatus == ID_STATUS_OFFLINE) {
@@ -1251,7 +1251,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void* hContact)
JABBER_LIST_ITEM *item = ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL) {
if (item->arResources.getCount() > 0) {
- Log("arResources.getCount() > 0");
+ debugLogA("arResources.getCount() > 0");
int msgCount = 0;
size_t len = 0;
for (int i=0; i < item->arResources.getCount(); i++) {
@@ -1294,7 +1294,7 @@ void __cdecl CJabberProto::GetAwayMsgThread(void* hContact)
HANDLE __cdecl CJabberProto::GetAwayMsg(HANDLE hContact)
{
- Log("GetAwayMsg called, hContact=%08X", hContact);
+ debugLogA("GetAwayMsg called, hContact=%08X", hContact);
ForkThread(&CJabberProto::GetAwayMsgThread, hContact);
return (HANDLE)1;
@@ -1313,7 +1313,7 @@ int __cdecl CJabberProto::RecvAwayMsg(HANDLE /*hContact*/, int /*statusMode*/, P
int __cdecl CJabberProto::SetAwayMsg(int status, const TCHAR *msg)
{
- Log("SetAwayMsg called, wParam=%d lParam=%S", status, msg);
+ debugLogA("SetAwayMsg called, wParam=%d lParam=%S", status, msg);
TCHAR **szMsg;
mir_cslockfull lck(m_csModeMsgMutex);
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index 9f60bc998b..d69341f93a 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -159,7 +159,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
ThreadData* m_ThreadInfo;
CJabberOptions m_options;
- HANDLE m_hNetlibUser;
PVOID m_sslCtx;
HANDLE m_hThreadHandle;
@@ -766,7 +765,6 @@ struct CJabberProto : public PROTO<CJabberProto>, public IJabberInterface
HANDLE HContactFromJID(const TCHAR *jid , BOOL bStripResource = 3);
HANDLE ChatRoomHContactFromJID(const TCHAR *jid);
- void Log(const char* fmt, ...);
void SendVisibleInvisiblePresence(BOOL invisible);
void SendPresenceTo(int status, TCHAR* to, HXML extra, const TCHAR *msg = NULL);
void SendPresence(int m_iStatus, bool bSendToAll);
diff --git a/protocols/JabberG/src/jabber_svc.cpp b/protocols/JabberG/src/jabber_svc.cpp
index fa5ff7d13e..8113a1792e 100644
--- a/protocols/JabberG/src/jabber_svc.cpp
+++ b/protocols/JabberG/src/jabber_svc.cpp
@@ -124,7 +124,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
ptrA szHashValue( getStringA(AI->hContact, "AvatarHash"));
if (szHashValue == NULL) {
- Log("No avatar");
+ debugLogA("No avatar");
return GAIR_NOAVATAR;
}
@@ -137,7 +137,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
if (::_taccess(AI->filename, 0) == 0) {
ptrA szSavedHash( getStringA(AI->hContact, "AvatarSaved"));
if (szSavedHash != NULL && !strcmp(szSavedHash, szHashValue)) {
- Log("Avatar is Ok: %s == %s", szSavedHash, szHashValue);
+ debugLogA("Avatar is Ok: %s == %s", szSavedHash, szHashValue);
return GAIR_SUCCESS;
}
}
@@ -157,7 +157,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
if (szJid[0] == 0)
_tcsncpy_s(szJid, SIZEOF(szJid), tszJid, _TRUNCATE);
- Log("Rereading %s for %S", isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid);
+ debugLogA("Rereading %s for %S", isXVcard ? JABBER_FEAT_VCARD_TEMP : JABBER_FEAT_AVATAR, szJid);
m_ThreadInfo->send((isXVcard) ?
XmlNodeIq( AddIQ(&CJabberProto::OnIqResultGetVCardAvatar, JABBER_IQ_TYPE_GET, szJid)) << XCHILDNS(_T("vCard"), JABBER_FEAT_VCARD_TEMP) :
@@ -167,7 +167,7 @@ INT_PTR __cdecl CJabberProto::JabberGetAvatarInfo(WPARAM wParam, LPARAM lParam)
}
}
- Log("No avatar");
+ debugLogA("No avatar");
return GAIR_NOAVATAR;
}
diff --git a/protocols/JabberG/src/jabber_thread.cpp b/protocols/JabberG/src/jabber_thread.cpp
index 34aef04081..f8b8c67034 100644
--- a/protocols/JabberG/src/jabber_thread.cpp
+++ b/protocols/JabberG/src/jabber_thread.cpp
@@ -173,7 +173,7 @@ void ThreadData::xmpp_client_query(void)
WORD dnsPort = port == 0 || port == 5222 ? dnsList[i]->wPort : port;
char* dnsHost = dnsList[i]->pNameTarget;
- proto->Log("%s%s resolved to %s:%d", "_xmpp-client._tcp.", server, dnsHost, dnsPort);
+ proto->debugLogA("%s%s resolved to %s:%d", "_xmpp-client._tcp.", server, dnsHost, dnsPort);
s = proto->WsConnect(dnsHost, dnsPort);
if (s) {
mir_snprintf(manualHost, SIZEOF(manualHost), "%s", dnsHost);
@@ -184,12 +184,12 @@ void ThreadData::xmpp_client_query(void)
DnsRecordListFree(results, DnsFreeRecordList);
}
else
- proto->Log("%s not resolved", temp);
+ proto->debugLogA("%s not resolved", temp);
}
void CJabberProto::xmlStreamInitialize(char *szWhich)
{
- Log("Stream will be initialized %s", szWhich);
+ debugLogA("Stream will be initialized %s", szWhich);
if (m_szXmlStreamToBeInitialized)
free(m_szXmlStreamToBeInitialized);
m_szXmlStreamToBeInitialized = _strdup(szWhich);
@@ -197,7 +197,7 @@ void CJabberProto::xmlStreamInitialize(char *szWhich)
void CJabberProto::xmlStreamInitializeNow(ThreadData* info)
{
- Log("Stream is initializing %s",
+ debugLogA("Stream is initializing %s",
m_szXmlStreamToBeInitialized ? m_szXmlStreamToBeInitialized : "after connect");
if (m_szXmlStreamToBeInitialized) {
free(m_szXmlStreamToBeInitialized);
@@ -237,7 +237,7 @@ void CJabberProto::ServerThread(ThreadData* info)
ptrA szValue;
ptrT tszValue;
- Log("Thread started: type=%d", info->type);
+ debugLogA("Thread started: type=%d", info->type);
info->resolveID = -1;
info->auth = NULL;
@@ -262,7 +262,7 @@ void CJabberProto::ServerThread(ThreadData* info)
// in case it is asleep in the reconnect loop so that it will immediately
// reconnect.
QueueUserAPC(JabberDummyApcFunc, m_ThreadInfo->hThread, 0);
- Log("Thread ended, another normal thread is running");
+ debugLogA("Thread ended, another normal thread is running");
LBL_Exit:
delete info;
return;
@@ -283,7 +283,7 @@ LBL_Exit:
}
if (*rtrimt(info->username) == '\0') {
- Log("Thread ended, login name is not configured");
+ debugLogA("Thread ended, login name is not configured");
JLoginFailed(LOGINERR_BADUSERID);
LBL_FatalError:
m_ThreadInfo = NULL;
@@ -297,7 +297,7 @@ LBL_FatalError:
strncpy_s(info->server, SIZEOF(info->server), szValue, _TRUNCATE);
else {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
- Log("Thread ended, login server is not configured");
+ debugLogA("Thread ended, login server is not configured");
goto LBL_FatalError;
}
@@ -335,7 +335,7 @@ LBL_FatalError:
if (param.dlgResult == IDCANCEL) {
JLoginFailed(LOGINERR_BADUSERID);
- Log("Thread ended, password request dialog was canceled");
+ debugLogA("Thread ended, password request dialog was canceled");
goto LBL_FatalError;
}
@@ -350,7 +350,7 @@ LBL_FatalError:
TCHAR *passw = JGetStringCrypt(NULL, "LoginPassword");
if (passw == NULL) {
JLoginFailed(LOGINERR_BADUSERID);
- Log("Thread ended, password is not configured");
+ debugLogA("Thread ended, password is not configured");
goto LBL_FatalError;
}
_tcsncpy(info->password, passw, SIZEOF(info->password));
@@ -369,20 +369,20 @@ LBL_FatalError:
iqIdRegSetReg = -1;
}
else {
- Log("Thread ended, invalid session type");
+ debugLogA("Thread ended, invalid session type");
goto LBL_FatalError;
}
int jabberNetworkBufferSize = 2048;
if ((buffer=(char*)mir_alloc(jabberNetworkBufferSize + 1)) == NULL) { // +1 is for '\0' when debug logging this buffer
- Log("Cannot allocate network buffer, thread ended");
+ debugLogA("Cannot allocate network buffer, thread ended");
if (info->type == JABBER_SESSION_NORMAL) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
}
else if (info->type == JABBER_SESSION_REGISTER) {
SendMessage(info->reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)TranslateT("Error: Not enough memory"));
}
- Log("Thread ended, network buffer cannot be allocated");
+ debugLogA("Thread ended, network buffer cannot be allocated");
goto LBL_FatalError;
}
@@ -396,9 +396,9 @@ LBL_FatalError:
else
info->s = WsConnect(info->manualHost, info->port);
- Log("Thread type=%d server='%s' port='%d'", info->type, info->manualHost, info->port);
+ debugLogA("Thread type=%d server='%s' port='%d'", info->type, info->manualHost, info->port);
if (info->s == NULL) {
- Log("Connection failed (%d)", WSAGetLastError());
+ debugLogA("Connection failed (%d)", WSAGetLastError());
if (info->type == JABBER_SESSION_NORMAL) {
if (m_ThreadInfo == info) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
@@ -406,16 +406,16 @@ LBL_FatalError:
else if (info->type == JABBER_SESSION_REGISTER)
SendMessage(info->reg_hwndDlg, WM_JABBER_REGDLG_UPDATE, 100, (LPARAM)TranslateT("Error: Cannot connect to the server"));
- Log("Thread ended, connection failed");
+ debugLogA("Thread ended, connection failed");
mir_free(buffer);
goto LBL_FatalError;
}
// Determine local IP
if (info->useSSL) {
- Log("Intializing SSL connection");
+ debugLogA("Intializing SSL connection");
if ( !CallService(MS_NETLIB_STARTSSL, (WPARAM)info->s, 0)) {
- Log("SSL intialization failed");
+ debugLogA("SSL intialization failed");
if (info->type == JABBER_SESSION_NORMAL) {
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_NONETWORK);
}
@@ -424,7 +424,7 @@ LBL_FatalError:
}
mir_free(buffer);
info->close();
- Log("Thread ended, SSL connection failed");
+ debugLogA("Thread ended, SSL connection failed");
goto LBL_FatalError;
} }
@@ -442,7 +442,7 @@ LBL_FatalError:
xmlStreamInitializeNow(info);
const TCHAR *tag = _T("stream:stream");
- Log("Entering main recv loop");
+ debugLogA("Entering main recv loop");
datalen = 0;
// cache values
@@ -471,7 +471,7 @@ LBL_FatalError:
} }
int recvResult = info->recv(buffer + datalen, jabberNetworkBufferSize - datalen);
- Log("recvResult = %d", recvResult);
+ debugLogA("recvResult = %d", recvResult);
if (recvResult <= 0)
break;
datalen += recvResult;
@@ -504,7 +504,7 @@ recvRest:
mir_free(str);
}
- Log("bytesParsed = %d", bytesParsed);
+ debugLogA("bytesParsed = %d", bytesParsed);
if (root) tag = NULL;
if (xmlGetName(root) == NULL) {
@@ -525,12 +525,12 @@ recvRest:
else if (datalen >= jabberNetworkBufferSize) {
//jabberNetworkBufferSize += 65536;
jabberNetworkBufferSize *= 2;
- Log("Increasing network buffer size to %d", jabberNetworkBufferSize);
+ debugLogA("Increasing network buffer size to %d", jabberNetworkBufferSize);
if ((buffer=(char*)mir_realloc(buffer, jabberNetworkBufferSize + 1)) == NULL) {
- Log("Cannot reallocate more network buffer, go offline now");
+ debugLogA("Cannot reallocate more network buffer, go offline now");
break;
} }
- else Log("Unknown state: bytesParsed=%d, datalen=%d, jabberNetworkBufferSize=%d", bytesParsed, datalen, jabberNetworkBufferSize);
+ else debugLogA("Unknown state: bytesParsed=%d, datalen=%d, jabberNetworkBufferSize=%d", bytesParsed, datalen, jabberNetworkBufferSize);
if (m_szXmlStreamToBeInitialized) {
xmlStreamInitializeNow(info);
@@ -587,7 +587,7 @@ recvRest:
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus);
}
- Log("Thread ended: type=%d server='%s'", info->type, info->server);
+ debugLogA("Thread ended: type=%d server='%s'", info->type, info->server);
if (info->type == JABBER_SESSION_NORMAL && m_ThreadInfo == info) {
mir_free(m_szStreamId);
@@ -597,7 +597,7 @@ recvRest:
info->close();
mir_free(buffer);
- Log("Exiting ServerThread");
+ debugLogA("Exiting ServerThread");
goto LBL_Exit;
}
@@ -739,13 +739,13 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info)
if ( !_tcscmp(xmlGetName(n), _T("starttls"))) {
if ( !info->useSSL && m_options.UseTLS) {
- Log("Requesting TLS");
+ debugLogA("Requesting TLS");
info->send(XmlNode(xmlGetName(n)) << XATTR(_T("xmlns"), _T("urn:ietf:params:xml:ns:xmpp-tls")));
return;
} }
if ( !_tcscmp(xmlGetName(n), _T("compression")) && m_options.EnableZlib == TRUE) {
- Log("Server compression available");
+ debugLogA("Server compression available");
for (int k=0; ; k++) {
HXML c = xmlGetChild(n,k);
if ( !c)
@@ -753,7 +753,7 @@ void CJabberProto::OnProcessFeatures(HXML node, ThreadData* info)
if ( !_tcscmp(xmlGetName(c), _T("method"))) {
if ( !_tcscmp(xmlGetText(c), _T("zlib")) && info->zlibInit() == TRUE) {
- Log("Requesting Zlib compression");
+ debugLogA("Requesting Zlib compression");
info->send(XmlNode(_T("compress")) << XATTR(_T("xmlns"), _T("http://jabber.org/protocol/compress"))
<< XCHILD(_T("method"), _T("zlib")));
return;
@@ -885,20 +885,20 @@ void CJabberProto::OnProcessSuccess(HXML node, ThreadData* info)
return;
}
- Log("Success: Logged-in.");
+ debugLogA("Success: Logged-in.");
ptrT tszNick( getTStringA("Nick"));
if (tszNick == NULL)
setTString("Nick", info->username);
xmlStreamInitialize("after successful sasl");
}
- else Log("Success: unknown action %S.",type);
+ else debugLogA("Success: unknown action %S.",type);
}
void CJabberProto::OnProcessChallenge(HXML node, ThreadData* info)
{
if (info->auth == NULL) {
- Log("No previous auth have been made, exiting...");
+ debugLogA("No previous auth have been made, exiting...");
return;
}
@@ -938,13 +938,13 @@ void CJabberProto::OnProcessProtocol(HXML node, ThreadData* info)
else if ( !lstrcmp(xmlGetName(node), _T("iq")))
OnProcessIq(node);
else
- Log("Invalid top-level tag (only <message/> <presence/> and <iq/> allowed)");
+ debugLogA("Invalid top-level tag (only <message/> <presence/> and <iq/> allowed)");
}
else if (info->type == JABBER_SESSION_REGISTER) {
if ( !lstrcmp(xmlGetName(node), _T("iq")))
OnProcessRegIq(node, info);
else
- Log("Invalid top-level tag (only <iq/> allowed)");
+ debugLogA("Invalid top-level tag (only <iq/> allowed)");
} }
void CJabberProto::OnProcessProceed(HXML node, ThreadData* info)
@@ -954,7 +954,7 @@ void CJabberProto::OnProcessProceed(HXML node, ThreadData* info)
return;
if ( !lstrcmp(type, _T("urn:ietf:params:xml:ns:xmpp-tls"))) {
- Log("Starting TLS...");
+ debugLogA("Starting TLS...");
char* gtlk = strstr(info->manualHost, "google.com");
bool isHosted = gtlk && !gtlk[10] && stricmp(info->server, "gmail.com") &&
@@ -964,7 +964,7 @@ void CJabberProto::OnProcessProceed(HXML node, ThreadData* info)
ssl.cbSize = sizeof(ssl);
ssl.host = isHosted ? info->manualHost : info->server;
if ( !CallService(MS_NETLIB_STARTSSL, (WPARAM)info->s, (LPARAM)&ssl)) {
- Log("SSL initialization failed");
+ debugLogA("SSL initialization failed");
info->send("</stream:stream>");
info->shutdown();
}
@@ -976,14 +976,14 @@ void CJabberProto::OnProcessCompressed(HXML node, ThreadData* info)
{
const TCHAR *type;
- Log("Compression confirmed");
+ debugLogA("Compression confirmed");
if ((type = xmlGetAttrValue(node, _T("xmlns"))) != NULL && !lstrcmp(type, _T("error")))
return;
if (lstrcmp(type, _T("http://jabber.org/protocol/compress")))
return;
- Log("Starting Zlib stream compression...");
+ debugLogA("Starting Zlib stream compression...");
info->useZlib = TRUE;
info->zRecvData = (char*)mir_alloc(ZLIB_CHUNK_SIZE);
@@ -1454,7 +1454,7 @@ void CJabberProto::OnProcessPresenceCapabilites(HXML node)
if ((from = xmlGetAttrValue(node, _T("from"))) == NULL)
return;
- Log("presence: for jid %S", from);
+ debugLogA("presence: for jid %S", from);
pResourceStatus r( ResourceInfoFromJID(from));
if (r == NULL)
@@ -1520,7 +1520,7 @@ void CJabberProto::UpdateJidDbSettings(const TCHAR *jid)
item->getTemp()->m_iStatus = status;
if (nSelectedResource != -1) {
pResourceStatus r(item->arResources[nSelectedResource]);
- Log("JabberUpdateJidDbSettings: updating jid %S to rc %S", item->jid, r->m_tszResourceName);
+ debugLogA("JabberUpdateJidDbSettings: updating jid %S to rc %S", item->jid, r->m_tszResourceName);
if (r->m_tszStatusMessage)
db_set_ts(hContact, "CList", "StatusMsg", r->m_tszStatusMessage);
else
@@ -1578,14 +1578,14 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
if ((hContact = HContactFromJID(from)) == NULL) {
if ( !_tcsicmp(info->fullJID, from) || (!bSelfPresence && !ListGetItemPtr(LIST_ROSTER, from))) {
- Log("SKIP Receive presence online from %S (who is not in my roster and not in list - skiping)", from);
+ debugLogA("SKIP Receive presence online from %S (who is not in my roster and not in list - skiping)", from);
mir_free(nick);
return;
}
hContact = DBCreateContact(from, nick, TRUE, TRUE);
}
if ( !ListGetItemPtr(LIST_ROSTER, from)) {
- Log("Receive presence online from %S (who is not in my roster)", from);
+ debugLogA("Receive presence online from %S (who is not in my roster)", from);
ListAdd(LIST_ROSTER, from);
}
DBCheckIsTransportedContact(from, hContact);
@@ -1613,7 +1613,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
if (_tcschr(from, '@') == NULL) {
UI_SAFE_NOTIFY(m_pDlgServiceDiscovery, WM_JABBER_TRANSPORT_REFRESH);
}
- Log("%S (%S) online, set contact status to %S", nick, from, pcli->pfnGetStatusModeDescription(status, 0));
+ debugLogA("%S (%S) online, set contact status to %S", nick, from, pcli->pfnGetStatusModeDescription(status, 0));
mir_free(nick);
HXML xNode;
@@ -1621,18 +1621,18 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
BOOL hasAvatar = false;
BOOL removedAvatar = false;
- Log("Avatar enabled");
+ debugLogA("Avatar enabled");
for (int i = 1; (xNode=xmlGetNthChild(node, _T("x"), i)) != NULL; i++) {
if ( !lstrcmp(xmlGetAttrValue(xNode, _T("xmlns")), _T("jabber:x:avatar"))) {
LPCTSTR ptszHash = xmlGetText( xmlGetChild(xNode , "hash"));
if (ptszHash != NULL) {
delSetting(hContact,"AvatarXVcard");
- Log("AvatarXVcard deleted");
+ debugLogA("AvatarXVcard deleted");
setTString(hContact, "AvatarHash", ptszHash);
hasAvatar = true;
ptrT saved( getTStringA(hContact, "AvatarSaved"));
if (saved != NULL || lstrcmp(saved, ptszHash)) {
- Log("Avatar was changed");
+ debugLogA("Avatar was changed");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
}
}
@@ -1640,19 +1640,19 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
}
}
if ( !hasAvatar) { //no jabber:x:avatar. try vcard-temp:x:update
- Log("Not hasXAvatar");
+ debugLogA("Not hasXAvatar");
for (int i = 1; (xNode=xmlGetNthChild(node, _T("x"), i)) != NULL; i++) {
if ( !lstrcmp(xmlGetAttrValue(xNode, _T("xmlns")), _T("vcard-temp:x:update"))) {
if ((xNode = xmlGetChild(xNode , "photo")) != NULL) {
LPCTSTR txt = xmlGetText(xNode);
if (txt != NULL && txt[0] != 0) {
setByte(hContact, "AvatarXVcard", 1);
- Log("AvatarXVcard set");
+ debugLogA("AvatarXVcard set");
setTString(hContact, "AvatarHash", txt);
hasAvatar = true;
ptrT saved( getTStringA(hContact, "AvatarSaved"));
if (saved || lstrcmp(saved, txt)) {
- Log("Avatar was changed. Using vcard-temp:x:update");
+ debugLogA("Avatar was changed. Using vcard-temp:x:update");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, NULL);
}
}
@@ -1660,7 +1660,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
} } } }
if ( !hasAvatar && removedAvatar) {
- Log("Has no avatar");
+ debugLogA("Has no avatar");
delSetting(hContact, "AvatarHash");
if ( ptrT( getTStringA(hContact, "AvatarSaved")) != NULL) {
@@ -1689,7 +1689,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
item->getTemp()->m_tszStatusMessage = mir_tstrdup(xmlGetText( xmlGetChild(node , "status")));
}
}
- else Log("SKIP Receive presence offline from %S (who is not in my roster)", from);
+ else debugLogA("SKIP Receive presence offline from %S (who is not in my roster)", from);
UpdateJidDbSettings(from);
@@ -1709,7 +1709,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
if (xNick != NULL) {
LPCTSTR xszNick = xmlGetText(xNick);
if (xszNick != NULL && *xszNick) {
- Log("Grabbed nick from presence: %S", xszNick);
+ debugLogA("Grabbed nick from presence: %S", xszNick);
tszNick = mir_tstrdup(xszNick);
}
}
@@ -1721,7 +1721,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
if (m_options.AutoAdd == TRUE) {
if ((item = ListGetItemPtr(LIST_ROSTER, from)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
- Log("Try adding contact automatically jid = %S", from);
+ debugLogA("Try adding contact automatically jid = %S", from);
if ((hContact = AddToListByJID(from, 0)) != NULL) {
setTString(hContact, "Nick", tszNick);
db_unset(hContact, "CList", "NotOnList");
@@ -1731,7 +1731,7 @@ void CJabberProto::OnProcessPresence(HXML node, ThreadData* info)
RebuildInfoFrame();
}
else {
- Log("%S (%S) requests authorization", tszNick, from);
+ debugLogA("%S (%S) requests authorization", tszNick, from);
DBAddAuthRequest(from, tszNick);
}
return;
@@ -1870,13 +1870,13 @@ void CJabberProto::OnProcessIq(HXML node)
// RECVED: <iq type='error'> ...
if ( !_tcscmp(type, _T("error"))) {
- Log("XXX on entry");
+ debugLogA("XXX on entry");
// Check for file transfer deny by comparing idStr with ft->iqId
LISTFOREACH(i, this, LIST_FILE)
{
JABBER_LIST_ITEM *item = ListGetItemPtrFromIndex(i);
if (item->ft != NULL && item->ft->state == FT_CONNECTING && id == item->ft->iqId) {
- Log("Denying file sending request");
+ debugLogA("Denying file sending request");
item->ft->state = FT_DENIED;
if (item->ft->hFileEvent != NULL)
SetEvent(item->ft->hFileEvent); // Simulate the termination of file server connection
diff --git a/protocols/JabberG/src/jabber_userinfo.cpp b/protocols/JabberG/src/jabber_userinfo.cpp
index fa37ead33d..e93c7d07e8 100644
--- a/protocols/JabberG/src/jabber_userinfo.cpp
+++ b/protocols/JabberG/src/jabber_userinfo.cpp
@@ -644,7 +644,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
item = photoInfo->ppro->ListGetItemPtr(LIST_ROSTER, jid);
if (item != NULL) {
if (item->photoFileName) {
- photoInfo->ppro->Log("Showing picture from %S", item->photoFileName);
+ photoInfo->ppro->debugLogA("Showing picture from %S", item->photoFileName);
photoInfo->hBitmap = (HBITMAP) CallService(MS_UTILS_LOADBITMAPT, 0, (LPARAM)item->photoFileName);
FIP->FI_Premultiply(photoInfo->hBitmap);
ShowWindow(GetDlgItem(hwndDlg, IDC_SAVE), SW_SHOW);
@@ -702,7 +702,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
ofn.nMaxFile = _MAX_PATH;
ofn.Flags = OFN_OVERWRITEPROMPT;
if ( GetSaveFileName(&ofn)) {
- photoInfo->ppro->Log("File selected is %s", szFileName);
+ photoInfo->ppro->debugLogA("File selected is %s", szFileName);
CopyFile(item->photoFileName, szFileName, FALSE);
}
}
@@ -782,7 +782,7 @@ static INT_PTR CALLBACK JabberUserPhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wP
case WM_DESTROY:
DestroyIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_SAVE, BM_SETIMAGE, IMAGE_ICON, 0));
if (photoInfo->hBitmap) {
- photoInfo->ppro->Log("Delete bitmap");
+ photoInfo->ppro->debugLogA("Delete bitmap");
DeleteObject(photoInfo->hBitmap);
}
if (photoInfo) mir_free(photoInfo);
diff --git a/protocols/JabberG/src/jabber_util.cpp b/protocols/JabberG/src/jabber_util.cpp
index 07d8a18e1d..77b6b0a91c 100644
--- a/protocols/JabberG/src/jabber_util.cpp
+++ b/protocols/JabberG/src/jabber_util.cpp
@@ -30,17 +30,6 @@ int CJabberProto::SerialNext(void)
return ::InterlockedIncrement(&m_nSerial);
}
-void CJabberProto::Log(const char* fmt, ...)
-{
- va_list vararg;
- va_start(vararg, fmt);
- char* str = (char*)alloca(32000);
- mir_vsnprintf(str, 32000, fmt, vararg);
- va_end(vararg);
-
- CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)str);
-}
-
///////////////////////////////////////////////////////////////////////////////
// JabberChatRoomHContactFromJID - looks for the char room HCONTACT with required JID
@@ -1344,7 +1333,7 @@ void __cdecl CJabberProto::LoadHttpAvatars(void* param)
fclose(out);
setString(AI.hContact, "AvatarSaved", buffer);
ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
- Log("Broadcast new avatar: %s",AI.filename);
+ debugLogA("Broadcast new avatar: %s",AI.filename);
}
else ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, &AI, 0);
}
diff --git a/protocols/JabberG/src/jabber_vcard.cpp b/protocols/JabberG/src/jabber_vcard.cpp
index a24c71f55a..8b3337fca8 100644
--- a/protocols/JabberG/src/jabber_vcard.cpp
+++ b/protocols/JabberG/src/jabber_vcard.cpp
@@ -292,7 +292,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
_tcscpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
- dat->ppro->Log("Temp file = %S", szTempFileName);
+ dat->ppro->debugLogA("Temp file = %S", szTempFileName);
if (CopyFile(szAvatarFileName, szTempFileName, FALSE) == TRUE) {
char* p = mir_t2a(szTempFileName);
if ((dat->hBitmap=(HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)p)) != NULL) {
@@ -337,7 +337,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
struct _stat st;
HBITMAP hNewBitmap;
- dat->ppro->Log("File selected is %S", szFileName);
+ dat->ppro->debugLogA("File selected is %S", szFileName);
if (_tstat(szFileName, &st)<0 || st.st_size>40*1024) {
MessageBox(hwndDlg, TranslateT("Only JPG, GIF, and BMP image files smaller than 40 KB are supported."), TranslateT("Jabber vCard"), MB_OK|MB_SETFOREGROUND);
break;
@@ -345,7 +345,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (GetTempPath(SIZEOF(szTempPath), szTempPath) <= 0)
_tcscpy(szTempPath, _T(".\\"));
if (GetTempFileName(szTempPath, _T("jab"), 0, szTempFileName) > 0) {
- dat->ppro->Log("Temp file = %S", szTempFileName);
+ dat->ppro->debugLogA("Temp file = %S", szTempFileName);
if (CopyFile(szFileName, szTempFileName, FALSE) == TRUE) {
char* pszTemp = mir_t2a(szTempFileName);
if ((hNewBitmap=(HBITMAP) CallService(MS_UTILS_LOADBITMAP, 0, (LPARAM)pszTemp)) != NULL) {
@@ -474,7 +474,7 @@ static INT_PTR CALLBACK PhotoDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
DestroyIcon((HICON)SendDlgItemMessage(hwndDlg, IDC_DELETE, BM_SETIMAGE, IMAGE_ICON, 0));
dat->ppro->WindowUnsubscribe(hwndDlg);
if (dat->hBitmap) {
- dat->ppro->Log("Delete bitmap");
+ dat->ppro->debugLogA("Delete bitmap");
DeleteObject(dat->hBitmap);
DeleteFile(dat->ppro->m_szPhotoFileName);
}
@@ -1117,7 +1117,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
szFileName = szAvatarName;
// Set photo element, also update the global jabberVcardPhotoFileName to reflect the update
- Log("Before update, file name = %S", szFileName);
+ debugLogA("Before update, file name = %S", szFileName);
if (szFileName == NULL || szFileName[0] == 0) {
v << XCHILD(_T("PHOTO"));
DeleteFile(szAvatarName);
@@ -1125,7 +1125,7 @@ void CJabberProto::SetServerVcard(BOOL bPhotoChanged, TCHAR* szPhotoFileName)
delSetting("AvatarHash");
}
else {
- Log("Saving picture from %S", szFileName);
+ debugLogA("Saving picture from %S", szFileName);
struct _stat st;
if ( _tstat(szFileName, &st) >= 0) {
diff --git a/protocols/JabberG/src/jabber_ws.cpp b/protocols/JabberG/src/jabber_ws.cpp
index eecaeab5f9..ef1f15bd98 100644
--- a/protocols/JabberG/src/jabber_ws.cpp
+++ b/protocols/JabberG/src/jabber_ws.cpp
@@ -60,7 +60,7 @@ int CJabberProto::WsSend(JABBER_SOCKET hConn, char* data, int datalen, int flags
int len;
if ((len = Netlib_Send(hConn, data, datalen, flags)) == SOCKET_ERROR || len != datalen) {
- Log("Netlib_Send() failed, error=%d", WSAGetLastError());
+ debugLogA("Netlib_Send() failed, error=%d", WSAGetLastError());
return SOCKET_ERROR;
}
return len;
@@ -72,11 +72,11 @@ int CJabberProto::WsRecv(JABBER_SOCKET hConn, char* data, long datalen, int flag
ret = Netlib_Recv(hConn, data, datalen, flags);
if (ret == SOCKET_ERROR) {
- Log("Netlib_Recv() failed, error=%d", WSAGetLastError());
+ debugLogA("Netlib_Recv() failed, error=%d", WSAGetLastError());
return 0;
}
if (ret == 0) {
- Log("Connection closed gracefully");
+ debugLogA("Connection closed gracefully");
return 0;
}
return ret;
diff --git a/protocols/JabberG/src/jabber_zstream.cpp b/protocols/JabberG/src/jabber_zstream.cpp
index e033be3785..edc5d5071c 100644
--- a/protocols/JabberG/src/jabber_zstream.cpp
+++ b/protocols/JabberG/src/jabber_zstream.cpp
@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
BOOL ThreadData::zlibInit(void)
{
- proto->Log("Zlib init...");
+ proto->debugLogA("Zlib init...");
zStreamIn.zalloc = Z_NULL;
zStreamIn.zfree = Z_NULL;
zStreamIn.opaque = Z_NULL;
@@ -64,16 +64,16 @@ int ThreadData::zlibSend(char* data, int datalen)
zStreamOut.next_out = (unsigned char*)send_data;
switch (deflate(&zStreamOut, Z_SYNC_FLUSH)) {
- case Z_OK: proto->Log("Deflate: Z_OK"); break;
- case Z_BUF_ERROR: proto->Log("Deflate: Z_BUF_ERROR"); break;
- case Z_DATA_ERROR: proto->Log("Deflate: Z_DATA_ERROR"); break;
- case Z_MEM_ERROR: proto->Log("Deflate: Z_MEM_ERROR"); break;
+ case Z_OK: proto->debugLogA("Deflate: Z_OK"); break;
+ case Z_BUF_ERROR: proto->debugLogA("Deflate: Z_BUF_ERROR"); break;
+ case Z_DATA_ERROR: proto->debugLogA("Deflate: Z_DATA_ERROR"); break;
+ case Z_MEM_ERROR: proto->debugLogA("Deflate: Z_MEM_ERROR"); break;
}
int len, send_datalen = ZLIB_CHUNK_SIZE - zStreamOut.avail_out;
if ((len = sendws(send_data, send_datalen, MSG_NODUMP)) == SOCKET_ERROR || len != send_datalen) {
- proto->Log("Netlib_Send() failed, error=%d", WSAGetLastError());
+ proto->debugLogA("Netlib_Send() failed, error=%d", WSAGetLastError());
return FALSE;
}
@@ -82,7 +82,7 @@ int ThreadData::zlibSend(char* data, int datalen)
while (zStreamOut.avail_out == 0);
if (db_get_b(NULL, "Netlib", "DumpSent", TRUE) == TRUE)
- proto->Log("(ZLIB) Data sent\n%s\n===OUT: %d(%d) bytes", data, datalen, bytesOut);
+ proto->debugLogA("(ZLIB) Data sent\n%s\n===OUT: %d(%d) bytes", data, datalen, bytesOut);
return TRUE;
}
@@ -93,7 +93,7 @@ int ThreadData::zlibRecv(char* data, long datalen)
retry:
zRecvDatalen = recvws(zRecvData, ZLIB_CHUNK_SIZE, MSG_NODUMP);
if (zRecvDatalen == SOCKET_ERROR) {
- proto->Log("Netlib_Recv() failed, error=%d", WSAGetLastError());
+ proto->debugLogA("Netlib_Recv() failed, error=%d", WSAGetLastError());
return SOCKET_ERROR;
}
if (zRecvDatalen == 0)
@@ -107,10 +107,10 @@ retry:
zStreamIn.next_out = (BYTE*)data;
switch (inflate(&zStreamIn, Z_NO_FLUSH)) {
- case Z_OK: proto->Log("Inflate: Z_OK"); break;
- case Z_BUF_ERROR: proto->Log("Inflate: Z_BUF_ERROR"); break;
- case Z_DATA_ERROR: proto->Log("Inflate: Z_DATA_ERROR"); break;
- case Z_MEM_ERROR: proto->Log("Inflate: Z_MEM_ERROR"); break;
+ case Z_OK: proto->debugLogA("Inflate: Z_OK"); break;
+ case Z_BUF_ERROR: proto->debugLogA("Inflate: Z_BUF_ERROR"); break;
+ case Z_DATA_ERROR: proto->debugLogA("Inflate: Z_DATA_ERROR"); break;
+ case Z_MEM_ERROR: proto->debugLogA("Inflate: Z_MEM_ERROR"); break;
}
int len = datalen - zStreamIn.avail_out;
@@ -118,7 +118,7 @@ retry:
char* szLogBuffer = (char*)alloca(len+32);
memcpy(szLogBuffer, data, len);
szLogBuffer[ len ]='\0';
- proto->Log("(ZLIB) Data received\n%s\n===IN: %d(%d) bytes", szLogBuffer, len, zRecvDatalen);
+ proto->debugLogA("(ZLIB) Data received\n%s\n===IN: %d(%d) bytes", szLogBuffer, len, zRecvDatalen);
}
if (len == 0)