diff options
Diffstat (limited to 'protocols')
186 files changed, 2288 insertions, 2536 deletions
diff --git a/protocols/AimOscar/src/avatars.cpp b/protocols/AimOscar/src/avatars.cpp index f0bd5d9480..6e764e8b78 100644 --- a/protocols/AimOscar/src/avatars.cpp +++ b/protocols/AimOscar/src/avatars.cpp @@ -23,7 +23,7 @@ void __cdecl CAimProto::avatar_request_thread(void* param) HANDLE hContact = (HANDLE)param;
char *sn = getStringA(hContact, AIM_KEY_SN);
- LOG("Starting avatar request thread for %s)", sn);
+ debugLogA("Starting avatar request thread for %s)", sn);
if (wait_conn(hAvatarConn, hAvatarEvent, 0x10))
{
@@ -33,7 +33,7 @@ void __cdecl CAimProto::avatar_request_thread(void* param) size_t len = (strlen(hash_str) + 1) / 2;
char* hash = (char*)alloca(len);
string_to_bytes(hash_str, hash);
- LOG("Requesting an Avatar: %s (Hash: %s)", sn, hash_str);
+ debugLogA("Requesting an Avatar: %s (Hash: %s)", sn, hash_str);
aim_request_avatar(hAvatarConn, avatar_seqno, sn, type, hash, (unsigned short)len);
mir_free(hash_str);
@@ -118,7 +118,7 @@ void CAimProto::avatar_retrieval_handler(const char* sn, const char* hash, const mir_free(my_sn);
}
}
- else LOG("AIM sent avatar of zero length for %s.(Usually caused by repeated request for the same icon)", sn);
+ else debugLogA("AIM sent avatar of zero length for %s.(Usually caused by repeated request for the same icon)", sn);
ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, res ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, &AI, 0);
}
diff --git a/protocols/AimOscar/src/client.cpp b/protocols/AimOscar/src/client.cpp index c7d4bf04b7..8c725810a5 100644 --- a/protocols/AimOscar/src/client.cpp +++ b/protocols/AimOscar/src/client.cpp @@ -600,7 +600,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno, aim_writetlv(0x2712,8,enc,frag_offset,msg_frag); // character set used by data
// aim_writetlvlong64(0x2713,ft->pfts.totalBytes,frag_offset,msg_frag); // file length
- LOG("Attempting to Send a file to a buddy.");
+ debugLogA("Attempting to Send a file to a buddy.");
}
else
{
@@ -620,7 +620,7 @@ int CAimProto::aim_send_file(HANDLE hServerConn, unsigned short &seqno, char cip[20];
long_ip_to_char_ip(ip, cip);
- LOG("IP for Buddy to connect to: %s:%u", cip, port);
+ debugLogA("IP for Buddy to connect to: %s:%u", cip, port);
return aim_sendflap(hServerConn,0x02,offset,buf,seqno)==0;
}
@@ -647,7 +647,7 @@ int CAimProto::aim_file_ad(HANDLE hServerConn,unsigned short &seqno,char* sn, ch aim_writegeneric(sn_length,sn,offset,buf); // screen name
aim_writetlv(0x05,frag_offset,msg_frag,offset,buf); // icbm tags
- LOG("%s a file transfer.", deny ? "Denying" : "Accepting");
+ debugLogA("%s a file transfer.", deny ? "Denying" : "Accepting");
return aim_sendflap(hServerConn,0x02,offset,buf,seqno)==0;
}
diff --git a/protocols/AimOscar/src/connection.cpp b/protocols/AimOscar/src/connection.cpp index 327274dac4..fcff93ef09 100644 --- a/protocols/AimOscar/src/connection.cpp +++ b/protocols/AimOscar/src/connection.cpp @@ -18,18 +18,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include "aim.h"
-int CAimProto::LOG(const char *fmt, ...)
-{
- va_list va;
- char szText[1024];
- if (!hNetlib)
- return 0;
- va_start(va, fmt);
- mir_vsnprintf(szText, sizeof(szText), fmt, va);
- va_end(va);
- return CallService(MS_NETLIB_LOG, (WPARAM) hNetlib, (LPARAM) szText);
-}
-
HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host)
{
NETLIBOPENCONNECTION ncon = { 0 };
@@ -38,15 +26,13 @@ HANDLE CAimProto::aim_connect(const char* server, unsigned short port, bool use_ ncon.wPort = port;
ncon.timeout = 6;
ncon.flags = NLOCF_V2;
- LOG("%s:%u", server, port);
- HANDLE con = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlib, (LPARAM)&ncon);
- if (con && use_ssl)
- {
+ debugLogA("%s:%u", server, port);
+ HANDLE con = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon);
+ if (con && use_ssl) {
NETLIBSSL ssl = {0};
ssl.cbSize = sizeof(ssl);
ssl.host = host;
- if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)con, (LPARAM)&ssl))
- {
+ if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)con, (LPARAM)&ssl)) {
Netlib_CloseHandle(con);
con = NULL;
}
@@ -62,8 +48,7 @@ HANDLE CAimProto::aim_peer_connect(const char* ip, unsigned short port) ncon.szHost = ip;
ncon.wPort = port;
ncon.timeout = 3;
- HANDLE con = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) hNetlibPeer, (LPARAM) & ncon);
- return con;
+ return (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibPeer, (LPARAM)&ncon);
}
HANDLE CAimProto::aim_peer_connect(unsigned long ip, unsigned short port)
@@ -107,12 +92,12 @@ void CAimProto::aim_connection_authorization(void) int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM) hServerPacketRecver, (LPARAM) & packetRecv);
if (recvResult == 0)
{
- LOG("Connection Closed: No Error? during Connection Authorization");
+ debugLogA("Connection Closed: No Error? during Connection Authorization");
break;
}
else if (recvResult < 0)
{
- LOG("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError());
+ debugLogA("Connection Closed: Socket Error during Connection Authorization %d", WSAGetLastError());
break;
}
else
@@ -143,7 +128,7 @@ void CAimProto::aim_connection_authorization(void) case 1:
mir_free(password);
Netlib_CloseHandle(hServerPacketRecver);
- LOG("Connection Authorization Thread Ending: Negotiation Beginning");
+ debugLogA("Connection Authorization Thread Ending: Negotiation Beginning");
return;
case 2:
@@ -158,7 +143,7 @@ void CAimProto::aim_connection_authorization(void) }
else if (flap.cmp(0x04))
{
- LOG("Connection Authorization Thread Ending: Flap 0x04");
+ debugLogA("Connection Authorization Thread Ending: Flap 0x04");
goto exit;
}
}
@@ -170,7 +155,7 @@ exit: if (m_iStatus!=ID_STATUS_OFFLINE) broadcast_status(ID_STATUS_OFFLINE);
if (hServerPacketRecver) Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(hServerConn); hServerConn=NULL;
- LOG("Connection Authorization Thread Ending: End of Thread");
+ debugLogA("Connection Authorization Thread Ending: End of Thread");
}
void __cdecl CAimProto::aim_protocol_negotiation( void* )
@@ -185,7 +170,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* ) int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
if (recvResult == 0)
{
- LOG("Connection Closed: No Error during Connection Negotiation?");
+ debugLogA("Connection Closed: No Error during Connection Negotiation?");
break;
}
else if (recvResult == SOCKET_ERROR)
@@ -197,7 +182,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* ) }
else
{
- LOG("Connection Closed: Socket Error during Connection Negotiation %d", WSAGetLastError());
+ debugLogA("Connection Closed: Socket Error during Connection Negotiation %d", WSAGetLastError());
break;
}
}
@@ -272,7 +257,7 @@ void __cdecl CAimProto::aim_protocol_negotiation( void* ) else if (flap.cmp(0x04))
{
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
- LOG("Connection Negotiation Thread Ending: Flap 0x04");
+ debugLogA("Connection Negotiation Thread Ending: Flap 0x04");
goto exit;
}
}
@@ -283,7 +268,7 @@ exit: if (m_iStatus!=ID_STATUS_OFFLINE) broadcast_status(ID_STATUS_OFFLINE);
Netlib_CloseHandle(hServerPacketRecver); hServerPacketRecver=NULL;
Netlib_CloseHandle(hServerConn); hServerConn=NULL;
- LOG("Connection Negotiation Thread Ending: End of Thread");
+ debugLogA("Connection Negotiation Thread Ending: End of Thread");
offline_contacts();
}
@@ -351,7 +336,7 @@ void __cdecl CAimProto::aim_mail_negotiation( void* ) }
exit:
- LOG("Mail Server Connection has ended");
+ debugLogA("Mail Server Connection has ended");
Netlib_CloseHandle(hServerPacketRecver);
Netlib_CloseHandle(hMailConn);
hMailConn=NULL;
@@ -418,7 +403,7 @@ exit: Netlib_CloseHandle(hAvatarConn);
hAvatarConn=NULL;
ResetEvent(hAvatarEvent);
- LOG("Avatar Server Connection has ended");
+ debugLogA("Avatar Server Connection has ended");
}
void __cdecl CAimProto::aim_chatnav_negotiation( void* )
@@ -496,7 +481,7 @@ exit: Netlib_CloseHandle(hChatNavConn);
hChatNavConn=NULL;
ResetEvent(hChatNavEvent);
- LOG("Chat Navigation Server Connection has ended");
+ debugLogA("Chat Navigation Server Connection has ended");
}
void __cdecl CAimProto::aim_chat_negotiation( void* param )
@@ -571,7 +556,7 @@ exit: Netlib_CloseHandle(item->hconn);
chat_leave(item->id);
remove_chat_by_ptr(item);
- LOG("Chat Server Connection has ended");
+ debugLogA("Chat Server Connection has ended");
}
void __cdecl CAimProto::aim_admin_negotiation( void* )
@@ -636,5 +621,5 @@ exit: Netlib_CloseHandle(hAdminConn);
hAdminConn=NULL;
ResetEvent(hAdminEvent);
- LOG("Admin Server Connection has ended");
+ debugLogA("Admin Server Connection has ended");
}
diff --git a/protocols/AimOscar/src/direct_connect.cpp b/protocols/AimOscar/src/direct_connect.cpp index f6d996ea37..982d56fe7d 100644 --- a/protocols/AimOscar/src/direct_connect.cpp +++ b/protocols/AimOscar/src/direct_connect.cpp @@ -52,7 +52,7 @@ void __cdecl CAimProto::aim_dc_helper(void* param) //only called when we are ini HANDLE hConn = aim_peer_connect(AIM_PROXY_SERVER, get_default_port());
if (hConn)
{
- LOG("Connected to proxy ip because we want to use a proxy for the file transfer.");
+ debugLogA("Connected to proxy ip because we want to use a proxy for the file transfer.");
ft->requester = true;
ft->hConn = hConn;
ForkThread(&CAimProto::aim_proxy_helper, ft);
@@ -74,7 +74,7 @@ void aim_direct_connection_initiated(HANDLE hNewConnection, DWORD, void* extra)/ NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hNewConnection, (LPARAM)&connInfo);
- ppro->LOG("Buddy connected: %s", connInfo.szIpPort);
+ ppro->debugLogA("Buddy connected: %s", connInfo.szIpPort);
// okay someone connected to us or we initiated the connection- we need to figure out who they are and if they belong
ft = ppro->ft_list.find_by_port(connInfo.wPort);
diff --git a/protocols/AimOscar/src/file.cpp b/protocols/AimOscar/src/file.cpp index 8cb4dcc4ca..ae5f3b8698 100644 --- a/protocols/AimOscar/src/file.cpp +++ b/protocols/AimOscar/src/file.cpp @@ -143,14 +143,14 @@ bool setup_next_file_send(file_transfer *ft) int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv)
{
- LOG("P2P: Entered file sending thread.");
+ debugLogA("P2P: Entered file sending thread.");
bool failed = true;
bool failed_conn = false;
if (!setup_next_file_send(ft)) return 2;
- LOG("Sent file information to buddy.");
+ debugLogA("Sent file information to buddy.");
//start listen for packets stuff
for (;;)
@@ -160,13 +160,13 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
if (recvResult == 0)
{
- LOG("P2P: File transfer connection Error: 0");
+ debugLogA("P2P: File transfer connection Error: 0");
break;
}
if (recvResult == SOCKET_ERROR)
{
failed_conn = true;
- LOG("P2P: File transfer connection Error: -1");
+ debugLogA("P2P: File transfer connection Error: -1");
break;
}
if (recvResult > 0)
@@ -182,7 +182,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI unsigned short type = _htons(recv_ft->type);
if (type == 0x0202 || type == 0x0207)
{
- LOG("P2P: Buddy Accepts our file transfer.");
+ debugLogA("P2P: Buddy Accepts our file transfer.");
int fid = _topen(ft->pfts.tszCurrentFile, _O_RDONLY | _O_BINARY, _S_IREAD);
if (fid < 0)
@@ -219,7 +219,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI }
}
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_DATA, ft, (LPARAM)&ft->pfts);
- LOG("P2P: Finished sending file bytes.");
+ debugLogA("P2P: Finished sending file bytes.");
_close(fid);
}
else if (type == 0x0204)
@@ -230,7 +230,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI ft->pfts.totalProgress += ft->pfts.currentFileSize;
}
- LOG("P2P: Buddy says they got the file successfully");
+ debugLogA("P2P: Buddy says they got the file successfully");
if ((ft->pfts.currentFileNumber + 1) < ft->pfts.totalFiles)
{
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
@@ -260,7 +260,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI recv_ft->recv_bytes = 0;
}
- LOG("P2P: Buddy wants us to start sending at a specified file point. (%I64u)", ft->pfts.currentFileProgress);
+ debugLogA("P2P: Buddy wants us to start sending at a specified file point. (%I64u)", ft->pfts.currentFileProgress);
if (Netlib_Send(ft->hConn, (char*)recv_ft, _htons(recv_ft->length), 0) <= 0) break;
ft->pfts.totalProgress += ft->pfts.currentFileProgress;
@@ -275,7 +275,7 @@ int CAimProto::sending_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLI int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NETLIBPACKETRECVER &packetRecv)
{
- LOG("P2P: Entered file receiving thread.");
+ debugLogA("P2P: Entered file receiving thread.");
bool failed = true;
bool failed_conn = false;
bool accepted_file = false;
@@ -293,13 +293,13 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)hServerPacketRecver, (LPARAM)&packetRecv);
if (recvResult == 0)
{
- LOG("P2P: File transfer connection Error: 0");
+ debugLogA("P2P: File transfer connection Error: 0");
break;
}
if (recvResult == SOCKET_ERROR)
{
failed_conn = true;
- LOG("P2P: File transfer connection Error: -1");
+ debugLogA("P2P: File transfer connection Error: -1");
break;
}
if (recvResult > 0)
@@ -317,7 +317,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET unsigned short type = _htons(recv_ft->type);
if (type == 0x0101)
{
- LOG("P2P: Buddy Ready to begin transfer.");
+ debugLogA("P2P: Buddy Ready to begin transfer.");
oft = (oft2*)mir_realloc(oft, pkt_len);
memcpy(oft, recv_ft, pkt_len);
memcpy(oft->icbm_cookie, ft->icbm_cookie, 8);
@@ -444,7 +444,7 @@ int CAimProto::receiving_file(file_transfer *ft, HANDLE hServerPacketRecver, NET oft->recv_bytes = _htonl(ft->pfts.currentFileProgress);
oft->recv_checksum = _htonl(aim_oft_checksum_file(ft->pfts.tszCurrentFile));
- LOG("P2P: We got the file successfully");
+ debugLogA("P2P: We got the file successfully");
Netlib_Send(ft->hConn, (char*)oft, _htons(oft->length), 0);
if (_htons(oft->num_files_left) == 1)
{
diff --git a/protocols/AimOscar/src/popup.cpp b/protocols/AimOscar/src/popup.cpp index 2d9489c5ac..107908da51 100644 --- a/protocols/AimOscar/src/popup.cpp +++ b/protocols/AimOscar/src/popup.cpp @@ -72,11 +72,11 @@ void CAimProto::ShowPopup(const char* msg, int flags, char* url) if (flags & TCHAR_POPUP)
{
char* errmsg = mir_t2a((TCHAR*)msg);
- LOG(errmsg);
+ debugLogA(errmsg);
mir_free(errmsg);
}
else
- LOG(msg);
+ debugLogA(msg);
}
TCHAR *msgt = (flags & TCHAR_POPUP) ? mir_tstrdup((TCHAR*)msg) : mir_a2t(msg);
diff --git a/protocols/AimOscar/src/proto.cpp b/protocols/AimOscar/src/proto.cpp index 61f1e8cdf5..a18ca749d0 100644 --- a/protocols/AimOscar/src/proto.cpp +++ b/protocols/AimOscar/src/proto.cpp @@ -21,7 +21,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) : PROTO<CAimProto>(aProtoName, aUserName),
chat_rooms(5)
{
- LOG("Setting protocol/module name to '%s'", m_szModuleName);
+ debugLogA("Setting protocol/module name to '%s'", m_szModuleName);
//create some events
hAvatarEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
@@ -57,7 +57,7 @@ CAimProto::CAimProto(const char* aProtoName, const TCHAR* aUserName) : nlu.szSettingsModule = m_szModuleName;
mir_sntprintf(descr, SIZEOF(descr), TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = descr;
- hNetlib = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2P[128];
mir_snprintf(szP2P, sizeof(szP2P), "%sP2P", m_szModuleName);
@@ -84,7 +84,7 @@ CAimProto::~CAimProto() close_chat_conn();
- Netlib_CloseHandle(hNetlib);
+ Netlib_CloseHandle(m_hNetlibUser);
Netlib_CloseHandle(hNetlibPeer);
DeleteCriticalSection(&SendingMutex);
@@ -231,7 +231,7 @@ int __cdecl CAimProto::FileCancel(HANDLE hContact, HANDLE hTransfer) file_transfer *ft = (file_transfer*)hTransfer;
if (!ft_list.find_by_ft(ft)) return 0;
- LOG("We are cancelling a file transfer.");
+ debugLogA("We are cancelling a file transfer.");
aim_chat_deny(hServerConn, seqno, ft->sn, ft->icbm_cookie);
@@ -254,7 +254,7 @@ int __cdecl CAimProto::FileDeny(HANDLE hContact, HANDLE hTransfer, const PROTOCH file_transfer *ft = (file_transfer*)hTransfer;
if (!ft_list.find_by_ft(ft)) return 0;
- LOG("We are denying a file transfer.");
+ debugLogA("We are denying a file transfer.");
aim_chat_deny(hServerConn, seqno, ft->sn, ft->icbm_cookie);
return 0;
@@ -445,10 +445,10 @@ int __cdecl CAimProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre) char *bbuf = NULL;
if (getByte(AIM_KEY_FI, 1))
{
- LOG("Converting from html to bbcodes then stripping leftover html.");
+ debugLogA("Converting from html to bbcodes then stripping leftover html.");
pre->szMessage = bbuf = html_to_bbcodes(pre->szMessage);
}
- LOG("Stripping html.");
+ debugLogA("Stripping html.");
html_decode(pre->szMessage);
INT_PTR res = Proto_RecvMessage(hContact, pre);
@@ -525,7 +525,7 @@ HANDLE __cdecl CAimProto::SendFile(HANDLE hContact, const PROTOCHAR* szDescripti if (ft->me_force_proxy)
{
- LOG("We are forcing a proxy file transfer.");
+ debugLogA("We are forcing a proxy file transfer.");
ForkThread(&CAimProto::accept_file_thread, ft);
}
else
diff --git a/protocols/AimOscar/src/proto.h b/protocols/AimOscar/src/proto.h index e7460fbe8c..041a78694c 100644 --- a/protocols/AimOscar/src/proto.h +++ b/protocols/AimOscar/src/proto.h @@ -139,7 +139,7 @@ struct CAimProto : public PROTO<CAimProto> //Some main connection stuff
HANDLE hServerConn;//handle to the main connection
- HANDLE hNetlib;//handle to netlib
+
unsigned long internal_ip; // our ip
unsigned long detected_ip; // our ip
unsigned short local_port; // our port
@@ -318,7 +318,6 @@ struct CAimProto : public PROTO<CAimProto> void __cdecl aim_chat_negotiation( void* );
void __cdecl aim_admin_negotiation( void* );
- int LOG(const char *fmt, ...);
HANDLE aim_connect(const char* server, unsigned short port, bool use_ssl, const char* host = NULL);
HANDLE aim_peer_connect(const char* ip, unsigned short port);
HANDLE aim_peer_connect(unsigned long ip, unsigned short port);
diff --git a/protocols/AimOscar/src/proxy.cpp b/protocols/AimOscar/src/proxy.cpp index f3cc734127..d24f34f8f2 100644 --- a/protocols/AimOscar/src/proxy.cpp +++ b/protocols/AimOscar/src/proxy.cpp @@ -90,7 +90,7 @@ void __cdecl CAimProto::aim_proxy_helper(void* param) unsigned long ip = _htonl(*(unsigned long*)&packetRecv.buffer[14]);
aim_send_file(hServerConn, seqno, ip, port, true, ft);
- LOG("Stage %d Proxy ft and we are not the sender.", ft->req_num);
+ debugLogA("Stage %d Proxy ft and we are not the sender.", ft->req_num);
}
else if (type == 0x0005)
{
diff --git a/protocols/AimOscar/src/server.cpp b/protocols/AimOscar/src/server.cpp index 3988e342fa..a81b8e2ed6 100644 --- a/protocols/AimOscar/src/server.cpp +++ b/protocols/AimOscar/src/server.cpp @@ -1029,7 +1029,7 @@ void CAimProto::snac_contact_list(SNAC &snac,HANDLE hServerConn,unsigned short & {
if (snac.subcmp(0x0006)) //contact list
{
- LOG("Contact List Received");
+ debugLogA("Contact List Received");
// unsigned char ver = snac.ubyte();
int num_obj = snac.ushort(1);
@@ -1064,7 +1064,7 @@ void CAimProto::snac_contact_list(SNAC &snac,HANDLE hServerConn,unsigned short & avatar_request_handler(NULL, NULL, 0);
- LOG("Connection Negotiation Finished");
+ debugLogA("Connection Negotiation Finished");
state = 1;
}
}
@@ -1356,8 +1356,8 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho {
if (rdz_msg_type == 0 && request_num == 1) //buddy wants to send us a file
{
- LOG("Buddy Wants to Send us a file. Request 1");
- LOG(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
+ debugLogA("Buddy Wants to Send us a file. Request 1");
+ debugLogA(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
file_transfer* ft = new file_transfer(hContact, sn, icbm_cookie);
@@ -1394,14 +1394,14 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho mir_free(filenameT);
char cip[20];
- LOG("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
- LOG("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
- LOG("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
+ debugLogA("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
+ debugLogA("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
+ debugLogA("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
}
else if (rdz_msg_type == 0)
{
- LOG("We are sending a file. Buddy wants us to connect to them. Request %d", request_num);
- LOG(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
+ debugLogA("We are sending a file. Buddy wants us to connect to them. Request %d", request_num);
+ debugLogA(force_proxy ? "Forcing a Proxy File transfer." : "Not forcing Proxy File transfer.");
file_transfer* ft = ft_list.find_by_cookie(icbm_cookie, hContact);
if (ft)
@@ -1419,21 +1419,21 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho ft->max_ver = max_ver;
char cip[20];
- LOG("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
- LOG("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
- LOG("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
+ debugLogA("Local IP: %s:%u", long_ip_to_char_ip(local_ip, cip), port);
+ debugLogA("Verified IP: %s:%u", long_ip_to_char_ip(verified_ip, cip), port);
+ debugLogA("Proxy IP: %s:%u", long_ip_to_char_ip(proxy_ip, cip), port);
ForkThread(&CAimProto::accept_file_thread, ft);
}
else
{
- LOG("Unknown File transfer, thus denied.");
+ debugLogA("Unknown File transfer, thus denied.");
aim_file_ad(hServerConn, seqno, sn, icbm_cookie, true, 0);
}
}
else if (rdz_msg_type == 1)//buddy cancelled or denied file transfer
{
- LOG("File transfer cancelled or denied.");
+ debugLogA("File transfer cancelled or denied.");
file_transfer* ft = ft_list.find_by_cookie(icbm_cookie, hContact);
ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_DENIED, ft, 0);
@@ -1441,7 +1441,7 @@ void CAimProto::snac_received_message(SNAC &snac,HANDLE hServerConn,unsigned sho }
else if (rdz_msg_type == 2)//buddy accepts our file transfer request
{
- LOG("File transfer accepted");
+ debugLogA("File transfer accepted");
file_transfer* ft = ft_list.find_by_cookie(icbm_cookie, hContact);
if (ft)
{
@@ -1495,7 +1495,7 @@ void CAimProto::snac_file_decline(SNAC &snac)//family 0x0004 int error = snac.ushort(13 + sn_len);
if (error == 0x02)
{
- LOG("File Transfer declied");
+ debugLogA("File Transfer declied");
HANDLE hContact = contact_from_sn(sn);
file_transfer *ft = ft_list.find_by_cookie(icbm_cookie, hContact);
if (ft)
@@ -1733,39 +1733,39 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 hMailConn = aim_connect(server, get_default_port(), false/*use_ssl != 0*/, host);
if (hMailConn)
{
- LOG("Successfully Connected to the Mail Server.");
+ debugLogA("Successfully Connected to the Mail Server.");
MAIL_COOKIE=local_cookie;
MAIL_COOKIE_LENGTH=local_cookie_length;
ForkThread( &CAimProto::aim_mail_negotiation, 0 );
}
else
- LOG("Failed to connect to the Mail Server.");
+ debugLogA("Failed to connect to the Mail Server.");
}
else if (family == 0x0010)
{
hAvatarConn = aim_connect(server, get_default_port(), false/*use_ssl != 0*/);
if (hAvatarConn)
{
- LOG("Successfully Connected to the Avatar Server.");
+ debugLogA("Successfully Connected to the Avatar Server.");
AVATAR_COOKIE = local_cookie;
AVATAR_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_avatar_negotiation, 0 );
}
else
- LOG("Failed to connect to the Avatar Server.");
+ debugLogA("Failed to connect to the Avatar Server.");
}
else if (family == 0x000D)
{
hChatNavConn = aim_connect(server, get_default_port(), use_ssl != 0, host);
if (hChatNavConn)
{
- LOG("Successfully Connected to the Chat Navigation Server.");
+ debugLogA("Successfully Connected to the Chat Navigation Server.");
CHATNAV_COOKIE = local_cookie;
CHATNAV_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_chatnav_negotiation, 0 );
}
else
- LOG("Failed to connect to the Chat Navigation Server.");
+ debugLogA("Failed to connect to the Chat Navigation Server.");
}
else if (family == 0x000E)
@@ -1776,14 +1776,14 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 item->hconn = aim_connect(server, get_default_port(), use_ssl != 0, host);
if (item->hconn)
{
- LOG("Successfully Connected to the Chat Server.");
+ debugLogA("Successfully Connected to the Chat Server.");
chat_start(item->id, item->exchange);
item->CHAT_COOKIE = local_cookie;
item->CHAT_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_chat_negotiation, item );
}
else
- LOG("Failed to connect to the Chat Server.");
+ debugLogA("Failed to connect to the Chat Server.");
}
}
else if (family == 0x0007)
@@ -1791,13 +1791,13 @@ void CAimProto::snac_service_redirect(SNAC &snac)//family 0x0001 hAdminConn = aim_connect(server, get_default_port(), false /*use_ssl != 0*/);
if (hAdminConn)
{
- LOG("Successfully Connected to the Admin Server.");
+ debugLogA("Successfully Connected to the Admin Server.");
ADMIN_COOKIE = local_cookie;
ADMIN_COOKIE_LENGTH = local_cookie_length;
ForkThread( &CAimProto::aim_admin_negotiation, 0 );
}
else
- LOG("Failed to connect to the Admin Server.");
+ debugLogA("Failed to connect to the Admin Server.");
}
mir_free(server);
mir_free(host);
@@ -1946,7 +1946,7 @@ void CAimProto::snac_chatnav_info_response(SNAC &snac,HANDLE hServerConn,unsigne {
if (snac.subcmp(0x0009))
{
- LOG("Chat Info Received");
+ debugLogA("Chat Info Received");
unsigned short offset_info=0;
while (offset_info < snac.len()) // Loop through all the TLVs and pull out the buddy name
diff --git a/protocols/AimOscar/src/thread.cpp b/protocols/AimOscar/src/thread.cpp index 60f16f5263..04b0991333 100644 --- a/protocols/AimOscar/src/thread.cpp +++ b/protocols/AimOscar/src/thread.cpp @@ -28,7 +28,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file hConn = aim_peer_connect(ft->proxy_ip, get_default_port());
if (hConn)
{
- LOG("Connected to proxy ip that buddy specified.");
+ debugLogA("Connected to proxy ip that buddy specified.");
ft->hConn = hConn;
ForkThread(&CAimProto::aim_proxy_helper, ft);
ft->stop_listen();
@@ -39,7 +39,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file hConn = aim_peer_connect(AIM_PROXY_SERVER, get_default_port());
if (hConn)
{
- LOG("Connected to proxy ip because we want to use a proxy for the file transfer.");
+ debugLogA("Connected to proxy ip because we want to use a proxy for the file transfer.");
ft->requester = true;
ft->hConn = hConn;
ForkThread(&CAimProto::aim_proxy_helper, ft);
@@ -52,7 +52,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file hConn = aim_peer_connect(verif ? ft->verified_ip : ft->local_ip, ft->port);
if (hConn)
{
- LOG("Connected to buddy over P2P port via %s ip.", verif ? "verified": "local");
+ debugLogA("Connected to buddy over P2P port via %s ip.", verif ? "verified": "local");
ft->accepted = true;
ft->hConn = hConn;
aim_file_ad(hServerConn, seqno, ft->sn, ft->icbm_cookie, false, ft->max_ver);
@@ -72,7 +72,7 @@ void __cdecl CAimProto::accept_file_thread(void* param)//buddy sending file }
else
{
- LOG("Failed to connect to buddy- asking buddy to connect to us.");
+ debugLogA("Failed to connect to buddy- asking buddy to connect to us.");
ft->listen(this);
ft->requester = true;
aim_send_file(hServerConn, seqno, detected_ip, ft->local_port, false, ft);
diff --git a/protocols/AimOscar/src/utility.cpp b/protocols/AimOscar/src/utility.cpp index a113ee191d..58ca76cb0e 100644 --- a/protocols/AimOscar/src/utility.cpp +++ b/protocols/AimOscar/src/utility.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CAimProto::broadcast_status(int status)
{
- LOG("Broadcast Status: %d",status);
+ debugLogA("Broadcast Status: %d",status);
int old_status = m_iStatus;
m_iStatus = status;
if (m_iStatus == ID_STATUS_OFFLINE)
@@ -139,7 +139,7 @@ bool CAimProto::wait_conn(HANDLE& hConn, HANDLE& hEvent, unsigned short service) EnterCriticalSection(&connMutex);
if (hConn == NULL && hServerConn)
{
- LOG("Starting Connection.");
+ debugLogA("Starting Connection.");
hConn = (HANDLE)1; //set so no additional service request attempts are made while aim is still processing the request
aim_new_service_request(hServerConn, seqno, service) ;//general service connection!
}
@@ -200,7 +200,7 @@ HANDLE CAimProto::contact_from_sn(const char* sn, bool addIfNeeded, bool tempora if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) m_szModuleName) == 0) {
setString(hContact, AIM_KEY_SN, norm_sn);
setString(hContact, AIM_KEY_NK, sn);
- LOG("Adding contact %s to client side list.",norm_sn);
+ debugLogA("Adding contact %s to client side list.",norm_sn);
if (temporary)
db_set_b(hContact, "CList", "NotOnList", 1);
return hContact;
@@ -227,7 +227,7 @@ void CAimProto::update_server_group(const char* group, unsigned short group_id) user_id_array[i] = _htons(group_list[i].item_id);
}
- LOG("Modifying group %s:%u on the serverside list",group, group_id);
+ debugLogA("Modifying group %s:%u on the serverside list",group, group_id);
aim_mod_group(hServerConn, seqno, group, group_id, (char*)user_id_array,
user_id_array_size * sizeof(unsigned short));
@@ -262,7 +262,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) unsigned short new_group_id = group_list.find_id(new_group);
if (!item_id)
- LOG("Contact %u not on list.", hContact);
+ debugLogA("Contact %u not on list.", hContact);
setGroupId(hContact, 1, new_group_id);
if (new_group && strcmp(new_group, AIM_DEFAULT_GROUP))
@@ -275,13 +275,13 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) if (new_group_id == 0)
{
create_group(new_group);
- LOG("Group %s not on list.", new_group);
+ debugLogA("Group %s not on list.", new_group);
new_group_id = group_list.add(new_group);
- LOG("Adding group %s:%u to the serverside list", new_group, new_group_id);
+ debugLogA("Adding group %s:%u to the serverside list", new_group, new_group_id);
aim_add_contact(hServerConn, seqno, new_group, 0, new_group_id, 1);//add the group server-side even if it exist
}
- LOG("Adding buddy %s:%u %s:%u to the serverside list", dbv.pszVal, new_item_id, new_group, new_group_id);
+ debugLogA("Adding buddy %s:%u %s:%u to the serverside list", dbv.pszVal, new_item_id, new_group, new_group_id);
aim_add_contact(hServerConn, seqno, dbv.pszVal, new_item_id, new_group_id, 0, nick);
update_server_group(new_group, new_group_id);
@@ -289,7 +289,7 @@ void CAimProto::add_contact_to_group(HANDLE hContact, const char* new_group) if (old_group_id && item_id)
{
bool is_not_in_list = getBool(hContact, AIM_KEY_NIL, false);
- LOG("Removing buddy %s:%u %s:%u from the serverside list", dbv.pszVal, item_id, old_group, old_group_id);
+ debugLogA("Removing buddy %s:%u %s:%u from the serverside list", dbv.pszVal, item_id, old_group, old_group_id);
aim_delete_contact(hServerConn, seqno, dbv.pszVal, item_id, old_group_id, 0, is_not_in_list);
update_server_group(old_group, old_group_id);
delSetting(hContact, AIM_KEY_NIL);
diff --git a/protocols/FacebookRM/src/communication.cpp b/protocols/FacebookRM/src/communication.cpp index f97c6f6c70..e2082b373a 100644 --- a/protocols/FacebookRM/src/communication.cpp +++ b/protocols/FacebookRM/src/communication.cpp @@ -54,7 +54,7 @@ http::response facebook_client::flap(RequestType request_type, std::string* requ nlhr.dataLength = (int)request_data->length();
}
- parent->Log("@@@@@ Sending request to '%s'", nlhr.szUrl);
+ parent->debugLogA("@@@@@ Sending request to '%s'", nlhr.szUrl);
switch (request_type)
{
@@ -99,14 +99,14 @@ http::response facebook_client::flap(RequestType request_type, std::string* requ if (pnlhr != NULL)
{
- parent->Log("@@@@@ Got response with code %d", pnlhr->resultCode);
+ parent->debugLogA("@@@@@ Got response with code %d", pnlhr->resultCode);
store_headers(&resp, pnlhr->headers, pnlhr->headersCount);
resp.code = pnlhr->resultCode;
resp.data = pnlhr->pData ? pnlhr->pData : "";
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)pnlhr);
} else {
- parent->Log("!!!!! No response from server (time-out)");
+ parent->debugLogA("!!!!! No response from server (time-out)");
resp.code = HTTP_CODE_FAKE_DISCONNECTED;
// Better to have something set explicitely as this value is compaired in all communication requests
}
@@ -142,7 +142,7 @@ http::response facebook_client::flap(RequestType request_type, std::string* requ resp.error_title = title;
resp.code = HTTP_CODE_FAKE_ERROR;
- parent->Log(" ! ! Received Facebook error: %d -- %s", error_num, error.c_str());
+ parent->debugLogA(" ! ! Received Facebook error: %d -- %s", error_num, error.c_str());
if (notify_errors(request_type))
client_notify(_A2T(error.c_str()));
}
@@ -154,13 +154,13 @@ http::response facebook_client::flap(RequestType request_type, std::string* requ bool facebook_client::handle_entry(std::string method)
{
- parent->Log(" >> Entering %s()", method.c_str());
+ parent->debugLogA(" >> Entering %s()", method.c_str());
return true;
}
bool facebook_client::handle_success(std::string method)
{
- parent->Log(" << Quitting %s()", method.c_str());
+ parent->debugLogA(" << Quitting %s()", method.c_str());
reset_error();
return true;
}
@@ -168,7 +168,7 @@ bool facebook_client::handle_success(std::string method) bool facebook_client::handle_error(std::string method, int action)
{
increment_error();
- parent->Log("!!!!! %s(): Something with Facebook went wrong", method.c_str());
+ parent->debugLogA("!!!!! %s(): Something with Facebook went wrong", method.c_str());
bool result = (error_count_ <= (UINT)parent->getByte(FACEBOOK_KEY_TIMEOUTS_LIMIT, FACEBOOK_TIMEOUTS_LIMIT));
if (action == FORCE_DISCONNECT || action == FORCE_QUIT)
@@ -630,16 +630,16 @@ void facebook_client::store_headers(http::response* resp, NETLIBHTTPHEADER* head std::string cookie_value = header_value.substr(header_value.find("=") + 1, header_value.find(";") - header_value.find("=") - 1);
if (cookie_value == "deleted")
{
- parent->Log(" Deleted cookie '%s'", cookie_name.c_str());
+ parent->debugLogA(" Deleted cookie '%s'", cookie_name.c_str());
cookies.erase(cookie_name);
} else {
- parent->Log(" New cookie '%s'", cookie_name.c_str());
+ parent->debugLogA(" New cookie '%s'", cookie_name.c_str());
cookies[cookie_name] = cookie_value;
}
}
else
{ // TODO RM: (un)comment
- //parent->Log("----- Got header '%s': %s", header_name.c_str(), header_value.c_str());
+ //parent->debugLogA("----- Got header '%s': %s", header_name.c_str(), header_value.c_str());
resp->headers[header_name] = header_value;
}
}
@@ -659,7 +659,7 @@ void loginError(FacebookProto *proto, std::string error_str) { utils::text::remove_html(
utils::text::edit_html(error_str))));
- proto->Log(" ! ! Login error: %s", error_str.length() ? error_str.c_str() : "Unknown error");
+ proto->debugLogA(" ! ! Login error: %s", error_str.length() ? error_str.c_str() : "Unknown error");
TCHAR buf[200];
mir_sntprintf(buf, SIZEOF(buf), TranslateT("Login error: %s"),
@@ -705,7 +705,7 @@ bool facebook_client::login(const char *username, const char *password) // Check for invalid requests
if (resp.headers["Location"].find("invalid_request.php") != std::string::npos) {
client_notify(TranslateT("Login error: Invalid request."));
- parent->Log(" ! ! Login error: Invalid request.");
+ parent->debugLogA(" ! ! Login error: Invalid request.");
return handle_error("login", FORCE_QUIT);
}
@@ -713,7 +713,7 @@ bool facebook_client::login(const char *username, const char *password) if (resp.headers["Location"].find("help.php") != std::string::npos)
{
client_notify(TranslateT("Login error: Some Facebook things are required."));
- parent->Log(" ! ! Login error: Some Facebook things are required.");
+ parent->debugLogA(" ! ! Login error: Some Facebook things are required.");
// return handle_error("login", FORCE_QUIT);
}
@@ -790,7 +790,7 @@ bool facebook_client::login(const char *username, const char *password) if (resp.data.find("id=\"captcha\"") != std::string::npos)
{
client_notify(TranslateT("Login error: Captcha code is required. Bad login credentials?"));
- parent->Log(" ! ! Login error: Captcha code is required.");
+ parent->debugLogA(" ! ! Login error: Captcha code is required.");
return handle_error("login", FORCE_QUIT);
}
@@ -807,11 +807,11 @@ bool facebook_client::login(const char *username, const char *password) if (cookies.find("c_user") != cookies.end()) {
this->self_.user_id = cookies.find("c_user")->second;
parent->setString(FACEBOOK_KEY_ID, this->self_.user_id.c_str());
- parent->Log(" Got self user id: %s", this->self_.user_id.c_str());
+ parent->debugLogA(" Got self user id: %s", this->self_.user_id.c_str());
return handle_success("login");
} else {
client_notify(TranslateT("Login error, probably bad login credentials."));
- parent->Log(" ! ! Login error, probably bad login credentials.");
+ parent->debugLogA(" ! ! Login error, probably bad login credentials.");
return handle_error("login", FORCE_QUIT);
}
}
@@ -864,7 +864,7 @@ bool facebook_client::home() }
this->dtsg_ = utils::text::source_get_value(&resp.data, 3, "name=\"fb_dtsg\"", "value=\"", "\"");
- parent->Log(" Got self dtsg: %s", this->dtsg_.c_str());
+ parent->debugLogA(" Got self dtsg: %s", this->dtsg_.c_str());
if (this->dtsg_.empty())
return false;
@@ -879,7 +879,7 @@ bool facebook_client::home() this->self_.real_name = utils::text::source_get_value(&resp.data, 2, "<strong class=\"profileName\">", "</strong>");
if (!this->self_.real_name.empty()) {
parent->SaveName(NULL, &this->self_);
- parent->Log(" Got self real name: %s", this->self_.real_name.c_str());
+ parent->debugLogA(" Got self real name: %s", this->self_.real_name.c_str());
} else {
client_notify(TranslateT("Something happened to Facebook. Maybe there was some major update so you should wait for an update."));
return handle_error("home", FORCE_QUIT);
@@ -887,18 +887,18 @@ bool facebook_client::home() // Get avatar
this->self_.image_url = utils::text::source_get_value(&resp.data, 3, "class=\"l\"", "<img src=\"", "\"");
- parent->Log(" Got self avatar: %s", this->self_.image_url.c_str());
+ parent->debugLogA(" Got self avatar: %s", this->self_.image_url.c_str());
parent->CheckAvatarChange(NULL, this->self_.image_url);
// Get logout hash
this->logout_hash_ = utils::text::source_get_value2(&resp.data, "/logout.php?h=", "&\"");
- parent->Log(" Got self logout hash: %s", this->logout_hash_.c_str());
+ parent->debugLogA(" Got self logout hash: %s", this->logout_hash_.c_str());
return handle_success("home");
}
case HTTP_CODE_FOUND:
// Work-around for replica_down, f**king hell what's that?
- parent->Log(" REPLICA_DOWN is back in force!");
+ parent->debugLogA(" REPLICA_DOWN is back in force!");
return this->home();
default:
@@ -931,16 +931,16 @@ bool facebook_client::reconnect() case HTTP_CODE_OK:
{
this->chat_channel_ = utils::text::source_get_value(&resp.data, 2, "\"user_channel\":\"", "\"");
- parent->Log(" Got self channel: %s", this->chat_channel_.c_str());
+ parent->debugLogA(" Got self channel: %s", this->chat_channel_.c_str());
this->chat_channel_partition_ = utils::text::source_get_value2(&resp.data, "\"partition\":", ",}");
- parent->Log(" Got self channel partition: %s", this->chat_channel_partition_.c_str());
+ parent->debugLogA(" Got self channel partition: %s", this->chat_channel_partition_.c_str());
this->chat_channel_host_ = utils::text::source_get_value(&resp.data, 2, "\"host\":\"", "\"");
- parent->Log(" Got self channel host: %s", this->chat_channel_host_.c_str());
+ parent->debugLogA(" Got self channel host: %s", this->chat_channel_host_.c_str());
this->chat_sequence_num_ = utils::text::source_get_value2(&resp.data, "\"seq\":", ",}");
- parent->Log(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
+ parent->debugLogA(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
return handle_success("reconnect");
}
@@ -1061,7 +1061,7 @@ bool facebook_client::load_pages() if (id.empty() || title.empty())
continue;
- parent->Log(" Got page: %s (%s)", title.c_str(), id.c_str());
+ parent->debugLogA(" Got page: %s (%s)", title.c_str(), id.c_str());
pages[id] = title;
}
@@ -1093,24 +1093,24 @@ bool facebook_client::channel() {
// Something went wrong (server flooding?)
- parent->Log("! ! ! Requested full reload");
+ parent->debugLogA("! ! ! Requested full reload");
this->chat_sequence_num_ = utils::text::source_get_value2(&resp.data, "\"seq\":", ",}");
- parent->Log(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
+ parent->debugLogA(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
this->chat_reconnect_reason_ = utils::text::source_get_value2(&resp.data, "\"reason\":", ",}");
- parent->Log(" Reconnect reason: %s", this->chat_reconnect_reason_.c_str());
+ parent->debugLogA(" Reconnect reason: %s", this->chat_reconnect_reason_.c_str());
}
else if (resp.data.find("\"t\":\"refresh\"") != std::string::npos)
{
// Something went wrong (server flooding?)
- parent->Log("! ! ! Requested channel refresh");
+ parent->debugLogA("! ! ! Requested channel refresh");
this->chat_reconnect_reason_ = utils::text::source_get_value2(&resp.data, "\"reason\":", ",}");
- parent->Log(" Reconnect reason: %s", this->chat_reconnect_reason_.c_str());
+ parent->debugLogA(" Reconnect reason: %s", this->chat_reconnect_reason_.c_str());
this->chat_sequence_num_ = utils::text::source_get_value2(&resp.data, "\"seq\":", ",}");
- parent->Log(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
+ parent->debugLogA(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
return this->reconnect();
} else {
@@ -1120,7 +1120,7 @@ bool facebook_client::channel() // Increment sequence number
this->chat_sequence_num_ = utils::text::source_get_value2(&resp.data, "\"seq\":", ",}");
- parent->Log(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
+ parent->debugLogA(" Got self sequence number: %s", this->chat_sequence_num_.c_str());
}
// Return
@@ -1145,7 +1145,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me switch (method) {
case MESSAGE_INBOX:
{
- parent->Log(" > Sending message through INBOX");
+ parent->debugLogA(" > Sending message through INBOX");
std::string data = "action=send";
data += "&body=" + utils::url::encode(message_text);
data += "&recipients[0]=" + message_recipient;
@@ -1159,7 +1159,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me }
case MESSAGE_MERCURY:
{
- parent->Log(" > Sending message through CHAT");
+ parent->debugLogA(" > Sending message through CHAT");
std::string data = "message_batch[0][action_type]=ma-type:user-generated-message";
data += "&message_batch[0][thread_id]";
data += "&message_batch[0][author]=fbid:" + this->self_.user_id;
@@ -1193,7 +1193,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me }
case MESSAGE_TID:
{
- parent->Log(" > Sending message through MERCURY (TID)");
+ parent->debugLogA(" > Sending message through MERCURY (TID)");
std::string data = "message_batch[0][action_type]=ma-type:user-generated-message";
data += "&message_batch[0][thread_id]=" + message_recipient;
data += "&message_batch[0][author]=fbid:" + this->self_.user_id;
@@ -1217,7 +1217,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me }
case MESSAGE_ASYNC:
{
- parent->Log(" > Sending message through ASYNC");
+ parent->debugLogA(" > Sending message through ASYNC");
std::string data = "action=send";
data += "&body=" + utils::url::encode(message_text);
data += "&recipients[0]=" + message_recipient;
@@ -1257,7 +1257,7 @@ bool facebook_client::send_message(std::string message_recipient, std::string me } break;
default: // Other error
- parent->Log(" !!! Send message error #%d: %s", resp.error_number, resp.error_text);
+ parent->debugLogA(" !!! Send message error #%d: %s", resp.error_number, resp.error_text);
return false;
}
@@ -1370,7 +1370,7 @@ bool facebook_client::save_url(const std::string &url,const std::tstring &filena if (resp)
{
nlc = resp->nlc;
- parent->Log("@@@@@ Saving avatar URL %s to path %s", url.c_str(), _T2A(filename.c_str()));
+ parent->debugLogA("@@@@@ Saving avatar URL %s to path %s", url.c_str(), _T2A(filename.c_str()));
// Create folder if necessary
std::tstring dir = filename.substr(0,filename.rfind('\\'));
diff --git a/protocols/FacebookRM/src/connection.cpp b/protocols/FacebookRM/src/connection.cpp index 9c2f866f4c..d4f255de95 100644 --- a/protocols/FacebookRM/src/connection.cpp +++ b/protocols/FacebookRM/src/connection.cpp @@ -67,7 +67,7 @@ void FacebookProto::ChangeStatus(void*) { // Login
SYSTEMTIME t;
GetLocalTime(&t);
- Log("[%d.%d.%d] Using Facebook Protocol RM %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING);
+ debugLogA("[%d.%d.%d] Using Facebook Protocol RM %s", t.wDay, t.wMonth, t.wYear, __VERSION_STRING);
LOG("***** Beginning SignOn process");
diff --git a/protocols/FacebookRM/src/definitions.h b/protocols/FacebookRM/src/definitions.h index 3de244779f..21df8e0d55 100644 --- a/protocols/FacebookRM/src/definitions.h +++ b/protocols/FacebookRM/src/definitions.h @@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #define FLAG_CONTAINS(x,y) ((x & y) == y)
#define REMOVE_FLAG(x,y) (x = (x & ~y))
-#define LOG Log
+#define LOG debugLogA
#define LOG_NOTIFY 0
#define LOG_WARNING 1
diff --git a/protocols/FacebookRM/src/events.cpp b/protocols/FacebookRM/src/events.cpp index 68f6a1f547..676522cc87 100644 --- a/protocols/FacebookRM/src/events.cpp +++ b/protocols/FacebookRM/src/events.cpp @@ -22,26 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. #include "common.h"
-int FacebookProto::Log(const char *fmt,...)
-{
- if (!getByte(FACEBOOK_KEY_LOGGING_ENABLE, 0))
- return EXIT_SUCCESS;
-
- va_list va;
- char text[65535];
- ScopedLock s(log_lock_);
-
- va_start(va,fmt);
- mir_vsnprintf(text,sizeof(text),fmt,va);
- va_end(va);
-
- // Write into network log
- CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)text);
-
- // Write into log file
- return utils::debug::log(m_szModuleName, text);
-}
-
void FacebookProto::NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url, std::string *notification_id)
{
char name[256];
diff --git a/protocols/FacebookRM/src/json.cpp b/protocols/FacebookRM/src/json.cpp index ee79210ed4..3ae668911e 100644 --- a/protocols/FacebookRM/src/json.cpp +++ b/protocols/FacebookRM/src/json.cpp @@ -236,7 +236,7 @@ bool ignore_duplicits(FacebookProto *proto, std::string mid, std::string text) std::map<std::string, bool>::iterator it = proto->facy.messages_ignore.find(mid);
if (it != proto->facy.messages_ignore.end()) {
std::string msg = "????? Ignoring duplicit/sent message\n" + text;
- proto->Log(msg.c_str());
+ proto->debugLogA(msg.c_str());
it->second = true; // mark to delete it at the end
return true;
@@ -614,7 +614,7 @@ int facebook_json_parser::parse_messages(void* data, std::vector< facebook_messa JSONNODE *visibility = json_get(event_data, "visibility");
bool isVisible = (visibility != NULL) && json_as_bool(visibility);
- proto->Log(" Requested chat switch to %s", isVisible ? "Online" : "Offline");
+ proto->debugLogA(" Requested chat switch to %s", isVisible ? "Online" : "Offline");
proto->SetStatus(isVisible ? ID_STATUS_ONLINE : ID_STATUS_INVISIBLE);
}
} else if (t == "buddylist_overlay") {
diff --git a/protocols/FacebookRM/src/messages.cpp b/protocols/FacebookRM/src/messages.cpp index f64addb82a..7e09ccd616 100644 --- a/protocols/FacebookRM/src/messages.cpp +++ b/protocols/FacebookRM/src/messages.cpp @@ -93,7 +93,7 @@ void FacebookProto::SendChatMsgWorker(void *p) tid = utils::text::source_get_value(&resp.data, 2, "\"thread_id\":\"", "\"");
setString(hContact, FACEBOOK_KEY_TID, tid.c_str());
- Log(" Got thread info: %s = %s", data->chat_id.c_str(), tid.c_str());
+ debugLogA(" Got thread info: %s = %s", data->chat_id.c_str(), tid.c_str());
}
if (!tid.empty()) {
diff --git a/protocols/FacebookRM/src/proto.h b/protocols/FacebookRM/src/proto.h index 857c30c20e..a6f56fa50c 100644 --- a/protocols/FacebookRM/src/proto.h +++ b/protocols/FacebookRM/src/proto.h @@ -222,8 +222,6 @@ public: HANDLE log_lock_;
HANDLE update_loop_lock_;
- HANDLE m_hNetlibUser;
-
std::vector<HANDLE> popupClasses;
std::string last_status_msg_;
@@ -233,6 +231,5 @@ public: static void CALLBACK APC_callback(ULONG_PTR p);
// Information providing
- int Log(const char *fmt,...);
void NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, std::string *url = NULL, std::string *notification_id = NULL);
};
diff --git a/protocols/FacebookRM/src/utils.cpp b/protocols/FacebookRM/src/utils.cpp index ad9bf8f246..c9b6eb561a 100644 --- a/protocols/FacebookRM/src/utils.cpp +++ b/protocols/FacebookRM/src/utils.cpp @@ -471,6 +471,7 @@ int utils::number::random() return rand();
}
+/*
int utils::debug::log(std::string file_name, std::string text)
{
char szFile[MAX_PATH];
@@ -489,3 +490,4 @@ int utils::debug::log(std::string file_name, std::string text) return EXIT_SUCCESS;
}
+*/
\ No newline at end of file diff --git a/protocols/FacebookRM/src/utils.h b/protocols/FacebookRM/src/utils.h index 8da874c96b..5be3bdb0c9 100644 --- a/protocols/FacebookRM/src/utils.h +++ b/protocols/FacebookRM/src/utils.h @@ -83,7 +83,7 @@ namespace utils namespace debug
{
- int log(std::string file_name, std::string text);
+ //int log(std::string file_name, std::string text);
};
};
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp index c3e2448567..5e2352f630 100644 --- a/protocols/Gadu-Gadu/src/avatar.cpp +++ b/protocols/Gadu-Gadu/src/avatar.cpp @@ -33,9 +33,9 @@ void GGPROTO::getAvatarFilename(HANDLE hContact, TCHAR *pszDest, int cbLen) if (_taccess(pszDest, 0)) {
int ret = CreateDirectoryTreeT(pszDest);
if (ret == 0)
- netlog("getAvatarFilename(): Created new directory for avatar cache: %S.", pszDest);
+ debugLogA("getAvatarFilename(): Created new directory for avatar cache: %S.", pszDest);
else {
- netlog("getAvatarFilename(): Can not create directory for avatar cache: %S. errno=%d: %s", pszDest, errno, strerror(errno));
+ debugLogA("getAvatarFilename(): Can not create directory for avatar cache: %S. errno=%d: %s", pszDest, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create avatars cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pszDest);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
@@ -68,14 +68,14 @@ bool GGPROTO::getAvatarFileInfo(uin_t uin, char **avatarurl, char **avatarts) req.szUrl = szUrl;
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
- NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)netlib, (LPARAM)&req);
+ NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp == NULL) {
- netlog("getAvatarFileInfo(): No response from HTTP request");
+ debugLogA("getAvatarFileInfo(): No response from HTTP request");
return false;
}
if (resp->resultCode != 200 || !resp->dataLength || !resp->pData) {
- netlog("getAvatarFileInfo(): Invalid response code from HTTP request");
+ debugLogA("getAvatarFileInfo(): Invalid response code from HTTP request");
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
return false;
}
@@ -114,7 +114,7 @@ char *gg_avatarhash(char *param) void GGPROTO::requestAvatarTransfer(HANDLE hContact, char *szAvatarURL)
{
if (pth_avatar.dwThreadId == NULL) {
- netlog("requestAvatarTransfer(): Can not list_add element to avatar_transfers list. No pth_avatar.dwThreadId");
+ debugLogA("requestAvatarTransfer(): Can not list_add element to avatar_transfers list. No pth_avatar.dwThreadId");
return;
}
@@ -131,7 +131,7 @@ void GGPROTO::requestAvatarTransfer(HANDLE hContact, char *szAvatarURL) void GGPROTO::requestAvatarInfo(HANDLE hContact, int iWaitFor)
{
if (pth_avatar.dwThreadId == NULL) {
- netlog("requestAvatarInfo(): Can not list_add element to avatar_requests list. No pth_avatar.dwThreadId");
+ debugLogA("requestAvatarInfo(): Can not list_add element to avatar_requests list. No pth_avatar.dwThreadId");
return;
}
@@ -154,7 +154,7 @@ void GGPROTO::requestAvatarInfo(HANDLE hContact, int iWaitFor) void __cdecl GGPROTO::avatarrequestthread(void*)
{
- netlog("avatarrequestthread() started. Avatar Request Thread Starting");
+ debugLogA("avatarrequestthread() started. Avatar Request Thread Starting");
while (pth_avatar.dwThreadId)
{
gg_EnterCriticalSection(&avatar_mutex, "avatarrequestthread", 3, "avatar_mutex", 1);
@@ -167,7 +167,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) gg_LeaveCriticalSection(&avatar_mutex, "avatarrequestthread", 3, 1, "avatar_mutex", 1);
uin_t uin = (uin_t)getDword(hContact, GG_KEY_UIN, 0);
- netlog("avatarrequestthread() new avatar_requests item for uin=%d.", uin);
+ debugLogA("avatarrequestthread() new avatar_requests item for uin=%d.", uin);
char *AvatarURL, *AvatarTs;
if (!getAvatarFileInfo(uin, &AvatarURL, &AvatarTs)) {
@@ -208,7 +208,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) GGGETAVATARDATA *data = avatar_transfers[0];
avatar_transfers.remove(0);
gg_LeaveCriticalSection(&avatar_mutex, "avatarrequestthread", 4, 1, "avatar_mutex", 1);
- netlog("avatarrequestthread() new avatar_transfers item for url=%s.", data->szAvatarURL);
+ debugLogA("avatarrequestthread() new avatar_transfers item for url=%s.", data->szAvatarURL);
int result = 0;
@@ -221,7 +221,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) req.szUrl = data->szAvatarURL;
req.flags = NLHRF_NODUMP | NLHRF_HTTP11 | NLHRF_REDIRECT;
- NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)netlib, (LPARAM)&req);
+ NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
int file_fd;
@@ -247,18 +247,18 @@ void __cdecl GGPROTO::avatarrequestthread(void*) _write(file_fd, resp->pData, resp->dataLength);
_close(file_fd);
result = 1;
- netlog("avatarrequestthread() new avatar_transfers item. Saved data from url=%s to file=%S.", data->szAvatarURL, pai.filename);
+ debugLogA("avatarrequestthread() new avatar_transfers item. Saved data from url=%s to file=%S.", data->szAvatarURL, pai.filename);
} else {
- netlog("avatarrequestthread(): _topen file %S error. errno=%d: %s", pai.filename, errno, strerror(errno));
+ debugLogA("avatarrequestthread(): _topen file %S error. errno=%d: %s", pai.filename, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai.filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
}
- else netlog("avatarrequestthread(): Invalid response code from HTTP request");
+ else debugLogA("avatarrequestthread(): Invalid response code from HTTP request");
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
}
- else netlog("avatarrequestthread(): No response from HTTP request");
+ else debugLogA("avatarrequestthread(): No response from HTTP request");
ProtoBroadcastAck(pai.hContact, ACKTYPE_AVATAR, result ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, (HANDLE)&pai, 0);
@@ -280,7 +280,7 @@ void __cdecl GGPROTO::avatarrequestthread(void*) avatar_requests.destroy();
avatar_transfers.destroy();
- netlog("avatarrequestthread(): end. Avatar Request Thread Ending");
+ debugLogA("avatarrequestthread(): end. Avatar Request Thread Ending");
}
void GGPROTO::initavatarrequestthread()
@@ -292,7 +292,7 @@ void GGPROTO::initavatarrequestthread() avatar_requests.destroy();
avatar_transfers.destroy();
#ifdef DEBUGMODE
- netlog("initavatarrequestthread(): ForkThreadEx 1 GGPROTO::avatarrequestthread");
+ debugLogA("initavatarrequestthread(): ForkThreadEx 1 GGPROTO::avatarrequestthread");
#endif
pth_avatar.hThread = ForkThreadEx(&GGPROTO::avatarrequestthread, NULL, &pth_avatar.dwThreadId);
}
@@ -300,7 +300,7 @@ void GGPROTO::initavatarrequestthread() void __cdecl GGPROTO::getOwnAvatarThread(void*)
{
- netlog("getOwnAvatarThread() started");
+ debugLogA("getOwnAvatarThread() started");
char *AvatarURL, *AvatarTs;
if (getAvatarFileInfo( getDword(GG_KEY_UIN, 0), &AvatarURL, &AvatarTs)) {
@@ -319,7 +319,7 @@ void __cdecl GGPROTO::getOwnAvatarThread(void*) getavatarinfo((WPARAM)GAIF_FORCE, (LPARAM)&pai);
}
#ifdef DEBUGMODE
- netlog("getOwnAvatarThread(): end");
+ debugLogA("getOwnAvatarThread(): end");
#endif
}
@@ -327,7 +327,7 @@ void GGPROTO::getOwnAvatar() {
if (getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS) && getDword(GG_KEY_UIN, 0)){
#ifdef DEBUGMODE
- netlog("getOwnAvatar(): ForkThread 2 GGPROTO::getOwnAvatarThread");
+ debugLogA("getOwnAvatar(): ForkThread 2 GGPROTO::getOwnAvatarThread");
#endif
ForkThread(&GGPROTO::getOwnAvatarThread, NULL);
}
@@ -343,12 +343,12 @@ void __cdecl GGPROTO::setavatarthread(void *param) char szUrl[128], uin[32], *authHeader, *data, *avatardata, content[256], image_ext[4], image_type[11];
int file_fd, avatardatalen, datalen, contentlen, contentendlen, res = 0, repeat = 0;
- netlog("setavatarthread(): started. Trying to set user avatar.");
+ debugLogA("setavatarthread(): started. Trying to set user avatar.");
UIN2IDA( getDword(GG_KEY_UIN, 0), uin);
file_fd = _topen(szFilename, _O_RDONLY | _O_BINARY, _S_IREAD);
if (file_fd == -1) {
- netlog("setavatarthread(): Failed to open avatar file errno=%d: %s.", errno, strerror(errno));
+ debugLogA("setavatarthread(): Failed to open avatar file errno=%d: %s.", errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot open avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFilename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
@@ -359,7 +359,7 @@ void __cdecl GGPROTO::setavatarthread(void *param) delSetting(GG_KEY_AVATARTYPEPREV);
getOwnAvatar();
#ifdef DEBUGMODE
- netlog("setavatarthread(): end. err1");
+ debugLogA("setavatarthread(): end. err1");
#endif
return;
}
@@ -416,20 +416,20 @@ void __cdecl GGPROTO::setavatarthread(void *param) req.pData = data;
req.dataLength = datalen;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)netlib, (LPARAM)&req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
#ifdef DEBUGMODE
- netlog("setavatarthread(): 1 resp.data= %s", resp->pData);
+ debugLogA("setavatarthread(): 1 resp.data= %s", resp->pData);
#endif
res = 1;
}
- else netlog("setavatarthread() Invalid response code from HTTP request");
+ else debugLogA("setavatarthread() Invalid response code from HTTP request");
if (resp->resultCode == 403 || resp->resultCode == 401)
repeat = 1;
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
}
- else netlog("setavatarthread(): No response from HTTP request");
+ else debugLogA("setavatarthread(): No response from HTTP request");
if (repeat) { // Access Token expired - we need to obtain new
mir_free(authHeader);
@@ -446,18 +446,18 @@ void __cdecl GGPROTO::setavatarthread(void *param) req.pData = data;
req.dataLength = datalen;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)netlib, (LPARAM)&req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
#ifdef DEBUGMODE
- netlog("setavatarthread(): 2 resp.data= %s", resp->pData);
+ debugLogA("setavatarthread(): 2 resp.data= %s", resp->pData);
#endif
res = 1;
}
- else netlog("setavatarthread(): Invalid response code from HTTP request");
+ else debugLogA("setavatarthread(): Invalid response code from HTTP request");
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
}
- else netlog("setavatarthread(): No response from HTTP request");
+ else debugLogA("setavatarthread(): No response from HTTP request");
}
mir_free(authHeader);
@@ -465,26 +465,26 @@ void __cdecl GGPROTO::setavatarthread(void *param) mir_free(data);
if (res) {
- netlog("setavatarthread(): User avatar set successfully.");
+ debugLogA("setavatarthread(): User avatar set successfully.");
} else {
int prevType = getByte(GG_KEY_AVATARTYPEPREV, -1);
if (prevType != -1)
setByte(GG_KEY_AVATARTYPE, prevType);
- netlog("setavatarthread(): Failed to set user avatar.");
+ debugLogA("setavatarthread(): Failed to set user avatar.");
}
delSetting(GG_KEY_AVATARTYPEPREV);
mir_free(szFilename);
getOwnAvatar();
#ifdef DEBUGMODE
- netlog("setavatarthread(): end.");
+ debugLogA("setavatarthread(): end.");
#endif
}
void GGPROTO::setAvatar(const TCHAR *szFilename)
{
#ifdef DEBUGMODE
- netlog("setAvatar(): ForkThread 3 GGPROTO::setavatarthread");
+ debugLogA("setAvatar(): ForkThread 3 GGPROTO::setavatarthread");
#endif
ForkThread(&GGPROTO::setavatarthread, mir_tstrdup(szFilename));
}
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index b506525aaa..f8e44b03f8 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -155,7 +155,7 @@ uint32_t gg_dnslookup(GGPROTO *gg, char *host) if (ip != INADDR_NONE)
{
#ifdef DEBUGMODE
- gg->netlog("gg_dnslookup(): Parameter \"%s\" is already IP number.", host);
+ gg->debugLogA("gg_dnslookup(): Parameter \"%s\" is already IP number.", host);
#endif
return ip;
}
@@ -164,12 +164,12 @@ uint32_t gg_dnslookup(GGPROTO *gg, char *host) {
ip = *(uint32_t *) he->h_addr_list[0];
#ifdef DEBUGMODE
- gg->netlog("gg_dnslookup(): Parameter \"%s\" was resolved to %d.%d.%d.%d.", host,
+ gg->debugLogA("gg_dnslookup(): Parameter \"%s\" was resolved to %d.%d.%d.%d.", host,
LOBYTE(LOWORD(ip)), HIBYTE(LOWORD(ip)), LOBYTE(HIWORD(ip)), HIBYTE(HIWORD(ip)));
#endif
return ip;
}
- gg->netlog("gg_dnslookup(): Cannot resolve hostname \"%s\".", host);
+ gg->debugLogA("gg_dnslookup(): Cannot resolve hostname \"%s\".", host);
return 0;
}
@@ -254,7 +254,7 @@ void __cdecl GGPROTO::mainthread(void *) time_t timeDeviation = getWord(GG_KEY_TIMEDEVIATION, GG_KEYDEF_TIMEDEVIATION);
int gg_failno = 0;
- netlog("mainthread(): started. (%x) Server Thread Starting", this);
+ debugLogA("mainthread(): started. (%x) Server Thread Starting", this);
#ifdef DEBUGMODE
gg_debug_level = GG_DEBUG_NET | GG_DEBUG_TRAFFIC | GG_DEBUG_FUNCTION | GG_DEBUG_MISC;
#else
@@ -284,10 +284,10 @@ void __cdecl GGPROTO::mainthread(void *) // Setup proxy
nlus.cbSize = sizeof(nlus);
- if (CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)netlib, (LPARAM)&nlus))
+ if (CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)m_hNetlibUser, (LPARAM)&nlus))
{
if (nlus.useProxy)
- netlog("mainthread() (%x): Using proxy %s:%d.", this, nlus.szProxyServer, nlus.wProxyPort);
+ debugLogA("mainthread() (%x): Using proxy %s:%d.", this, nlus.szProxyServer, nlus.wProxyPort);
gg_proxy_enabled = nlus.useProxy;
gg_proxy_host = nlus.szProxyServer;
gg_proxy_port = nlus.wProxyPort;
@@ -300,7 +300,7 @@ void __cdecl GGPROTO::mainthread(void *) }
else
{
- netlog("mainthread() (%x): Failed loading proxy settings.", this);
+ debugLogA("mainthread() (%x): Failed loading proxy settings.", this);
gg_proxy_enabled = 0;
}
@@ -323,10 +323,10 @@ void __cdecl GGPROTO::mainthread(void *) }
else
{
- netlog("mainthread() (%x): No password specified. Exiting.", this);
+ debugLogA("mainthread() (%x): No password specified. Exiting.", this);
broadcastnewstatus(ID_STATUS_OFFLINE);
#ifdef DEBUGMODE
- netlog("mainthread(): end. err1");
+ debugLogA("mainthread(): end. err1");
#endif
return;
}
@@ -334,18 +334,18 @@ void __cdecl GGPROTO::mainthread(void *) // Readup number
if (!(p.uin = getDword(GG_KEY_UIN, 0)))
{
- netlog("mainthread() (%x): No Gadu-Gadu number specified. Exiting.", this);
+ debugLogA("mainthread() (%x): No Gadu-Gadu number specified. Exiting.", this);
broadcastnewstatus(ID_STATUS_OFFLINE);
mir_free(p.password);
#ifdef DEBUGMODE
- netlog("mainthread(): end. err2");
+ debugLogA("mainthread(): end. err2");
#endif
return;
}
// Readup SSL/TLS setting
if (p.tls = getByte(GG_KEY_SSLCONN, GG_KEYDEF_SSLCONN))
- netlog("mainthread() (%x): Using TLS/SSL for connections.", this);
+ debugLogA("mainthread() (%x): Using TLS/SSL for connections.", this);
// Gadu-Gadu accepts image sizes upto 255
p.image_size = 255;
@@ -359,7 +359,7 @@ void __cdecl GGPROTO::mainthread(void *) // Wait for DCC
#ifdef DEBUGMODE
- netlog("mainthread() (%x): Waiting DCC service to start...", this);
+ debugLogA("mainthread() (%x): Waiting DCC service to start...", this);
#endif
while (WaitForSingleObjectEx(hEvent, INFINITE, TRUE) != WAIT_OBJECT_0);
CloseHandle(hEvent); hEvent = NULL;
@@ -378,7 +378,7 @@ void __cdecl GGPROTO::mainthread(void *) showpopup(m_tszUserName, error, GG_POPUP_WARNING | GG_POPUP_ALLOW_MSGBOX);
}
else
- netlog("mainthread() (%x): Loading forwarding host %s and port %d.", dbv.pszVal, p.external_port, this);
+ debugLogA("mainthread() (%x): Loading forwarding host %s and port %d.", dbv.pszVal, p.external_port, this);
if (p.external_addr) p.external_port = getWord(GG_KEY_FORWARDPORT, GG_KEYDEF_FORWARDPORT);
db_free(&dbv);
}
@@ -393,7 +393,7 @@ retry: p.status_descr = mir_utf8encodeT(getstatusmsg(m_iDesiredStatus));
p.status = status_m2gg(m_iDesiredStatus, p.status_descr != NULL);
- netlog("mainthread() (%x): Connecting with number %d, status %d and description \"%S\".", this, p.uin, m_iDesiredStatus,
+ debugLogA("mainthread() (%x): Connecting with number %d, status %d and description \"%S\".", this, p.uin, m_iDesiredStatus,
p.status_descr ? getstatusmsg(m_iDesiredStatus) : _T("<none>"));
gg_LeaveCriticalSection(&modemsg_mutex, "mainthread", 13, 1, "modemsg_mutex", 1);
@@ -411,7 +411,7 @@ retry: else
{
p.server_port = hosts[hostnum].port;
- netlog("mainthread() (%x): Connecting to manually specified host %s (%d.%d.%d.%d) and port %d.", this,
+ debugLogA("mainthread() (%x): Connecting to manually specified host %s (%d.%d.%d.%d) and port %d.", this,
hosts[hostnum].hostname, LOBYTE(LOWORD(p.server_addr)), HIBYTE(LOWORD(p.server_addr)),
LOBYTE(HIWORD(p.server_addr)), HIBYTE(HIWORD(p.server_addr)), p.server_port);
}
@@ -438,7 +438,7 @@ retry: mir_sntprintf(error, SIZEOF(error), TranslateT("Connection cannot be established. errno=%d: %s"),errno, strerror(errno));
perror = error;
}
- netlog("mainthread() (%x): %s", this, perror);
+ debugLogA("mainthread() (%x): %s", this, perror);
if (getByte(GG_KEY_SHOWCERRORS, GG_KEYDEF_SHOWCERRORS))
showpopup(m_tszUserName, perror, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
@@ -473,7 +473,7 @@ retry: gg_LeaveCriticalSection(&modemsg_mutex, "mainthread", 14, 1, "modemsg_mutex", 1);
}
else
- netlog("mainthread() (%x)): Connection attempt cancelled by the user.", this);
+ debugLogA("mainthread() (%x)): Connection attempt cancelled by the user.", this);
}
else
{
@@ -512,14 +512,14 @@ retry: {
// Connection broken/closed
#ifdef DEBUGMODE
- netlog("mainthread(): waiting for gg_watch_fd");
+ debugLogA("mainthread(): waiting for gg_watch_fd");
#endif
if (!(e = gg_watch_fd(sess)))
{
#ifdef DEBUGMODE
- netlog("mainthread(): waiting for gg_watch_fd - DONE error");
+ debugLogA("mainthread(): waiting for gg_watch_fd - DONE error");
#endif
- netlog("mainthread() (%x): Connection closed.", this);
+ debugLogA("mainthread() (%x): Connection closed.", this);
gg_EnterCriticalSection(&sess_mutex, "mainthread", 16, "sess_mutex", 1);
gg_free_session(sess);
sess = NULL;
@@ -528,9 +528,9 @@ retry: }
else {
#ifdef DEBUGMODE
- netlog("mainthread(): waiting for gg_watch_fd - DONE");
+ debugLogA("mainthread(): waiting for gg_watch_fd - DONE");
#endif
- netlog("mainthread() (%x): Event: %s", this, ggdebug_eventtype(e));
+ debugLogA("mainthread() (%x): Event: %s", this, ggdebug_eventtype(e));
}
switch(e->type)
@@ -607,18 +607,18 @@ retry: if (e->type == GG_EVENT_PUBDIR50_SEARCH_REPLY)
{
- netlog("mainthread() (%x): Got user info.", this);
+ debugLogA("mainthread() (%x): Got user info.", this);
// Store next search UIN
if (res->seq == GG_SEQ_SEARCH)
next_uin = gg_pubdir50_next(res);
}
else if (e->type == GG_EVENT_PUBDIR50_READ)
{
- netlog("mainthread() (%x): Got owner info.", this);
+ debugLogA("mainthread() (%x): Got owner info.", this);
}
else if (e->type == GG_EVENT_PUBDIR50_WRITE)
{
- netlog("mainthread() (%x): Public directory save succesful.", this);
+ debugLogA("mainthread() (%x): Public directory save succesful.", this);
// Update user details
GetInfo(NULL, 0);
}
@@ -641,7 +641,7 @@ retry: uin_t uin = __fmnumber ? atoi(__fmnumber) : 0;
HANDLE hContact = (res->seq == GG_SEQ_CHINFO) ? NULL : getcontact(uin, 0, 0, NULL);
- netlog("mainthread() (%x): Search result for uin %d, seq %d.", this, uin, res->seq);
+ debugLogA("mainthread() (%x): Search result for uin %d, seq %d.", this, uin, res->seq);
if (res->seq == GG_SEQ_SEARCH)
{
TCHAR strFmt1[64];
@@ -748,7 +748,7 @@ retry: delSetting(GG_KEY_PD_GANDER);
}
- netlog("mainthread() (%x): Setting user info for uin %d.", this, uin);
+ debugLogA("mainthread() (%x): Setting user info for uin %d.", this, uin);
ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_SUCCESS, (HANDLE) 1, 0);
}
@@ -851,7 +851,7 @@ retry: gcevent.ptszNick = (TCHAR*) CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM) getcontact(e->event.msg.sender, 1, 0, NULL), GCDNF_TCHAR);
gcevent.time = (!(e->event.msg.msgclass & GG_CLASS_OFFLINE) || e->event.msg.time > (t - timeDeviation)) ? t : e->event.msg.time;
gcevent.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- netlog("mainthread() (%x): Conference message to room %S & id %S.", this, chat, id);
+ debugLogA("mainthread() (%x): Conference message to room %S & id %S.", this, chat, id);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
mir_free(messageT);
}
@@ -885,7 +885,7 @@ retry: gg_image_request(sess, e->event.msg.sender, image->size, image->crc32);
gg_LeaveCriticalSection(&sess_mutex, "mainthread", 18, 1, "sess_mutex", 1);
- netlog("mainthread(): image request sent!");
+ debugLogA("mainthread(): image request sent!");
add_ptr += sizeof(struct gg_msg_richtext_image);
}
if (((struct gg_msg_richtext_format*)formats)->font & GG_FONT_COLOR)
@@ -926,7 +926,7 @@ retry: gcevent.time = e->event.multilogon_msg.time;
gcevent.bIsMe = 1;
gcevent.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- netlog("mainthread() (%x): Sent conference message to room %S.", this, chat);
+ debugLogA("mainthread() (%x): Sent conference message to room %S.", this, chat);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
mir_free(messageT);
mir_free(nickT);
@@ -951,7 +951,7 @@ retry: {
list_t l;
int* iIndexes = NULL, i;
- netlog("mainthread(): Concurrent sessions count: %d.", e->event.multilogon_info.count);
+ debugLogA("mainthread(): Concurrent sessions count: %d.", e->event.multilogon_info.count);
if (e->event.multilogon_info.count > 0)
iIndexes = (int*)mir_calloc(e->event.multilogon_info.count * sizeof(int));
gg_EnterCriticalSection(&sessions_mutex, "mainthread", 19, "sess_mutex", 1);
@@ -1051,7 +1051,7 @@ retry: case GG_EVENT_DCC7_NEW:
{
struct gg_dcc7 *dcc7 = e->event.dcc7_new;
- netlog("mainthread() (%x): Incoming direct connection.", this);
+ debugLogA("mainthread() (%x): Incoming direct connection.", this);
dcc7->contact = getcontact(dcc7->peer_uin, 0, 0, NULL);
// Check if user is on the list and if it is my uin
@@ -1069,7 +1069,7 @@ retry: //////////////////////////////////////////////////
// Add file recv request
- netlog("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin,
+ debugLogA("mainthread() (%x): Client: %d, File ack filename \"%s\" size %d.", this, dcc7->peer_uin,
dcc7->filename, dcc7->size);
TCHAR* filenameT = mir_a2t((char*)dcc7->filename);
@@ -1094,7 +1094,7 @@ retry: struct gg_dcc7 *dcc7 = e->event.dcc7_reject.dcc7;
if (dcc7->type == GG_SESSION_DCC7_SEND)
{
- netlog("mainthread() (%x): File transfer denied by client %d (reason = %d).", this, dcc7->peer_uin, e->event.dcc7_reject.reason);
+ debugLogA("mainthread() (%x): File transfer denied by client %d (reason = %d).", this, dcc7->peer_uin, e->event.dcc7_reject.reason);
ProtoBroadcastAck(dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0);
// Remove from watches and free
@@ -1105,7 +1105,7 @@ retry: }
else
{
- netlog("mainthread() (%x): File transfer aborted by client %d.", this, dcc7->peer_uin);
+ debugLogA("mainthread() (%x): File transfer aborted by client %d.", this, dcc7->peer_uin);
// Remove transfer from waiting list
gg_EnterCriticalSection(&ft_mutex, "mainthread", 22, "ft_mutex", 1);
@@ -1123,25 +1123,25 @@ retry: switch (e->event.dcc7_error)
{
case GG_ERROR_DCC7_HANDSHAKE:
- netlog("mainthread() (%x): Client: %d, Handshake error.", this, dcc7 ? dcc7->peer_uin : 0);
+ debugLogA("mainthread() (%x): Client: %d, Handshake error.", this, dcc7 ? dcc7->peer_uin : 0);
break;
case GG_ERROR_DCC7_NET:
- netlog("mainthread() (%x): Client: %d, Network error.", this, dcc7 ? dcc7->peer_uin : 0);
+ debugLogA("mainthread() (%x): Client: %d, Network error.", this, dcc7 ? dcc7->peer_uin : 0);
break;
case GG_ERROR_DCC7_FILE:
- netlog("mainthread() (%x): Client: %d, File read/write error.", this, dcc7 ? dcc7->peer_uin : 0);
+ debugLogA("mainthread() (%x): Client: %d, File read/write error.", this, dcc7 ? dcc7->peer_uin : 0);
break;
case GG_ERROR_DCC7_EOF:
- netlog("mainthread() (%x): Client: %d, End of file/connection error.", this, dcc7 ? dcc7->peer_uin : 0);
+ debugLogA("mainthread() (%x): Client: %d, End of file/connection error.", this, dcc7 ? dcc7->peer_uin : 0);
break;
case GG_ERROR_DCC7_REFUSED:
- netlog("mainthread() (%x): Client: %d, Connection refused error.", this, dcc7 ? dcc7->peer_uin : 0);
+ debugLogA("mainthread() (%x): Client: %d, Connection refused error.", this, dcc7 ? dcc7->peer_uin : 0);
break;
case GG_ERROR_DCC7_RELAY:
- netlog("mainthread() (%x): Client: %d, Relay connection error.", this, dcc7 ? dcc7->peer_uin : 0);
+ debugLogA("mainthread() (%x): Client: %d, Relay connection error.", this, dcc7 ? dcc7->peer_uin : 0);
break;
default:
- netlog("mainthread() (%x): Client: %d, Unknown error.", this, dcc7 ? dcc7->peer_uin : 0);
+ debugLogA("mainthread() (%x): Client: %d, Unknown error.", this, dcc7 ? dcc7->peer_uin : 0);
}
if (!dcc7) break;
@@ -1186,10 +1186,10 @@ retry: tag = mir_a2t("event/sender");
node = xi.getChildByPath(hXml, tag, 0);
sender = node != NULL ? mir_t2a(xi.getText(node)) : NULL;
- netlog("mainthread() (%x): XML Action type: %s.", this, type != NULL ? type : "unknown");
+ debugLogA("mainthread() (%x): XML Action type: %s.", this, type != NULL ? type : "unknown");
// Avatar change notify
if (type != NULL && !strcmp(type, "28")) {
- netlog("mainthread() (%x): Client %s changed his avatar.", this, sender);
+ debugLogA("mainthread() (%x): Client %s changed his avatar.", this, sender);
requestAvatarInfo(getcontact(atoi(sender), 0, 0, NULL), 0);
}
mir_free(type);
@@ -1205,7 +1205,7 @@ retry: {
HANDLE hContact = getcontact(e->event.typing_notification.uin, 0, 0, NULL);
#ifdef DEBUGMODE
- netlog("mainthread() (%x): Typing notification from %d (%d).", this,
+ debugLogA("mainthread() (%x): Typing notification from %d (%d).", this,
e->event.typing_notification.uin, e->event.typing_notification.length);
#endif
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact,
@@ -1225,7 +1225,7 @@ retry: if (m_iDesiredStatus != ID_STATUS_OFFLINE
&& getByte(GG_KEY_ARECONNECT, GG_KEYDEF_ARECONNECT))
{
- netlog("mainthread() (%x): Unintentional disconnection detected. Going to reconnect...", this);
+ debugLogA("mainthread() (%x): Unintentional disconnection detected. Going to reconnect...", this);
hostnum = 0;
broadcastnewstatus(ID_STATUS_CONNECTING);
mir_free(p.status_descr);
@@ -1253,14 +1253,14 @@ retry: // Stop dcc server
pth_dcc.dwThreadId = 0;
#ifdef DEBUGMODE
- netlog("mainthread() (%x): Waiting pth_dcc thread. Waiting until DCC Server Thread finished, if needed.", this);
+ debugLogA("mainthread() (%x): Waiting pth_dcc thread. Waiting until DCC Server Thread finished, if needed.", this);
#endif
threadwait(&pth_dcc);
#ifdef DEBUGMODE
- netlog("mainthread() (%x): Waiting pth_dcc thread - OK", this);
+ debugLogA("mainthread() (%x): Waiting pth_dcc thread - OK", this);
#endif
- netlog("mainthread(): end. (%x) Server Thread Ending", this);
+ debugLogA("mainthread(): end. (%x) Server Thread Ending", this);
return;
}
@@ -1282,7 +1282,7 @@ void GGPROTO::broadcastnewstatus(int newStatus) ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, newStatus);
- netlog("broadcastnewstatus(): Broadcast new status: %d.", newStatus);
+ debugLogA("broadcastnewstatus(): Broadcast new status: %d.", newStatus);
}
////////////////////////////////////////////////////////////
@@ -1304,7 +1304,7 @@ int GGPROTO::contactdeleted(WPARAM wParam, LPARAM lParam) gcevent.dwFlags = GC_TCHAR;
GGGC *chat = gc_lookup(dbv.ptszVal);
- netlog("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, dbv.pszVal);
+ debugLogA("contactdeleted(): Terminating chat %x, id %s from contact list...", chat, dbv.pszVal);
if (chat)
{
// Destroy chat entry
@@ -1351,7 +1351,7 @@ int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam) HANDLE hContact = (HANDLE) wParam;
char *szProto = NULL;
- netlog("dbsettingchanged(): fired. szModule=%s szSetting=%s", cws->szModule, cws->szSetting);
+ debugLogA("dbsettingchanged(): fired. szModule=%s szSetting=%s", cws->szModule, cws->szSetting);
// Check if the contact is NULL or we are not online
if (!isonline())
@@ -1385,7 +1385,7 @@ int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam) GCEVENT gcevent = {sizeof(GCEVENT), &gcdest};
gcevent.dwFlags = GC_TCHAR;
gcevent.ptszText = ptszVal;
- netlog("dbsettingchanged(): Conference %s was renamed.", dbv.pszVal);
+ debugLogA("dbsettingchanged(): Conference %s was renamed.", dbv.pszVal);
// Mark cascading
/* FIXME */ cascade = 1;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
@@ -1422,7 +1422,7 @@ int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam) }
#ifdef DEBUGMODE
- netlog("dbsettingchanged(): end. szModule=%s szSetting=%s", cws->szModule, cws->szSetting);
+ debugLogA("dbsettingchanged(): end. szModule=%s szSetting=%s", cws->szModule, cws->szSetting);
#endif
return 0;
@@ -1433,7 +1433,7 @@ int GGPROTO::dbsettingchanged(WPARAM wParam, LPARAM lParam) void GGPROTO::setalloffline()
{
- netlog("setalloffline(): started. Setting buddies offline");
+ debugLogA("setalloffline(): started. Setting buddies offline");
setWord(GG_KEY_STATUS, ID_STATUS_OFFLINE);
for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -1445,7 +1445,7 @@ void GGPROTO::setalloffline() db_unset(hContact, "CList", GG_KEY_STATUSDESCR);
}
#ifdef DEBUGMODE
- netlog("setalloffline(): End.");
+ debugLogA("setalloffline(): End.");
#endif
}
@@ -1499,7 +1499,7 @@ void GGPROTO::notifyall() uin_t *uins;
char *types;
- netlog("notifyall(): Subscribing notification to all users");
+ debugLogA("notifyall(): Subscribing notification to all users");
// Readup count
for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
@@ -1550,7 +1550,7 @@ void GGPROTO::notifyall() HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick)
{
#ifdef DEBUGMODE
- netlog("getcontact(): uin=%d create=%d inlist=%d", uin, create, inlist);
+ debugLogA("getcontact(): uin=%d create=%d inlist=%d", uin, create, inlist);
#endif
// Look for contact in DB
for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) {
@@ -1567,18 +1567,18 @@ HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_ADD, 0, 0);
if (!hContact) {
- netlog("getcontact(): Failed to create Gadu-Gadu contact %S", szNick);
+ debugLogA("getcontact(): Failed to create Gadu-Gadu contact %S", szNick);
return NULL;
}
if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM) hContact, (LPARAM) m_szModuleName) != 0) {
// For some reason we failed to register the protocol for this contact
CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
- netlog("getcontact(): Failed to register GG contact %d", uin);
+ debugLogA("getcontact(): Failed to register GG contact %d", uin);
return NULL;
}
- netlog("getcontact(): Added buddy: %d", uin);
+ debugLogA("getcontact(): Added buddy: %d", uin);
if (!inlist)
db_set_b(hContact, "CList", "NotOnList", 1);
@@ -1603,7 +1603,7 @@ HANDLE GGPROTO::getcontact(uin_t uin, int create, int inlist, TCHAR *szNick) TCHAR* uinT = mir_a2t(ditoa(uin));
setTString(hContact, GG_KEY_NICK, uinT);
mir_free(uinT);
- netlog("getcontact(): Search for nick on uin: %d", uin);
+ debugLogA("getcontact(): Search for nick on uin: %d", uin);
}
}
@@ -1721,7 +1721,7 @@ int GGPROTO::status_gg2m(int status) void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, int time, uint32_t remote_ip, uint16_t remote_port, uint32_t version)
{
#ifdef DEBUGMODE
- netlog("changecontactstatus(): uin=%d status=%d", uin, status);
+ debugLogA("changecontactstatus(): uin=%d status=%d", uin, status);
#endif
HANDLE hContact = getcontact(uin, 0, 0, NULL);
@@ -1734,7 +1734,7 @@ void GGPROTO::changecontactstatus(uin_t uin, int status, const TCHAR *idescr, in // Check if there's description and if it's not empty
if (idescr && *idescr)
{
- netlog("changecontactstatus(): Saving for %d status descr \"%S\".", uin, idescr);
+ debugLogA("changecontactstatus(): Saving for %d status descr \"%S\".", uin, idescr);
db_set_ts(hContact, "CList", GG_KEY_STATUSDESCR, idescr);
} else {
// Remove status if there's nothing
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 4d87b2c10d..761b5a7747 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -35,7 +35,7 @@ void GGPROTO::dccstart() if (exitCode == STILL_ACTIVE)
{
#ifdef DEBUGMODE
- netlog("dccstart(): DCC thread still active. Exiting...");
+ debugLogA("dccstart(): DCC thread still active. Exiting...");
#endif
// Signalize mainthread it's started
if (hEvent) SetEvent(hEvent);
@@ -45,14 +45,14 @@ void GGPROTO::dccstart() // Check if we wan't direct connections
if (!getByte(GG_KEY_DIRECTCONNS, GG_KEYDEF_DIRECTCONNS))
{
- netlog("dccstart(): No direct connections setup.");
+ debugLogA("dccstart(): No direct connections setup.");
if (hEvent) SetEvent(hEvent);
return;
}
// Start thread
#ifdef DEBUGMODE
- netlog("dccstart(): ForkThreadEx 4 GGPROTO::dccmainthread");
+ debugLogA("dccstart(): ForkThreadEx 4 GGPROTO::dccmainthread");
#endif
pth_dcc.hThread = ForkThreadEx(&GGPROTO::dccmainthread, NULL, &pth_dcc.dwThreadId);
}
@@ -63,7 +63,7 @@ void GGPROTO::dccconnect(uin_t uin) HANDLE hContact = getcontact(uin, 0, 0, NULL);
DWORD ip, myuin; WORD port;
- netlog("dccconnect(): Connecting to uin %d.", uin);
+ debugLogA("dccconnect(): Connecting to uin %d.", uin);
// If unknown user or not on list ignore
if (!hContact) return;
@@ -96,24 +96,24 @@ struct ftfaildata void __cdecl GGPROTO::ftfailthread(void *param)
{
struct ftfaildata *ft = (struct ftfaildata *)param;
- netlog("ftfailthread(): started. Sending failed file transfer.");
+ debugLogA("ftfailthread(): started. Sending failed file transfer.");
gg_sleep(100, FALSE, "ftfailthread", 102, 1);
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft->hProcess, 0);
free(ft);
- netlog("ftfailthread(): end.");
+ debugLogA("ftfailthread(): end.");
}
HANDLE ftfail(GGPROTO *gg, HANDLE hContact)
{
ftfaildata *ft = (ftfaildata*)malloc(sizeof(struct ftfaildata));
#ifdef DEBUGMODE
- gg->netlog("ftfail(): Failing file transfer...");
+ gg->debugLogA("ftfail(): Failing file transfer...");
#endif
srand(time(NULL));
ft->hProcess = (HANDLE)rand();
ft->hContact = hContact;
#ifdef DEBUGMODE
- gg->netlog("ftfail(): ForkThread 5 GGPROTO::ftfailthread");
+ gg->debugLogA("ftfail(): ForkThread 5 GGPROTO::ftfailthread");
#endif
gg->ForkThread(&GGPROTO::ftfailthread, ft);
return ft->hProcess;
@@ -140,15 +140,15 @@ void __cdecl GGPROTO::dccmainthread(void*) // Zero up lists
watches = transfers = requests = l = NULL;
- netlog("dccmainthread(): started. DCC Server Thread Starting");
+ debugLogA("dccmainthread(): started. DCC Server Thread Starting");
// Readup number
if (!(uin = getDword(GG_KEY_UIN, 0)))
{
- netlog("dccmainthread(): No Gadu-Gadu number specified. Exiting.");
+ debugLogA("dccmainthread(): No Gadu-Gadu number specified. Exiting.");
if (hEvent) SetEvent(hEvent);
#ifdef DEBUGMODE
- netlog("dccmainthread(): end 1.");
+ debugLogA("dccmainthread(): end 1.");
#endif
return;
}
@@ -156,18 +156,18 @@ void __cdecl GGPROTO::dccmainthread(void*) // Create listen socket on config direct port
if (!(dcc = gg_dcc_socket_create(uin, (uint16_t)getWord(GG_KEY_DIRECTPORT, GG_KEYDEF_DIRECTPORT))))
{
- netlog("dccmainthread(): Cannot create DCC listen socket. Exiting.");
+ debugLogA("dccmainthread(): Cannot create DCC listen socket. Exiting.");
// Signalize mainthread we haven't start
if (hEvent) SetEvent(hEvent);
#ifdef DEBUGMODE
- netlog("dccmainthread(): end 2.");
+ debugLogA("dccmainthread(): end 2.");
#endif
return;
}
gg_dcc_port = dcc->port;
gg_dcc_ip = inet_addr("255.255.255.255");
- netlog("dccmainthread(): Listening on port %d.", gg_dcc_port);
+ debugLogA("dccmainthread(): Listening on port %d.", gg_dcc_port);
// Signalize mainthread we started
if (hEvent) SetEvent(hEvent);
@@ -211,9 +211,9 @@ void __cdecl GGPROTO::dccmainthread(void*) if (ret == -1)
{
if (errno == EBADF)
- netlog("dccmainthread(): Bad descriptor on select().");
+ debugLogA("dccmainthread(): Bad descriptor on select().");
else if (errno != EINTR)
- netlog("dccmainthread(): Unknown error on select().");
+ debugLogA("dccmainthread(): Unknown error on select().");
continue;
}
@@ -240,7 +240,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 2, "ft_mutex", 1);
if (!(e = gg_dcc_socket_watch_fd(local_dcc)))
{
- netlog("dccmainthread(): Socket closed.");
+ debugLogA("dccmainthread(): Socket closed.");
// Remove socket and _close
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
list_remove(&watches, local_dcc, 0);
@@ -251,7 +251,7 @@ void __cdecl GGPROTO::dccmainthread(void*) continue;
} else {
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
- netlog("dccmainthread(): Event: %s", ggdebug_eventtype(e));
+ debugLogA("dccmainthread(): Event: %s", ggdebug_eventtype(e));
}
switch(e->type)
@@ -293,7 +293,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Connection was successfuly ended
case GG_EVENT_DCC_DONE:
- netlog("dccmainthread(): Client: %d, Transfer done ! Closing connection.", dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Transfer done ! Closing connection.", dcc->peer_uin);
// Remove from watches
list_remove(&watches, local_dcc, 0);
// Close file & success
@@ -333,22 +333,22 @@ void __cdecl GGPROTO::dccmainthread(void*) switch (e->event.dcc_error)
{
case GG_ERROR_DCC_HANDSHAKE:
- netlog("dccmainthread(): Client: %d, Handshake error.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Handshake error.", local_dcc->peer_uin);
break;
case GG_ERROR_DCC_NET:
- netlog("dccmainthread(): Client: %d, Network error.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Network error.", local_dcc->peer_uin);
break;
case GG_ERROR_DCC_FILE:
- netlog("dccmainthread(): Client: %d, File read/write error.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, File read/write error.", local_dcc->peer_uin);
break;
case GG_ERROR_DCC_EOF:
- netlog("dccmainthread(): Client: %d, End of file/connection error.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, End of file/connection error.", local_dcc->peer_uin);
break;
case GG_ERROR_DCC_REFUSED:
- netlog("dccmainthread(): Client: %d, Connection refused error.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Connection refused error.", local_dcc->peer_uin);
break;
default:
- netlog("dccmainthread(): Client: %d, Unknown error.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Unknown error.", local_dcc->peer_uin);
}
// Don't do anything if it's main socket
if (local_dcc == dcc) break;
@@ -370,7 +370,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Need file acknowledgement
case GG_EVENT_DCC_NEED_FILE_ACK:
- netlog("dccmainthread(): Client: %d, File ack filename \"%s\" size %d.", local_dcc->peer_uin,
+ debugLogA("dccmainthread(): Client: %d, File ack filename \"%s\" size %d.", local_dcc->peer_uin,
local_dcc->file_info.filename, local_dcc->file_info.size);
// Do not watch for transfer until user accept it
list_remove(&watches, local_dcc, 0);
@@ -402,7 +402,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Need client accept
case GG_EVENT_DCC_CLIENT_ACCEPT:
- netlog("dccmainthread(): Client: %d, Client accept.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Client accept.", local_dcc->peer_uin);
// Check if user is on the list and if it is my uin
if (getcontact(local_dcc->peer_uin, 0, 0, NULL) &&
getDword(GG_KEY_UIN, -1) == local_dcc->uin)
@@ -417,7 +417,7 @@ void __cdecl GGPROTO::dccmainthread(void*) case GG_EVENT_DCC_CALLBACK:
{
int found = 0;
- netlog("dccmainthread(): Callback from client %d.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Callback from client %d.", local_dcc->peer_uin);
// Seek for stored callback request
for (l = requests; l; l = l->next)
{
@@ -444,7 +444,7 @@ void __cdecl GGPROTO::dccmainthread(void*) list_add(&watches, req, 0);
// Free old dat
gg_free_dcc(local_dcc);
- netlog("dccmainthread(): Found stored request to client %d, filename \"%s\" size %d, folder \"%s\".",
+ debugLogA("dccmainthread(): Found stored request to client %d, filename \"%s\" size %d, folder \"%s\".",
req->peer_uin, req->file_info.filename, req->file_info.size, req->folder);
break;
}
@@ -452,7 +452,7 @@ void __cdecl GGPROTO::dccmainthread(void*) if (!found)
{
- netlog("dccmainthread(): Unknown request to client %d.", local_dcc->peer_uin);
+ debugLogA("dccmainthread(): Unknown request to client %d.", local_dcc->peer_uin);
// Kill unauthorized dcc
list_remove(&watches, local_dcc, 0);
gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = NULL;
@@ -479,7 +479,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_LeaveCriticalSection(&ft_mutex, "dccmainthread", 37, 8, "ft_mutex", 1);
if (!(e = gg_dcc7_watch_fd(local_dcc7)))
{
- netlog("dccmainthread(): Socket closed.");
+ debugLogA("dccmainthread(): Socket closed.");
// Remove socket and _close
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
list_remove(&watches, local_dcc7, 0);
@@ -487,7 +487,7 @@ void __cdecl GGPROTO::dccmainthread(void*) continue;
} else {
gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1);
- netlog("dccmainthread(): Event: %s", ggdebug_eventtype(e));
+ debugLogA("dccmainthread(): Event: %s", ggdebug_eventtype(e));
}
switch(e->type)
@@ -523,7 +523,7 @@ void __cdecl GGPROTO::dccmainthread(void*) // Connection was successfuly ended
case GG_EVENT_DCC7_DONE:
- netlog("dccmainthread(): Client: %d, Transfer done ! Closing connection.", dcc->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Transfer done ! Closing connection.", dcc->peer_uin);
// Remove from watches
list_remove(&watches, local_dcc7, 0);
// Close file & success
@@ -563,25 +563,25 @@ void __cdecl GGPROTO::dccmainthread(void*) switch (e->event.dcc7_error)
{
case GG_ERROR_DCC7_HANDSHAKE:
- netlog("dccmainthread(): Client: %d, Handshake error.", local_dcc7->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Handshake error.", local_dcc7->peer_uin);
break;
case GG_ERROR_DCC7_NET:
- netlog("dccmainthread(): Client: %d, Network error.", local_dcc7->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Network error.", local_dcc7->peer_uin);
break;
case GG_ERROR_DCC7_FILE:
- netlog("dccmainthread(): Client: %d, File read/write error.", local_dcc7->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, File read/write error.", local_dcc7->peer_uin);
break;
case GG_ERROR_DCC7_EOF:
- netlog("dccmainthread(): Client: %d, End of file/connection error.", local_dcc7->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, End of file/connection error.", local_dcc7->peer_uin);
break;
case GG_ERROR_DCC7_REFUSED:
- netlog("dccmainthread(): Client: %d, Connection refused error.", local_dcc7->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Connection refused error.", local_dcc7->peer_uin);
break;
case GG_ERROR_DCC7_RELAY:
- netlog("dccmainthread(): Client: %d, Relay connection error.", local_dcc7->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Relay connection error.", local_dcc7->peer_uin);
break;
default:
- netlog("dccmainthread(): Client: %d, Unknown error.", local_dcc7->peer_uin);
+ debugLogA("dccmainthread(): Client: %d, Unknown error.", local_dcc7->peer_uin);
}
// Remove from watches
list_remove(&watches, local_dcc7, 0);
@@ -659,7 +659,7 @@ void __cdecl GGPROTO::dccmainthread(void*) gg_dcc_port = 0;
gg_dcc_ip = 0;
- netlog("dccmainthread(): end. DCC Server Thread Ending");
+ debugLogA("dccmainthread(): end. DCC Server Thread Ending");
}
HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath)
@@ -680,7 +680,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath) // Open file for appending and check if ok
if ((dcc->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1)
{
- netlog("dccfileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
+ debugLogA("dccfileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
@@ -698,7 +698,7 @@ HANDLE GGPROTO::dccfileallow(HANDLE hTransfer, const PROTOCHAR* szPath) list_add(&watches, dcc, 0);
gg_LeaveCriticalSection(&ft_mutex, "dccfileallow", 39, 1, "ft_mutex", 1);
- netlog("dccfileallow(): Receiving file \"%s\" from %d.", dcc->file_info.filename, dcc->peer_uin);
+ debugLogA("dccfileallow(): Receiving file \"%s\" from %d.", dcc->file_info.filename, dcc->peer_uin);
return hTransfer;
}
@@ -721,7 +721,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) if (iFtRemoveRes == -1)
{
- netlog("dcc7fileallow(): File transfer denied.");
+ debugLogA("dcc7fileallow(): File transfer denied.");
ProtoBroadcastAck(dcc7->contact, ACKTYPE_FILE, ACKRESULT_DENIED, dcc7, 0);
// Free transfer
gg_dcc7_free(dcc7);
@@ -731,7 +731,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) // Open file for appending and check if ok
if ((dcc7->file_fd = _open(fileName, _O_WRONLY | _O_APPEND | _O_BINARY | _O_CREAT, _S_IREAD | _S_IWRITE)) == -1)
{
- netlog("dcc7fileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
+ debugLogA("dcc7fileallow(): Failed to create file \"%s\". errno=%d: %s", fileName, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create transfer file. ERROR: %d: %s (dcc7)\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
@@ -751,7 +751,7 @@ HANDLE GGPROTO::dcc7fileallow(HANDLE hTransfer, const PROTOCHAR* szPath) list_add(&watches, dcc7, 0);
gg_LeaveCriticalSection(&ft_mutex, "dcc7fileallow", 41, 1, "ft_mutex", 1);
- netlog("dcc7fileallow(): Receiving file \"%s\" from %d.", dcc7->filename, dcc7->peer_uin);
+ debugLogA("dcc7fileallow(): Receiving file \"%s\" from %d.", dcc7->filename, dcc7->peer_uin);
return hTransfer;
}
@@ -767,7 +767,7 @@ int GGPROTO::dccfiledeny(HANDLE hTransfer) if (transfers) list_remove(&transfers, dcc, 0);
gg_LeaveCriticalSection(&ft_mutex, "dccfiledeny", 42, 1, "ft_mutex", 1);
- netlog("dccfiledeny(): Rejected file \"%s\" from/to %d.", dcc->file_info.filename, dcc->peer_uin);
+ debugLogA("dccfiledeny(): Rejected file \"%s\" from/to %d.", dcc->file_info.filename, dcc->peer_uin);
// Free transfer
gg_free_dcc(dcc);
@@ -787,7 +787,7 @@ int GGPROTO::dcc7filedeny(HANDLE hTransfer) if (transfers) list_remove(&transfers, dcc7, 0);
gg_LeaveCriticalSection(&ft_mutex, "dcc7filedeny", 43, 1, "ft_mutex", 1);
- netlog("dcc7filedeny(): Rejected file \"%s\" from/to %d.", dcc7->filename, dcc7->peer_uin);
+ debugLogA("dcc7filedeny(): Rejected file \"%s\" from/to %d.", dcc7->filename, dcc7->peer_uin);
// Free transfer
gg_dcc7_free(dcc7);
@@ -815,7 +815,7 @@ int GGPROTO::dccfilecancel(HANDLE hTransfer) dcc->file_fd = -1;
}
- netlog("dccfilecancel(): Canceled file \"%s\" from/to %d.", dcc->file_info.filename, dcc->peer_uin);
+ debugLogA("dccfilecancel(): Canceled file \"%s\" from/to %d.", dcc->file_info.filename, dcc->peer_uin);
// Free transfer
gg_free_dcc(dcc);
@@ -845,7 +845,7 @@ int GGPROTO::dcc7filecancel(HANDLE hTransfer) dcc7->file_fd = -1;
}
- netlog("dcc7filecancel(): Canceled file \"%s\" from/to %d.", dcc7->filename, dcc7->peer_uin);
+ debugLogA("dcc7filecancel(): Canceled file \"%s\" from/to %d.", dcc7->filename, dcc7->peer_uin);
// Free transfer
gg_dcc7_free(dcc7);
@@ -940,13 +940,13 @@ HANDLE GGPROTO::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOC gg_EnterCriticalSection(&sess_mutex, "SendFile", 46, "sess_mutex", 1);
if (!(dcc7 = gg_dcc7_send_file(sess, uin, filename, NULL, NULL))) {
gg_LeaveCriticalSection(&sess_mutex, "SendFile", 46, 1, "sess_mutex", 1);
- netlog("SendFile(): Failed to send file \"%s\".", filename);
+ debugLogA("SendFile(): Failed to send file \"%s\".", filename);
mir_free(filename);
return ftfail(this, hContact);
}
gg_LeaveCriticalSection(&sess_mutex, "SendFile", 46, 2, "sess_mutex", 1);
- netlog("SendFile(): Sending file \"%s\" to %d.", filename, uin);
+ debugLogA("SendFile(): Sending file \"%s\" to %d.", filename, uin);
// Add dcc to watches
list_add(&watches, dcc7, 0);
@@ -968,7 +968,7 @@ HANDLE GGPROTO::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOC // Return if bad connection info
if (!port || !uin || !myuin)
{
- netlog("SendFile(): Bad contact uin or my uin. Exit.");
+ debugLogA("SendFile(): Bad contact uin or my uin. Exit.");
mir_free(filename);
return ftfail(this, hContact);
}
@@ -984,7 +984,7 @@ HANDLE GGPROTO::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOC dcc->peer_uin = uin;
dcc->fd = -1;
dcc->type = GG_SESSION_DCC_SEND;
- netlog("SendFile(): Requesting user to connect us and scheduling gg_dcc struct for a later use.");
+ debugLogA("SendFile(): Requesting user to connect us and scheduling gg_dcc struct for a later use.");
gg_EnterCriticalSection(&sess_mutex, "SendFile", 47, "sess_mutex", 1);
gg_dcc_request(sess, uin);
gg_LeaveCriticalSection(&sess_mutex, "SendFile", 47, 1, "sess_mutex", 1);
@@ -994,13 +994,13 @@ HANDLE GGPROTO::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, PROTOC // Write filename
if (gg_dcc_fill_file_info(dcc, filename) == -1)
{
- netlog("SendFile(): Cannot open and file fileinfo \"%s\".", filename);
+ debugLogA("SendFile(): Cannot open and file fileinfo \"%s\".", filename);
gg_free_dcc(dcc);
mir_free(filename);
return ftfail(this, hContact);
}
- netlog("SendFile(): Sending file \"%s\" to %d in %s mode.", filename, uin, (dcc->fd != -1) ? "active" : "passive");
+ debugLogA("SendFile(): Sending file \"%s\" to %d in %s mode.", filename, uin, (dcc->fd != -1) ? "active" : "passive");
// Add dcc to watches if not passive
if (dcc->fd != -1) list_add(&watches, dcc, 0);
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp index 932d3410a1..a790e63ffc 100644 --- a/protocols/Gadu-Gadu/src/gg.cpp +++ b/protocols/Gadu-Gadu/src/gg.cpp @@ -152,12 +152,12 @@ void GGPROTO::cleanuplastplugin(DWORD version) //1. clean files: %miranda_avatarcache%\GG\*.(null)
if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 2)){
- netlog("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
+ debugLogA("cleanuplastplugin() 1: version=%d Cleaning junk avatar files from < 0.11.0.2", version);
TCHAR avatarsPath[MAX_PATH];
mir_sntprintf(avatarsPath, MAX_PATH, _T("%s\\%s"), VARST( _T("%miranda_avatarcache%")), m_tszUserName);
- netlog("cleanuplastplugin() 1: miranda_avatarcache = %S", avatarsPath);
+ debugLogA("cleanuplastplugin() 1: miranda_avatarcache = %S", avatarsPath);
if (avatarsPath != NULL){
HANDLE hFind = INVALID_HANDLE_VALUE;
@@ -170,7 +170,7 @@ void GGPROTO::cleanuplastplugin(DWORD version) TCHAR filePathT [2*MAX_PATH + 10];
mir_sntprintf(filePathT, 2*MAX_PATH + 10, _T("%s\\%s"), avatarsPath, ffd.cFileName);
if (!_taccess(filePathT, 0)){
- netlog("cleanuplastplugin() 1: remove file = %S", filePathT);
+ debugLogA("cleanuplastplugin() 1: remove file = %S", filePathT);
_tremove(filePathT);
}
} while (FindNextFile(hFind, &ffd) != 0);
@@ -460,33 +460,11 @@ void gg_debughandler(int level, const char *format, va_list ap) memcpy(szText, prefix, PREFIXLEN);
mir_vsnprintf(szText + strlen(szText), sizeof(szText) - strlen(szText), szFormat, ap);
- CallService(MS_NETLIB_LOG, (WPARAM) NULL, (LPARAM) szText);
+ CallService(MS_NETLIB_LOG, NULL, (LPARAM)szText);
free(szFormat);
}
#endif
-
-int GGPROTO::netlog(const char *fmt, ...)
-{
- va_list va;
- char szText[1024];
- memset(szText, '\0', PREFIXLEN + 1);
-
-#ifdef DEBUGMODE
- char prefix[6];
- mir_snprintf(prefix, PREFIXLEN, "%lu", GetCurrentThreadId());
- size_t prefixLen = strlen(prefix);
- if (prefixLen < PREFIXLEN) memset(prefix + prefixLen, ' ', PREFIXLEN - prefixLen);
- memcpy(szText, prefix, PREFIXLEN);
-#endif
-
- va_start(va, fmt);
- mir_vsnprintf(szText + strlen(szText), sizeof(szText) - strlen(szText), fmt, va);
- va_end(va);
-
- return CallService(MS_NETLIB_LOG, (WPARAM)netlib, (LPARAM) szText);
-}
-
//////////////////////////////////////////////////////////
// main DLL function
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index d8dabc0b56..483bdd0716 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -38,7 +38,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : InitializeCriticalSection(&avatar_mutex);
InitializeCriticalSection(&sessions_mutex);
- // Register netlib user
+ // Register m_hNetlibUser user
TCHAR name[128];
mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), m_tszUserName);
@@ -48,7 +48,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : nlu.szSettingsModule = m_szModuleName;
nlu.ptszDescriptiveName = name;
- netlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
// Register services
CreateProtoService(PS_GETAVATARCAPS, &GGPROTO::getavatarcaps);
@@ -83,7 +83,7 @@ GGPROTO::GGPROTO(const char* pszProtoName, const TCHAR* tszUserName) : GGPROTO::~GGPROTO()
{
#ifdef DEBUGMODE
- netlog("~GGPROTO(): destroying protocol interface");
+ debugLogA("~GGPROTO(): destroying protocol interface");
#endif
// Destroy modules
@@ -99,7 +99,7 @@ GGPROTO::~GGPROTO() CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM)hMenuRoot, 0);
// Close handles
- Netlib_CloseHandle(netlib);
+ Netlib_CloseHandle(m_hNetlibUser);
// Destroy mutexes
DeleteCriticalSection(&sess_mutex);
@@ -109,7 +109,7 @@ GGPROTO::~GGPROTO() DeleteCriticalSection(&avatar_mutex);
DeleteCriticalSection(&sessions_mutex);
#ifdef DEBUGMODE
- netlog("~GGPROTO(): DeleteCriticalSections. OK");
+ debugLogA("~GGPROTO(): DeleteCriticalSections. OK");
#endif
// Free status messages
@@ -144,7 +144,7 @@ int GGPROTO::RecvAwayMsg(HANDLE hContact, int mode, PROTORECVEVENT *evt) { re HANDLE GGPROTO::AddToList(int flags, PROTOSEARCHRESULT *psr)
{
#ifdef DEBUGMODE
- netlog("AddToList(): id=%s");
+ debugLogA("AddToList(): id=%s");
#endif
GGSEARCHRESULT *sr = (GGSEARCHRESULT *)psr;
uin_t uin;
@@ -188,10 +188,10 @@ DWORD_PTR GGPROTO::GetCaps(int type, HANDLE hContact) void __cdecl GGPROTO::cmdgetinfothread(void *hContact)
{
- netlog("cmdgetinfothread(): started. Failed info retreival.");
+ debugLogA("cmdgetinfothread(): started. Failed info retreival.");
gg_sleep(100, FALSE, "cmdgetinfothread", 103, 1);
ProtoBroadcastAck(hContact, ACKTYPE_GETINFO, ACKRESULT_FAILED, (HANDLE) 1, 0);
- netlog("cmdgetinfothread(): end.");
+ debugLogA("cmdgetinfothread(): end.");
}
int GGPROTO::GetInfo(HANDLE hContact, int infoType)
@@ -204,7 +204,7 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
{
#ifdef DEBUGMODE
- netlog("GetInfo(): ForkThread 6 GGPROTO::cmdgetinfothread");
+ debugLogA("GetInfo(): ForkThread 6 GGPROTO::cmdgetinfothread");
#endif
ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
@@ -214,7 +214,7 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) gg_pubdir50_add(req, GG_PUBDIR50_UIN, ditoa((uin_t)getDword(hContact, GG_KEY_UIN, 0)));
gg_pubdir50_seq_set(req, GG_SEQ_INFO);
- netlog("GetInfo(): Requesting user info.", req->seq);
+ debugLogA("GetInfo(): Requesting user info.", req->seq);
if (isonline())
{
gg_EnterCriticalSection(&sess_mutex, "GetInfo", 48, "sess_mutex", 1);
@@ -222,7 +222,7 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) {
gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("GetInfo(): ForkThread 7 GGPROTO::cmdgetinfothread");
+ debugLogA("GetInfo(): ForkThread 7 GGPROTO::cmdgetinfothread");
#endif
ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
@@ -236,7 +236,7 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) if (!(req = gg_pubdir50_new(GG_PUBDIR50_READ)))
{
#ifdef DEBUGMODE
- netlog("GetInfo(): ForkThread 8 GGPROTO::cmdgetinfothread");
+ debugLogA("GetInfo(): ForkThread 8 GGPROTO::cmdgetinfothread");
#endif
ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
@@ -245,7 +245,7 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) // Add seq
gg_pubdir50_seq_set(req, GG_SEQ_CHINFO);
- netlog("GetInfo(): Requesting owner info.", req->seq);
+ debugLogA("GetInfo(): Requesting owner info.", req->seq);
if (isonline())
{
gg_EnterCriticalSection(&sess_mutex, "GetInfo", 49, "sess_mutex", 1);
@@ -253,7 +253,7 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) {
gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread");
+ debugLogA("GetInfo(): ForkThread 9 GGPROTO::cmdgetinfothread");
#endif
ForkThread(&GGPROTO::cmdgetinfothread, hContact);
return 1;
@@ -261,7 +261,7 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 2, "sess_mutex", 1);
}
}
- netlog("GetInfo(): Seq %d.", req->seq);
+ debugLogA("GetInfo(): Seq %d.", req->seq);
gg_pubdir50_free(req);
return 1;
@@ -272,11 +272,11 @@ int GGPROTO::GetInfo(HANDLE hContact, int infoType) void __cdecl GGPROTO::searchthread(void *)
{
- netlog("searchthread(): started. Failed search.");
+ debugLogA("searchthread(): started. Failed search.");
gg_sleep(100, FALSE, "searchthread", 104, 1);
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_FAILED, (HANDLE)1, 0);
#ifdef DEBUGMODE
- netlog("searchthread(): end.");
+ debugLogA("searchthread(): end.");
#endif
}
@@ -288,7 +288,7 @@ HANDLE GGPROTO::SearchBasic(const PROTOCHAR *id) gg_pubdir50_t req;
if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH))) {
#ifdef DEBUGMODE
- netlog("SearchBasic(): ForkThread 10 GGPROTO::searchthread");
+ debugLogA("SearchBasic(): ForkThread 10 GGPROTO::searchthread");
#endif
ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
@@ -307,13 +307,13 @@ HANDLE GGPROTO::SearchBasic(const PROTOCHAR *id) {
gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("SearchBasic(): ForkThread 11 GGPROTO::searchthread");
+ debugLogA("SearchBasic(): ForkThread 11 GGPROTO::searchthread");
#endif
ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 2, "sess_mutex", 1);
- netlog("SearchBasic(): Seq %d.", req->seq);
+ debugLogA("SearchBasic(): Seq %d.", req->seq);
gg_pubdir50_free(req);
return (HANDLE)1;
@@ -338,7 +338,7 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName, if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
{
#ifdef DEBUGMODE
- netlog("SearchByName(): ForkThread 12 GGPROTO::searchthread");
+ debugLogA("SearchByName(): ForkThread 12 GGPROTO::searchthread");
#endif
ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
@@ -386,13 +386,13 @@ HANDLE GGPROTO::SearchByName(const PROTOCHAR *nick, const PROTOCHAR *firstName, {
gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("SearchByName(): ForkThread 13 GGPROTO::searchthread");
+ debugLogA("SearchByName(): ForkThread 13 GGPROTO::searchthread");
#endif
ForkThread(&GGPROTO::searchthread, NULL);
return (HANDLE)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 2, "sess_mutex", 1);
- netlog("SearchByName(): Seq %d.", req->seq);
+ debugLogA("SearchByName(): Seq %d.", req->seq);
gg_pubdir50_free(req);
return (HANDLE)1;
@@ -414,7 +414,7 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) if (!(req = gg_pubdir50_new(GG_PUBDIR50_SEARCH)))
{
#ifdef DEBUGMODE
- netlog("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread");
+ debugLogA("SearchAdvanced(): ForkThread 14 GGPROTO::searchthread");
#endif
ForkThread(&GGPROTO::searchthread, NULL);
return (HWND)1;
@@ -532,14 +532,14 @@ HWND GGPROTO::SearchAdvanced(HWND hwndDlg) {
gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 1, "sess_mutex", 1);
#ifdef DEBUGMODE
- netlog("SearchAdvanced(): ForkThread 15 GGPROTO::searchthread");
+ debugLogA("SearchAdvanced(): ForkThread 15 GGPROTO::searchthread");
#endif
ForkThread(&GGPROTO::searchthread, NULL);
return (HWND)1;
}
gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 2, "sess_mutex", 1);
}
- netlog("SearchAdvanced(): Seq %d.", req->seq);
+ debugLogA("SearchAdvanced(): Seq %d.", req->seq);
gg_pubdir50_free(req);
return (HWND)1;
@@ -629,7 +629,7 @@ int GGPROTO::SendMsg(HANDLE hContact, int flags, const char *msg) ack->seq = seq;
ack->hContact = hContact;
#ifdef DEBUGMODE
- netlog("SendMsg(): ForkThread 16 GGPROTO::sendackthread");
+ debugLogA("SendMsg(): ForkThread 16 GGPROTO::sendackthread");
#endif
ForkThread(&GGPROTO::sendackthread, ack);
}
@@ -663,7 +663,7 @@ int GGPROTO::SetStatus(int iNewStatus) if (hConnStopEvent) SetEvent(hConnStopEvent);
if (m_iStatus == nNewStatus) return 0;
- netlog("SetStatus(): PS_SETSTATUS(%d) normalized to %d.", iNewStatus, nNewStatus);
+ debugLogA("SetStatus(): PS_SETSTATUS(%d) normalized to %d.", iNewStatus, nNewStatus);
refreshstatus(nNewStatus);
return 0;
@@ -676,23 +676,23 @@ void __cdecl GGPROTO::getawaymsgthread(void *hContact) {
DBVARIANT dbv;
- netlog("getawaymsgthread(): started");
+ debugLogA("getawaymsgthread(): started");
gg_sleep(100, FALSE, "getawaymsgthread", 106, 1);
if (!db_get_s(hContact, "CList", GG_KEY_STATUSDESCR, &dbv, DBVT_TCHAR))
{
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) dbv.ptszVal);
- netlog("getawaymsgthread(): Reading away msg <%S>.", dbv.ptszVal);
+ debugLogA("getawaymsgthread(): Reading away msg <%S>.", dbv.ptszVal);
db_free(&dbv);
} else {
ProtoBroadcastAck(hContact, ACKTYPE_AWAYMSG, ACKRESULT_SUCCESS, (HANDLE) 1, (LPARAM) NULL);
}
- netlog("getawaymsgthread(): end");
+ debugLogA("getawaymsgthread(): end");
}
HANDLE GGPROTO::GetAwayMsg(HANDLE hContact)
{
#ifdef DEBUGMODE
- netlog("GetAwayMsg(): ForkThread 17 GGPROTO::getawaymsgthread");
+ debugLogA("GetAwayMsg(): ForkThread 17 GGPROTO::getawaymsgthread");
#endif
ForkThread(&GGPROTO::getawaymsgthread, hContact);
return (HANDLE)1;
@@ -707,7 +707,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const PROTOCHAR *newMsg) int status = gg_normalizestatus(iStatus);
TCHAR **msgPtr;
- netlog("SetAwayMsg(): PS_SETAWAYMSG(%d, \"%S\").", iStatus, newMsg);
+ debugLogA("SetAwayMsg(): PS_SETAWAYMSG(%d, \"%S\").", iStatus, newMsg);
gg_EnterCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, "modemsg_mutex", 1);
// Select proper our msg ptr
@@ -739,7 +739,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const PROTOCHAR *newMsg) {
if (status == m_iDesiredStatus && m_iDesiredStatus == m_iStatus)
{
- netlog("SetAwayMsg(): Message hasn't been changed, return.");
+ debugLogA("SetAwayMsg(): Message hasn't been changed, return.");
gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 2, "modemsg_mutex", 1);
return 0;
}
@@ -750,7 +750,7 @@ int GGPROTO::SetAwayMsg(int iStatus, const PROTOCHAR *newMsg) mir_free(*msgPtr);
*msgPtr = newMsg && *newMsg ? mir_tstrdup(newMsg) : NULL;
#ifdef DEBUGMODE
- netlog("SetAwayMsg(): Message changed.");
+ debugLogA("SetAwayMsg(): Message changed.");
#endif
}
gg_LeaveCriticalSection(&modemsg_mutex, "SetAwayMsg", 55, 3, "modemsg_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 1f91546bce..6f506d6377 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -229,9 +229,6 @@ struct GGPROTO : public PROTO<GGPROTO> BOOL sessions_closedlg();
void sessions_menus_init(HGENMENU hRoot);
- // Debug functions
- int netlog(const char *fmt, ...);
-
void block_init();
void block_uninit();
@@ -262,7 +259,7 @@ struct GGPROTO : public PROTO<GGPROTO> TCHAR *invisible;
TCHAR *offline;
} modemsg;
- HANDLE netlib;
+
HGENMENU hMenuRoot;
HGENMENU hMainMenu[7];
HGENMENU hBlockMenuItem, hImageMenuItem, hInstanceMenuItem;
@@ -289,12 +286,12 @@ inline void GGPROTO::gg_EnterCriticalSection(CRITICAL_SECTION* mutex, char* call extendedLogging = 1;
if(logging == 1 && mutex->LockCount != -1) {
logAfter = 1;
- netlog("%s(): %i before EnterCriticalSection %s LockCount=%ld RecursionCount=%ld OwningThread=%ld", callingFunction, sectionNumber, mutexName, mutex->LockCount, mutex->RecursionCount, mutex->OwningThread);
+ debugLogA("%s(): %i before EnterCriticalSection %s LockCount=%ld RecursionCount=%ld OwningThread=%ld", callingFunction, sectionNumber, mutexName, mutex->LockCount, mutex->RecursionCount, mutex->OwningThread);
}
#endif
EnterCriticalSection(mutex);
#ifdef DEBUGMODE
- if(logging == 1 && logAfter == 1) netlog("%s(): %i after EnterCriticalSection %s LockCount=%ld RecursionCount=%ld OwningThread=%ld", callingFunction, sectionNumber, mutexName, mutex->LockCount, mutex->RecursionCount, mutex->OwningThread);
+ if(logging == 1 && logAfter == 1) debugLogA("%s(): %i after EnterCriticalSection %s LockCount=%ld RecursionCount=%ld OwningThread=%ld", callingFunction, sectionNumber, mutexName, mutex->LockCount, mutex->RecursionCount, mutex->OwningThread);
extendedLogging = 0;
#endif
@@ -303,7 +300,7 @@ inline void GGPROTO::gg_EnterCriticalSection(CRITICAL_SECTION* mutex, char* call inline void GGPROTO::gg_LeaveCriticalSection(CRITICAL_SECTION* mutex, char* callingFunction, int sectionNumber, int returnNumber, char* mutexName, int logging) /*0-never, 1-debug, 2-all*/
{
#ifdef DEBUGMODE
- if(logging == 1 && extendedLogging == 1) netlog("%s(): %i.%i LeaveCriticalSection %s", callingFunction, sectionNumber, returnNumber, mutexName);
+ if(logging == 1 && extendedLogging == 1) debugLogA("%s(): %i.%i LeaveCriticalSection %s", callingFunction, sectionNumber, returnNumber, mutexName);
#endif
LeaveCriticalSection(mutex);
}
@@ -311,7 +308,7 @@ inline void GGPROTO::gg_LeaveCriticalSection(CRITICAL_SECTION* mutex, char* call inline void GGPROTO::gg_sleep(DWORD miliseconds, BOOL alterable, char* callingFunction, int sleepNumber, int logging){
SleepEx(miliseconds, alterable);
#ifdef DEBUGMODE
- if(logging == 1 && extendedLogging == 1) netlog("%s(): %i after SleepEx(%ld,%u)", callingFunction, sleepNumber, miliseconds, alterable);
+ if(logging == 1 && extendedLogging == 1) debugLogA("%s(): %i after SleepEx(%ld,%u)", callingFunction, sleepNumber, miliseconds, alterable);
#endif
}
diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index 0714d7fc41..fbc3c3bed9 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -48,10 +48,10 @@ int GGPROTO::gc_init() gc_enabled = TRUE;
// create & hook event
mir_snprintf(service, 64, GG_GC_GETCHAT, m_szModuleName);
- netlog("gc_init(): Registered with groupchat plugin.");
+ debugLogA("gc_init(): Registered with groupchat plugin.");
}
else
- netlog("gc_init(): Cannot register with groupchat plugin !!!");
+ debugLogA("gc_init(): Cannot register with groupchat plugin !!!");
return 1;
}
@@ -137,7 +137,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) // Window terminated (Miranda exit)
if (gch->pDest->iType == SESSION_TERMINATE)
{
- netlog("gc_event(): Terminating chat %x, id %S from chat window...", chat, gch->pDest->ptszID);
+ debugLogA("gc_event(): Terminating chat %x, id %S from chat window...", chat, gch->pDest->ptszID);
// Destroy chat entry
free(chat->recipients);
list_remove(&chats, chat, 1);
@@ -188,7 +188,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) gcevent.time = time(NULL);
gcevent.bIsMe = 1;
gcevent.dwFlags = GC_TCHAR | GCEF_ADDTOLOG;
- netlog("gc_event(): Sending conference message to room %S, \"%S\".", gch->pDest->ptszID, gch->ptszText);
+ debugLogA("gc_event(): Sending conference message to room %S, \"%S\".", gch->pDest->ptszID, gch->ptszText);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
mir_free(nickT);
@@ -208,7 +208,7 @@ int GGPROTO::gc_event(WPARAM wParam, LPARAM lParam) if ((uin = _ttoi(gch->ptszUID)) && (hContact = getcontact(uin, 1, 0, NULL)))
CallService(MS_MSG_SENDMESSAGE, (WPARAM)hContact, 0);
}
- netlog("gc_event(): Unhandled event %d, chat %x, uin %d, text \"%S\".", gch->pDest->iType, chat, uin, gch->ptszText);
+ debugLogA("gc_event(): Unhandled event %d, chat %x, uin %d, text \"%S\".", gch->pDest->iType, chat, uin, gch->ptszText);
return 0;
}
@@ -233,7 +233,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count GCDEST gcdest = {m_szModuleName, 0, GC_EVENT_ADDGROUP};
GCEVENT gcevent = {sizeof(GCEVENT), &gcdest};
- netlog("gc_getchat(): Count %d.", recipients_count);
+ debugLogA("gc_getchat(): Count %d.", recipients_count);
if (!recipients) return NULL;
// Look for existing chat
@@ -259,9 +259,9 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count if (found == recipients_count)
{
if (chat->ignore)
- netlog("gc_getchat(): Ignoring existing id %S, size %d.", chat->id, chat->recipients_count);
+ debugLogA("gc_getchat(): Ignoring existing id %S, size %d.", chat->id, chat->recipients_count);
else
- netlog("gc_getchat(): Returning existing id %S, size %d.", chat->id, chat->recipients_count);
+ debugLogA("gc_getchat(): Returning existing id %S, size %d.", chat->id, chat->recipients_count);
return !(chat->ignore) ? chat->id : NULL;
}
}
@@ -307,7 +307,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count for(i = 0; i < recipients_count; i++)
chat->recipients[i] = recipients[i];
if (sender) chat->recipients[i] = sender;
- netlog("gc_getchat(): Ignoring new chat %S, count %d.", chat->id, chat->recipients_count);
+ debugLogA("gc_getchat(): Ignoring new chat %S, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
return NULL;
}
@@ -335,7 +335,7 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count // Create new room
if (CallServiceSync(MS_GC_NEWSESSION, 0, (LPARAM) &gcwindow))
{
- netlog("gc_getchat(): Cannot create new chat window %S.", chat->id);
+ debugLogA("gc_getchat(): Cannot create new chat window %S.", chat->id);
free(name);
free(chat);
return NULL;
@@ -369,9 +369,9 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count gcevent.bIsMe = 1;
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
mir_free(nickT);
- netlog("gc_getchat(): Myself %S: %S (%S) to the list...", gcevent.ptszUID, gcevent.ptszNick, gcevent.ptszStatus);
+ debugLogA("gc_getchat(): Myself %S: %S (%S) to the list...", gcevent.ptszUID, gcevent.ptszNick, gcevent.ptszStatus);
}
- else netlog("gc_getchat(): Myself adding failed with uin %d !!!", uin);
+ else debugLogA("gc_getchat(): Myself adding failed with uin %d !!!", uin);
// Copy recipient list
chat->recipients_count = recipients_count + (sender ? 1 : 0);
@@ -390,14 +390,14 @@ TCHAR* GGPROTO::gc_getchat(uin_t sender, uin_t *recipients, int recipients_count gcevent.ptszNick = TranslateT("'Unknown'");
gcevent.bIsMe = 0;
gcevent.dwFlags = GC_TCHAR;
- netlog("gc_getchat(): Added %S: %S (%S) to the list...", gcevent.ptszUID, gcevent.ptszNick, gcevent.pszStatus);
+ debugLogA("gc_getchat(): Added %S: %S (%S) to the list...", gcevent.ptszUID, gcevent.ptszNick, gcevent.pszStatus);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gcevent);
}
gcdest.iType = GC_EVENT_CONTROL;
CallServiceSync(MS_GC_EVENT, SESSION_INITDONE, (LPARAM)&gcevent);
CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gcevent);
- netlog("gc_getchat(): Returning new chat window %S, count %d.", chat->id, chat->recipients_count);
+ debugLogA("gc_getchat(): Returning new chat window %S, count %d.", chat->id, chat->recipients_count);
list_add(&chats, chat, 0);
return chat->id;
}
@@ -489,7 +489,7 @@ static INT_PTR CALLBACK gg_gc_openconfdlg(HWND hwndDlg, UINT message, WPARAM wPa // Create new participiants table
TCHAR* chat;
uin_t* participants = (uin_t*)calloc(count, sizeof(uin_t));
- gg->netlog("gg_gc_openconfdlg(): WM_COMMAND IDOK Opening new conference for %d contacts.", count);
+ gg->debugLogA("gg_gc_openconfdlg(): WM_COMMAND IDOK Opening new conference for %d contacts.", count);
for (HANDLE hContact = db_find_first(); hContact && i < count; hContact = db_find_next(hContact)) {
HANDLE hItem = (HANDLE)SendMessage(hwndList, CLM_FINDCONTACT, (WPARAM)hContact, 0);
if (hItem && SendMessage(hwndList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) {
@@ -643,7 +643,7 @@ int GGPROTO::gc_changenick(HANDLE hContact, TCHAR *ptszNick) uin_t uin = getDword(hContact, GG_KEY_UIN, 0);
if (!uin || !ptszNick) return 0;
- netlog("gc_changenick(): Nickname for uin %d changed. Lookup for chats having this nick", uin);
+ debugLogA("gc_changenick(): Nickname for uin %d changed. Lookup for chats having this nick", uin);
// Lookup for chats having this nick
for(l = chats; l; l = l->next) {
GGGC *chat = (GGGC *)l->data;
@@ -665,7 +665,7 @@ int GGPROTO::gc_changenick(HANDLE hContact, TCHAR *ptszNick) gce.dwFlags = GC_TCHAR;
gce.ptszText = ptszNick;
- netlog("gc_changenick(): Found room %S with uin %d, sending nick change %S.", chat->id, uin, id);
+ debugLogA("gc_changenick(): Found room %S with uin %d, sending nick change %S.", chat->id, uin, id);
CallServiceSync(MS_GC_EVENT, 0, (LPARAM)&gce);
break;
diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 5e69a74f66..9f2bf2c39e 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -93,7 +93,7 @@ int GGPROTO::img_shutdown() {
list_t l;
#ifdef DEBUGMODE
- netlog("img_shutdown(): Closing all dialogs...");
+ debugLogA("img_shutdown(): Closing all dialogs...");
#endif
// Rather destroy window instead of just removing structures
for (l = imagedlgs; l;)
@@ -107,10 +107,10 @@ int GGPROTO::img_shutdown() {
// Post message async, since it maybe be different thread
if (!PostMessage(dat->hWnd, WM_CLOSE, 0, 0))
- netlog("img_shutdown(): Image dlg %x cannot be released !!", dat->hWnd);
+ debugLogA("img_shutdown(): Image dlg %x cannot be released !!", dat->hWnd);
}
else
- netlog("img_shutdown(): Image dlg %x not exists, but structure does !!", dat->hWnd);
+ debugLogA("img_shutdown(): Image dlg %x not exists, but structure does !!", dat->hWnd);
}
}
@@ -270,11 +270,11 @@ int gg_img_saveimage(HWND hwnd, GGIMAGEENTRY *dat) {
fwrite(dat->lpData, dat->nSize, 1, fp);
fclose(fp);
- gg->netlog("gg_img_saveimage(): Image saved to %S.", szFileName);
+ gg->debugLogA("gg_img_saveimage(): Image saved to %S.", szFileName);
}
else
{
- gg->netlog("gg_img_saveimage(): Cannot save image to %S.", szFileName);
+ gg->debugLogA("gg_img_saveimage(): Cannot save image to %S.", szFileName);
MessageBox(hwnd, TranslateT("Image cannot be written to disk."), gg->m_tszUserName, MB_OK | MB_ICONERROR);
}
}
@@ -399,7 +399,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP // Send event if someone's waiting
if (dat->hEvent) SetEvent(dat->hEvent);
- else dat->gg->netlog("gg_img_dlgproc(): WM_INITDIALOG Creation event not found, but someone might be waiting.");
+ else dat->gg->debugLogA("gg_img_dlgproc(): WM_INITDIALOG Creation event not found, but someone might be waiting.");
// Making buttons flat
SendDlgItemMessage(hwndDlg, IDC_IMG_PREV, BUTTONSETASFLATBTN, TRUE, 0);
@@ -500,7 +500,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP if (!img)
{
- dat->gg->netlog("gg_img_dlgproc(): WM_PAINT Image was not found on the list. Cannot paint the window.");
+ dat->gg->debugLogA("gg_img_dlgproc(): WM_PAINT Image was not found on the list. Cannot paint the window.");
return FALSE;
}
@@ -576,7 +576,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP img = img->lpNext;
if (!img)
{
- dat->gg->netlog("gg_img_dlgproc(): IDC_IMG_DELETE Image was not found on the list. Cannot delete it from the list.");
+ dat->gg->debugLogA("gg_img_dlgproc(): IDC_IMG_DELETE Image was not found on the list. Cannot delete it from the list.");
return FALSE;
}
del = img->lpNext;
@@ -602,7 +602,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP img = img->lpNext;
if (!img)
{
- dat->gg->netlog("gg_img_dlgproc(): IDC_IMG_SAVE Image was not found on the list. Cannot launch saving.");
+ dat->gg->debugLogA("gg_img_dlgproc(): IDC_IMG_SAVE Image was not found on the list. Cannot launch saving.");
return FALSE;
}
gg_img_saveimage(hwndDlg, img);
@@ -720,12 +720,12 @@ void __cdecl GGPROTO::img_dlgcallthread(void *param) {
HWND hMIWnd = 0; //(HWND) CallService(MS_CLUI_GETHWND, 0, 0);
- netlog("img_dlgcallthread(): started.");
+ debugLogA("img_dlgcallthread(): started.");
GGIMAGEDLGDATA *dat = (GGIMAGEDLGDATA *)param;
DialogBoxParam(hInstance, dat->bReceiving ? MAKEINTRESOURCE(IDD_IMAGE_RECV) : MAKEINTRESOURCE(IDD_IMAGE_SEND),
hMIWnd, gg_img_dlgproc, (LPARAM) dat);
#ifdef DEBUGMODE
- netlog("img_dlgcallthread(): end.");
+ debugLogA("img_dlgcallthread(): end.");
#endif
}
@@ -742,7 +742,7 @@ GGIMAGEDLGDATA *gg_img_recvdlg(GGPROTO *gg, HANDLE hContact) dat->gg = gg;
ResetEvent(dat->hEvent);
#ifdef DEBUGMODE
- gg->netlog("gg_img_recvdlg(): ForkThread 18 GGPROTO::img_dlgcallthread");
+ gg->debugLogA("gg_img_recvdlg(): ForkThread 18 GGPROTO::img_dlgcallthread");
#endif
gg->ForkThread(&GGPROTO::img_dlgcallthread, dat);
return dat;
@@ -826,9 +826,9 @@ int GGPROTO::img_displayasmsg(HANDLE hContact, void *img) if ( _taccess(szPath, 0)){
int ret = CreateDirectoryTreeT(szPath);
if (ret == 0){
- netlog("img_displayasmsg(): Created new directory for image cache: %S.", szPath);
+ debugLogA("img_displayasmsg(): Created new directory for image cache: %S.", szPath);
} else {
- netlog("img_displayasmsg(): Can not create directory for image cache: %S. errno=%d: %s", szPath, errno, strerror(errno));
+ debugLogA("img_displayasmsg(): Can not create directory for image cache: %S. errno=%d: %s", szPath, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot create image cache directory. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
@@ -852,7 +852,7 @@ int GGPROTO::img_displayasmsg(HANDLE hContact, void *img) res = fwrite(dat->lpData, dat->nSize, 1, fp) > 0;
fclose(fp);
} else {
- netlog("img_displayasmsg(): Cannot open file %S for write image. errno=%d: %s", szPath, errno, strerror(errno));
+ debugLogA("img_displayasmsg(): Cannot open file %S for write image. errno=%d: %s", szPath, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot save received image to file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szPath);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
@@ -869,11 +869,11 @@ int GGPROTO::img_displayasmsg(HANDLE hContact, void *img) pre.timestamp = time(NULL);
pre.tszMessage = image_msg;
ProtoChainRecvMsg(hContact, &pre);
- netlog("img_displayasmsg(): Image saved to %S.", szPath);
+ debugLogA("img_displayasmsg(): Image saved to %S.", szPath);
}
else
{
- netlog("img_displayasmsg(): Cannot save image to %S.", szPath);
+ debugLogA("img_displayasmsg(): Cannot save image to %S.", szPath);
}
return 0;
@@ -983,7 +983,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) FILE *fp = _tfopen(szFileName, _T("rb"));
if (!fp) {
free(dat);
- netlog("img_loadpicture(): fopen(\"%S\", \"rb\") failed. errno=%d: %s", szFileName, errno, strerror(errno));
+ debugLogA("img_loadpicture(): fopen(\"%S\", \"rb\") failed. errno=%d: %s", szFileName, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot open image file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), szFileName);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
@@ -995,7 +995,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) {
fclose(fp);
free(dat);
- netlog("img_loadpicture(): Zero file size \"%S\" failed.", szFileName);
+ debugLogA("img_loadpicture(): Zero file size \"%S\" failed.", szFileName);
return NULL;
}
// Maximum acceptable image size
@@ -1003,7 +1003,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) {
fclose(fp);
free(dat);
- netlog("img_loadpicture(): Image size of \"%S\" exceeds 255 KB.", szFileName);
+ debugLogA("img_loadpicture(): Image size of \"%S\" exceeds 255 KB.", szFileName);
MessageBox(NULL, TranslateT("Image exceeds maximum allowed size of 255 KB."), m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
return NULL;
}
@@ -1014,7 +1014,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) free(dat->lpData);
fclose(fp);
free(dat);
- netlog("img_loadpicture(): Reading file \"%S\" failed.", szFileName);
+ debugLogA("img_loadpicture(): Reading file \"%S\" failed.", szFileName);
return NULL;
}
fclose(fp);
@@ -1064,7 +1064,7 @@ void* GGPROTO::img_loadpicture(gg_event* e, TCHAR *szFileName) // If everything is fine return the handle
if (dat->hBitmap) return dat;
- netlog("img_loadpicture(): MS_IMG_LOAD(MEM) failed.");
+ debugLogA("img_loadpicture(): MS_IMG_LOAD(MEM) failed.");
if (dat)
{
if (dat->lpData)
@@ -1083,7 +1083,7 @@ INT_PTR GGPROTO::img_recvimage(WPARAM wParam, LPARAM lParam) CLISTEVENT *cle = (CLISTEVENT *)lParam;
GGIMAGEENTRY *img = (GGIMAGEENTRY *)cle->lParam;
- netlog("img_recvimage(%x, %x): Popup new image.", wParam, lParam);
+ debugLogA("img_recvimage(%x, %x): Popup new image.", wParam, lParam);
if (!img) return FALSE;
img_display(cle->hContact, img);
@@ -1152,7 +1152,7 @@ GGIMAGEDLGDATA* gg_img_find(GGPROTO *gg, uin_t uin, uint32_t crc32) }
gg->gg_LeaveCriticalSection(&gg->img_mutex, "gg_img_find", 62, 2, "img_mutex", 1);
- gg->netlog("gg_img_find(): Image not found on the list. It might be released before calling this function.");
+ gg->debugLogA("gg_img_find(): Image not found on the list. It might be released before calling this function.");
return NULL;
}
@@ -1196,7 +1196,7 @@ INT_PTR GGPROTO::img_sendimg(WPARAM wParam, LPARAM lParam) // Create new dialog
#ifdef DEBUGMODE
- netlog("img_sendimg(): ForkThread 19 GGPROTO::img_dlgcallthread");
+ debugLogA("img_sendimg(): ForkThread 19 GGPROTO::img_dlgcallthread");
#endif
ForkThread(&GGPROTO::img_dlgcallthread, dat);
diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index 4e1f2ae72c..7c28acd9df 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -109,7 +109,7 @@ char *gg_makecontacts(GGPROTO *gg, int cr) contacts = string_free(s, 0);
#ifdef DEBUGMODE
- gg->netlog("gg_makecontacts(): \n%s", contacts);
+ gg->debugLogA("gg_makecontacts(): \n%s", contacts);
#endif
return contacts;
@@ -212,7 +212,7 @@ void GGPROTO::parsecontacts(char *contacts) {
HANDLE hContact = getcontact(uin, 1, 1, _A2T(strNick));
#ifdef DEBUGMODE
- netlog("parsecontacts(): Found contact %d with nickname \"%s\".", uin, strNick);
+ debugLogA("parsecontacts(): Found contact %d with nickname \"%s\".", uin, strNick);
#endif
// Write group
if (hContact && strGroup) {
@@ -287,7 +287,7 @@ INT_PTR GGPROTO::import_server(WPARAM wParam, LPARAM lParam) gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1);
mir_sntprintf(error, SIZEOF(error), TranslateT("List cannot be imported because of error:\n\t%s (Error: %d)"), _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
- netlog("import_server(): Cannot import list. errno:%d: %s", errno, strerror(errno));
+ debugLogA("import_server(): Cannot import list. errno:%d: %s", errno, strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 2, "sess_mutex", 1);
free(password);
@@ -334,7 +334,7 @@ INT_PTR GGPROTO::remove_server(WPARAM wParam, LPARAM lParam) gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1);
mir_sntprintf(error, SIZEOF(error), TranslateT("List cannot be removed because of error: %s (Error: %d)"), _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
- netlog("remove_server(): Cannot remove list. errno=%d: %s", errno, strerror(errno));
+ debugLogA("remove_server(): Cannot remove list. errno=%d: %s", errno, strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 2, "sess_mutex", 1);
@@ -386,7 +386,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) ofn.lpstrDefExt = _T("txt");
#ifdef DEBUGMODE
- netlog("import_text()");
+ debugLogA("import_text()");
#endif
if (!GetOpenFileName(&ofn)) return 0;
@@ -408,7 +408,7 @@ INT_PTR GGPROTO::import_text(WPARAM wParam, LPARAM lParam) TCHAR error[256];
mir_sntprintf(error, SIZEOF(error), TranslateT("List cannot be imported from file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
- netlog("import_text(): Cannot import list from file \"%S\". errno=%d: %s", str, errno, strerror(errno));
+ debugLogA("import_text(): Cannot import list from file \"%S\". errno=%d: %s", str, errno, strerror(errno));
}
return 0;
@@ -451,7 +451,7 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) ofn.lpstrDefExt = _T("txt");
#ifdef DEBUGMODE
- netlog("export_text(%S).", str);
+ debugLogA("export_text(%S).", str);
#endif
if (!GetSaveFileName(&ofn)) return 0;
@@ -469,7 +469,7 @@ INT_PTR GGPROTO::export_text(WPARAM wParam, LPARAM lParam) TCHAR error[128];
mir_sntprintf(error, SIZEOF(error), TranslateT("List cannot be exported to file \"%s\" because of error:\n\t%s (Error: %d)"), str, _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
- netlog("export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, strerror(errno));
+ debugLogA("export_text(): Cannot export list to file \"%s\". errno=%d: %s", str, errno, strerror(errno));
}
return 0;
@@ -507,7 +507,7 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam) char *contacts = gg_makecontacts(this, 1);
#ifdef DEBUGMODE
- netlog("export_server(): gg_userlist_request(%s).", contacts);
+ debugLogA("export_server(): gg_userlist_request(%s).", contacts);
#endif
gg_EnterCriticalSection(&sess_mutex, "export_server", 67, "sess_mutex", 1);
@@ -517,7 +517,7 @@ INT_PTR GGPROTO::export_server(WPARAM wParam, LPARAM lParam) gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1);
mir_sntprintf(error, SIZEOF(error), TranslateT("List cannot be exported because of error:\n\t%s (Error: %d)"), _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
- netlog("export_server(): Cannot export list. errno=%d: %s", errno, strerror(errno));
+ debugLogA("export_server(): Cannot export list. errno=%d: %s", errno, strerror(errno));
}
gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 2, "sess_mutex", 1);
diff --git a/protocols/Gadu-Gadu/src/keepalive.cpp b/protocols/Gadu-Gadu/src/keepalive.cpp index 7cc179d2d0..a9a0ff52e1 100644 --- a/protocols/Gadu-Gadu/src/keepalive.cpp +++ b/protocols/Gadu-Gadu/src/keepalive.cpp @@ -41,7 +41,7 @@ static VOID CALLBACK gg_keepalive(HWND hwnd, UINT message, UINT_PTR idEvent, DWO if (gg->isonline())
{
#ifdef DEBUGMODE
- gg->netlog("gg_keepalive(): Sending keep-alive");
+ gg->debugLogA("gg_keepalive(): Sending keep-alive");
#endif
gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_keepalive", 68, "sess_mutex", 1);
gg_ping(gg->sess);
@@ -59,7 +59,7 @@ void GGPROTO::keepalive_init() if (i < MAX_TIMERS)
{
#ifdef DEBUGMODE
- netlog("keepalive_init(): Initializing Timer %d", i);
+ debugLogA("keepalive_init(): Initializing Timer %d", i);
#endif
timer = SetTimer(NULL, 0, 1000 * 30, gg_keepalive);
g_timers[i] = this;
@@ -70,7 +70,7 @@ void GGPROTO::keepalive_init() void GGPROTO::keepalive_destroy()
{
#ifdef DEBUGMODE
- netlog("keepalive_destroy(): Killing Timer");
+ debugLogA("keepalive_destroy(): Killing Timer");
#endif
if (timer)
{
@@ -83,10 +83,10 @@ void GGPROTO::keepalive_destroy() }
timer = 0;
#ifdef DEBUGMODE
- netlog("keepalive_destroy(): Killed Timer %d", i);
+ debugLogA("keepalive_destroy(): Killed Timer %d", i);
#endif
}
#ifdef DEBUGMODE
- netlog("keepalive_destroy(): End");
+ debugLogA("keepalive_destroy(): End");
#endif
}
diff --git a/protocols/Gadu-Gadu/src/oauth.cpp b/protocols/Gadu-Gadu/src/oauth.cpp index 361b3ff81c..db2a8220f9 100644 --- a/protocols/Gadu-Gadu/src/oauth.cpp +++ b/protocols/Gadu-Gadu/src/oauth.cpp @@ -319,7 +319,7 @@ int GGPROTO::oauth_receivetoken() }
// 1. Obtaining an Unauthorized Request Token
- netlog("oauth_receivetoken(): Obtaining an Unauthorized Request Token...");
+ debugLogA("oauth_receivetoken(): Obtaining an Unauthorized Request Token...");
strcpy(szUrl, "http://api.gadu-gadu.pl/request_token");
str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, NULL, NULL);
@@ -338,7 +338,7 @@ int GGPROTO::oauth_receivetoken() req.headersCount = 3;
req.headers = httpHeaders;
- NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)netlib, (LPARAM)&req);
+ NETLIBHTTPREQUEST *resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
nlc = resp->nlc;
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
@@ -355,13 +355,13 @@ int GGPROTO::oauth_receivetoken() }
mir_free(xmlAction);
}
- else netlog("oauth_receivetoken(): Invalid response code from HTTP request");
+ else debugLogA("oauth_receivetoken(): Invalid response code from HTTP request");
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
}
- else netlog("oauth_receivetoken(): No response from HTTP request");
+ else debugLogA("oauth_receivetoken(): No response from HTTP request");
// 2. Obtaining User Authorization
- netlog("oauth_receivetoken(): Obtaining User Authorization...");
+ debugLogA("oauth_receivetoken(): Obtaining User Authorization...");
mir_free(str);
str = oauth_uri_escape("http://www.mojageneracja.pl");
@@ -383,12 +383,12 @@ int GGPROTO::oauth_receivetoken() req.pData = str;
req.dataLength = (int)strlen(str);
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)netlib, (LPARAM)&req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
- else netlog("oauth_receivetoken(): No response from HTTP request");
+ else debugLogA("oauth_receivetoken(): No response from HTTP request");
// 3. Obtaining an Access Token
- netlog("oauth_receivetoken(): Obtaining an Access Token...");
+ debugLogA("oauth_receivetoken(): Obtaining an Access Token...");
strcpy(szUrl, "http://api.gadu-gadu.pl/access_token");
mir_free(str);
str = oauth_auth_header("POST", szUrl, HMACSHA1, uin, password, token, token_secret);
@@ -408,7 +408,7 @@ int GGPROTO::oauth_receivetoken() httpHeaders[1].szName = "Authorization";
httpHeaders[1].szValue = str;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)netlib, (LPARAM)&req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp) {
if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
TCHAR *xmlAction = mir_a2t(resp->pData);
@@ -424,11 +424,11 @@ int GGPROTO::oauth_receivetoken() }
mir_free(xmlAction);
}
- else netlog("oauth_receivetoken(): Invalid response code from HTTP request");
+ else debugLogA("oauth_receivetoken(): Invalid response code from HTTP request");
Netlib_CloseHandle(resp->nlc);
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
}
- else netlog("oauth_receivetoken(): No response from HTTP request");
+ else debugLogA("oauth_receivetoken(): No response from HTTP request");
mir_free(password);
mir_free(str);
@@ -437,13 +437,13 @@ int GGPROTO::oauth_receivetoken() setString(GG_KEY_TOKEN, token);
CallService(MS_DB_CRYPT_ENCODESTRING, (WPARAM)(int)strlen(token_secret) + 1, (LPARAM) token_secret);
setString(GG_KEY_TOKENSECRET, token_secret);
- netlog("oauth_receivetoken(): Access Token obtained successfully.");
+ debugLogA("oauth_receivetoken(): Access Token obtained successfully.");
res = 1;
}
else {
delSetting(GG_KEY_TOKEN);
delSetting(GG_KEY_TOKENSECRET);
- netlog("oauth_receivetoken(): Failed to obtain Access Token.");
+ debugLogA("oauth_receivetoken(): Failed to obtain Access Token.");
}
mir_free(token);
mir_free(token_secret);
diff --git a/protocols/Gadu-Gadu/src/ownerinfo.cpp b/protocols/Gadu-Gadu/src/ownerinfo.cpp index 908cc842c3..a8f56eb856 100644 --- a/protocols/Gadu-Gadu/src/ownerinfo.cpp +++ b/protocols/Gadu-Gadu/src/ownerinfo.cpp @@ -36,12 +36,12 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) GG_REMIND_PASS *rp = (GG_REMIND_PASS *)param;
GGTOKEN token;
- netlog("remindpasswordthread(): Started.");
+ debugLogA("remindpasswordthread(): Started.");
if (!rp || !rp->email || !rp->uin || !strlen(rp->email))
{
if (rp) free(rp);
#ifdef DEBUGMODE
- netlog("remindpasswordthread(): End. err1");
+ debugLogA("remindpasswordthread(): End. err1");
#endif
return;
}
@@ -49,7 +49,7 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) // Get token
if (!gettoken(&token)){
#ifdef DEBUGMODE
- netlog("remindpasswordthread(): End. err2");
+ debugLogA("remindpasswordthread(): End. err2");
#endif
return;
}
@@ -59,18 +59,18 @@ void __cdecl GGPROTO::remindpasswordthread(void *param) TCHAR error[128];
mir_sntprintf(error, SIZEOF(error), TranslateT("Password could not be reminded because of error:\n\t%s (Error: %d)"), _tcserror(errno), errno);
MessageBox(NULL, error, m_tszUserName, MB_OK | MB_ICONSTOP);
- netlog("remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, strerror(errno));
+ debugLogA("remindpasswordthread(): Password could not be reminded. errno=%d: %s", errno, strerror(errno));
}
else
{
gg_pubdir_free(h);
- netlog("remindpasswordthread(): Password remind successful.");
+ debugLogA("remindpasswordthread(): Password remind successful.");
MessageBox(NULL, TranslateT("Password was sent to your e-mail."), m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
if (rp) free(rp);
#ifdef DEBUGMODE
- netlog("remindpasswordthread(): End.");
+ debugLogA("remindpasswordthread(): End.");
#endif
}
@@ -81,7 +81,7 @@ void GGPROTO::remindpassword(uin_t uin, const char *email) rp->uin = uin;
rp->email = email;
#ifdef DEBUGMODE
- netlog("remindpassword(): ForkThreadEx 20 GGPROTO::remindpasswordthread");
+ debugLogA("remindpassword(): ForkThreadEx 20 GGPROTO::remindpasswordthread");
#endif
ForkThread(&GGPROTO::remindpasswordthread, rp);
}
diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 63426ab80a..f905023250 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -89,12 +89,12 @@ int GGPROTO::refreshstatus(int status) if (exitCode == STILL_ACTIVE)
return TRUE;
#ifdef DEBUGMODE
- netlog("refreshstatus(): Waiting pth_sess thread. Going to connect...");
+ debugLogA("refreshstatus(): Waiting pth_sess thread. Going to connect...");
#endif
threadwait(&pth_sess);
#ifdef DEBUGMODE
- netlog("refreshstatus(): Waiting pth_sess thread - OK");
- netlog("refreshstatus(): ForkThreadEx 21 GGPROTO::mainthread");
+ debugLogA("refreshstatus(): Waiting pth_sess thread - OK");
+ debugLogA("refreshstatus(): ForkThreadEx 21 GGPROTO::mainthread");
#endif
pth_sess.hThread = ForkThreadEx(&GGPROTO::mainthread, NULL, &pth_sess.dwThreadId);
}
@@ -108,14 +108,14 @@ int GGPROTO::refreshstatus(int status) char *szMsg_utf8 = mir_utf8encodeT(szMsg);
if (szMsg_utf8)
{
- netlog("refreshstatus(): Setting status and away message.");
+ debugLogA("refreshstatus(): Setting status and away message.");
gg_EnterCriticalSection(&sess_mutex, "refreshstatus", 70, "sess_mutex", 1);
gg_change_status_descr(sess, status_m2gg(status, szMsg_utf8 != NULL), szMsg_utf8);
gg_LeaveCriticalSection(&sess_mutex, "refreshstatus", 70, 1, "sess_mutex", 1);
}
else
{
- netlog("refreshstatus(): Setting just status.");
+ debugLogA("refreshstatus(): Setting just status.");
gg_EnterCriticalSection(&sess_mutex, "refreshstatus", 71, "sess_mutex", 1);
gg_change_status(sess, status_m2gg(status, 0));
gg_LeaveCriticalSection(&sess_mutex, "refreshstatus", 71, 1, "sess_mutex", 1);
@@ -180,12 +180,12 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) uin_t uin = (uin_t)getDword(pai->hContact, GG_KEY_UIN, 0);
if (!uin) {
- netlog("getavatarinfo(): Incoming request for avatar information. No uin found. return GAIR_NOAVATAR");
+ debugLogA("getavatarinfo(): Incoming request for avatar information. No uin found. return GAIR_NOAVATAR");
return GAIR_NOAVATAR;
}
if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS)) {
- netlog("getavatarinfo(): Incoming request for avatar information. GG_KEY_ENABLEAVATARS == 0. return GAIR_NOAVATAR");
+ debugLogA("getavatarinfo(): Incoming request for avatar information. GG_KEY_ENABLEAVATARS == 0. return GAIR_NOAVATAR");
return GAIR_NOAVATAR;
}
@@ -193,7 +193,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) DBVARIANT dbv;
if (!db_get_ts(pai->hContact, "ContactPhoto", "Backup", &dbv)) {
if ((_tcslen(dbv.ptszVal)>0) && db_get_b(pai->hContact, "ContactPhoto", "Locked", 0)){
- netlog("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
+ debugLogA("getavatarinfo(): Incoming request for avatar information. Contact has assigned Locked ContactPhoto. return GAIR_SUCCESS");
_tcscpy_s(pai->filename, SIZEOF(pai->filename) ,dbv.ptszVal);
pai->format = ProtoGetAvatarFormat(pai->filename);
db_free(&dbv);
@@ -205,10 +205,10 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (!getByte(pai->hContact, GG_KEY_AVATARREQUESTED, GG_KEYDEF_AVATARREQUESTED)) {
requestAvatarInfo(pai->hContact, 1);
if ((wParam & GAIF_FORCE) != 0) {
- netlog("getavatarinfo(): Incoming request for avatar information. uin=%d. requestAvatarInfo() fired. return GAIR_WAITFOR", uin);
+ debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. requestAvatarInfo() fired. return GAIR_WAITFOR", uin);
return GAIR_WAITFOR;
} else {
- netlog("getavatarinfo(): Incoming request for avatar information. uin=%d. requestAvatarInfo() fired. return GAIR_NOAVATAR", uin);
+ debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. requestAvatarInfo() fired. return GAIR_NOAVATAR", uin);
return GAIR_NOAVATAR;
}
}
@@ -231,24 +231,24 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) getAvatarFilename(pai->hContact, pai->filename, SIZEOF(pai->filename));
if (!strcmp(AvatarHash, AvatarSavedHash)) {
if (_taccess(pai->filename, 0) == 0){
- netlog("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged. return GAIR_SUCCESS", uin);
+ debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged. return GAIR_SUCCESS", uin);
return GAIR_SUCCESS;
}
requestAvatarTransfer(pai->hContact, AvatarURL);
- netlog("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged but file %S does not exist. errno=%d: %s. requestAvatarTransfer() fired. return GAIR_WAITFOR", uin, pai->filename, errno, strerror(errno));
+ debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash unchanged but file %S does not exist. errno=%d: %s. requestAvatarTransfer() fired. return GAIR_WAITFOR", uin, pai->filename, errno, strerror(errno));
return GAIR_WAITFOR;
}
if ((wParam & GAIF_FORCE) != 0) {
if (_tremove(pai->filename) != 0){
- netlog("getavatarinfo(): refresh. _tremove 1 file %S error. errno=%d: %s", pai->filename, errno, strerror(errno));
+ debugLogA("getavatarinfo(): refresh. _tremove 1 file %S error. errno=%d: %s", pai->filename, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot remove old avatar file before refresh. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
}
setString(pai->hContact, GG_KEY_AVATARHASH, AvatarHash);
requestAvatarTransfer(pai->hContact, AvatarURL);
- netlog("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash changed, requestAvatarTransfer() fired. return GAIR_WAITFOR", uin);
+ debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. Avatar hash changed, requestAvatarTransfer() fired. return GAIR_WAITFOR", uin);
return GAIR_WAITFOR;
}
}
@@ -256,7 +256,7 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) if (AvatarHash == NULL && AvatarSavedHash != NULL) {
getAvatarFilename(pai->hContact, pai->filename, sizeof(pai->filename));
if (_tremove(pai->filename) != 0){
- netlog("getavatarinfo(): delete. _tremove file %S error. errno=%d: %s", pai->filename, errno, strerror(errno));
+ debugLogA("getavatarinfo(): delete. _tremove file %S error. errno=%d: %s", pai->filename, errno, strerror(errno));
TCHAR error[512];
mir_sntprintf(error, SIZEOF(error), TranslateT("Cannot remove old avatar file. ERROR: %d: %s\n%s"), errno, _tcserror(errno), pai->filename);
showpopup(m_tszUserName, error, GG_POPUP_ERROR);
@@ -264,17 +264,17 @@ INT_PTR GGPROTO::getavatarinfo(WPARAM wParam, LPARAM lParam) delSetting(pai->hContact, GG_KEY_AVATARHASH);
delSetting(pai->hContact, GG_KEY_AVATARURL);
delSetting(pai->hContact, GG_KEY_AVATARTYPE);
- netlog("getavatarinfo(): Incoming request for avatar information. Contact %d deleted avatar. return GAIR_NOAVATAR", uin);
+ debugLogA("getavatarinfo(): Incoming request for avatar information. Contact %d deleted avatar. return GAIR_NOAVATAR", uin);
}
else if (AvatarHash != NULL && AvatarSavedHash == NULL) {
setString(pai->hContact, GG_KEY_AVATARHASH, AvatarHash);
requestAvatarTransfer(pai->hContact, AvatarURL);
- netlog("getavatarinfo(): Incoming request for avatar information. Contact %d set avatar. requestAvatarTransfer() fired. return GAIR_WAITFOR", uin);
+ debugLogA("getavatarinfo(): Incoming request for avatar information. Contact %d set avatar. requestAvatarTransfer() fired. return GAIR_WAITFOR", uin);
return GAIR_WAITFOR;
}
- else netlog("getavatarinfo(): Incoming request for avatar information. uin=%d. AvatarHash==AvatarSavedHash==NULL, with GAIF_FORCE param. return GAIR_NOAVATAR", uin);
+ else debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. AvatarHash==AvatarSavedHash==NULL, with GAIF_FORCE param. return GAIR_NOAVATAR", uin);
}
- else netlog("getavatarinfo(): Incoming request for avatar information. uin=%d. AvatarHash==null or AvatarSavedHash==null, but no GAIF_FORCE param. return GAIR_NOAVATAR", uin);
+ else debugLogA("getavatarinfo(): Incoming request for avatar information. uin=%d. AvatarHash==null or AvatarSavedHash==null, but no GAIF_FORCE param. return GAIR_NOAVATAR", uin);
return GAIR_NOAVATAR;
}
@@ -289,21 +289,21 @@ INT_PTR GGPROTO::getmyavatar(WPARAM wParam, LPARAM lParam) int len = (int)lParam;
if (szFilename == NULL || len <= 0) {
- netlog("getmyavatar(): Incoming request for self avatar information. szFilename == NULL. return -1 (error)");
+ debugLogA("getmyavatar(): Incoming request for self avatar information. szFilename == NULL. return -1 (error)");
return -1;
}
if (!getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS)) {
- netlog("getmyavatar(): Incoming request for self avatar information. GG_KEY_ENABLEAVATARS==0. return -2 (error)");
+ debugLogA("getmyavatar(): Incoming request for self avatar information. GG_KEY_ENABLEAVATARS==0. return -2 (error)");
return -2;
}
getAvatarFilename(NULL, szFilename, len);
if (_taccess(szFilename, 0) == 0){
- netlog("getmyavatar(): Incoming request for self avatar information. returned ok.");
+ debugLogA("getmyavatar(): Incoming request for self avatar information. returned ok.");
return 0;
} else {
- netlog("getmyavatar(): Incoming request for self avatar information. saved avatar file %S does not exist. return -1 (error)", szFilename);
+ debugLogA("getmyavatar(): Incoming request for self avatar information. saved avatar file %S does not exist. return -1 (error)", szFilename);
return -1;
}
@@ -329,7 +329,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam) int iAvType = ProtoGetAvatarFormat(szFilename);
if ( iAvType == PA_FORMAT_UNKNOWN) {
- netlog("setmyavatar(): Failed to set user avatar. File %s has incompatible extension.", szFilename);
+ debugLogA("setmyavatar(): Failed to set user avatar. File %s has incompatible extension.", szFilename);
return -1;
}
@@ -339,7 +339,7 @@ INT_PTR GGPROTO::setmyavatar(WPARAM wParam, LPARAM lParam) TCHAR szMyFilename[MAX_PATH];
getAvatarFilename(NULL, szMyFilename, SIZEOF(szMyFilename));
if ( _tcscmp(szFilename, szMyFilename) && !CopyFile(szFilename, szMyFilename, FALSE)) {
- netlog("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
+ debugLogA("setmyavatar(): Failed to set user avatar. File with type %d could not be created/overwritten.", iAvType);
return -1;
}
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp index 8c213563d2..b33dcd33bc 100644 --- a/protocols/Gadu-Gadu/src/userutils.cpp +++ b/protocols/Gadu-Gadu/src/userutils.cpp @@ -31,7 +31,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) GGTOKEN token;
#ifdef DEBUGMODE
- gg->netlog("gg_doregister(): Starting.");
+ gg->debugLogA("gg_doregister(): Starting.");
#endif
if (!newPass || !newEmail) return NULL;
@@ -45,7 +45,7 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) (h && !s) ? http_error_string(h ? h->error : 0) :
(s ? TranslateT("Registration rejected") : _tcserror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
- gg->netlog("gg_doregister(): Cannot register. errno=%d: %s", errno, strerror(errno));
+ gg->debugLogA("gg_doregister(): Cannot register. errno=%d: %s", errno, strerror(errno));
}
else
{
@@ -55,14 +55,14 @@ void *gg_doregister(GGPROTO *gg, char *newPass, char *newEmail) gg->setString(GG_KEY_PASSWORD, newPass);
gg->setString(GG_KEY_EMAIL, newEmail);
gg_pubdir_free(h);
- gg->netlog("gg_doregister(): Account registration succesful.");
+ gg->debugLogA("gg_doregister(): Account registration succesful.");
MessageBox( NULL,
TranslateT("You have registered new account.\nPlease fill up your personal details in \"M->View/Change My Details...\""),
gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
- gg->netlog("gg_doregister(): End.");
+ gg->debugLogA("gg_doregister(): End.");
#endif
return NULL;
@@ -78,7 +78,7 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) GGTOKEN token;
#ifdef DEBUGMODE
- gg->netlog("gg_dounregister(): Starting.");
+ gg->debugLogA("gg_dounregister(): Starting.");
#endif
if (!uin || !password) return NULL;
@@ -92,19 +92,19 @@ void *gg_dounregister(GGPROTO *gg, uin_t uin, char *password) (h && !s) ? http_error_string(h ? h->error : 0) :
(s ? TranslateT("Bad number or password") : _tcserror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
- gg->netlog("gg_dounregister(): Cannot remove account. errno=%d: %s", errno, strerror(errno));
+ gg->debugLogA("gg_dounregister(): Cannot remove account. errno=%d: %s", errno, strerror(errno));
}
else
{
gg_pubdir_free(h);
gg->delSetting(GG_KEY_PASSWORD);
gg->delSetting(GG_KEY_UIN);
- gg->netlog("gg_dounregister(): Account %d has been removed.", uin);
+ gg->debugLogA("gg_dounregister(): Account %d has been removed.", uin);
MessageBox(NULL, TranslateT("Your account has been removed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
- gg->netlog("gg_dounregister(): End.");
+ gg->debugLogA("gg_dounregister(): End.");
#endif
return NULL;
@@ -123,7 +123,7 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) GGTOKEN token;
#ifdef DEBUGMODE
- gg->netlog("gg_dochpass(): Starting.");
+ gg->debugLogA("gg_dochpass(): Starting.");
#endif
if (!uin || !password || !newPass) return NULL;
@@ -144,19 +144,19 @@ void *gg_dochpass(GGPROTO *gg, uin_t uin, char *password, char *newPass) (h && !s) ? http_error_string(h ? h->error : 0) :
(s ? TranslateT("Invalid data entered") : _tcserror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
- gg->netlog("gg_dochpass(): Cannot change password. errno=%d: %s", errno, strerror(errno));
+ gg->debugLogA("gg_dochpass(): Cannot change password. errno=%d: %s", errno, strerror(errno));
}
else
{
gg_pubdir_free(h);
CallService(MS_DB_CRYPT_ENCODESTRING, strlen(newPass) + 1, (LPARAM) newPass);
gg->setString(GG_KEY_PASSWORD, newPass);
- gg->netlog("gg_dochpass(): Password change succesful.");
+ gg->debugLogA("gg_dochpass(): Password change succesful.");
MessageBox(NULL, TranslateT("Your password has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
- gg->netlog("gg_dochpass(): End.");
+ gg->debugLogA("gg_dochpass(): End.");
#endif
return NULL;
@@ -173,7 +173,7 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne GGTOKEN token;
#ifdef DEBUGMODE
- gg->netlog("gg_dochemail(): Starting.");
+ gg->debugLogA("gg_dochemail(): Starting.");
#endif
if (!uin || !email || !newEmail) return NULL;
@@ -186,18 +186,18 @@ void *gg_dochemail(GGPROTO *gg, uin_t uin, char *password, char *email, char *ne mir_sntprintf(error, SIZEOF(error), TranslateT("Your e-mail cannot be changed because of error:\n\t%s"),
(h && !s) ? http_error_string(h ? h->error : 0) : (s ? TranslateT("Bad old e-mail or password") : _tcserror(errno)));
MessageBox(NULL, error, gg->m_tszUserName, MB_OK | MB_ICONSTOP);
- gg->netlog("gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, strerror(errno));
+ gg->debugLogA("gg_dochemail(): Cannot change e-mail. errno=%d: %s", errno, strerror(errno));
}
else
{
gg_pubdir_free(h);
gg->setString(GG_KEY_EMAIL, newEmail);
- gg->netlog("gg_dochemail(): E-mail change succesful.");
+ gg->debugLogA("gg_dochemail(): E-mail change succesful.");
MessageBox(NULL, TranslateT("Your e-mail has been changed."), gg->m_tszUserName, MB_OK | MB_ICONINFORMATION);
}
#ifdef DEBUGMODE
- gg->netlog("gg_dochemail(): End.");
+ gg->debugLogA("gg_dochemail(): End.");
#endif
return NULL;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp index a280009923..9e4218f3dd 100644 --- a/protocols/IRCG/src/commandmonitor.cpp +++ b/protocols/IRCG/src/commandmonitor.cpp @@ -28,8 +28,8 @@ using namespace irc; VOID CALLBACK IdentTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
ppro->KillChatTimer( ppro->IdentTimer );
@@ -42,8 +42,8 @@ VOID CALLBACK IdentTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK TimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
ppro->KillChatTimer( ppro->InitTimer );
@@ -59,8 +59,8 @@ VOID CALLBACK TimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK KeepAliveTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( !ppro->m_sendKeepAlive || ( ppro->m_iStatus == ID_STATUS_OFFLINE || ppro->m_iStatus == ID_STATUS_CONNECTING )) {
@@ -80,8 +80,8 @@ VOID CALLBACK KeepAliveTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK OnlineNotifTimerProc3( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( !ppro->m_channelAwayNotification ||
@@ -123,8 +123,8 @@ VOID CALLBACK OnlineNotifTimerProc3( HWND, UINT, UINT_PTR idEvent, DWORD ) VOID CALLBACK OnlineNotifTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( ppro->m_iStatus == ID_STATUS_OFFLINE || ppro->m_iStatus == ID_STATUS_CONNECTING ||
@@ -1484,7 +1484,7 @@ bool CIrcProto::OnIrc_TOPIC(const CIrcMessage* pmsg) static void __stdcall sttShowDlgList( void* param )
{
- CIrcProto* ppro = ( CIrcProto* )param;
+ CIrcProto *ppro = ( CIrcProto* )param;
if ( ppro->m_listDlg == NULL ) {
ppro->m_listDlg = new CListDlg( ppro );
ppro->m_listDlg->Show();
@@ -1640,7 +1640,7 @@ bool CIrcProto::OnIrc_BANLISTEND(const CIrcMessage* pmsg) static void __stdcall sttShowWhoisWnd( void* param )
{
CIrcMessage* pmsg = ( CIrcMessage* )param;
- CIrcProto* ppro = ( CIrcProto* )pmsg->m_proto;
+ CIrcProto *ppro = ( CIrcProto* )pmsg->m_proto;
if ( ppro->m_whoisDlg == NULL ) {
ppro->m_whoisDlg = new CWhoisDlg( ppro );
ppro->m_whoisDlg->Show();
@@ -1805,7 +1805,7 @@ bool CIrcProto::OnIrc_WHOIS_NO_USER(const CIrcMessage* pmsg) static void __stdcall sttShowNickWnd( void* param )
{
CIrcMessage* pmsg = ( CIrcMessage* )param;
- CIrcProto* ppro = pmsg->m_proto;
+ CIrcProto *ppro = pmsg->m_proto;
if ( ppro->m_nickDlg == NULL ) {
ppro->m_nickDlg = new CNickDlg( ppro );
ppro->m_nickDlg->Show();
@@ -2340,7 +2340,7 @@ void CIrcProto::OnIrcDisconnected() static void __stdcall sttMainThrdOnConnect( void* param )
{
- CIrcProto* ppro = ( CIrcProto* )param;
+ CIrcProto *ppro = ( CIrcProto* )param;
ppro->SetChatTimer( ppro->InitTimer, 1*1000, TimerProc );
if ( ppro->m_identTimer )
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp index 156932e8b8..01bccf2925 100644 --- a/protocols/IRCG/src/input.cpp +++ b/protocols/IRCG/src/input.cpp @@ -196,7 +196,7 @@ CMString CIrcProto::DoIdentifiers( CMString text, const TCHAR* ) static void __stdcall sttSetTimerOn( void* _pro )
{
- CIrcProto* ppro = ( CIrcProto* )_pro;
+ CIrcProto *ppro = ( CIrcProto* )_pro;
ppro->DoEvent( GC_EVENT_INFORMATION, NULL, ppro->m_info.sNick.c_str(), TranslateT( "The buddy check function is enabled"), NULL, NULL, NULL, true, false);
ppro->SetChatTimer( ppro->OnlineNotifTimer, 500, OnlineNotifTimerProc );
if ( ppro->m_channelAwayNotification )
@@ -205,7 +205,7 @@ static void __stdcall sttSetTimerOn( void* _pro ) static void __stdcall sttSetTimerOff( void* _pro )
{
- CIrcProto* ppro = ( CIrcProto* )_pro;
+ CIrcProto *ppro = ( CIrcProto* )_pro;
ppro->DoEvent( GC_EVENT_INFORMATION, NULL, ppro->m_info.sNick.c_str(), TranslateT("The buddy check function is disabled"), NULL, NULL, NULL, true, false);
ppro->KillChatTimer( ppro->OnlineNotifTimer );
ppro->KillChatTimer( ppro->OnlineNotifTimer3 );
@@ -737,14 +737,14 @@ struct DoInputRequestParam str( mir_tstrdup( _str ))
{}
- CIrcProto* ppro;
+ CIrcProto *ppro;
TCHAR* str;
};
static void __stdcall DoInputRequestAliasApcStub( void* _par )
{
DoInputRequestParam* param = ( DoInputRequestParam* )_par;
- CIrcProto* ppro = param->ppro;
+ CIrcProto *ppro = param->ppro;
TCHAR* str = param->str;
TCHAR* infotext = NULL;
diff --git a/protocols/IRCG/src/irc.h b/protocols/IRCG/src/irc.h index 510375eee8..9c1aef10e6 100644 --- a/protocols/IRCG/src/irc.h +++ b/protocols/IRCG/src/irc.h @@ -372,7 +372,7 @@ struct CIrcProto : public PROTO<CIrcProto> DWORD m_bConnectThreadRunning;
HGENMENU hMenuRoot, hMenuQuick, hMenuServer, hMenuJoin, hMenuNick, hMenuList;
- HANDLE hNetlib, hNetlibDCC;
+ HANDLE hNetlibDCC;
bool bTempDisableCheck, bTempForceCheck, bEcho;
bool nickflag;
@@ -474,7 +474,6 @@ struct CIrcProto : public PROTO<CIrcProto> // services.cpp
void ConnectToServer(void);
void DisconnectFromServer(void);
- void DoNetlibLog( const char* fmt, ... );
void InitMainMenus(void);
UINT_PTR RetryTimer;
diff --git a/protocols/IRCG/src/irclib.cpp b/protocols/IRCG/src/irclib.cpp index 78f30e729c..abb59fa2e6 100644 --- a/protocols/IRCG/src/irclib.cpp +++ b/protocols/IRCG/src/irclib.cpp @@ -194,7 +194,7 @@ bool CIrcProto::Connect(const CIrcSessionInfo& info) ncon.cbSize = sizeof(ncon);
ncon.szHost = info.sServer.c_str();
ncon.wPort = info.iPort;
- con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlib, (LPARAM)&ncon);
+ con = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&ncon);
if (con == NULL) {
TCHAR szTemp[300];
mir_sntprintf(szTemp, SIZEOF(szTemp), _T("\0035%s \002%s\002 (%S: %u)."),
@@ -373,9 +373,9 @@ void CIrcProto::DoReceive() nb.pfnNewConnectionV2 = DoIdent;
nb.pExtra = this;
nb.wPort = m_info.iIdentServerPort;
- hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlib, (LPARAM)&nb);
+ hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hNetlibUser, (LPARAM)&nb);
if ( !hBindPort || nb.wPort != m_info.iIdentServerPort ) {
- DoNetlibLog("Error: unable to bind local port %u", m_info.iIdentServerPort);
+ debugLogA("Error: unable to bind local port %u", m_info.iIdentServerPort);
KillIdent();
} }
@@ -702,7 +702,7 @@ void CIrcProto::OnIrcMessage(const CIrcMessage* pmsg) }
__except( EXCEPTION_EXECUTE_HANDLER ) // dedicated to Sava :)
{
- DoNetlibLog( "IRC handler feels sick: %S", pmsg->sCommand.c_str());
+ debugLogA( "IRC handler feels sick: %S", pmsg->sCommand.c_str());
}
}
else // handler not found. call default handler
@@ -1409,7 +1409,7 @@ int CDccSession::Disconnect() VOID CALLBACK DCCTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
+ CIrcProto *ppro = GetTimerOwner( idEvent );
if ( ppro )
ppro->CheckDCCTimeout();
}
@@ -1434,7 +1434,7 @@ void strdel( char* parBuffer, int len ) void DoIdent(HANDLE hConnection, DWORD, void* extra )
{
- CIrcProto* ppro = ( CIrcProto* )extra;
+ CIrcProto *ppro = ( CIrcProto* )extra;
char szBuf[1024];
int cbTotal = 0;
@@ -1454,7 +1454,7 @@ LBL_Parse: EOLPos[0] = EOLPos[1] = '\0';
rtrim( szBuf );
- ppro->DoNetlibLog("Got Ident request: %s", szBuf);
+ ppro->debugLogA("Got Ident request: %s", szBuf);
unsigned int PeerPortNrRcvd = 0, LocalPortNrRcvd = 0;
int iParamCnt = sscanf( szBuf, "%d , %d", &LocalPortNrRcvd, &PeerPortNrRcvd );
@@ -1481,9 +1481,9 @@ LBL_Parse: }
if ( Netlib_Send(hConnection, (const char*)buf, cbLen, 0) > 0)
- ppro->DoNetlibLog("Sent Ident answer: %s", buf);
+ ppro->debugLogA("Sent Ident answer: %s", buf);
else
- ppro->DoNetlibLog("Sending Ident answer failed.");
+ ppro->debugLogA("Sending Ident answer failed.");
if ( ppro->m_identTimer )
break;
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp index 0592354d3a..39e92289f3 100644 --- a/protocols/IRCG/src/ircproto.cpp +++ b/protocols/IRCG/src/ircproto.cpp @@ -149,7 +149,7 @@ CIrcProto::~CIrcProto() con = NULL;
}
- Netlib_CloseHandle(hNetlib); hNetlib = NULL;
+ Netlib_CloseHandle(m_hNetlibUser); m_hNetlibUser = NULL;
Netlib_CloseHandle(hNetlibDCC); hNetlibDCC = NULL;
m_dcc_chats.destroy();
@@ -201,7 +201,7 @@ int CIrcProto::OnModulesLoaded( WPARAM, LPARAM ) nlu.szSettingsModule = m_szModuleName;
mir_sntprintf( name, SIZEOF(name), TranslateT("%s server connection"), m_tszUserName);
nlu.ptszDescriptiveName = name;
- hNetlib = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
nlu.flags = NUF_OUTGOING|NUF_INCOMING|NUF_HTTPCONNS|NUF_TCHAR;
char szTemp2[256];
diff --git a/protocols/IRCG/src/main.cpp b/protocols/IRCG/src/main.cpp index 88e3fe181b..88f151671b 100644 --- a/protocols/IRCG/src/main.cpp +++ b/protocols/IRCG/src/main.cpp @@ -75,12 +75,12 @@ extern "C" __declspec(dllexport) const MUUID MirandaInterfaces[] = {MIID_PROTOCO static CIrcProto* ircProtoInit( const char* pszProtoName, const TCHAR* tszUserName )
{
- CIrcProto* ppro = new CIrcProto( pszProtoName, tszUserName );
+ CIrcProto *ppro = new CIrcProto( pszProtoName, tszUserName );
g_Instances.insert( ppro );
return ppro;
}
-static int ircProtoUninit( CIrcProto* ppro )
+static int ircProtoUninit( CIrcProto *ppro )
{
g_Instances.remove(( CIrcProto* )ppro);
delete ppro;
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp index b59a589a7b..4631eda7ff 100644 --- a/protocols/IRCG/src/services.cpp +++ b/protocols/IRCG/src/services.cpp @@ -105,25 +105,25 @@ static CIrcProto* IrcGetInstanceByHContact(HANDLE hContact) static INT_PTR IrcMenuChanSettings(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuChanSettings(wParam, lParam) : 0;
}
static INT_PTR IrcMenuWhois(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuWhois(wParam, lParam) : 0;
}
static INT_PTR IrcMenuDisconnect(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuDisconnect(wParam, lParam) : 0;
}
static INT_PTR IrcMenuIgnore(WPARAM wParam, LPARAM lParam)
{
- CIrcProto* ppro = IrcGetInstanceByHContact((HANDLE)wParam);
+ CIrcProto *ppro = IrcGetInstanceByHContact((HANDLE)wParam);
return (ppro) ? ppro->OnMenuIgnore(wParam, lParam) : 0;
}
@@ -1197,8 +1197,8 @@ INT_PTR __cdecl CIrcProto::GetMyAwayMsg(WPARAM wParam,LPARAM lParam) VOID CALLBACK RetryTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD )
{
- CIrcProto* ppro = GetTimerOwner( idEvent );
- if ( !ppro )
+ CIrcProto *ppro = GetTimerOwner( idEvent );
+ if (ppro == NULL)
return;
if ( ppro->m_iRetryCount <= StrToInt( ppro->m_retryCount) && ppro->m_retry ) {
@@ -1222,15 +1222,3 @@ VOID CALLBACK RetryTimerProc( HWND, UINT, UINT_PTR idEvent, DWORD ) }
else ppro->KillChatTimer( ppro->RetryTimer );
}
-
-// logs text into NetLib (stolen from Jabber ;))
-void CIrcProto::DoNetlibLog( 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)hNetlib, (LPARAM)str);
-}
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp index 76e89c81f0..f477221510 100644 --- a/protocols/IRCG/src/tools.cpp +++ b/protocols/IRCG/src/tools.cpp @@ -554,7 +554,7 @@ struct TimerPair {}
UINT_PTR idEvent;
- CIrcProto* ppro;
+ CIrcProto *ppro;
};
static int CompareTimers( const TimerPair* p1, const TimerPair* p2 )
diff --git a/protocols/IRCG/src/userinfo.cpp b/protocols/IRCG/src/userinfo.cpp index e3ac6f23c3..b693d06d9e 100644 --- a/protocols/IRCG/src/userinfo.cpp +++ b/protocols/IRCG/src/userinfo.cpp @@ -31,7 +31,7 @@ struct UserDetailsDlgProcParam hContact( _info )
{}
- CIrcProto* ppro;
+ CIrcProto *ppro;
HANDLE hContact;
};
diff --git a/protocols/IcqOscarJ/src/capabilities.cpp b/protocols/IcqOscarJ/src/capabilities.cpp index 4c374ed492..e1b8b47a94 100644 --- a/protocols/IcqOscarJ/src/capabilities.cpp +++ b/protocols/IcqOscarJ/src/capabilities.cpp @@ -96,7 +96,7 @@ void NetLog_CapabilityChange(CIcqProto *ppro, const char *szChange, DWORD fdwCap }
}
// Log the change
- ppro->NetLog_Server("Capabilities: %s %s", szChange, szBuffer);
+ ppro->debugLogA("Capabilities: %s %s", szChange, szBuffer);
}
#endif
diff --git a/protocols/IcqOscarJ/src/chan_01login.cpp b/protocols/IcqOscarJ/src/chan_01login.cpp index 3c4c4febc6..b8444f228e 100644 --- a/protocols/IcqOscarJ/src/chan_01login.cpp +++ b/protocols/IcqOscarJ/src/chan_01login.cpp @@ -35,7 +35,7 @@ void CIcqProto::handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *i icq_packet packet;
#ifdef _DEBUG
- NetLog_Server("Received SRV_HELLO from %s", info->isLoginServer ? "login server" : "communication server");
+ debugLogA("Received SRV_HELLO from %s", info->isLoginServer ? "login server" : "communication server");
#endif
// isLoginServer is "1" if we just received SRV_HELLO
@@ -47,7 +47,7 @@ void CIcqProto::handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *i WORD wUinLen;
#ifdef _DEBUG
- NetLog_Server("Sending %s to %s", "CLI_HELLO", "login server");
+ debugLogA("Sending %s to %s", "CLI_HELLO", "login server");
#endif
packet.wLen = 12;
write_flap(&packet, ICQ_LOGIN_CHAN);
@@ -57,7 +57,7 @@ void CIcqProto::handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *i wUinLen = strlennull(strUID(m_dwLocalUIN, szUin));
#ifdef _DEBUG
- NetLog_Server("Sending %s to %s", "ICQ_SIGNON_AUTH_REQUEST", "login server");
+ debugLogA("Sending %s to %s", "ICQ_SIGNON_AUTH_REQUEST", "login server");
#endif
serverPacketInit(&packet, (WORD)(14 + wUinLen));
@@ -69,7 +69,7 @@ void CIcqProto::handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *i {
sendClientAuth((char*)info->szAuthKey, info->wAuthKeyLen, FALSE);
#ifdef _DEBUG
- NetLog_Server("Sent CLI_IDENT to %s", "login server");
+ debugLogA("Sent CLI_IDENT to %s", "login server");
#endif
}
@@ -90,7 +90,7 @@ void CIcqProto::handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *i sendServPacket(&packet);
#ifdef _DEBUG
- NetLog_Server("Sent CLI_IDENT to %s", "communication server");
+ debugLogA("Sent CLI_IDENT to %s", "communication server");
#endif
SAFE_FREE((void**)&info->cookieData);
@@ -99,7 +99,7 @@ void CIcqProto::handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *i else
{
// We need a cookie to identify us to the communication server
- NetLog_Server("Error: Connected to %s without a cookie!", "communication server");
+ debugLogA("Error: Connected to %s without a cookie!", "communication server");
}
}
}
diff --git a/protocols/IcqOscarJ/src/chan_02data.cpp b/protocols/IcqOscarJ/src/chan_02data.cpp index d55e0262e9..2c40d0902b 100644 --- a/protocols/IcqOscarJ/src/chan_02data.cpp +++ b/protocols/IcqOscarJ/src/chan_02data.cpp @@ -36,15 +36,15 @@ void CIcqProto::handleDataChannel(BYTE *pBuffer, WORD wBufferLength, serverthrea if (!unpackSnacHeader(&snacHeader, &pBuffer, &wBufferLength) || !snacHeader.bValid)
{
- NetLog_Server("Error: Failed to parse SNAC header");
+ debugLogA("Error: Failed to parse SNAC header");
}
else
{
#ifdef _DEBUG
if (snacHeader.wFlags & 0x8000)
- NetLog_Server(" Received SNAC(x%02X,x%02X), version %u", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wVersion);
+ debugLogA(" Received SNAC(x%02X,x%02X), version %u", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wVersion);
else
- NetLog_Server(" Received SNAC(x%02X,x%02X)", snacHeader.wFamily, snacHeader.wSubtype);
+ debugLogA(" Received SNAC(x%02X,x%02X)", snacHeader.wFamily, snacHeader.wSubtype);
#endif
switch (snacHeader.wFamily) {
@@ -90,7 +90,7 @@ void CIcqProto::handleDataChannel(BYTE *pBuffer, WORD wBufferLength, serverthrea break;
default:
- NetLog_Server("Ignoring SNAC(x%02X,x%02X) - FAMILYx%02X not implemented", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wFamily);
+ debugLogA("Ignoring SNAC(x%02X,x%02X) - FAMILYx%02X not implemented", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wFamily);
break;
}
@@ -218,5 +218,5 @@ void CIcqProto::LogFamilyError(WORD wFamily, WORD wError) default: msg = ""; break;
}
- NetLog_Server("SNAC(x%02X,x01) - Error(%u): %s", wFamily, wError, msg);
+ debugLogA("SNAC(x%02X,x01) - Error(%u): %s", wFamily, wError, msg);
}
diff --git a/protocols/IcqOscarJ/src/chan_03error.cpp b/protocols/IcqOscarJ/src/chan_03error.cpp index 71c6e2ea7c..a4119f2aa9 100644 --- a/protocols/IcqOscarJ/src/chan_03error.cpp +++ b/protocols/IcqOscarJ/src/chan_03error.cpp @@ -31,5 +31,5 @@ void CIcqProto::handleErrorChannel(unsigned char* buf, WORD datalen)
{
- NetLog_Server("Ignoring server packet on ERROR channel");
+ debugLogA("Ignoring server packet on ERROR channel");
}
diff --git a/protocols/IcqOscarJ/src/chan_04close.cpp b/protocols/IcqOscarJ/src/chan_04close.cpp index 8158e2767c..0eb714feae 100644 --- a/protocols/IcqOscarJ/src/chan_04close.cpp +++ b/protocols/IcqOscarJ/src/chan_04close.cpp @@ -85,7 +85,7 @@ void CIcqProto::handleLoginReply(BYTE *buf, WORD datalen, serverthread_info *inf if (!(chain = readIntoTLVChain(&buf, datalen, 0)))
{
- NetLog_Server("Error: Missing chain on close channel");
+ debugLogA("Error: Missing chain on close channel");
NetLib_CloseConnection(&hServerConn, TRUE);
return; // Invalid data
}
@@ -129,7 +129,7 @@ void CIcqProto::handleLoginReply(BYTE *buf, WORD datalen, serverthread_info *inf return; // Failure
}
- NetLog_Server("Authenticated.");
+ debugLogA("Authenticated.");
info->newServerReady = 1;
return;
@@ -154,9 +154,9 @@ int CIcqProto::connectNewServer(serverthread_info *info) NetLib_SafeCloseHandle(&info->hPacketRecver);
NetLib_CloseConnection(&hServerConn, TRUE);
- NetLog_Server("Closed connection to login server");
+ debugLogA("Closed connection to login server");
- hServerConn = NetLib_OpenConnection(m_hServerNetlibUser, NULL, &nloc);
+ hServerConn = NetLib_OpenConnection(m_hNetlibUser, NULL, &nloc);
if (hServerConn && info->newServerSSL)
{ /* Start SSL session if requested */
if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)hServerConn, 0))
@@ -169,7 +169,7 @@ int CIcqProto::connectNewServer(serverthread_info *info) info->hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 0x2400);
if (!info->hPacketRecver)
{
- NetLog_Server("Error: Failed to create packet receiver.");
+ debugLogA("Error: Failed to create packet receiver.");
}
else // we need to reset receiving structs
{
@@ -180,7 +180,7 @@ int CIcqProto::connectNewServer(serverthread_info *info) }
else
{ // TODO: We should really do some checks here
- NetLog_Server("Walking in Gateway to %s", info->newServer);
+ debugLogA("Walking in Gateway to %s", info->newServer);
// TODO: This REQUIRES more work (most probably some kind of mid-netlib module)
icq_httpGatewayWalkTo(hServerConn, &nloc);
res = 1;
@@ -198,7 +198,7 @@ int CIcqProto::connectNewServer(serverthread_info *info) void CIcqProto::handleMigration(serverthread_info *info)
{
// Check the data that was saved when the migration was announced
- NetLog_Server("Migrating to %s", info->newServer);
+ debugLogA("Migrating to %s", info->newServer);
if (!info->newServer || !info->cookieData)
{
icq_LogMessage(LOG_FATAL, LPGEN("You have been disconnected from the ICQ network because the current server shut down."));
diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp index e74071dc4b..7bb06d9a43 100644 --- a/protocols/IcqOscarJ/src/chan_05ping.cpp +++ b/protocols/IcqOscarJ/src/chan_05ping.cpp @@ -32,7 +32,7 @@ void CIcqProto::handlePingChannel(BYTE *buf, WORD datalen)
{
- NetLog_Server("Warning: Ignoring server packet on PING channel");
+ debugLogA("Warning: Ignoring server packet on PING channel");
}
@@ -42,7 +42,7 @@ void __cdecl CIcqProto::KeepAliveThread(void *arg) icq_packet packet;
DWORD dwInterval = getDword("KeepAliveInterval", KEEPALIVE_INTERVAL);
- NetLog_Server("Keep alive thread starting.");
+ debugLogA("Keep alive thread starting.");
info->hKeepAliveEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
@@ -65,7 +65,7 @@ void __cdecl CIcqProto::KeepAliveThread(void *arg) break;
}
- NetLog_Server("Keep alive thread ended.");
+ debugLogA("Keep alive thread ended.");
CloseHandle(info->hKeepAliveEvent);
info->hKeepAliveEvent = NULL;
diff --git a/protocols/IcqOscarJ/src/fam_01service.cpp b/protocols/IcqOscarJ/src/fam_01service.cpp index 3e5c091ea8..1bba5e3149 100644 --- a/protocols/IcqOscarJ/src/fam_01service.cpp +++ b/protocols/IcqOscarJ/src/fam_01service.cpp @@ -40,8 +40,8 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header case ICQ_SERVER_READY:
#ifdef _DEBUG
- NetLog_Server("Server is ready and is requesting my Family versions");
- NetLog_Server("Sending my Families");
+ debugLogA("Server is ready and is requesting my Family versions");
+ debugLogA("Sending my Families");
#endif
// This packet is a response to SRV_FAMILIES SNAC(1,3).
@@ -69,8 +69,8 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header /* This is a reply to CLI_FAMILIES and it tells the client which families and their versions that this server understands.
* We send a rate request packet */
#ifdef _DEBUG
- NetLog_Server("Server told me his Family versions");
- NetLog_Server("Requesting Rate Information");
+ debugLogA("Server told me his Family versions");
+ debugLogA("Requesting Rate Information");
#endif
serverPacketInit(&packet, 10);
packFNACHeader(&packet, ICQ_SERVICE_FAMILY, ICQ_CLIENT_REQ_RATE_INFO);
@@ -79,20 +79,20 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header case ICQ_SERVER_RATE_INFO:
#ifdef _DEBUG
- NetLog_Server("Server sent Rate Info");
+ debugLogA("Server sent Rate Info");
#endif
/* init rates management */
m_rates = new rates(this, pBuffer, wBufferLength);
/* ack rate levels */
#ifdef _DEBUG
- NetLog_Server("Sending Rate Info Ack");
+ debugLogA("Sending Rate Info Ack");
#endif
m_rates->initAckPacket(&packet);
sendServPacket(&packet);
/* CLI_REQINFO - This command requests from the server certain information about the client that is stored on the server. */
#ifdef _DEBUG
- NetLog_Server("Sending CLI_REQINFO");
+ debugLogA("Sending CLI_REQINFO");
#endif
serverPacketInit(&packet, 10);
packFNACHeader(&packet, ICQ_SERVICE_FAMILY, ICQ_CLIENT_REQINFO);
@@ -108,7 +108,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header // CLI_REQLISTS - we want to use SSI
#ifdef _DEBUG
- NetLog_Server("Requesting roster rights");
+ debugLogA("Requesting roster rights");
#endif
serverPacketInit(&packet, 16);
packFNACHeader(&packet, ICQ_LISTS_FAMILY, ICQ_LISTS_CLI_REQLISTS);
@@ -118,7 +118,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header if (!wRecordCount) // CLI_REQROSTER
{ // we do not have any data - request full list
#ifdef _DEBUG
- NetLog_Server("Requesting full roster");
+ debugLogA("Requesting full roster");
#endif
serverPacketInit(&packet, 10);
ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
@@ -136,7 +136,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header else // CLI_CHECKROSTER
{
#ifdef _DEBUG
- NetLog_Server("Requesting roster check");
+ debugLogA("Requesting roster check");
#endif
serverPacketInit(&packet, 16);
ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
@@ -166,7 +166,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header // CLI_REQLOCATION
#ifdef _DEBUG
- NetLog_Server("Requesting Location rights");
+ debugLogA("Requesting Location rights");
#endif
serverPacketInit(&packet, 10);
packFNACHeader(&packet, ICQ_LOCATION_FAMILY, ICQ_LOCATION_CLI_REQ_RIGHTS);
@@ -174,7 +174,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header // CLI_REQBUDDY
#ifdef _DEBUG
- NetLog_Server("Requesting Client-side contactlist rights");
+ debugLogA("Requesting Client-side contactlist rights");
#endif
serverPacketInit(&packet, 16);
packFNACHeader(&packet, ICQ_BUDDY_FAMILY, ICQ_USER_CLI_REQBUDDY);
@@ -187,7 +187,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header // CLI_REQICBM
#ifdef _DEBUG
- NetLog_Server("Sending CLI_REQICBM");
+ debugLogA("Sending CLI_REQICBM");
#endif
serverPacketInit(&packet, 10);
packFNACHeader(&packet, ICQ_MSG_FAMILY, ICQ_MSG_CLI_REQICBM);
@@ -195,7 +195,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header // CLI_REQBOS
#ifdef _DEBUG
- NetLog_Server("Sending CLI_REQBOS");
+ debugLogA("Sending CLI_REQBOS");
#endif
serverPacketInit(&packet, 10);
packFNACHeader(&packet, ICQ_BOS_FAMILY, ICQ_PRIVACY_REQ_RIGHTS);
@@ -203,7 +203,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header break;
case ICQ_SERVER_PAUSE:
- NetLog_Server("Server is going down in a few seconds... (Flags: %u)", pSnacHeader->wFlags);
+ debugLogA("Server is going down in a few seconds... (Flags: %u)", pSnacHeader->wFlags);
// This is the list of groups that we want to have on the next server
serverPacketInit(&packet, 30);
packFNACHeader(&packet, ICQ_SERVICE_FAMILY, ICQ_CLIENT_PAUSE_ACK);
@@ -219,14 +219,14 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header packWord(&packet,ICQ_STATS_FAMILY);
sendServPacket(&packet);
#ifdef _DEBUG
- NetLog_Server("Sent server pause ack");
+ debugLogA("Sent server pause ack");
#endif
break;
case ICQ_SERVER_MIGRATIONREQ:
{
#ifdef _DEBUG
- NetLog_Server("Server migration requested (Flags: %u)", pSnacHeader->wFlags);
+ debugLogA("Server migration requested (Flags: %u)", pSnacHeader->wFlags);
#endif
pBuffer += 2; // Unknown, seen: 0
wBufferLength -= 2;
@@ -253,7 +253,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header return;
}
- NetLog_Server("Migration has started. New server will be %s", info->newServer);
+ debugLogA("Migration has started. New server will be %s", info->newServer);
m_iDesiredStatus = m_iStatus;
SetCurrentStatus(ID_STATUS_CONNECTING); // revert to connecting state
@@ -269,7 +269,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header oscar_tlv_chain *chain;
#ifdef _DEBUG
- NetLog_Server("Received self info");
+ debugLogA("Received self info");
#endif
unpackByte(&pBuffer, &bUinLen);
pBuffer += bUinLen;
@@ -336,14 +336,14 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header { // this is only the simplest solution, needs rate management to every section
ProtoBroadcastAck(NULL, ICQACKTYPE_RATEWARNING, ACKRESULT_STATUS, (HANDLE)wClass, wStatus);
if (wStatus == 2)
- NetLog_Server("Rates #%u: Alert", wClass);
+ debugLogA("Rates #%u: Alert", wClass);
else
- NetLog_Server("Rates #%u: Limit", wClass);
+ debugLogA("Rates #%u: Limit", wClass);
}
else if (wStatus == 4)
{
ProtoBroadcastAck(NULL, ICQACKTYPE_RATEWARNING, ACKRESULT_STATUS, (HANDLE)wClass, wStatus);
- NetLog_Server("Rates #%u: Clear", wClass);
+ debugLogA("Rates #%u: Clear", wClass);
}
}
@@ -356,7 +356,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header if (!(pChain = readIntoTLVChain(&pBuffer, wBufferLength, 0)))
{
- NetLog_Server("Received Broken Redirect Service SNAC(1,5).");
+ debugLogA("Received Broken Redirect Service SNAC(1,5).");
break;
}
WORD wFamily = pChain->getWord(0x0D, 1);
@@ -365,7 +365,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header if ((!FindCookie(pSnacHeader->dwRef, NULL, (void**)&pCookieData)) || (pCookieData->wFamily != wFamily))
{
disposeChain(&pChain);
- NetLog_Server("Received unexpected SNAC(1,5), skipping.");
+ debugLogA("Received unexpected SNAC(1,5), skipping.");
break;
}
@@ -379,7 +379,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header if (!pServer || !pCookie)
{
- NetLog_Server("Server returned invalid data, family unavailable.");
+ debugLogA("Server returned invalid data, family unavailable.");
SAFE_FREE(&pServer);
SAFE_FREE(&pCookie);
@@ -399,20 +399,20 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header nloc.szHost = pServer;
nloc.wPort = wPort;
- HANDLE hConnection = NetLib_OpenConnection(m_hServerNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : NULL, &nloc);
+ HANDLE hConnection = NetLib_OpenConnection(m_hNetlibUser, wFamily == ICQ_AVATAR_FAMILY ? "Avatar " : NULL, &nloc);
if (hConnection == NULL)
{
- NetLog_Server("Unable to connect to ICQ new family server.");
+ debugLogA("Unable to connect to ICQ new family server.");
} // we want the handler to be called even if the connecting failed
else if (bServerSSL)
{ /* Start SSL session if requested */
#ifdef _DEBUG
- NetLog_Server("(%d) Starting SSL negotiation", CallService(MS_NETLIB_GETSOCKET, (WPARAM)hConnection, 0));
+ debugLogA("(%d) Starting SSL negotiation", CallService(MS_NETLIB_GETSOCKET, (WPARAM)hConnection, 0));
#endif
if (!CallService(MS_NETLIB_STARTSSL, (WPARAM)hConnection, 0))
{
- NetLog_Server("Unable to connect to ICQ new family server, SSL could not be negotiated");
+ debugLogA("Unable to connect to ICQ new family server, SSL could not be negotiated");
NetLib_CloseConnection(&hConnection, FALSE);
}
}
@@ -432,7 +432,7 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header case ICQ_SERVER_EXTSTATUS: // our session data
{
#ifdef _DEBUG
- NetLog_Server("Received owner session data.");
+ debugLogA("Received owner session data.");
#endif
while (wBufferLength > 4)
{ // loop thru all items
@@ -443,13 +443,13 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header if (itemType == AVATAR_HASH_PHOTO) /// TODO: handle photo item
{ // skip photo item
#ifdef _DEBUG
- NetLog_Server("Photo item recognized");
+ debugLogA("Photo item recognized");
#endif
}
else if ((itemType == AVATAR_HASH_STATIC || itemType == AVATAR_HASH_FLASH) && (itemLen >= 0x10))
{
#ifdef _DEBUG
- NetLog_Server("Avatar item recognized");
+ debugLogA("Avatar item recognized");
#endif
if (m_bAvatarsEnabled && !info->bMyAvatarInited) // signal the server after login
{ // this refreshes avatar state - it used to work automatically, but now it does not
@@ -476,13 +476,13 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header else if (itemType == 0x02)
{
#ifdef _DEBUG
- NetLog_Server("Status message item recognized");
+ debugLogA("Status message item recognized");
#endif
}
else if (itemType == 0x0E)
{
#ifdef _DEBUG
- NetLog_Server("Status mood item recognized");
+ debugLogA("Status mood item recognized");
#endif
}
@@ -517,12 +517,12 @@ void CIcqProto::handleServiceFam(BYTE *pBuffer, WORD wBufferLength, snac_header // Stuff we don't care about
case ICQ_SERVER_MOTD:
#ifdef _DEBUG
- NetLog_Server("Server message of the day");
+ debugLogA("Server message of the day");
#endif
break;
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_SERVICE_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_SERVICE_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
@@ -925,7 +925,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) sendServPacket(&packet);
- NetLog_Server(" *** Yeehah, login sequence complete");
+ debugLogA(" *** Yeehah, login sequence complete");
// login sequence is complete enter logged-in mode
info->bLoggedIn = 1;
@@ -963,7 +963,7 @@ void CIcqProto::handleServUINSettings(int nPort, serverthread_info *info) icq_requestnewfamily(ICQ_AVATAR_FAMILY, &CIcqProto::StartAvatarThread);
m_avatarsConnectionPending = TRUE;
- NetLog_Server("Requesting Avatar family entry point.");
+ debugLogA("Requesting Avatar family entry point.");
}
// Set last xstatus
diff --git a/protocols/IcqOscarJ/src/fam_02location.cpp b/protocols/IcqOscarJ/src/fam_02location.cpp index 1913681070..e360b9dc8b 100644 --- a/protocols/IcqOscarJ/src/fam_02location.cpp +++ b/protocols/IcqOscarJ/src/fam_02location.cpp @@ -37,7 +37,7 @@ void CIcqProto::handleLocationFam(BYTE *pBuffer, WORD wBufferLength, snac_header switch (pSnacHeader->wSubtype) {
case ICQ_LOCATION_RIGHTS_REPLY: // Reply to CLI_REQLOCATION
- NetLog_Server("Server sent SNAC(x02,x03) - SRV_LOCATION_RIGHTS_REPLY");
+ debugLogA("Server sent SNAC(x02,x03) - SRV_LOCATION_RIGHTS_REPLY");
break;
case ICQ_LOCATION_USR_INFO_REPLY: // AIM user info reply
@@ -71,7 +71,7 @@ void CIcqProto::handleLocationFam(BYTE *pBuffer, WORD wBufferLength, snac_header }
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_LOCATION_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_LOCATION_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -132,20 +132,20 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie if (hContact == INVALID_HANDLE_VALUE)
{
#ifdef _DEBUG
- NetLog_Server("Ignoring away reply (%s)", strUID(dwUIN, szUID));
+ debugLogA("Ignoring away reply (%s)", strUID(dwUIN, szUID));
#endif
return;
}
if (!FindCookie(dwCookie, &hCookieContact, (void**)&pCookieData))
{
- NetLog_Server("Error: Received unexpected away reply from %s", strUID(dwUIN, szUID));
+ debugLogA("Error: Received unexpected away reply from %s", strUID(dwUIN, szUID));
return;
}
if (hContact != hCookieContact)
{
- NetLog_Server("Error: Away reply Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact);
+ debugLogA("Error: Away reply Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact);
ReleaseCookie(dwCookie); // This could be a bad idea, but I think it is safe
return;
@@ -225,7 +225,7 @@ void CIcqProto::handleLocationUserInfoReply(BYTE* buf, WORD wLen, DWORD dwCookie status = AwayMsgTypeToStatus(pCookieData->nAckType);
if (status == ID_STATUS_OFFLINE)
{
- NetLog_Server("SNAC(2.6) Ignoring unknown status message from %s", strUID(dwUIN, szUID));
+ debugLogA("SNAC(2.6) Ignoring unknown status message from %s", strUID(dwUIN, szUID));
ReleaseCookie(dwCookie);
return;
diff --git a/protocols/IcqOscarJ/src/fam_03buddy.cpp b/protocols/IcqOscarJ/src/fam_03buddy.cpp index 44c285c446..94f5e1c930 100644 --- a/protocols/IcqOscarJ/src/fam_03buddy.cpp +++ b/protocols/IcqOscarJ/src/fam_03buddy.cpp @@ -66,7 +66,7 @@ void CIcqProto::handleBuddyFam(BYTE *pBuffer, WORD wBufferLength, snac_header *p }
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_BUDDY_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_BUDDY_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -82,15 +82,15 @@ void CIcqProto::handleReplyBuddy(BYTE *buf, WORD wPackLen) DWORD wMaxWatchers = pChain->getWord(2, 1);
DWORD wMaxTemporary = pChain->getWord(4, 1);
- NetLog_Server("MaxUINs %u", wMaxUins);
- NetLog_Server("MaxWatchers %u", wMaxWatchers);
- NetLog_Server("MaxTemporary %u", wMaxTemporary);
+ debugLogA("MaxUINs %u", wMaxUins);
+ debugLogA("MaxWatchers %u", wMaxWatchers);
+ debugLogA("MaxTemporary %u", wMaxTemporary);
disposeChain(&pChain);
}
else
{
- NetLog_Server("Error: Malformed BuddyReply");
+ debugLogA("Error: Malformed BuddyReply");
}
}
@@ -200,7 +200,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) if (hContact == INVALID_HANDLE_VALUE)
{
#ifdef _DEBUG
- NetLog_Server("Ignoring user online (%s)", strUID(dwUIN, szUID));
+ debugLogA("Ignoring user online (%s)", strUID(dwUIN, szUID));
#endif
return;
}
@@ -295,8 +295,8 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) }
#ifdef _DEBUG
- NetLog_Server("Flags are %x", wStatusFlags);
- NetLog_Server("Status is %x", wStatus);
+ debugLogA("Flags are %x", wStatusFlags);
+ debugLogA("Status is %x", wStatus);
#endif
// Get IP TLV
@@ -322,10 +322,10 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) #ifdef _DEBUG
if (wIdleTimer)
- NetLog_Server("Idle timer is %u.", wIdleTimer);
- NetLog_Server("Online since %s", time2text(dwOnlineSince));
+ debugLogA("Idle timer is %u.", wIdleTimer);
+ debugLogA("Online since %s", time2text(dwOnlineSince));
if (dwAwaySince)
- NetLog_Server("Status was set on %s", time2text(dwAwaySince));
+ debugLogA("Status was set on %s", time2text(dwAwaySince));
#endif
// Check client capabilities
@@ -396,7 +396,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) }
}
#ifdef _DEBUG
- NetLog_Server("Detected %d capability items.", capLen / BINARY_CAP_SIZE);
+ debugLogA("Detected %d capability items.", capLen / BINARY_CAP_SIZE);
#endif
}
@@ -417,7 +417,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) ClearAllContactCapabilities(hContact);
// no capability
- NetLog_Server("No capability info TLVs");
+ debugLogA("No capability info TLVs");
szClient = detectUserClient(hContact, nIsICQ, wClass, dwOnlineSince, NULL, wVersion, dwFT1, dwFT2, dwFT3, nTCPFlag, dwDirectConnCookie, dwWebPort, NULL, capLen, &bClientId, szStrBuf);
}
@@ -443,9 +443,9 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) #ifdef _DEBUG
if (wOldStatus == ID_STATUS_OFFLINE) {
if (CheckContactCapabilities(hContact, CAPF_SRV_RELAY))
- NetLog_Server("Supports advanced messages");
+ debugLogA("Supports advanced messages");
else
- NetLog_Server("Does NOT support advanced messages");
+ debugLogA("Does NOT support advanced messages");
}
#endif
@@ -456,13 +456,13 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) ClearContactCapabilities(hContact, CAPF_SRV_RELAY);
if (dwUIN && wOldStatus == ID_STATUS_OFFLINE)
- NetLog_Server("Logged in with AIM client");
+ debugLogA("Logged in with AIM client");
}
if (nIsICQ && wVersion < 8) {
ClearContactCapabilities(hContact, CAPF_SRV_RELAY);
if (wOldStatus == ID_STATUS_OFFLINE)
- NetLog_Server("Forcing simple messages due to compability issues");
+ debugLogA("Forcing simple messages due to compability issues");
}
// Process Avatar Hash
@@ -535,16 +535,16 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) if (wOldStatus != IcqStatusToMiranda(wStatus)) {
// And a small log notice... if status was changed
if (nIsICQ)
- NetLog_Server("%u changed status to %S (v%d).", dwUIN, ptszStatus, wVersion);
+ debugLogA("%u changed status to %S (v%d).", dwUIN, ptszStatus, wVersion);
else
- NetLog_Server("%s changed status to %S.", strUID(dwUIN, szUID), ptszStatus);
+ debugLogA("%s changed status to %S.", strUID(dwUIN, szUID), ptszStatus);
}
#ifdef _DEBUG
else {
if (nIsICQ)
- NetLog_Server("%u has status %s (v%d).", dwUIN, ptszStatus, wVersion);
+ debugLogA("%u has status %s (v%d).", dwUIN, ptszStatus, wVersion);
else
- NetLog_Server("%s has status %s.", strUID(dwUIN, szUID), ptszStatus);
+ debugLogA("%s has status %s.", strUID(dwUIN, szUID), ptszStatus);
}
#endif
@@ -558,7 +558,7 @@ void CIcqProto::handleUserOnline(BYTE *buf, WORD wLen, serverthread_info *info) ShowPopupMsg(hContact, LPGEN("Spambot Detected"), LPGEN("Contact deleted & further events blocked."), POPTYPE_SPAM);
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- NetLog_Server("Contact %u deleted", dwUIN);
+ debugLogA("Contact %u deleted", dwUIN);
}
}
}
@@ -645,7 +645,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen) if (wOldStatus != ID_STATUS_OFFLINE)
{
- NetLog_Server("%s went offline.", strUID(dwUIN, szUID));
+ debugLogA("%s went offline.", strUID(dwUIN, szUID));
setWord(hContact, "Status", ID_STATUS_OFFLINE);
// close Direct Connections to that user
@@ -655,7 +655,7 @@ void CIcqProto::handleUserOffline(BYTE *buf, WORD wLen) }
#ifdef _DEBUG
else
- NetLog_Server("%s is offline.", strUID(dwUIN, szUID));
+ debugLogA("%s is offline.", strUID(dwUIN, szUID));
#endif
}
@@ -727,7 +727,7 @@ void CIcqProto::parseStatusNote(DWORD dwUin, char *szUid, HANDLE hContact, oscar DBVARIANT dbv = {DBVT_DELETED};
if (strlennull(szStatusNote) || (!getString(hContact, DBSETTING_STATUS_NOTE, &dbv) && (dbv.type == DBVT_ASCIIZ || dbv.type == DBVT_UTF8) && strlennull(dbv.pszVal)))
- NetLog_Server("%s changed status note to \"%s\"", strUID(dwUin, szUid), szStatusNote ? szStatusNote : "");
+ debugLogA("%s changed status note to \"%s\"", strUID(dwUin, szUid), szStatusNote ? szStatusNote : "");
db_free(&dbv);
@@ -766,5 +766,5 @@ void CIcqProto::handleNotifyRejected(BYTE *buf, WORD wPackLen) while (wPackLen)
if (unpackUID(&buf, &wPackLen, &dwUIN, &szUID))
- NetLog_Server("%s status notification rejected.", strUID(dwUIN, szUID));
+ debugLogA("%s status notification rejected.", strUID(dwUIN, szUID));
}
diff --git a/protocols/IcqOscarJ/src/fam_04message.cpp b/protocols/IcqOscarJ/src/fam_04message.cpp index d11a36b83a..996f991394 100644 --- a/protocols/IcqOscarJ/src/fam_04message.cpp +++ b/protocols/IcqOscarJ/src/fam_04message.cpp @@ -67,7 +67,7 @@ void CIcqProto::handleMsgFam(BYTE *pBuffer, WORD wBufferLength, snac_header *pSn break;
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_MSG_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_MSG_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -117,7 +117,7 @@ void CIcqProto::handleRecvServMsg(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef if (wLen < 11)
{ // just do some basic packet checking
- NetLog_Server("Error: Malformed message thru server");
+ debugLogA("Error: Malformed message thru server");
return;
}
@@ -137,13 +137,13 @@ void CIcqProto::handleRecvServMsg(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef if (dwUin && IsOnSpammerList(dwUin))
{
- NetLog_Server("Ignored Message from known Spammer");
+ debugLogA("Ignored Message from known Spammer");
return;
}
if (wLen < 4)
{ // just do some basic packet checking
- NetLog_Server("Error: Malformed message thru server");
+ debugLogA("Error: Malformed message thru server");
return;
}
@@ -193,7 +193,7 @@ void CIcqProto::handleRecvServMsg(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwRef break;
default:
- NetLog_Server("Unknown format message thru server - Ref %u, Type: %u, UID: %s", dwRef, wMessageFormat, strUID(dwUin, szUID));
+ debugLogA("Unknown format message thru server - Ref %u, Type: %u, UID: %s", dwRef, wMessageFormat, strUID(dwUin, szUID));
break;
}
@@ -220,13 +220,13 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * if (wLen < 4)
{ // just perform basic structure check
- NetLog_Server("Message (format %u) - Ignoring empty message", 1);
+ debugLogA("Message (format %u) - Ignoring empty message", 1);
return;
}
// Unpack the first TLV(2)
unpackTypedTLV(buf, wLen, 2, &wTLVType, &wTLVLen, &pMsgTLV);
- NetLog_Server("Message (format %u) - UID: %s", 1, strUID(dwUin, szUID));
+ debugLogA("Message (format %u) - UID: %s", 1, strUID(dwUin, szUID));
// It must be TLV(2)
if (wTLVType == 2)
@@ -255,10 +255,10 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * pDataBuf = pCapabilityTLV->pData;
if (wDataLen > 0)
- NetLog_Server("Message (format 1) - Message has %d caps.", wDataLen);
+ debugLogA("Message (format 1) - Message has %d caps.", wDataLen);
}
else
- NetLog_Server("Message (format 1) - No message cap.");
+ debugLogA("Message (format 1) - No message cap.");
{ // Parse the message parts, usually only one 0x0101 TLV containing the message,
// but in some cases there can be more 0x0101 TLVs containing message parts in
@@ -291,7 +291,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * unpackWord(&pMsgBuf, &wCodePage);
wMsgLen = pMessageTLV->wLen - 4;
- NetLog_Server("Message (format 1) - Part %d: Encoding is 0x%X, page is 0x%X", wMsgPart, wEncoding, wCodePage);
+ debugLogA("Message (format 1) - Part %d: Encoding is 0x%X, page is 0x%X", wMsgPart, wEncoding, wCodePage);
switch (wEncoding) {
@@ -385,7 +385,7 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * BYTE *pBuf = pTimeTLV;
unpackDWord(&pBuf, &dwRecvTime);
- NetLog_Server("Message (format %u) - Offline timestamp is %s", 1, time2text(dwRecvTime));
+ debugLogA("Message (format %u) - Offline timestamp is %s", 1, time2text(dwRecvTime));
}
SAFE_FREE((void**)&pTimeTLV);
}
@@ -395,12 +395,12 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * pre.szMessage = (char *)szMsg;
ProtoChainRecvMsg(hContact, &pre);
- NetLog_Server("Message (format 1) received");
+ debugLogA("Message (format 1) received");
// Save tick value
setDword(hContact, "TickTS", time(NULL) - (dwMsgID1/1000));
}
- else NetLog_Server("Message (format %u) - Ignoring empty message", 1);
+ else debugLogA("Message (format %u) - Ignoring empty message", 1);
SAFE_FREE(&szMsg);
}
@@ -409,10 +409,10 @@ void CIcqProto::handleRecvServMsgType1(BYTE *buf, WORD wLen, DWORD dwUin, char * disposeChain(&pChain);
}
else
- NetLog_Server("Failed to read TLV chain in message (format 1)");
+ debugLogA("Failed to read TLV chain in message (format 1)");
}
else
- NetLog_Server("Unsupported TLV (%u) in message (format %u)", wTLVType, 1);
+ debugLogA("Unsupported TLV (%u) in message (format %u)", wTLVType, 1);
SAFE_FREE((void**)&pMsgTLV);
}
@@ -427,13 +427,13 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * if (wLen < 4)
{
- NetLog_Server("Message (format %u) - Ignoring empty message", 2);
+ debugLogA("Message (format %u) - Ignoring empty message", 2);
return;
}
// Unpack the first TLV(5)
unpackTypedTLV(buf, wLen, 5, &wTLVType, &wTLVLen, &pDataBuf);
- NetLog_Server("Message (format %u) - UID: %s", 2, strUID(dwUin, szUID));
+ debugLogA("Message (format %u) - UID: %s", 2, strUID(dwUin, szUID));
pBuf = pDataBuf;
// It must be TLV(5)
@@ -446,7 +446,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * if (wTLVLen < 26)
{ // just check if all basic data is there
- NetLog_Server("Message (format %u) - Ignoring empty message", 2);
+ debugLogA("Message (format %u) - Ignoring empty message", 2);
SAFE_FREE((void**)&pBuf);
return;
}
@@ -454,7 +454,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * unpackWord(&pDataBuf, &wCommand);
wTLVLen -= 2; // Command 0x0000 - Normal message/file send request
#ifdef _DEBUG // 0x0001 - Abort request
- NetLog_Server("Command is %u", wCommand); // 0x0002 - Acknowledge request
+ debugLogA("Command is %u", wCommand); // 0x0002 - Acknowledge request
#endif
// Some stuff we don't use
@@ -472,14 +472,14 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * if (wCommand == 1)
{
- NetLog_Server("Cannot handle abort messages yet... :(");
+ debugLogA("Cannot handle abort messages yet... :(");
SAFE_FREE((void**)&pBuf);
return;
}
if (wTLVLen < 4)
{ // just check if at least one tlv is there
- NetLog_Server("Message (format %u) - Ignoring empty message", 2);
+ debugLogA("Message (format %u) - Ignoring empty message", 2);
SAFE_FREE((void**)&pBuf);
return;
}
@@ -496,7 +496,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * chain = readIntoTLVChain(&pDataBuf, wTLVLen, 0);
if (!chain)
{ // sanity check
- NetLog_Server("Message (format %u) - Invalid data", 2);
+ debugLogA("Message (format %u) - Invalid data", 2);
SAFE_FREE((void**)&pBuf);
return;
}
@@ -531,7 +531,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * }
else
{
- NetLog_Server("Warning, no 0x2711 TLV in message (format 2)");
+ debugLogA("Warning, no 0x2711 TLV in message (format 2)");
}
// Clean up
disposeChain(&chain);
@@ -540,26 +540,26 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * { // Handle reverse DC request
if (wCommand == 1)
{
- NetLog_Server("Cannot handle abort messages yet... :(");
+ debugLogA("Cannot handle abort messages yet... :(");
SAFE_FREE((void**)&pBuf);
return;
}
if (wTLVLen < 4)
{ // just check if at least one tlv is there
- NetLog_Server("Message (format %u) - Ignoring empty message", 2);
+ debugLogA("Message (format %u) - Ignoring empty message", 2);
SAFE_FREE((void**)&pBuf);
return;
}
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
SAFE_FREE((void**)&pBuf);
return;
}
chain = readIntoTLVChain(&pDataBuf, wTLVLen, 0);
if (!chain)
{ // Malformed packet
- NetLog_Server("Error: Malformed data in packet");
+ debugLogA("Error: Malformed data in packet");
SAFE_FREE((void**)&pBuf);
return;
}
@@ -578,7 +578,7 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * HANDLE hContact = HContactFromUIN(dwUin, NULL);
if (hContact == INVALID_HANDLE_VALUE)
{
- NetLog_Server("Error: %s from unknown contact %u", "Reverse Connect Request", dwUin);
+ debugLogA("Error: %s from unknown contact %u", "Reverse Connect Request", dwUin);
}
else
{
@@ -611,17 +611,17 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * OpenDirectConnection(hContact, DIRECTCONN_REVERSE, (void*)pCookie);
}
else
- NetLog_Server("Warning: Unsupported direct protocol version in %s", "Reverse Connect Request");
+ debugLogA("Warning: Unsupported direct protocol version in %s", "Reverse Connect Request");
}
}
else
{
- NetLog_Server("Malformed %s", "Reverse Connect Request");
+ debugLogA("Malformed %s", "Reverse Connect Request");
}
}
else
{
- NetLog_Server("Warning, no 0x2711 TLV in message (format 2)");
+ debugLogA("Warning, no 0x2711 TLV in message (format 2)");
}
// Clean up
disposeChain(&chain);
@@ -636,12 +636,12 @@ void CIcqProto::handleRecvServMsgType2(BYTE *buf, WORD wLen, DWORD dwUin, char * }
else // here should be detection of extra data streams (Xtraz)
{
- NetLog_Server("Unknown Message Format Capability");
+ debugLogA("Unknown Message Format Capability");
}
}
else
{
- NetLog_Server("Unsupported TLV (%u) in message (format %u)", wTLVType, 2);
+ debugLogA("Unsupported TLV (%u) in message (format %u)", wTLVType, 2);
}
SAFE_FREE((void**)&pBuf);
@@ -654,7 +654,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D if (wLen < 2)
{
- NetLog_Server("Message (format %u) - Ignoring empty message", 2);
+ debugLogA("Message (format %u) - Ignoring empty message", 2);
return;
}
@@ -670,7 +670,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D if (wLen < 31)
{ // just check if we have data to work with
- NetLog_Server("Message (format %u) - Ignoring empty message", 2);
+ debugLogA("Message (format %u) - Ignoring empty message", 2);
return;
}
@@ -705,7 +705,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D if (wLen < 20)
{ // check if there is everything that should be there
- NetLog_Server("Message (format %u) - Ignoring empty message", 2);
+ debugLogA("Message (format %u) - Ignoring empty message", 2);
return;
}
@@ -723,7 +723,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D // Priority
unpackLEWord(&pDataBuf, &wPritority);
wLen -= 2;
- NetLog_Server("Priority: %u", wPritority);
+ debugLogA("Priority: %u", wPritority);
// Message
unpackLEWord(&pDataBuf, &wMsgLen);
@@ -737,7 +737,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D {
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
@@ -759,7 +759,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D }
else
{
- NetLog_Server("Ignored strange file message");
+ debugLogA("Ignored strange file message");
}
break;
@@ -776,7 +776,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D {
if (wLen < wMsgLen)
{ // sanity check
- NetLog_Server("Error: Malformed server Greeting message");
+ debugLogA("Error: Malformed server Greeting message");
return;
}
@@ -789,7 +789,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D {
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
message_ack_params pMsgAck = {0};
@@ -810,7 +810,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D { // info manager plugin - obsolete
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
@@ -827,7 +827,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D unpackByte(&pDataBuf, &bLevel);
if (bLevel != 0 || wLen < 16)
{
- NetLog_Server("Invalid %s Manager Plugin message from %u", "Info", dwUin);
+ debugLogA("Invalid %s Manager Plugin message from %u", "Info", dwUin);
return;
}
unpackDWord(&pDataBuf, &dwGuid1); // plugin request GUID
@@ -838,16 +838,16 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D if (CompareGUIDs(dwGuid1, dwGuid2, dwGuid3, dwGuid4, PMSG_QUERY_INFO))
{
- NetLog_Server("User %u requests our %s plugin list. NOT SUPPORTED", dwUin, "info");
+ debugLogA("User %u requests our %s plugin list. NOT SUPPORTED", dwUin, "info");
}
else
- NetLog_Server("Unknown %s Manager message from %u", "Info", dwUin);
+ debugLogA("Unknown %s Manager message from %u", "Info", dwUin);
}
else if (CompareGUIDs(dwGuid1, dwGuid2, dwGuid3, dwGuid4, PSIG_STATUS_PLUGIN))
{ // status manager plugin - obsolete
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
@@ -864,7 +864,7 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D unpackByte(&pDataBuf, &bLevel);
if (bLevel != 0 || wLen < 16)
{
- NetLog_Server("Invalid %s Manager Plugin message from %u", "Status", dwUin);
+ debugLogA("Invalid %s Manager Plugin message from %u", "Status", dwUin);
return;
}
unpackDWord(&pDataBuf, &dwGuid1); // plugin request GUID
@@ -874,15 +874,15 @@ void CIcqProto::parseServRelayData(BYTE *pDataBuf, WORD wLen, HANDLE hContact, D wLen -= 16;
if (CompareGUIDs(dwGuid1, dwGuid2, dwGuid3, dwGuid4, PMSG_QUERY_STATUS))
- NetLog_Server("User %u requests our %s plugin list. NOT SUPPORTED", dwUin, "status");
+ debugLogA("User %u requests our %s plugin list. NOT SUPPORTED", dwUin, "status");
else
- NetLog_Server("Unknown %s Manager message from %u", "Status", dwUin);
+ debugLogA("Unknown %s Manager message from %u", "Status", dwUin);
}
else
- NetLog_Server("Unknown signature (%08x-%08x-%08x-%08x) in message (format 2)", dwGuid1, dwGuid2, dwGuid3, dwGuid4);
+ debugLogA("Unknown signature (%08x-%08x-%08x-%08x) in message (format 2)", dwGuid1, dwGuid2, dwGuid3, dwGuid4);
}
else
- NetLog_Server("Unknown wId1 (%u) in message (format 2)", wId);
+ debugLogA("Unknown wId1 (%u) in message (format 2)", wId);
}
@@ -891,7 +891,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hCont int nTypeId;
WORD wFunction;
- NetLog_Server("Parsing Greeting message through server");
+ debugLogA("Parsing Greeting message through server");
// Message plugin identification
if (!unpackPluginTypeId(&pDataBuf, &wLen, &nTypeId, &wFunction, FALSE)) return;
@@ -915,10 +915,10 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hCont {
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
- NetLog_Server("This is file ack");
+ debugLogA("This is file ack");
char *szMsg = (char *)_alloca(dwDataLen + 1);
memcpy(szMsg, pDataBuf, dwDataLen);
@@ -932,10 +932,10 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hCont {
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
- NetLog_Server("This is a file request");
+ debugLogA("This is a file request");
char *szMsg = (char *)_alloca(dwDataLen + 1);
memcpy(szMsg, pDataBuf, dwDataLen);
@@ -949,10 +949,10 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hCont { // TODO: this is deprecated
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
- NetLog_Server("This is a chat request");
+ debugLogA("This is a chat request");
char *szMsg = (char *)_alloca(dwDataLen + 1);
memcpy(szMsg, pDataBuf, dwDataLen);
@@ -994,7 +994,7 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hCont {
if (!dwUin)
{ // AIM cannot send this, just sanity
- NetLog_Server("Error: Malformed UIN in packet");
+ debugLogA("Error: Malformed UIN in packet");
return;
}
message_ack_params pMsgAck = {0};
@@ -1010,11 +1010,11 @@ void CIcqProto::parseServRelayPluginData(BYTE *pDataBuf, WORD wLen, HANDLE hCont }
else
{
- NetLog_Server("Unsupported plugin message type %d", nTypeId);
+ debugLogA("Unsupported plugin message type %d", nTypeId);
}
}
else
- NetLog_Server("Error: Malformed server plugin message");
+ debugLogA("Error: Malformed server plugin message");
}
@@ -1026,13 +1026,13 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha { // received contacts
if (wLen < 4)
{ // just check if at least one tlv is there
- NetLog_Server("Message (format %u) - Ignoring empty contacts message", 2);
+ debugLogA("Message (format %u) - Ignoring empty contacts message", 2);
return;
}
oscar_tlv_chain *chain = readIntoTLVChain(&buf, wLen, 0);
if (!chain)
{ // sanity check
- NetLog_Server("Message (format %u) - Invalid data", 2);
+ debugLogA("Message (format %u) - Invalid data", 2);
return;
}
@@ -1045,7 +1045,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha if (!tlvUins || tlvUins->wLen < 4)
{
- NetLog_Server("Malformed '%s' message", "contacts");
+ debugLogA("Malformed '%s' message", "contacts");
disposeChain(&chain);
return;
}
@@ -1122,7 +1122,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha }
if (!iContact || !valid)
{
- NetLog_Server("Malformed '%s' message", "contacts");
+ debugLogA("Malformed '%s' message", "contacts");
disposeChain(&chain);
for (int i = 0; i < iContact; i++)
{
@@ -1192,7 +1192,7 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha if (!valid)
{
- NetLog_Server("Malformed '%s' message", "contacts");
+ debugLogA("Malformed '%s' message", "contacts");
}
else
{
@@ -1219,13 +1219,13 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha SAFE_FREE((void**)&contacts);
}
else
- NetLog_Server("Error: Received unknown contacts message, ignoring.");
+ debugLogA("Error: Received unknown contacts message, ignoring.");
// Clean up
disposeChain(&chain);
}
else if (wCommand == 1)
{
- NetLog_Server("Cannot handle abort messages yet... :(");
+ debugLogA("Cannot handle abort messages yet... :(");
return;
}
else if (wCommand == 2)
@@ -1236,14 +1236,14 @@ void CIcqProto::handleRecvServMsgContacts(BYTE *buf, WORD wLen, DWORD dwUin, cha if (FindMessageCookie(dwID1, dwID2, &dwCookie, &hCookieContact, NULL))
{
if (hCookieContact != hContact)
- NetLog_Server("Warning: Ack Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact);
+ debugLogA("Warning: Ack Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact);
ProtoBroadcastAck(hContact, ACKTYPE_CONTACTS, ACKRESULT_SUCCESS, (HANDLE)dwCookie, 0);
ReleaseCookie(dwCookie);
}
else
- NetLog_Server("Warning: Unexpected Contact Transfer ack from %s", strUID(dwUin, szUID));
+ debugLogA("Warning: Unexpected Contact Transfer ack from %s", strUID(dwUin, szUID));
}
}
@@ -1257,13 +1257,13 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, WORD wLen, DWORD dwUin, char * if (wLen < 2)
{
- NetLog_Server("Message (format %u) - Ignoring empty message", 4);
+ debugLogA("Message (format %u) - Ignoring empty message", 4);
return;
}
// Unpack the first TLV(5)
unpackTypedTLV(buf, wLen, 5, &wTLVType, &wTLVLen, &pDataBuf);
- NetLog_Server("Message (format %u) - UID: %s", 4, strUID(dwUin, szUID));
+ debugLogA("Message (format %u) - UID: %s", 4, strUID(dwUin, szUID));
// It must be TLV(5)
if (wTLVType == 5)
@@ -1284,7 +1284,7 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, WORD wLen, DWORD dwUin, char * if (bMsgType == 0 && wMsgLen == 1)
{
- NetLog_Server("User %u probably checks his ignore state.", dwUin);
+ debugLogA("User %u probably checks his ignore state.", dwUin);
}
else
{
@@ -1304,7 +1304,7 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, WORD wLen, DWORD dwUin, char * BYTE *pBuf = pTimeTLV;
unpackDWord(&pBuf, &dwRecvTime);
- NetLog_Server("Message (format %u) - Offline timestamp is %s", 4, time2text(dwRecvTime));
+ debugLogA("Message (format %u) - Offline timestamp is %s", 4, time2text(dwRecvTime));
}
SAFE_FREE((void**)&pTimeTLV);
}
@@ -1314,7 +1314,7 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, WORD wLen, DWORD dwUin, char * WORD wLen = wTLVLen - 8;
int typeId;
- NetLog_Server("Parsing Greeting message through server");
+ debugLogA("Parsing Greeting message through server");
pmsg += wMsgLen;
wLen -= wMsgLen;
@@ -1341,7 +1341,7 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, WORD wLen, DWORD dwUin, char * }
else
{
- NetLog_Server("Unsupported plugin message type %d", typeId);
+ debugLogA("Unsupported plugin message type %d", typeId);
}
}
}
@@ -1354,12 +1354,12 @@ void CIcqProto::handleRecvServMsgType4(BYTE *buf, WORD wLen, DWORD dwUin, char * }
else
{
- NetLog_Server("Ignoring spoofed TYPE4 message thru server from %d", dwUin);
+ debugLogA("Ignoring spoofed TYPE4 message thru server from %d", dwUin);
}
}
else
{
- NetLog_Server("Unsupported TLV (%u) in message (format %u)", wTLVType, 4);
+ debugLogA("Unsupported TLV (%u) in message (format %u)", wTLVType, 4);
}
SAFE_FREE((void**)&pDataBuf);
@@ -1625,13 +1625,13 @@ void packPluginTypeId(icq_packet *packet, int nTypeID) void CIcqProto::handleStatusMsgReply(const char *szPrefix, HANDLE hContact, DWORD dwUin, WORD wVersion, int bMsgType, WORD wCookie, const char *szMsg, int nMsgFlags)
{
if (hContact == INVALID_HANDLE_VALUE) {
- NetLog_Server("%sIgnoring status message from unknown contact %u", szPrefix, dwUin);
+ debugLogA("%sIgnoring status message from unknown contact %u", szPrefix, dwUin);
return;
}
int status = AwayMsgTypeToStatus(bMsgType);
if (status == ID_STATUS_OFFLINE) {
- NetLog_Server("%sIgnoring unknown status message from %u", szPrefix, dwUin);
+ debugLogA("%sIgnoring unknown status message from %u", szPrefix, dwUin);
return;
}
@@ -1659,7 +1659,7 @@ HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData))
{
- NetLog_Server("%sIgnoring unrequested status message from %u", "handleMessageAck: ", dwUin);
+ debugLogA("%sIgnoring unrequested status message from %u", "handleMessageAck: ", dwUin);
ReleaseCookie(wCookie);
return INVALID_HANDLE_VALUE;
@@ -1667,7 +1667,7 @@ HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD if (hContact != hCookieContact)
{
- NetLog_Server("%sAck Contact does not match Cookie Contact(0x%x != 0x%x)", "handleMessageAck: ", hContact, hCookieContact);
+ debugLogA("%sAck Contact does not match Cookie Contact(0x%x != 0x%x)", "handleMessageAck: ", hContact, hCookieContact);
ReleaseCookie(wCookie);
return INVALID_HANDLE_VALUE;
@@ -1679,7 +1679,7 @@ HANDLE CIcqProto::handleMessageAck(DWORD dwUin, char *szUID, WORD wCookie, WORD else
{
// Should not happen
- NetLog_Server("%sIgnored type %u ack message (this should not happen)", "handleMessageAck: ", type);
+ debugLogA("%sIgnored type %u ack message (this should not happen)", "handleMessageAck: ", type);
}
return INVALID_HANDLE_VALUE;
@@ -1877,7 +1877,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, char* pCurBlob;
if (nMsgFields < 6) {
- NetLog_Server("Malformed '%s' message", "auth req");
+ debugLogA("Malformed '%s' message", "auth req");
break;
}
@@ -1908,7 +1908,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, if (nMsgFields < 4)
{
- NetLog_Server("Malformed '%s' message", "you were added");
+ debugLogA("Malformed '%s' message", "you were added");
break;
}
@@ -2009,7 +2009,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, NetLog_Uni(bThruDC, "Malformed '%s' message", "SMS Mobile");
break;
}
- NetLog_Server("Received SMS Mobile message");
+ debugLogA("Received SMS Mobile message");
ProtoBroadcastAck(NULL, ICQACKTYPE_SMS, ACKRESULT_SUCCESS, NULL, (LPARAM)szMsg);
break;
@@ -2018,7 +2018,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, /* it's either extended StatusMsg reply from icq2003b or a IcqWebMessage */
if (dwUin == 1003)
{
- NetLog_Server("Received ICQWebMessage - NOT SUPPORTED");
+ debugLogA("Received ICQWebMessage - NOT SUPPORTED");
}
break;
@@ -2030,7 +2030,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, if (nMsgFields < 6)
{
- NetLog_Server("Malformed '%s' message", "web pager");
+ debugLogA("Malformed '%s' message", "web pager");
break;
}
@@ -2053,7 +2053,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, if (nMsgFields < 6)
{
- NetLog_Server("Malformed '%s' message", "e-mail express");
+ debugLogA("Malformed '%s' message", "e-mail express");
break;
}
@@ -2136,7 +2136,7 @@ void CIcqProto::handleMessageTypes(DWORD dwUin, char *szUID, DWORD dwTimestamp, else if (dwUin)
ppro->icq_sendAwayMsgReplyServ(dwUin, dwMsgID1, dwMsgID2, wCookie, wVersion, (BYTE)nMsgType, pszMsg);
else
- ppro->NetLog_Server("Error: Malformed UIN in packet");
+ ppro->debugLogA("Error: Malformed UIN in packet");
};
BOOL bExtended;
@@ -2203,7 +2203,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d wLen -= 2;
if (wMessageFormat != 2)
{
- NetLog_Server("SNAC(4.B) Unknown type");
+ debugLogA("SNAC(4.B) Unknown type");
return;
}
@@ -2216,7 +2216,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (!FindMessageCookie(dwMsgID1, dwMsgID2, &dwCookie, &hCookieContact, &pCookieData))
{
- NetLog_Server("SNAC(4.B) Received an ack that I did not ask for from (%u)", dwUin);
+ debugLogA("SNAC(4.B) Received an ack that I did not ask for from (%u)", dwUin);
return;
}
@@ -2228,7 +2228,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (!dwUin)
{ // AIM cannot send this - just sanity
- NetLog_Server("Error: Invalid UID in message response.");
+ debugLogA("Error: Invalid UID in message response.");
return;
}
@@ -2272,14 +2272,14 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (!FindCookie(wCookie, &hCookieContact, (void**)&pCookieData))
{ // use old reliable method
- NetLog_Server("Warning: Invalid cookie in %s from (%u)", "message response", dwUin);
+ debugLogA("Warning: Invalid cookie in %s from (%u)", "message response", dwUin);
if (pCookieData->bMessageType != MTYPE_AUTOAWAY && bFlags == 3)
{ // most probably a broken ack of some kind (e.g. from R&Q), try to fix that
bMsgType = pCookieData->bMessageType;
bFlags = 0;
- NetLog_Server("Warning: Invalid message type in %s from (%u)", "message response", dwUin);
+ debugLogA("Warning: Invalid message type in %s from (%u)", "message response", dwUin);
}
}
else if (bMsgType != MTYPE_PLUGIN && pCookieData->bMessageType != MTYPE_AUTOAWAY)
@@ -2287,14 +2287,14 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d dwCookie = wCookie;
if (bMsgType != pCookieData->bMessageType)
- NetLog_Server("Warning: Invalid message type in %s from (%u)", "message response", dwUin);
+ debugLogA("Warning: Invalid message type in %s from (%u)", "message response", dwUin);
bMsgType = pCookieData->bMessageType;
}
else if (pCookieData->bMessageType == MTYPE_AUTOAWAY && bMsgType != MTYPE_PLUGIN)
{
if (bMsgType != pCookieData->nAckType)
- NetLog_Server("Warning: Invalid message type in %s from (%u)", "message response", dwUin);
+ debugLogA("Warning: Invalid message type in %s from (%u)", "message response", dwUin);
}
}
else
@@ -2305,7 +2305,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (hCookieContact != hContact)
{
- NetLog_Server("SNAC(4.B) Ack Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact);
+ debugLogA("SNAC(4.B) Ack Contact does not match Cookie Contact(0x%x != 0x%x)", hContact, hCookieContact);
ReleaseCookie(dwCookie); // This could be a bad idea, but I think it is safe
return;
@@ -2322,7 +2322,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (hContact == NULL || hContact == INVALID_HANDLE_VALUE)
{
- NetLog_Server("SNAC(4.B) Message from unknown contact (%u)", dwUin);
+ debugLogA("SNAC(4.B) Message from unknown contact (%u)", dwUin);
ReleaseCookie(dwCookie); // This could be a bad idea, but I think it is safe
return;
@@ -2363,13 +2363,13 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (wLength != 0x1B)
{
- NetLog_Server("Invalid Greeting %s", "message response");
+ debugLogA("Invalid Greeting %s", "message response");
ReleaseCookie(dwCookie);
return;
}
- NetLog_Server("Parsing Greeting %s", "message response");
+ debugLogA("Parsing Greeting %s", "message response");
// Message
unpackLEWord(&buf, &wMsgLen);
@@ -2392,7 +2392,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d if (wLen < 4)
{
- NetLog_Server("Error: Invalid greeting %s", "message response");
+ debugLogA("Error: Invalid greeting %s", "message response");
ReleaseCookie(dwCookie);
return;
@@ -2437,7 +2437,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d case MTYPE_FILEREQ:
{
- NetLog_Server("This is file ack");
+ debugLogA("This is file ack");
char *szMsg = (char *)_alloca(dwDataLen + 1);
@@ -2485,7 +2485,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d return;
default:
- NetLog_Server("Error: Unknown plugin message response, type %d.", typeId);
+ debugLogA("Error: Unknown plugin message response, type %d.", typeId);
return;
}
}
@@ -2522,7 +2522,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
}
- NetLog_Server("Reverse Connect request failed");
+ debugLogA("Reverse Connect request failed");
// Set DC status to failed
setByte(hContact, "DCStatus", 2);
@@ -2532,7 +2532,7 @@ void CIcqProto::handleRecvMsgResponse(BYTE *buf, WORD wLen, WORD wFlags, DWORD d case MTYPE_CHAT:
default:
- NetLog_Server("SNAC(4.B) Unknown message type (%u) in switch", bMsgType);
+ debugLogA("SNAC(4.B) Unknown message type (%u) in switch", bMsgType);
return;
}
@@ -2688,7 +2688,7 @@ void CIcqProto::handleRecvServMsgError(BYTE *buf, WORD wLen, WORD wFlags, DWORD }
else
{
- NetLog_Server("Error: Message delivery to %u failed: %s", dwUin, pszErrorMessage);
+ debugLogA("Error: Message delivery to %u failed: %s", dwUin, pszErrorMessage);
}
FreeCookie((WORD)dwSequence);
@@ -2715,7 +2715,7 @@ void CIcqProto::handleServerAck(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwSeque if (wLen < 13)
{
- NetLog_Server("Ignoring SNAC(4,C) Packet to short");
+ debugLogA("Ignoring SNAC(4,C) Packet to short");
return;
}
@@ -2766,7 +2766,7 @@ void CIcqProto::handleServerAck(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwSeque default:
ackType = -1;
- NetLog_Server("Error: Unknown message type %d in ack", pCookieData->bMessageType);
+ debugLogA("Error: Unknown message type %d in ack", pCookieData->bMessageType);
break;
}
if (ackType != -1)
@@ -2778,9 +2778,9 @@ void CIcqProto::handleServerAck(BYTE *buf, WORD wLen, WORD wFlags, DWORD dwSeque FreeCookie((WORD)dwSequence);
}
else if (pCookieData && (pCookieData->nAckType == ACKTYPE_CLIENT))
- NetLog_Server("Received a server ack, waiting for client ack.");
+ debugLogA("Received a server ack, waiting for client ack.");
else
- NetLog_Server("Ignored a server ack I did not ask for");
+ debugLogA("Ignored a server ack I did not ask for");
}
}
@@ -2866,14 +2866,14 @@ void CIcqProto::handleOffineMessagesReply(BYTE *buf, WORD wLen, WORD wFlags, DWO if (FindCookie(dwRef, NULL, (void**)&cookie))
{
- NetLog_Server("End of offline msgs, %u received", cookie->nMessages);
+ debugLogA("End of offline msgs, %u received", cookie->nMessages);
if (cookie->nMissed)
{ // NASTY WORKAROUND!!
// The ICQ server has a bug that causes offline messages to be received again and again when some
// missed message notification is present (most probably it is not processed correctly and causes
// the server to fail the purging process); try to purge them using the old offline messages
// protocol. 2008/05/21
- NetLog_Server("Warning: Received %u missed message notifications, trying to fix the server.", cookie->nMissed);
+ debugLogA("Warning: Received %u missed message notifications, trying to fix the server.", cookie->nMissed);
icq_packet packet;
// This will delete the messages stored on server
@@ -2893,7 +2893,7 @@ void CIcqProto::handleOffineMessagesReply(BYTE *buf, WORD wLen, WORD wFlags, DWO ReleaseCookie(dwRef);
}
else
- NetLog_Server("Error: Received unexpected end of offline msgs.");
+ debugLogA("Error: Received unexpected end of offline msgs.");
}
@@ -2906,13 +2906,13 @@ void CIcqProto::handleTypingNotification(BYTE *buf, WORD wLen, WORD wFlags, DWOR if (wLen < 14)
{
- NetLog_Server("Ignoring SNAC(4.x11) Packet to short");
+ debugLogA("Ignoring SNAC(4.x11) Packet to short");
return;
}
#ifndef DBG_CAPMTN
{
- NetLog_Server("Ignoring unexpected typing notification");
+ debugLogA("Ignoring unexpected typing notification");
return;
}
#endif
@@ -2944,12 +2944,12 @@ void CIcqProto::handleTypingNotification(BYTE *buf, WORD wLen, WORD wFlags, DWOR case MTN_FINISHED:
case MTN_TYPED:
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)PROTOTYPE_CONTACTTYPING_OFF);
- NetLog_Server("%s has stopped typing (ch %u).", strUID(dwUin, szUid), wChannel);
+ debugLogA("%s has stopped typing (ch %u).", strUID(dwUin, szUid), wChannel);
break;
case MTN_BEGUN:
CallService(MS_PROTO_CONTACTISTYPING, (WPARAM)hContact, (LPARAM)60);
- NetLog_Server("%s is typing a message (ch %u).", strUID(dwUin, szUid), wChannel);
+ debugLogA("%s is typing a message (ch %u).", strUID(dwUin, szUid), wChannel);
break;
case MTN_WINDOW_CLOSED:
@@ -2962,12 +2962,12 @@ void CIcqProto::handleTypingNotification(BYTE *buf, WORD wLen, WORD wFlags, DWOR ShowPopupMsg(hContact, ICQTranslateUtfStatic(LPGEN("ICQ Note"), szFormat, MAX_PATH), szMsg, LOG_NOTE);
SAFE_FREE((void**)&nick);
- NetLog_Server("%s has closed the message window.", strUID(dwUin, szUid));
+ debugLogA("%s has closed the message window.", strUID(dwUin, szUid));
}
break;
default:
- NetLog_Server("Unknown typing notification from %s, type %u (ch %u)", strUID(dwUin, szUid), wNotification, wChannel);
+ debugLogA("Unknown typing notification from %s, type %u (ch %u)", strUID(dwUin, szUid), wNotification, wChannel);
break;
}
}
diff --git a/protocols/IcqOscarJ/src/fam_09bos.cpp b/protocols/IcqOscarJ/src/fam_09bos.cpp index daa7589c3e..882ded41aa 100644 --- a/protocols/IcqOscarJ/src/fam_09bos.cpp +++ b/protocols/IcqOscarJ/src/fam_09bos.cpp @@ -51,7 +51,7 @@ void CIcqProto::handleBosFam(unsigned char *pBuffer, WORD wBufferLength, snac_he }
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_BOS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_BOS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
@@ -74,7 +74,7 @@ void CIcqProto::handlePrivacyRightsReply(unsigned char *pBuffer, WORD wBufferLen disposeChain(&pChain);
- NetLog_Server("PRIVACY: Max visible %u, max invisible %u, max temporary visible %u items.", wMaxVisibleContacts, wMaxInvisibleContacts, wMaxTemporaryVisibleContacts);
+ debugLogA("PRIVACY: Max visible %u, max invisible %u, max temporary visible %u items.", wMaxVisibleContacts, wMaxInvisibleContacts, wMaxTemporaryVisibleContacts);
// Success
return;
@@ -82,7 +82,7 @@ void CIcqProto::handlePrivacyRightsReply(unsigned char *pBuffer, WORD wBufferLen }
// Failure
- NetLog_Server("Warning: Malformed SRV_PRIVACY_RIGHTS_REPLY");
+ debugLogA("Warning: Malformed SRV_PRIVACY_RIGHTS_REPLY");
}
void CIcqProto::makeContactTemporaryVisible(HANDLE hContact)
@@ -101,6 +101,6 @@ void CIcqProto::makeContactTemporaryVisible(HANDLE hContact) setByte(hContact, "TemporaryVisible", 1);
#ifdef _DEBUG
- NetLog_Server("Added contact %s to temporary visible list", strUID(dwUin, szUid));
+ debugLogA("Added contact %s to temporary visible list", strUID(dwUin, szUid));
#endif
}
diff --git a/protocols/IcqOscarJ/src/fam_0alookup.cpp b/protocols/IcqOscarJ/src/fam_0alookup.cpp index 9e8c3c26f9..3eefca98c8 100644 --- a/protocols/IcqOscarJ/src/fam_0alookup.cpp +++ b/protocols/IcqOscarJ/src/fam_0alookup.cpp @@ -50,7 +50,7 @@ void CIcqProto::handleLookupFam(BYTE *pBuffer, WORD wBufferLength, snac_header* if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&pCookie))
{
if (wError == 0x14)
- NetLog_Server("Lookup: No results");
+ debugLogA("Lookup: No results");
ReleaseLookupCookie(pSnacHeader->dwRef, pCookie);
@@ -62,7 +62,7 @@ void CIcqProto::handleLookupFam(BYTE *pBuffer, WORD wBufferLength, snac_header* }
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_LOOKUP_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_LOOKUP_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -95,11 +95,11 @@ void CIcqProto::handleLookupEmailReply(BYTE* buf, WORD wLen, DWORD dwCookie) if (!FindCookie(dwCookie, NULL, (void**)&pCookie))
{
- NetLog_Server("Error: Received unexpected lookup reply");
+ debugLogA("Error: Received unexpected lookup reply");
return;
}
- NetLog_Server("SNAC(0x0A,0x3): Lookup reply");
+ debugLogA("SNAC(0x0A,0x3): Lookup reply");
sr.hdr.cbSize = sizeof(sr);
sr.hdr.flags = PSR_TCHAR;
diff --git a/protocols/IcqOscarJ/src/fam_0bstatus.cpp b/protocols/IcqOscarJ/src/fam_0bstatus.cpp index 7a979007e2..d50683d3f5 100644 --- a/protocols/IcqOscarJ/src/fam_0bstatus.cpp +++ b/protocols/IcqOscarJ/src/fam_0bstatus.cpp @@ -38,7 +38,7 @@ void CIcqProto::handleStatusFam(unsigned char *pBuffer, WORD wBufferLength, snac {
WORD wInterval;
unpackWord(&pBuffer, &wInterval);
- NetLog_Server("Server sent SNAC(x0B,x02) - SRV_SET_MINREPORTINTERVAL (Value: %u hours)", wInterval);
+ debugLogA("Server sent SNAC(x0B,x02) - SRV_SET_MINREPORTINTERVAL (Value: %u hours)", wInterval);
}
break;
@@ -56,7 +56,7 @@ void CIcqProto::handleStatusFam(unsigned char *pBuffer, WORD wBufferLength, snac }
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_STATS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_STATS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index ee848c5e0f..049d3c1cab 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -48,7 +48,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&sc))
{ // look for action cookie
#ifdef _DEBUG
- NetLog_Server("Received expected server list ack, action: %d, result: %d", sc->dwAction, wError);
+ debugLogA("Received expected server list ack, action: %d, result: %d", sc->dwAction, wError);
#endif
FreeCookie(pSnacHeader->dwRef); // release cookie
@@ -57,11 +57,11 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade int i;
#ifdef _DEBUG
- NetLog_Server("Server-List: Grouped action contains %d actions.", sc->dwGroupCount);
+ debugLogA("Server-List: Grouped action contains %d actions.", sc->dwGroupCount);
#endif
pBuffer -= 2; // revoke unpack
if (wBufferLength != 2*sc->dwGroupCount)
- NetLog_Server("Error: Server list ack does not contain expected amount of result codes (%u != %u)", wBufferLength/2, sc->dwGroupCount);
+ debugLogA("Error: Server list ack does not contain expected amount of result codes (%u != %u)", wBufferLength/2, sc->dwGroupCount);
for (i = 0; i < sc->dwGroupCount; i++)
{
@@ -74,7 +74,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade wError = -1;
#ifdef _DEBUG
- NetLog_Server("Action: %d, ack result: %d", sc->pGroupItems[i]->dwAction, wError);
+ debugLogA("Action: %d, ack result: %d", sc->pGroupItems[i]->dwAction, wError);
#endif
// call normal ack handler
handleServerCListAck(sc->pGroupItems[i], wError);
@@ -88,7 +88,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade }
else
{
- NetLog_Server("Received unexpected server list ack %u", wError);
+ debugLogA("Received unexpected server list ack %u", wError);
}
}
break;
@@ -98,7 +98,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade handleServerCListRightsReply(pBuffer, wBufferLength);
#ifdef _DEBUG
- NetLog_Server("Server sent SNAC(x13,x03) - SRV_REPLYLISTS");
+ debugLogA("Server sent SNAC(x13,x03) - SRV_REPLYLISTS");
#endif
}
break;
@@ -144,13 +144,13 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&sc))
{ // we requested servlist check
#ifdef _DEBUG
- NetLog_Server("Server stated roster is ok.");
+ debugLogA("Server stated roster is ok.");
#endif
ReleaseCookie(pSnacHeader->dwRef);
LoadServerIDs();
}
else
- NetLog_Server("Server sent unexpected SNAC(x13,x0F) - SRV_REPLYROSTEROK");
+ debugLogA("Server sent unexpected SNAC(x13,x0F) - SRV_REPLYROSTEROK");
// This will activate the server side list
sendRosterAck(); // this must be here, cause of failures during cookie alloc
@@ -159,11 +159,11 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade }
case ICQ_LISTS_CLI_MODIFYSTART:
- NetLog_Server("Server sent SNAC(x13,x%02x) - %s", ICQ_LISTS_CLI_MODIFYSTART, "Server is modifying contact list");
+ debugLogA("Server sent SNAC(x13,x%02x) - %s", ICQ_LISTS_CLI_MODIFYSTART, "Server is modifying contact list");
break;
case ICQ_LISTS_CLI_MODIFYEND:
- NetLog_Server("Server sent SNAC(x13,x%02x) - %s", ICQ_LISTS_CLI_MODIFYEND, "End of server modification");
+ debugLogA("Server sent SNAC(x13,x%02x) - %s", ICQ_LISTS_CLI_MODIFYEND, "End of server modification");
break;
case ICQ_LISTS_ADDTOLIST:
@@ -218,7 +218,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade szChange = "Server removed %u item(s) from list";
mir_snprintf(szLogText, MAX_PATH, szChange, nItems);
- NetLog_Server("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText);
+ debugLogA("Server sent SNAC(x13,x%02x) - %s", pSnacHeader->wSubtype, szLogText);
}
}
break;
@@ -232,7 +232,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade break;
case ICQ_LISTS_AUTHGRANTED:
- NetLog_Server("Server sent SNAC(x13,x%02x) - %s", ICQ_LISTS_AUTHGRANTED, "User granted us future authorization");
+ debugLogA("Server sent SNAC(x13,x%02x) - %s", ICQ_LISTS_AUTHGRANTED, "User granted us future authorization");
break;
case ICQ_LISTS_YOUWEREADDED:
@@ -250,7 +250,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade if (FindCookie(pSnacHeader->dwRef, NULL, (void**)&sc))
{ // look for action cookie
#ifdef _DEBUG
- NetLog_Server("Received server list error, action: %d, result: %d", sc->dwAction, wError);
+ debugLogA("Received server list error, action: %d, result: %d", sc->dwAction, wError);
#endif
FreeCookie(pSnacHeader->dwRef); // release cookie
@@ -271,7 +271,7 @@ void CIcqProto::handleServCListFam(BYTE *pBuffer, WORD wBufferLength, snac_heade break;
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_LISTS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_LISTS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -342,7 +342,7 @@ void CIcqProto::handleServerCListRightsReply(BYTE *buf, WORD wLen) if (i + 1 >= SIZEOF(m_wServerListLimits)) break;
}
- NetLog_Server("SSI: Max %d contacts (%d per group), %d groups, %d permit, %d deny, %d ignore items.", m_wServerListLimits[SSI_ITEM_BUDDY], m_wServerListGroupMaxContacts, m_wServerListLimits[SSI_ITEM_GROUP], m_wServerListLimits[SSI_ITEM_PERMIT], m_wServerListLimits[SSI_ITEM_DENY], m_wServerListLimits[SSI_ITEM_IGNORE]);
+ debugLogA("SSI: Max %d contacts (%d per group), %d groups, %d permit, %d deny, %d ignore items.", m_wServerListLimits[SSI_ITEM_BUDDY], m_wServerListGroupMaxContacts, m_wServerListLimits[SSI_ITEM_GROUP], m_wServerListLimits[SSI_ITEM_PERMIT], m_wServerListLimits[SSI_ITEM_DENY], m_wServerListLimits[SSI_ITEM_IGNORE]);
}
disposeChain(&chain);
@@ -358,7 +358,7 @@ DWORD CIcqProto::updateServerGroupData(WORD wGroupId, void *groupData, int group ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
if (!ack)
{
- NetLog_Server("Updating of group on server list failed (malloc error)");
+ debugLogA("Updating of group on server list failed (malloc error)");
return 0;
}
ack->dwAction = SSA_GROUP_UPDATE;
@@ -377,7 +377,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) case SSA_VISIBILITY:
{
if (wError)
- NetLog_Server("Server visibility update failed, error %d", wError);
+ debugLogA("Server visibility update failed, error %d", wError);
break;
}
case SSA_CONTACT_UPDATE:
@@ -385,7 +385,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) servlistPendingRemoveContact(sc->hContact, sc->wContactId, sc->wGroupId, wError ? PENDING_RESULT_FAILED : PENDING_RESULT_SUCCESS);
if (wError)
{
- NetLog_Server("Updating of server contact failed, error %d", wError);
+ debugLogA("Updating of server contact failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Updating of server contact failed."));
}
break;
@@ -394,7 +394,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) {
if (wError)
{
- NetLog_Server("Adding of privacy item to server list failed, error %d", wError);
+ debugLogA("Adding of privacy item to server list failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Adding of privacy item to server list failed."));
}
break;
@@ -403,7 +403,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) {
if (wError)
{
- NetLog_Server("Removing of privacy item from server list failed, error %d", wError);
+ debugLogA("Removing of privacy item from server list failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Removing of privacy item from server list failed."));
}
FreeServerID(sc->wContactId, SSIT_ITEM); // release server id
@@ -417,7 +417,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) {
DWORD dwCookie;
- NetLog_Server("Contact could not be added without authorization, add with await auth flag.");
+ debugLogA("Contact could not be added without authorization, add with await auth flag.");
setByte(sc->hContact, "Auth", 1); // we need auth
dwCookie = AllocateCookie(CKT_SERVERLIST, ICQ_LISTS_ADDTOLIST, sc->hContact, sc);
@@ -428,7 +428,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) }
FreeServerID(sc->wContactId, SSIT_ITEM);
- NetLog_Server("Adding of contact to server list failed, error %d", wError);
+ debugLogA("Adding of contact to server list failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Adding of contact to server list failed."));
servlistPendingRemoveContact(sc->hContact, 0, sc->wGroupId, PENDING_RESULT_FAILED);
@@ -452,7 +452,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) }
else
{ // this should never happen
- NetLog_Server("Group update failed.");
+ debugLogA("Group update failed.");
servlistPostPacket(NULL, 0, SSO_END_OPERATION, 100); // end server modifications here
}
}
@@ -463,7 +463,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) if (wError)
{
FreeServerID(sc->wGroupId, SSIT_GROUP);
- NetLog_Server("Adding of group to server list failed, error %d", wError);
+ debugLogA("Adding of group to server list failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Adding of group to server list failed."));
servlistPendingRemoveGroup(sc->szGroup, 0, PENDING_RESULT_FAILED);
@@ -539,7 +539,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) }
else
{
- NetLog_Server("Removing of contact from server list failed, error %d", wError);
+ debugLogA("Removing of contact from server list failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Removing of contact from server list failed."));
servlistPendingRemoveContact(sc->hContact, sc->wContactId, sc->wGroupId, PENDING_RESULT_FAILED);
@@ -552,7 +552,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) {
if (wError)
{
- NetLog_Server("Updating of group on server list failed, error %d", wError);
+ debugLogA("Updating of group on server list failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Updating of group on server list failed."));
}
SAFE_FREE((void**)&sc->szGroupName);
@@ -563,7 +563,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) SAFE_FREE((void**)&sc->szGroupName);
if (wError)
{
- NetLog_Server("Removing of group from server list failed, error %d", wError);
+ debugLogA("Removing of group from server list failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Removing of group from server list failed."));
servlistPendingRemoveGroup(sc->szGroup, 0, PENDING_RESULT_FAILED);
@@ -613,13 +613,13 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) if (!getByte(sc->hContact, "Auth", 0))
{ // we tried without AWAIT_AUTH, try again with it
- NetLog_Server("Contact could not be added without authorization, add with await auth flag.");
+ debugLogA("Contact could not be added without authorization, add with await auth flag.");
setByte(sc->hContact, "Auth", 1); // we need auth
}
else
{ // we tried with AWAIT_AUTH, try again without
- NetLog_Server("Contact count not be added awaiting authorization, try authorized.");
+ debugLogA("Contact count not be added awaiting authorization, try authorized.");
setByte(sc->hContact, "Auth", 0);
}
@@ -631,7 +631,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) break;
}
FreeServerID(sc->wNewContactId, SSIT_ITEM);
- NetLog_Server("Moving of user to another group on server list failed, error %d", wError);
+ debugLogA("Moving of user to another group on server list failed, error %d", wError);
icq_LogMessage(LOG_ERROR, LPGEN("Moving of user to another group on server list failed."));
servlistPendingRemoveContact(sc->hContact, 0, (WORD)(sc->lParam ? sc->wGroupId : sc->wNewGroupId), PENDING_RESULT_FAILED);
@@ -697,7 +697,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) {
if (wError)
{
- NetLog_Server("Renaming of server group failed, error %d", wError);
+ debugLogA("Renaming of server group failed, error %d", wError);
icq_LogMessage(LOG_WARNING, LPGEN("Renaming of server group failed."));
servlistPendingRemoveGroup(sc->szGroup, sc->wGroupId, PENDING_RESULT_FAILED);
@@ -723,7 +723,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) {
if (wError)
{
- NetLog_Server("Uploading of avatar hash failed.");
+ debugLogA("Uploading of avatar hash failed.");
if (sc->wGroupId) // is avatar added or updated?
{
FreeServerID(sc->wContactId, SSIT_ITEM);
@@ -739,7 +739,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) case SSA_REMOVEAVATAR:
{
if (wError)
- NetLog_Server("Removing of avatar hash failed.");
+ debugLogA("Removing of avatar hash failed.");
else
{
FreeServerID(sc->wContactId, SSIT_ITEM);
@@ -755,7 +755,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) case SSA_IMPORT:
{
if (wError)
- NetLog_Server("Re-starting import sequence failed, error %d", wError);
+ debugLogA("Re-starting import sequence failed, error %d", wError);
else
{
setWord("SrvImportID", 0);
@@ -764,7 +764,7 @@ void CIcqProto::handleServerCListAck(cookie_servlist_action* sc, WORD wError) break;
}
default:
- NetLog_Server("Server ack cookie type (%d) not recognized.", sc->dwAction);
+ debugLogA("Server ack cookie type (%d) not recognized.", sc->dwAction);
}
SAFE_FREE((void**)&sc); // free the memory
@@ -857,32 +857,32 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server // server list.
unpackWord(&buf, &wRecordCount);
wLen -= 2;
- NetLog_Server("SSI: number of entries is %u, version is %u", wRecordCount, bySSIVersion);
+ debugLogA("SSI: number of entries is %u, version is %u", wRecordCount, bySSIVersion);
// Loop over all items in the packet
for (wRecord = 0; wRecord < wRecordCount; wRecord++)
{
- NetLog_Server("SSI: parsing record %u", wRecord + 1);
+ debugLogA("SSI: parsing record %u", wRecord + 1);
if (wLen < 10)
{ // minimum: name length (zero), group ID, item ID, empty TLV
- NetLog_Server("Warning: SSI parsing error (%d)", 0);
+ debugLogA("Warning: SSI parsing error (%d)", 0);
break;
}
if (!unpackServerListItem(&buf, &wLen, szRecordName, &wGroupId, &wItemId, &wTlvType, &wTlvLength))
{ // unpack basic structure
- NetLog_Server("Warning: SSI parsing error (%d)", 1);
+ debugLogA("Warning: SSI parsing error (%d)", 1);
break;
}
- NetLog_Server("Name: '%s', GroupID: %u, EntryID: %u, EntryType: %u, TLVlength: %u",
+ debugLogA("Name: '%s', GroupID: %u, EntryID: %u, EntryType: %u, TLVlength: %u",
szRecordName, wGroupId, wItemId, wTlvType, wTlvLength);
if (wLen < wTlvLength)
{
- NetLog_Server("Warning: SSI parsing error (%d)", 2);
+ debugLogA("Warning: SSI parsing error (%d)", 2);
break;
}
@@ -916,7 +916,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server if (bAdded)
{ // Not already on list: added
- NetLog_Server("SSI added new %s contact '%s'", "ICQ", szRecordName);
+ debugLogA("SSI added new %s contact '%s'", "ICQ", szRecordName);
AddJustAddedContact(hContact);
}
@@ -928,7 +928,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server bAdded = 1; // we want details for new contacts
}
else
- NetLog_Server("SSI ignoring existing contact '%s'", szRecordName);
+ debugLogA("SSI ignoring existing contact '%s'", szRecordName);
// Contact on server is always on list
db_set_b(hContact, "CList", "NotOnList", 0);
}
@@ -998,7 +998,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server memcpy(pszNick, pTLV->pData, wNickLength);
pszNick[wNickLength] = 0; // Terminate string
- NetLog_Server("Nickname is '%s'", pszNick);
+ debugLogA("Nickname is '%s'", pszNick);
bNicked = 1;
@@ -1031,7 +1031,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server }
else
{
- NetLog_Server("Invalid nickname");
+ debugLogA("Invalid nickname");
}
}
if (bAdded && !bNicked)
@@ -1053,7 +1053,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server memcpy(pszComment, pTLV->pData, wCommentLength);
pszComment[wCommentLength] = 0; // Terminate string
- NetLog_Server("Comment is '%s'", pszComment);
+ debugLogA("Comment is '%s'", pszComment);
// Write comment to database
if (getByte("LoadServerDetails", DEFAULT_SS_LOAD) || bAdded)
@@ -1080,7 +1080,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server }
else
{
- NetLog_Server("Invalid comment");
+ debugLogA("Invalid comment");
}
}
@@ -1088,7 +1088,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server if (pChain->getTLV(SSI_TLV_AWAITING_AUTH, 1))
{
setByte(hContact, "Auth", 1);
- NetLog_Server("SSI contact need authorization");
+ debugLogA("SSI contact need authorization");
}
else
{
@@ -1100,7 +1100,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server setSettingBlob(hContact, DBSETTING_METAINFO_TOKEN, pTLV->pData, pTLV->wLen);
if (pChain->getTLV(SSI_TLV_METAINFO_TIME, 1))
setSettingDouble(hContact, DBSETTING_METAINFO_TIME, pChain->getDouble(SSI_TLV_METAINFO_TIME, 1));
- NetLog_Server("SSI contact has meta info token");
+ debugLogA("SSI contact has meta info token");
}
else
{
@@ -1123,7 +1123,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server }
else
{ // failed to add or other error
- NetLog_Server("SSI failed to handle %s Item '%s'", "Buddy", szRecordName);
+ debugLogA("SSI failed to handle %s Item '%s'", "Buddy", szRecordName);
}
}
break;
@@ -1146,7 +1146,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server setServListGroupName(wGroupId, szRecordName);
- NetLog_Server("Group %s added to known groups.", szRecordName);
+ debugLogA("Group %s added to known groups.", szRecordName);
/* demangle full grouppath, set it to known */
SAFE_FREE(&szActiveSrvGroup);
@@ -1158,12 +1158,12 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server }
else
{
- NetLog_Server("Unhandled type 0x01, wItemID != 0");
+ debugLogA("Unhandled type 0x01, wItemID != 0");
}
}
else
{
- NetLog_Server("Unhandled type 0x01");
+ debugLogA("Unhandled type 0x01");
}
break;
@@ -1181,25 +1181,25 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server {
if (bAdded)
{
- NetLog_Server("SSI added new %s contact '%s'", "Permit", szRecordName);
+ debugLogA("SSI added new %s contact '%s'", "Permit", szRecordName);
// It wasn't previously in the list, we hide it so it only appears in the visible list
setContactHidden(hContact, 1);
// Add it to the list, so it can be added properly if proper contact
AddJustAddedContact(hContact);
}
else
- NetLog_Server("SSI %s contact already exists '%s'", "Permit", szRecordName);
+ debugLogA("SSI %s contact already exists '%s'", "Permit", szRecordName);
// Save permit ID
setWord(hContact, DBSETTING_SERVLIST_PERMIT, wItemId);
ReserveServerID(wItemId, SSIT_ITEM, 0);
// Set apparent mode
setWord(hContact, "ApparentMode", ID_STATUS_ONLINE);
- NetLog_Server("Visible-contact (%s)", szRecordName);
+ debugLogA("Visible-contact (%s)", szRecordName);
}
else
{ // failed to add or other error
- NetLog_Server("SSI failed to handle %s Item '%s'", "Permit", szRecordName);
+ debugLogA("SSI failed to handle %s Item '%s'", "Permit", szRecordName);
ReserveServerID(wItemId, SSIT_ITEM, SSIF_UNHANDLED);
}
@@ -1221,14 +1221,14 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server if (bAdded)
{
/* not already on list: added */
- NetLog_Server("SSI added new %s contact '%s'", "Deny", szRecordName);
+ debugLogA("SSI added new %s contact '%s'", "Deny", szRecordName);
// It wasn't previously in the list, we hide it so it only appears in the visible list
setContactHidden(hContact, 1);
// Add it to the list, so it can be added properly if proper contact
AddJustAddedContact(hContact);
}
else
- NetLog_Server("SSI %s contact already exists '%s'", "Deny", szRecordName);
+ debugLogA("SSI %s contact already exists '%s'", "Deny", szRecordName);
// Save Deny ID
setWord(hContact, DBSETTING_SERVLIST_DENY, wItemId);
@@ -1236,11 +1236,11 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server // Set apparent mode
setWord(hContact, "ApparentMode", ID_STATUS_OFFLINE);
- NetLog_Server("Invisible-contact (%s)", szRecordName);
+ debugLogA("Invisible-contact (%s)", szRecordName);
}
else
{ // failed to add or other error
- NetLog_Server("SSI failed to handle %s Item '%s'", "Deny", szRecordName);
+ debugLogA("SSI failed to handle %s Item '%s'", "Deny", szRecordName);
ReserveServerID(wItemId, SSIT_ITEM, SSIF_UNHANDLED);
}
@@ -1257,7 +1257,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server setWord(DBSETTING_SERVLIST_PRIVACY, wItemId);
ReserveServerID(wItemId, SSIT_ITEM, 0);
- NetLog_Server("Visibility is %u", bVisibility);
+ debugLogA("Visibility is %u", bVisibility);
}
else
ReserveServerID(wItemId, SSIT_ITEM, SSIF_UNHANDLED);
@@ -1279,14 +1279,14 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server if (bAdded)
{
/* not already on list: add */
- NetLog_Server("SSI added new %s contact '%s'", "Ignore", szRecordName);
+ debugLogA("SSI added new %s contact '%s'", "Ignore", szRecordName);
// It wasn't previously in the list, we hide it
setContactHidden(hContact, 1);
// Add it to the list, so it can be added properly if proper contact
AddJustAddedContact(hContact);
}
else
- NetLog_Server("SSI %s contact already exists '%s'", "Ignore", szRecordName);
+ debugLogA("SSI %s contact already exists '%s'", "Ignore", szRecordName);
// Save Ignore ID
setWord(hContact, DBSETTING_SERVLIST_IGNORE, wItemId);
@@ -1296,11 +1296,11 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server setWord(hContact, "ApparentMode", ID_STATUS_OFFLINE);
// set ignore all events
CallService(MS_IGNORE_IGNORE, (WPARAM)hContact, IGNOREEVENT_ALL);
- NetLog_Server("Ignore-contact (%s)", szRecordName);
+ debugLogA("Ignore-contact (%s)", szRecordName);
}
else
{ // failed to add or other error
- NetLog_Server("SSI failed to handle %s Item '%s'", "Ignore", szRecordName);
+ debugLogA("SSI failed to handle %s Item '%s'", "Ignore", szRecordName);
ReserveServerID(wItemId, SSIT_ITEM, SSIF_UNHANDLED);
}
@@ -1308,7 +1308,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server break;
case SSI_ITEM_UNKNOWN2:
- NetLog_Server("SSI unknown type 0x11");
+ debugLogA("SSI unknown type 0x11");
ReserveServerID(wItemId, SSIT_ITEM, SSIF_UNHANDLED);
break;
@@ -1322,7 +1322,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server setDword("ImportTS", pChain->getDWord(SSI_TLV_TIMESTAMP, 1));
setWord("SrvImportID", wItemId);
ReserveServerID(wItemId, SSIT_ITEM, 0);
- NetLog_Server("SSI %s item recognized", "first import");
+ debugLogA("SSI %s item recognized", "first import");
}
break;
@@ -1337,12 +1337,12 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server if (!strcmpnull(szRecordName, "12"))
{ // need to handle Photo Item separately
setWord(DBSETTING_SERVLIST_PHOTO, wItemId);
- NetLog_Server("SSI %s item recognized", "Photo");
+ debugLogA("SSI %s item recognized", "Photo");
}
else
{
setWord(DBSETTING_SERVLIST_AVATAR, wItemId);
- NetLog_Server("SSI %s item recognized", "Avatar");
+ debugLogA("SSI %s item recognized", "Avatar");
}
ReserveServerID(wItemId, SSIT_ITEM, 0);
}
@@ -1364,7 +1364,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server setWord(DBSETTING_SERVLIST_METAINFO, wItemId);
ReserveServerID(wItemId, SSIT_ITEM, 0);
- NetLog_Server("SSI %s item recognized", "Meta info");
+ debugLogA("SSI %s item recognized", "Meta info");
}
break;
@@ -1382,7 +1382,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server break;
default:
- NetLog_Server("SSI unhandled item %2x", wTlvType);
+ debugLogA("SSI unhandled item %2x", wTlvType);
if (wItemId)
ReserveServerID(wItemId, SSIT_ITEM, SSIF_UNHANDLED);
@@ -1395,7 +1395,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server // Release Memory
SAFE_FREE(&szActiveSrvGroup);
- NetLog_Server("Bytes left: %u", wLen);
+ debugLogA("Bytes left: %u", wLen);
setWord("SrvRecordCount", (WORD)(wRecord + getWord("SrvRecordCount", 0)));
@@ -1415,7 +1415,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server /* finally we get a time_t of the last update time */
unpackDWord(&buf, &dwLastUpdateTime);
setDword("SrvLastUpdate", dwLastUpdateTime);
- NetLog_Server("Last update of server list was (%u) %s", dwLastUpdateTime, time2text(dwLastUpdateTime));
+ debugLogA("Last update of server list was (%u) %s", dwLastUpdateTime, time2text(dwLastUpdateTime));
sendRosterAck();
handleServUINSettings(wListenPort, info);
@@ -1424,7 +1424,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server }
else
{
- NetLog_Server("Last packet missed update time...");
+ debugLogA("Last packet missed update time...");
}
if (getWord("SrvRecordCount", 0) == 0)
{ // we got empty serv-list, create master group
@@ -1444,7 +1444,7 @@ void CIcqProto::handleServerCListReply(BYTE *buf, WORD wLen, WORD wFlags, server }
else
{
- NetLog_Server("Waiting for more packets");
+ debugLogA("Waiting for more packets");
}
}
@@ -1459,7 +1459,7 @@ void CIcqProto::handleServerCListItemAdd(const char *szRecordName, WORD wGroupId setWord("SrvImportID", wItemId);
ReserveServerID(wItemId, SSIT_ITEM, 0);
- NetLog_Server("Server added Import timestamp to list");
+ debugLogA("Server added Import timestamp to list");
return;
}
@@ -1513,9 +1513,9 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou if (!pToken || dbv.cpbVal != pToken->wLen || memcmp(dbv.pbVal, pToken->pData, dbv.cpbVal))
{
if (!pToken)
- NetLog_Server("Contact %s, meta info token removed", szRecordName);
+ debugLogA("Contact %s, meta info token removed", szRecordName);
else
- NetLog_Server("Contact %s, meta info token changed", szRecordName);
+ debugLogA("Contact %s, meta info token changed", szRecordName);
// user info was changed, refresh
if (IsMetaInfoChanged(hContact))
@@ -1526,7 +1526,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou }
else if (pToken)
{
- NetLog_Server("Contact %s, meta info token added", szRecordName);
+ debugLogA("Contact %s, meta info token added", szRecordName);
// user info was changed, refresh
if (IsMetaInfoChanged(hContact))
@@ -1563,9 +1563,9 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou if (!pToken || dbv.cpbVal != pToken->wLen || memcmp(dbv.pbVal, pToken->pData, dbv.cpbVal))
{
if (!pToken)
- NetLog_Server("Owner meta info token removed");
+ debugLogA("Owner meta info token removed");
else
- NetLog_Server("Owner meta info token changed");
+ debugLogA("Owner meta info token changed");
}
db_free(&dbv);
@@ -1579,7 +1579,7 @@ void CIcqProto::handleServerCListItemUpdate(const char *szRecordName, WORD wGrou }
else if (wItemType == SSI_ITEM_GROUP)
{ // group updated
- NetLog_Server("Server updated our group \"%s\" on list", szRecordName);
+ debugLogA("Server updated our group \"%s\" on list", szRecordName);
}
}
@@ -1622,7 +1622,7 @@ void CIcqProto::handleRecvAuthRequest(unsigned char *buf, WORD wLen) if (dwUin && IsOnSpammerList(dwUin))
{
- NetLog_Server("Ignored Message from known Spammer");
+ debugLogA("Ignored Message from known Spammer");
return;
}
@@ -1716,7 +1716,7 @@ void CIcqProto::handleRecvAdded(unsigned char *buf, WORD wLen) if (dwUin && IsOnSpammerList(dwUin))
{
- NetLog_Server("Ignored Message from known Spammer");
+ debugLogA("Ignored Message from known Spammer");
return;
}
@@ -1778,7 +1778,7 @@ void CIcqProto::handleRecvAuthResponse(unsigned char *buf, WORD wLen) if (dwUin && IsOnSpammerList(dwUin))
{
- NetLog_Server("Ignored Message from known Spammer");
+ debugLogA("Ignored Message from known Spammer");
return;
}
@@ -1807,18 +1807,18 @@ void CIcqProto::handleRecvAuthResponse(unsigned char *buf, WORD wLen) {
case 0:
- NetLog_Server("Authorization request %s by %s", "denied", strUID(dwUin, szUid));
+ debugLogA("Authorization request %s by %s", "denied", strUID(dwUin, szUid));
// TODO: Add to system history as soon as new auth system is ready
break;
case 1:
setByte(hContact, "Auth", 0);
- NetLog_Server("Authorization request %s by %s", "granted", strUID(dwUin, szUid));
+ debugLogA("Authorization request %s by %s", "granted", strUID(dwUin, szUid));
// TODO: Add to system history as soon as new auth system is ready
break;
default:
- NetLog_Server("Unknown Authorization request response (%u) from %s", bResponse, strUID(dwUin, szUid));
+ debugLogA("Unknown Authorization request response (%u) from %s", bResponse, strUID(dwUin, szUid));
break;
}
@@ -1860,13 +1860,13 @@ void CIcqProto::updateServVisibilityCode(BYTE bCode) setWord(DBSETTING_SERVLIST_PRIVACY, wVisibilityID);
wCommand = ICQ_LISTS_ADDTOLIST;
#ifdef _DEBUG
- NetLog_Server("Made new srvVisibilityID, id is %u, code is %u", wVisibilityID, bCode);
+ debugLogA("Made new srvVisibilityID, id is %u, code is %u", wVisibilityID, bCode);
#endif
}
else
{
#ifdef _DEBUG
- NetLog_Server("Reused srvVisibilityID, id is %u, code is %u", wVisibilityID, bCode);
+ debugLogA("Reused srvVisibilityID, id is %u, code is %u", wVisibilityID, bCode);
#endif
wCommand = ICQ_LISTS_UPDATEGROUP;
}
@@ -1874,7 +1874,7 @@ void CIcqProto::updateServVisibilityCode(BYTE bCode) ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
if (!ack)
{
- NetLog_Server("Cookie alloc failure.");
+ debugLogA("Cookie alloc failure.");
return; // out of memory, go away
}
ack->dwAction = SSA_VISIBILITY; // update visibility
@@ -1937,7 +1937,7 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
if (!ack)
{
- NetLog_Server("Cookie alloc failure.");
+ debugLogA("Cookie alloc failure.");
return; // out of memory, go away
}
ack->dwAction = SSA_REMOVEAVATAR; // update avatar hash
@@ -1963,13 +1963,13 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) wAvatarID = GenerateServerID(SSIT_ITEM, 0);
wCommand = ICQ_LISTS_ADDTOLIST;
#ifdef _DEBUG
- NetLog_Server("Made new srvAvatarID, id is %u", wAvatarID);
+ debugLogA("Made new srvAvatarID, id is %u", wAvatarID);
#endif
}
else
{
#ifdef _DEBUG
- NetLog_Server("Reused srvAvatarID, id is %u", wAvatarID);
+ debugLogA("Reused srvAvatarID, id is %u", wAvatarID);
#endif
wCommand = ICQ_LISTS_UPDATEGROUP;
}
@@ -1977,7 +1977,7 @@ void CIcqProto::updateServAvatarHash(BYTE *pHash, int size) ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
if (!ack)
{
- NetLog_Server("Cookie alloc failure.");
+ debugLogA("Cookie alloc failure.");
return; // out of memory, go away
}
ack->dwAction = SSA_SETAVATAR; // update avatar hash
@@ -2056,6 +2056,6 @@ void CIcqProto::sendRosterAck(void) sendServPacket(&packet);
#ifdef _DEBUG
- NetLog_Server("Sent SNAC(x13,x07) - CLI_ROSTERACK");
+ debugLogA("Sent SNAC(x13,x07) - CLI_ROSTERACK");
#endif
}
diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index 3e4a6654ad..327e6cbc35 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -42,7 +42,7 @@ void CIcqProto::handleIcqExtensionsFam(BYTE *pBuffer, WORD wBufferLength, snac_h break;
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_EXTENSIONS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_EXTENSIONS_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -99,25 +99,25 @@ void CIcqProto::handleExtensionError(BYTE *buf, WORD wPackLen) ReleaseCookie(wCookie); // we do not leak cookie and memory
}
- NetLog_Server("Full info request error 0x%02x received", wErrorCode);
+ debugLogA("Full info request error 0x%02x received", wErrorCode);
}
else if (wSubType == META_SET_PASSWORD_REQ)
{
// failed to change user password, report to UI
ProtoBroadcastAck(NULL, ACKTYPE_SETINFO, ACKRESULT_FAILED, (HANDLE)wCookie, 0);
- NetLog_Server("Meta change password request failed, error 0x%02x", wErrorCode);
+ debugLogA("Meta change password request failed, error 0x%02x", wErrorCode);
}
else
- NetLog_Server("Meta request error 0x%02x received", wErrorCode);
+ debugLogA("Meta request error 0x%02x received", wErrorCode);
}
else
- NetLog_Server("Meta request error 0x%02x received", wErrorCode);
+ debugLogA("Meta request error 0x%02x received", wErrorCode);
break;
default:
- NetLog_Server("Unknown request 0x%02x error 0x%02x received", wData, wErrorCode);
+ debugLogA("Unknown request 0x%02x error 0x%02x received", wData, wErrorCode);
}
disposeChain(&chain);
return;
@@ -138,7 +138,7 @@ void CIcqProto::handleExtensionServerInfo(BYTE *buf, WORD wPackLen, WORD wFlags) chain = readIntoTLVChain(&buf, wPackLen, 0);
if (chain == NULL)
{
- NetLog_Server("Error: Broken snac 15/3 %d", 1);
+ debugLogA("Error: Broken snac 15/3 %d", 1);
return;
}
@@ -146,7 +146,7 @@ void CIcqProto::handleExtensionServerInfo(BYTE *buf, WORD wPackLen, WORD wFlags) if (dataTlv == NULL)
{
disposeChain(&chain);
- NetLog_Server("Error: Broken snac 15/3 %d", 2);
+ debugLogA("Error: Broken snac 15/3 %d", 2);
return;
}
BYTE *databuf = dataTlv->pData;
@@ -178,13 +178,13 @@ void CIcqProto::handleExtensionServerInfo(BYTE *buf, WORD wPackLen, WORD wFlags) break;
default:
- NetLog_Server("Warning: Ignoring Meta response - Unknown type %d", wRequestType);
+ debugLogA("Warning: Ignoring Meta response - Unknown type %d", wRequestType);
break;
}
}
}
else
- NetLog_Server("Error: Broken snac 15/3 %d", 3);
+ debugLogA("Error: Broken snac 15/3 %d", 3);
if (chain)
disposeChain(&chain);
@@ -271,7 +271,7 @@ void CIcqProto::handleExtensionMetaResponse(BYTE *databuf, WORD wPacketLen, WORD }
// Parsing failure
- NetLog_Server("Error: Failure parsing META_SMS_DELIVERY_RECEIPT");
+ debugLogA("Error: Failure parsing META_SMS_DELIVERY_RECEIPT");
break;
case META_DIRECTORY_DATA:
@@ -279,14 +279,14 @@ void CIcqProto::handleExtensionMetaResponse(BYTE *databuf, WORD wPacketLen, WORD if (bResultCode == 0x0A)
handleDirectoryQueryResponse(databuf, wPacketLen, wCookie, wReplySubtype, wFlags);
else
- NetLog_Server("Error: Directory request failed, code %u", bResultCode);
+ debugLogA("Error: Directory request failed, code %u", bResultCode);
break;
case META_DIRECTORY_UPDATE_ACK:
if (bResultCode == 0x0A)
handleDirectoryUpdateResponse(databuf, wPacketLen, wCookie, wReplySubtype);
else
- NetLog_Server("Error: Directory request failed, code %u", bResultCode);
+ debugLogA("Error: Directory request failed, code %u", bResultCode);
break;
case META_BASIC_USERINFO:
@@ -298,11 +298,11 @@ void CIcqProto::handleExtensionMetaResponse(BYTE *databuf, WORD wPacketLen, WORD case META_AFFILATIONS_USERINFO:
case META_SHORT_USERINFO:
case META_HPAGECAT_USERINFO:
- NetLog_Server("Warning: Ignored 15/03 (legacy user info) replysubtype x%x", wReplySubtype);
+ debugLogA("Warning: Ignored 15/03 (legacy user info) replysubtype x%x", wReplySubtype);
break;
default:
- NetLog_Server("Warning: Ignored 15/03 replysubtype x%x", wReplySubtype);
+ debugLogA("Warning: Ignored 15/03 replysubtype x%x", wReplySubtype);
// _ASSERTE(0);
break;
}
@@ -312,7 +312,7 @@ void CIcqProto::handleExtensionMetaResponse(BYTE *databuf, WORD wPacketLen, WORD }
// Failure
- NetLog_Server("Warning: Broken 15/03 ExtensionMetaResponse");
+ debugLogA("Warning: Broken 15/03 ExtensionMetaResponse");
}
@@ -350,7 +350,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, WORD wPacketLen, WORD if (!FindCookie(wCookie, NULL, (void**)&pCookie))
{
- NetLog_Server("Warning: Received unexpected search reply");
+ debugLogA("Warning: Received unexpected search reply");
pCookie = NULL;
}
@@ -362,9 +362,9 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, WORD wPacketLen, WORD case SRV_USER_FOUND: // Search: user found reply
if (bLastUser)
- NetLog_Server("SNAC(0x15,0x3): Last search reply");
+ debugLogA("SNAC(0x15,0x3): Last search reply");
else
- NetLog_Server("SNAC(0x15,0x3): Search reply");
+ debugLogA("SNAC(0x15,0x3): Search reply");
if (bResultCode == 0xA)
{
@@ -480,7 +480,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, WORD wPacketLen, WORD databuf += 5;
unpackLEDWord(&databuf, &dwLeft);
if (dwLeft)
- NetLog_Server("Warning: %d search results omitted", dwLeft);
+ debugLogA("Warning: %d search results omitted", dwLeft);
}
ReleaseSearchCookie(wCookie, pCookie);
}
@@ -489,7 +489,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, WORD wPacketLen, WORD else
{
// Failed search
- NetLog_Server("SNAC(0x15,0x3): Search error %u", bResultCode);
+ debugLogA("SNAC(0x15,0x3): Search error %u", bResultCode);
ReleaseSearchCookie(wCookie, pCookie);
@@ -507,7 +507,7 @@ void CIcqProto::parseSearchReplies(unsigned char *databuf, WORD wPacketLen, WORD // For debugging purposes only
if (!bParsingOK)
{
- NetLog_Server("Warning: Parsing error in 15/03 search reply type x%x", wReplySubtype);
+ debugLogA("Warning: Parsing error in 15/03 search reply type x%x", wReplySubtype);
_ASSERTE(!bParsingOK);
}
}
@@ -527,7 +527,7 @@ void CIcqProto::parseUserInfoUpdateAck(unsigned char *databuf, WORD wPacketLen, break;
default:
- NetLog_Server("Warning: Ignored 15/03 user info update ack type x%x", wReplySubtype);
+ debugLogA("Warning: Ignored 15/03 user info update ack type x%x", wReplySubtype);
break;
}
}
@@ -634,7 +634,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR BYTE requestResult;
#ifdef _DEBUG
- NetLog_Server("Received directory query response");
+ debugLogA("Received directory query response");
#endif
if (wPacketLen >= 2)
unpackLEWord(&databuf, &wBytesRemaining);
@@ -643,7 +643,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR if (!unpackSnacHeader(&requestSnac, &databuf, &wPacketLen) || !requestSnac.bValid)
{
- NetLog_Server("Error: Failed to parse directory response");
+ debugLogA("Error: Failed to parse directory response");
return;
}
@@ -652,7 +652,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR // check request cookie
if (!FindCookie(wCookie, &hContact, (void**)&pCookieData) || !pCookieData)
{
- NetLog_Server("Warning: Ignoring unrequested directory reply type (x%x, x%x)", requestSnac.wFamily, requestSnac.wSubtype);
+ debugLogA("Warning: Ignoring unrequested directory reply type (x%x, x%x)", requestSnac.wFamily, requestSnac.wSubtype);
return;
}
/// FIXME: we should really check the snac contents according to cookie data here ??
@@ -664,14 +664,14 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR unpackByte(&databuf, &requestResult);
else
{
- NetLog_Server("Error: Malformed directory response");
+ debugLogA("Error: Malformed directory response");
if (!bMoreDataFollows)
ReleaseCookie(wCookie);
return;
}
if (requestResult != 1 && requestResult != 4)
{
- NetLog_Server("Error: Directory request failed, status %u", requestResult);
+ debugLogA("Error: Directory request failed, status %u", requestResult);
if (!bMoreDataFollows)
{
@@ -688,11 +688,11 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR unpackWord(&databuf, &wLen);
wPacketLen -= 3;
if (wLen)
- NetLog_Server("Warning: Data in error message present!");
+ debugLogA("Warning: Data in error message present!");
if (wPacketLen <= 0x16)
{ // sanity check
- NetLog_Server("Error: Malformed directory response");
+ debugLogA("Error: Malformed directory response");
if (!bMoreDataFollows)
{
@@ -717,11 +717,11 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR wPacketLen -= 6;
if (pCookieData->bRequestType == DIRECTORYREQUEST_SEARCH && !bMoreDataFollows)
- NetLog_Server("Directory Search: %d contacts found (%u pages)", dwItemCount, wPageCount);
+ debugLogA("Directory Search: %d contacts found (%u pages)", dwItemCount, wPageCount);
if (wPacketLen <= 2)
{ // sanity check, block expected
- NetLog_Server("Error: Malformed directory response");
+ debugLogA("Error: Malformed directory response");
if (!bMoreDataFollows)
{
@@ -745,7 +745,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR if (wData == 0 && pCookieData->bRequestType == DIRECTORYREQUEST_SEARCH)
{
- NetLog_Server("Directory Search: No contacts found");
+ debugLogA("Directory Search: No contacts found");
ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)wCookie, 0);
ReleaseCookie(wCookie);
return;
@@ -754,7 +754,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR _ASSERTE(wData == 1 && wPacketLen == wLen);
if (wData != 1 || wPacketLen != wLen)
{
- NetLog_Server("Error: Malformed directory response (missing data)");
+ debugLogA("Error: Malformed directory response (missing data)");
if (!bMoreDataFollows)
{
@@ -781,7 +781,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR char *szUid = pDirectoryData->getString(0x32, 1);
if (!szUid)
{
- NetLog_Server("Error: Received unrecognized data from the directory");
+ debugLogA("Error: Received unrecognized data from the directory");
break;
}
@@ -790,7 +790,7 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR if (hContact != HContactFromUID(dwUin, szUid, NULL))
{
- NetLog_Server("Error: Received data does not match cookie contact, ignoring.");
+ debugLogA("Error: Received data does not match cookie contact, ignoring.");
SAFE_FREE(&szUid);
break;
}
@@ -807,12 +807,12 @@ void CIcqProto::handleDirectoryQueryResponse(BYTE *databuf, WORD wPacketLen, WOR break;
default:
- NetLog_Server("Error: Unknown cookie type %x for directory response!", pCookieData->bRequestType);
+ debugLogA("Error: Unknown cookie type %x for directory response!", pCookieData->bRequestType);
}
disposeChain(&pDirectoryData);
}
else
- NetLog_Server("Error: Failed parsing directory response");
+ debugLogA("Error: Failed parsing directory response");
// Release Memory
if (!bMoreDataFollows)
@@ -854,7 +854,7 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * char *szUid = cDetails->getString(0x32, 1);
if (!szUid)
{
- NetLog_Server("Error: Received unrecognized data from the directory");
+ debugLogA("Error: Received unrecognized data from the directory");
return;
}
@@ -864,13 +864,13 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * hContact = HContactFromUID(dwUin, szUid, NULL);
if (hContact == INVALID_HANDLE_VALUE)
{
- NetLog_Server("Error: Received details for unknown contact \"%s\"", szUid);
+ debugLogA("Error: Received details for unknown contact \"%s\"", szUid);
SAFE_FREE(&szUid);
return;
}
#ifdef _DEBUG
else
- NetLog_Server("Received user info for %s from directory", szUid);
+ debugLogA("Received user info for %s from directory", szUid);
#endif
SAFE_FREE(&szUid);
}
@@ -880,9 +880,9 @@ void CIcqProto::parseDirectoryUserDetailsData(HANDLE hContact, oscar_tlv_chain * char *szUid = cDetails->getString(0x32, 1);
if (!hContact)
- NetLog_Server("Received owner user info from directory");
+ debugLogA("Received owner user info from directory");
else
- NetLog_Server("Received user info for %s from directory", szUid);
+ debugLogA("Received user info for %s from directory", szUid);
SAFE_FREE(&szUid);
}
#endif
@@ -1050,7 +1050,7 @@ void CIcqProto::parseDirectorySearchData(oscar_tlv_chain *cDetails, DWORD dwCook char *szUid = cDetails->getString(0x32, 1); // User ID
#ifdef _DEBUG
- NetLog_Server("Directory Search: Found user %s", szUid);
+ debugLogA("Directory Search: Found user %s", szUid);
#endif
isr.hdr.cbSize = sizeof(ICQSEARCHRESULT);
isr.hdr.flags = PSR_TCHAR;
@@ -1138,7 +1138,7 @@ void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, WORD wPacketLen, WO BYTE requestResult;
#ifdef _DEBUG
- NetLog_Server("Received directory update response");
+ debugLogA("Received directory update response");
#endif
if (wPacketLen >= 2)
unpackLEWord(&databuf, &wBytesRemaining);
@@ -1147,7 +1147,7 @@ void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, WORD wPacketLen, WO if (!unpackSnacHeader(&requestSnac, &databuf, &wPacketLen) || !requestSnac.bValid)
{
- NetLog_Server("Error: Failed to parse directory response");
+ debugLogA("Error: Failed to parse directory response");
return;
}
@@ -1156,7 +1156,7 @@ void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, WORD wPacketLen, WO // check request cookie
if (!FindCookie(wCookie, &hContact, (void**)&pCookieData) || !pCookieData)
{
- NetLog_Server("Warning: Ignoring unrequested directory reply type (x%x, x%x)", requestSnac.wFamily, requestSnac.wSubtype);
+ debugLogA("Warning: Ignoring unrequested directory reply type (x%x, x%x)", requestSnac.wFamily, requestSnac.wSubtype);
return;
}
/// FIXME: we should really check the snac contents according to cookie data here ??
@@ -1165,13 +1165,13 @@ void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, WORD wPacketLen, WO unpackByte(&databuf, &requestResult);
else
{
- NetLog_Server("Error: Malformed directory response");
+ debugLogA("Error: Malformed directory response");
ReleaseCookie(wCookie);
return;
}
if (requestResult != 1 && requestResult != 4)
{
- NetLog_Server("Error: Directory request failed, status %u", requestResult);
+ debugLogA("Error: Directory request failed, status %u", requestResult);
if (pCookieData->bRequestType == DIRECTORYREQUEST_UPDATEOWNER)
ProtoBroadcastAck(NULL, ACKTYPE_SETINFO, ACKRESULT_FAILED, (HANDLE)wCookie, 0);
@@ -1184,7 +1184,7 @@ void CIcqProto::handleDirectoryUpdateResponse(BYTE *databuf, WORD wPacketLen, WO unpackWord(&databuf, &wLen);
wPacketLen -= 3;
if (wLen)
- NetLog_Server("Warning: Data in error message present!");
+ debugLogA("Warning: Data in error message present!");
if (pCookieData->bRequestType == DIRECTORYREQUEST_UPDATEOWNER)
ProtoBroadcastAck(NULL, ACKTYPE_SETINFO, ACKRESULT_SUCCESS, (HANDLE)wCookie, 0);
diff --git a/protocols/IcqOscarJ/src/fam_17signon.cpp b/protocols/IcqOscarJ/src/fam_17signon.cpp index c4c546ca60..2ac1de498d 100644 --- a/protocols/IcqOscarJ/src/fam_17signon.cpp +++ b/protocols/IcqOscarJ/src/fam_17signon.cpp @@ -55,7 +55,7 @@ void CIcqProto::handleAuthorizationFam(BYTE *pBuffer, WORD wBufferLength, snac_h break;
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_AUTHORIZATION_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_AUTHORIZATION_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -135,12 +135,12 @@ void CIcqProto::handleAuthKeyResponse(BYTE *buf, WORD wPacketLen, serverthread_i BYTE digest[16];
#ifdef _DEBUG
- NetLog_Server("Received %s", "ICQ_SIGNON_AUTH_KEY");
+ debugLogA("Received %s", "ICQ_SIGNON_AUTH_KEY");
#endif
if (wPacketLen < 2)
{
- NetLog_Server("Malformed %s", "ICQ_SIGNON_AUTH_KEY");
+ debugLogA("Malformed %s", "ICQ_SIGNON_AUTH_KEY");
icq_LogMessage(LOG_FATAL, LPGEN("Secure login failed.\nInvalid server response."));
SetCurrentStatus(ID_STATUS_OFFLINE);
return;
@@ -151,7 +151,7 @@ void CIcqProto::handleAuthKeyResponse(BYTE *buf, WORD wPacketLen, serverthread_i if (!wKeyLen || wKeyLen > wPacketLen || wKeyLen > sizeof(szKey))
{
- NetLog_Server("Invalid length in %s: %u", "ICQ_SIGNON_AUTH_KEY", wKeyLen);
+ debugLogA("Invalid length in %s: %u", "ICQ_SIGNON_AUTH_KEY", wKeyLen);
icq_LogMessage(LOG_FATAL, LPGEN("Secure login failed.\nInvalid key length."));
SetCurrentStatus(ID_STATUS_OFFLINE);
return;
@@ -170,7 +170,7 @@ void CIcqProto::handleAuthKeyResponse(BYTE *buf, WORD wPacketLen, serverthread_i mir_md5_finish(&state, digest);
#ifdef _DEBUG
- NetLog_Server("Sending ICQ_SIGNON_LOGIN_REQUEST to login server");
+ debugLogA("Sending ICQ_SIGNON_LOGIN_REQUEST to login server");
#endif
sendClientAuth((char*)digest, 0x10, TRUE);
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index b50330a1b9..f5eb6ce4e0 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -233,11 +233,11 @@ void CIcqProto::StartAvatarThread(HANDLE hConn, char *cookie, WORD cookieLen) // if (m_avatarsConnection && m_avatarsConnection->isPending())
{
- NetLog_Server("Avatar, Multiple start thread attempt, ignored.");
+ debugLogA("Avatar, Multiple start thread attempt, ignored.");
SAFE_FREE((void**)&cookie);
return;
}
- NetLog_Server("Avatars: Connection failed");
+ debugLogA("Avatars: Connection failed");
m_avatarsConnectionPending = FALSE;
@@ -270,7 +270,7 @@ void CIcqProto::StartAvatarThread(HANDLE hConn, char *cookie, WORD cookieLen) // if (m_avatarsConnection && m_avatarsConnection->isPending())
{
- NetLog_Server("Avatar, Multiple start thread attempt, ignored.");
+ debugLogA("Avatar, Multiple start thread attempt, ignored.");
NetLib_CloseConnection(&hConn, FALSE);
@@ -305,11 +305,11 @@ void CIcqProto::StopAvatarThread() static void NetLog_Hash(CIcqProto *ppro, const char *pszIdent, const BYTE *pHash, int nHashLen)
{
if (nHashLen == 0x14)
- ppro->NetLog_Server("Avatars: %s hash: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", pszIdent, pHash[0], pHash[1], pHash[2], pHash[3], pHash[4], pHash[5], pHash[6], pHash[7], pHash[8], pHash[9], pHash[10], pHash[11], pHash[12], pHash[13], pHash[14], pHash[15], pHash[16], pHash[17], pHash[18], pHash[19]);
+ ppro->debugLogA("Avatars: %s hash: %02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", pszIdent, pHash[0], pHash[1], pHash[2], pHash[3], pHash[4], pHash[5], pHash[6], pHash[7], pHash[8], pHash[9], pHash[10], pHash[11], pHash[12], pHash[13], pHash[14], pHash[15], pHash[16], pHash[17], pHash[18], pHash[19]);
else if (nHashLen == 0x09)
- ppro->NetLog_Server("Avatars: %s hash: %02X%02X%02X%02X%02X%02X%02X%02X%02X", pszIdent, pHash[0], pHash[1], pHash[2], pHash[3], pHash[4], pHash[5], pHash[6], pHash[7], pHash[8]);
+ ppro->debugLogA("Avatars: %s hash: %02X%02X%02X%02X%02X%02X%02X%02X%02X", pszIdent, pHash[0], pHash[1], pHash[2], pHash[3], pHash[4], pHash[5], pHash[6], pHash[7], pHash[8]);
else
- ppro->NetLog_Server("Avatars: %s hash: Unknown hash format.", pszIdent);
+ ppro->debugLogA("Avatars: %s hash: Unknown hash format.", pszIdent);
}
#endif
@@ -332,7 +332,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY { // we have no avatar file, download from server
TCHAR szFile[MAX_PATH * 2 + 4];
#ifdef _DEBUG
- NetLog_Server("We have no avatar, requesting from server.");
+ debugLogA("We have no avatar, requesting from server.");
#endif
GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2);
GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile);
@@ -345,7 +345,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY { // hash could not be calculated - probably missing file, get avatar from server
TCHAR szFile[MAX_PATH * 2 + 4];
#ifdef _DEBUG
- NetLog_Server("We have no avatar, requesting from server.");
+ debugLogA("We have no avatar, requesting from server.");
#endif
GetAvatarFileName(0, NULL, szFile, MAX_PATH * 2);
GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, szFile);
@@ -357,7 +357,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY DWORD dwPaFormat = ::ProtoGetAvatarFileFormat(file);
BYTE *pHash = (BYTE*)_alloca(0x14);
- NetLog_Server("Our avatar is different, setting our new hash.");
+ debugLogA("Our avatar is different, setting our new hash.");
pHash[0] = 0;
pHash[1] = dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC;
@@ -370,7 +370,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY { // get avatar from server
TCHAR tszFile[MAX_PATH * 2 + 4];
#ifdef _DEBUG
- NetLog_Server("We have different avatar, requesting new from server.");
+ debugLogA("We have different avatar, requesting new from server.");
#endif
GetAvatarFileName(0, NULL, tszFile, MAX_PATH * 2);
GetAvatarData(NULL, m_dwLocalUIN, NULL, pData, 0x14, tszFile);
@@ -389,7 +389,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY TCHAR *file = GetOwnAvatarFileName();
if (!file)
{ // we have no file to upload, remove hash from server
- NetLog_Server("We do not have avatar, removing hash.");
+ debugLogA("We do not have avatar, removing hash.");
SetMyAvatar(0, 0);
break;
}
@@ -398,7 +398,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY if (!hash)
{ // the hash could not be calculated, remove from server
- NetLog_Server("We could not obtain hash, removing hash.");
+ debugLogA("We could not obtain hash, removing hash.");
SetMyAvatar(0, 0);
}
else if (!memcmp(hash, pData + 4, 0x10))
@@ -407,7 +407,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY BYTE *ppMap = NULL;
long cbFileSize = 0;
- NetLog_Server("Uploading our avatar data.");
+ debugLogA("Uploading our avatar data.");
if ((hFile = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL )) != INVALID_HANDLE_VALUE)
if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL)
@@ -428,7 +428,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY {
BYTE *pHash = (BYTE*)_alloca(0x14);
- NetLog_Server("Our file is different, set our new hash.");
+ debugLogA("Our file is different, set our new hash.");
pHash[0] = 0;
pHash[1] = dwPaFormat == PA_FORMAT_XML ? AVATAR_HASH_FLASH : AVATAR_HASH_STATIC;
@@ -444,7 +444,7 @@ void CIcqProto::handleAvatarOwnerHash(WORD wItemID, BYTE bFlags, BYTE *pData, BY break;
}
default:
- NetLog_Server("Received UNKNOWN Avatar Status.");
+ debugLogA("Received UNKNOWN Avatar Status.");
}
}
}
@@ -532,14 +532,13 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac NetLog_Hash(this, "old", dbv.pbVal, dbv.cpbVal);
#endif
db_free(&dbv);
- NetLog_Server("%s has removed Avatar.", strUID(dwUIN, szUID));
+ debugLogA("%s has removed Avatar.", strUID(dwUIN, szUID));
delSetting(hContact, "AvatarHash");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
#ifdef _DEBUG
- else
- NetLog_Server("%s has empty Avatar.", strUID(dwUIN, szUID));
+ else debugLogA("%s has empty Avatar.", strUID(dwUIN, szUID));
#endif
return;
}
@@ -556,7 +555,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac GetFullAvatarFileName(dwUIN, szUID, dwPaFormat, tszAvatar, MAX_PATH * 2);
if (_taccess(tszAvatar, 0) == 0)
{ // the file is there, link to contactphoto, save hash
- NetLog_Server("%s has published Avatar. Image was found in the cache.", strUID(dwUIN, szUID));
+ debugLogA("%s has published Avatar. Image was found in the cache.", strUID(dwUIN, szUID));
#ifdef _DEBUG
NetLog_Hash(this, "new", pAvatarHash, cbAvatarHash);
#endif
@@ -565,7 +564,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac }
else
{ // the file was lost, request avatar again
- NetLog_Server("%s has published Avatar.", strUID(dwUIN, szUID));
+ debugLogA("%s has published Avatar.", strUID(dwUIN, szUID));
#ifdef _DEBUG
NetLog_Hash(this, "new", pAvatarHash, cbAvatarHash);
#endif
@@ -574,7 +573,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac }
else
{ // the hash is not the one we want, request avatar
- NetLog_Server("%s has published a new Avatar.", strUID(dwUIN, szUID));
+ debugLogA("%s has published a new Avatar.", strUID(dwUIN, szUID));
#ifdef _DEBUG
NetLog_Hash(this, "new", pAvatarHash, cbAvatarHash);
#endif
@@ -588,7 +587,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac #ifdef _DEBUG
NetLog_Hash(this, "old", dbv.pbVal, dbv.cpbVal);
#endif
- NetLog_Server("%s has changed Avatar.", strUID(dwUIN, szUID));
+ debugLogA("%s has changed Avatar.", strUID(dwUIN, szUID));
#ifdef _DEBUG
NetLog_Hash(this, "new", pAvatarHash, cbAvatarHash);
#endif
@@ -607,7 +606,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac #ifdef _DEBUG
NetLog_Hash(this, "current", dbv.pbVal, dbv.cpbVal);
#endif
- NetLog_Server("%s has Avatar. Image is missing.", strUID(dwUIN, szUID));
+ debugLogA("%s has Avatar. Image is missing.", strUID(dwUIN, szUID));
bJob = 2;
}
else
@@ -618,7 +617,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac #ifdef _DEBUG
NetLog_Hash(this, "current", dbv.pbVal, dbv.cpbVal);
#endif
- NetLog_Server("%s has Avatar. Image is missing.", strUID(dwUIN, szUID));
+ debugLogA("%s has Avatar. Image is missing.", strUID(dwUIN, szUID));
bJob = 2;
}
#ifdef _DEBUG
@@ -626,7 +625,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac {
NetLog_Hash(this, "current", dbv.pbVal, dbv.cpbVal);
- NetLog_Server("%s has Avatar. Image was found in the cache.", strUID(dwUIN, szUID));
+ debugLogA("%s has Avatar. Image was found in the cache.", strUID(dwUIN, szUID));
}
#endif
}
@@ -636,7 +635,7 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac #ifdef _DEBUG
NetLog_Hash(this, "current", dbv.pbVal, dbv.cpbVal);
#endif
- NetLog_Server("%s has Avatar. Image was not retrieved yet.", strUID(dwUIN, szUID));
+ debugLogA("%s has Avatar. Image was not retrieved yet.", strUID(dwUIN, szUID));
bJob = 2;
}
}
@@ -683,14 +682,14 @@ void CIcqProto::handleAvatarContactHash(DWORD dwUIN, char *szUID, HANDLE hContac NetLog_Hash(this, "old", dbv.pbVal, dbv.cpbVal);
#endif
db_free(&dbv);
- NetLog_Server("%s has removed Avatar.", strUID(dwUIN, szUID));
+ debugLogA("%s has removed Avatar.", strUID(dwUIN, szUID));
delSetting(hContact, "AvatarHash");
ProtoBroadcastAck(hContact, ACKTYPE_AVATAR, ACKRESULT_STATUS, NULL, 0);
}
#ifdef _DEBUG
else
- NetLog_Server("%s has no Avatar.", strUID(dwUIN, szUID));
+ debugLogA("%s has no Avatar.", strUID(dwUIN, szUID));
#endif
}
}
@@ -724,7 +723,7 @@ int CIcqProto::GetAvatarData(HANDLE hContact, DWORD dwUin, const char *szUid, co continue;
}
m_avatarsMutex->Leave();
- NetLog_Server("Avatars: Requests for %s avatar are blocked.", strUID(dwUin, pszUid));
+ debugLogA("Avatars: Requests for %s avatar are blocked.", strUID(dwUin, pszUid));
return 0;
}
ar = ar->pNext;
@@ -761,7 +760,7 @@ int CIcqProto::GetAvatarData(HANDLE hContact, DWORD dwUin, const char *szUid, co continue;
}
m_avatarsMutex->Leave();
- NetLog_Server("Avatars: Ignoring duplicate get %s avatar request.", strUID(dwUin, pszUid));
+ debugLogA("Avatars: Ignoring duplicate get %s avatar request.", strUID(dwUin, pszUid));
// make sure avatar connection is in progress
requestAvatarConnection();
@@ -794,7 +793,7 @@ int CIcqProto::GetAvatarData(HANDLE hContact, DWORD dwUin, const char *szUid, co m_avatarsQueue = ar;
m_avatarsMutex->Leave();
- NetLog_Server("Avatars: Request to get %s image added to queue.", strUID(dwUin, pszUid));
+ debugLogA("Avatars: Request to get %s image added to queue.", strUID(dwUin, pszUid));
// make sure avatar connection is in progress
requestAvatarConnection();
@@ -837,7 +836,7 @@ int CIcqProto::SetAvatarData(HANDLE hContact, WORD wRef, const BYTE *data, unsig if (ar->hContact == hContact && ar->type == ART_UPLOAD)
{ // we found it, return error
m_avatarsMutex->Leave();
- NetLog_Server("Avatars: Ignoring duplicate upload avatar request.");
+ debugLogA("Avatars: Ignoring duplicate upload avatar request.");
// make sure avatar connection is in progress
requestAvatarConnection();
@@ -867,7 +866,7 @@ int CIcqProto::SetAvatarData(HANDLE hContact, WORD wRef, const BYTE *data, unsig m_avatarsQueue = ar;
m_avatarsMutex->Leave();
- NetLog_Server("Avatars: Request to upload image added to queue.");
+ debugLogA("Avatars: Request to upload image added to queue.");
// make sure avatar connection is in progress
requestAvatarConnection();
@@ -893,7 +892,7 @@ void CIcqProto::requestAvatarConnection() void __cdecl CIcqProto::AvatarThread(avatars_server_connection *pInfo)
{
- NetLog_Server("%s thread started.", "Avatar");
+ debugLogA("%s thread started.", "Avatar");
// Execute connection handler
pInfo->connectionThread();
@@ -909,7 +908,7 @@ void __cdecl CIcqProto::AvatarThread(avatars_server_connection *pInfo) delete pInfo;
}
- NetLog_Server("%s thread ended.", "Avatar");
+ debugLogA("%s thread ended.", "Avatar");
}
@@ -940,19 +939,6 @@ avatars_server_connection::~avatars_server_connection() }
-int avatars_server_connection::NetLog_Server(const char *fmt,...)
-{
- va_list va;
- char szText[1024 + 9];
-
- strcpy(szText, "Avatars: ");
- va_start(va, fmt);
- mir_vsnprintf(szText + 9, sizeof(szText) - 9, fmt, va);
- va_end(va);
- return CallService(MS_NETLIB_LOG,(WPARAM)ppro->m_hServerNetlibUser,(LPARAM)szText);
-}
-
-
void avatars_server_connection::closeConnection()
{
stopThread = TRUE;
@@ -996,7 +982,7 @@ DWORD avatars_server_connection::sendGetAvatarRequest(HANDLE hContact, DWORD dwU if (runContact[i] == hContact)
{
ppro->m_avatarsMutex->Leave();
- NetLog_Server("Ignoring duplicate get %s image request.", strUID(dwUin, szUid));
+ ppro->debugLogA("Ignoring duplicate get %s image request.", strUID(dwUin, szUid));
return -1; // Success: request ignored
}
@@ -1014,7 +1000,7 @@ DWORD avatars_server_connection::sendGetAvatarRequest(HANDLE hContact, DWORD dwU { // we will be over quota if we send the request now, add to queue instead
bSendNow = FALSE;
#ifdef _DEBUG
- NetLog_Server("Rates: Delay avatar request.");
+ ppro->debugLogA("Rates: Delay avatar request.");
#endif
}
}
@@ -1050,7 +1036,7 @@ DWORD avatars_server_connection::sendGetAvatarRequest(HANDLE hContact, DWORD dwU if (sendServerPacket(&packet))
{
- NetLog_Server("Request to get %s image sent.", strUID(dwUin, szUid));
+ ppro->debugLogA("Request to get %s image sent.", strUID(dwUin, szUid));
return dwCookie;
}
@@ -1087,7 +1073,7 @@ DWORD avatars_server_connection::sendUploadAvatarRequest(HANDLE hContact, WORD w if (sendServerPacket(&packet))
{
- NetLog_Server("Upload image packet sent.");
+ ppro->debugLogA("Upload image packet sent.");
return dwCookie;
}
@@ -1100,7 +1086,7 @@ DWORD avatars_server_connection::sendUploadAvatarRequest(HANDLE hContact, WORD w void avatars_server_connection::checkRequestQueue()
{
#ifdef _DEBUG
- NetLog_Server("Checking request queue...");
+ ppro->debugLogA("Checking request queue...");
#endif
ppro->m_avatarsMutex->Enter();
@@ -1116,7 +1102,7 @@ void avatars_server_connection::checkRequestQueue() if (m_rates->getNextRateLevel(wGroup) < m_rates->getLimitLevel(wGroup, RML_ALERT))
{ // we are over rate, leave queue and wait
#ifdef _DEBUG
- NetLog_Server("Rates: Leaving avatar queue processing");
+ ppro->debugLogA("Rates: Leaving avatar queue processing");
#endif
break;
}
@@ -1147,7 +1133,7 @@ void avatars_server_connection::checkRequestQueue() ppro->m_avatarsMutex->Leave();
#ifdef _DEBUG
- NetLog_Server("Picked up the %s request from queue.", strUID(pRequest->dwUin, pRequest->szUid));
+ ppro->debugLogA("Picked up the %s request from queue.", strUID(pRequest->dwUin, pRequest->szUid));
#endif
switch (pRequest->type)
{
@@ -1184,7 +1170,7 @@ void avatars_server_connection::connectionThread() if (recvResult == 0)
{
- NetLog_Server("Clean closure of server socket");
+ ppro->debugLogA("Clean closure of server socket");
break;
}
@@ -1198,8 +1184,7 @@ void avatars_server_connection::connectionThread() continue;
}
#ifdef _DEBUG
- else
- NetLog_Server("Thread is Idle.");
+ else ppro->debugLogA("Thread is Idle.");
#endif
if (GetTickCount() > wLastKeepAlive)
{ // limit frequency (HACK: on some systems select() does not work well)
@@ -1216,7 +1201,7 @@ void avatars_server_connection::connectionThread() else
{ // this is bad, the system does not handle select() properly
#ifdef _DEBUG
- NetLog_Server("Thread is Forcing Idle.");
+ ppro->debugLogA("Thread is Forcing Idle.");
#endif
SleepEx(500, TRUE); // wait some time, can we do anything else ??
if (Miranda_Terminated())
@@ -1230,9 +1215,9 @@ void avatars_server_connection::connectionThread() continue;
}
if (!stopThread)
- NetLog_Server("Abortive closure of server socket, error: %d", GetLastError());
+ ppro->debugLogA("Abortive closure of server socket, error: %d", GetLastError());
else
- NetLog_Server("Connection closed.");
+ ppro->debugLogA("Connection closed.");
break;
}
@@ -1293,7 +1278,7 @@ int avatars_server_connection::sendServerPacket(icq_packet *pPacket) // Send error
if (nSendResult == SOCKET_ERROR)
{ // thread stops automatically
- NetLog_Server("Your connection with the ICQ avatar server was abortively closed");
+ ppro->debugLogA("Your connection with the ICQ avatar server was abortively closed");
}
else
{
@@ -1306,7 +1291,7 @@ int avatars_server_connection::sendServerPacket(icq_packet *pPacket) }
else
{
- NetLog_Server("Error: Failed to send packet (no connection)");
+ ppro->debugLogA("Error: Failed to send packet (no connection)");
}
localSeqMutex->Leave();
@@ -1341,7 +1326,7 @@ int avatars_server_connection::handleServerPackets(BYTE *buf, int buflen) break;
#ifdef _DEBUG
- NetLog_Server("Server FLAP: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
+ ppro->debugLogA("Server FLAP: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
#endif
switch (channel)
@@ -1355,7 +1340,7 @@ int avatars_server_connection::handleServerPackets(BYTE *buf, int buflen) break;
default:
- NetLog_Server("Warning: Unhandled Server FLAP Channel: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
+ ppro->debugLogA("Warning: Unhandled Server FLAP Channel: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
break;
}
@@ -1381,16 +1366,13 @@ void avatars_server_connection::handleLoginChannel(BYTE *buf, WORD datalen) sendServerPacket(&packet);
#ifdef _DEBUG
- NetLog_Server("Sent CLI_IDENT to %s", "avatar server");
+ ppro->debugLogA("Sent CLI_IDENT to %s", "avatar server");
#endif
SAFE_FREE((void**)&pCookie);
wCookieLen = 0;
}
- else
- {
- NetLog_Server("Invalid Server response, Channel 1.");
- }
+ else ppro->debugLogA("Invalid Server response, Channel 1.");
}
@@ -1399,21 +1381,16 @@ void avatars_server_connection::handleDataChannel(BYTE *buf, WORD datalen) snac_header snacHeader = {0};
if (!unpackSnacHeader(&snacHeader, &buf, &datalen) || !snacHeader.bValid)
- {
- NetLog_Server("Error: Failed to parse SNAC header");
- }
- else
- {
+ ppro->debugLogA("Error: Failed to parse SNAC header");
+ else {
#ifdef _DEBUG
if (snacHeader.wFlags & 0x8000)
- NetLog_Server(" Received SNAC(x%02X,x%02X), version %u", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wVersion);
+ ppro->debugLogA(" Received SNAC(x%02X,x%02X), version %u", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wVersion);
else
- NetLog_Server(" Received SNAC(x%02X,x%02X)", snacHeader.wFamily, snacHeader.wSubtype);
+ ppro->debugLogA(" Received SNAC(x%02X,x%02X)", snacHeader.wFamily, snacHeader.wSubtype);
#endif
- switch (snacHeader.wFamily)
- {
-
+ switch (snacHeader.wFamily) {
case ICQ_SERVICE_FAMILY:
handleServiceFam(buf, datalen, &snacHeader);
break;
@@ -1423,7 +1400,7 @@ void avatars_server_connection::handleDataChannel(BYTE *buf, WORD datalen) break;
default:
- NetLog_Server("Ignoring SNAC(x%02X,x%02X) - FAMILYx%02X not implemented", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wFamily);
+ ppro->debugLogA("Ignoring SNAC(x%02X,x%02X) - FAMILYx%02X not implemented", snacHeader.wFamily, snacHeader.wSubtype, snacHeader.wFamily);
break;
}
}
@@ -1439,8 +1416,8 @@ void avatars_server_connection::handleServiceFam(BYTE *pBuffer, WORD wBufferLeng case ICQ_SERVER_READY:
#ifdef _DEBUG
- NetLog_Server("Server is ready and is requesting my Family versions");
- NetLog_Server("Sending my Families");
+ ppro->debugLogA("Server is ready and is requesting my Family versions");
+ ppro->debugLogA("Sending my Families");
#endif
// Miranda mimics the behaviour of Icq5
@@ -1455,8 +1432,8 @@ void avatars_server_connection::handleServiceFam(BYTE *pBuffer, WORD wBufferLeng /* This is a reply to CLI_FAMILIES and it tells the client which families and their versions that this server understands.
* We send a rate request packet */
#ifdef _DEBUG
- NetLog_Server("Server told me his Family versions");
- NetLog_Server("Requesting Rate Information");
+ ppro->debugLogA("Server told me his Family versions");
+ ppro->debugLogA("Requesting Rate Information");
#endif
serverPacketInit(&packet, 10);
packFNACHeader(&packet, ICQ_SERVICE_FAMILY, ICQ_CLIENT_REQ_RATE_INFO);
@@ -1465,13 +1442,13 @@ void avatars_server_connection::handleServiceFam(BYTE *pBuffer, WORD wBufferLeng case ICQ_SERVER_RATE_INFO:
#ifdef _DEBUG
- NetLog_Server("Server sent Rate Info");
+ ppro->debugLogA("Server sent Rate Info");
#endif
/* init rates management */
m_rates = new rates(ppro, pBuffer, wBufferLength);
/* ack rate levels */
#ifdef _DEBUG
- NetLog_Server("Sending Rate Info Ack");
+ ppro->debugLogA("Sending Rate Info Ack");
#endif
m_rates->initAckPacket(&packet);
sendServerPacket(&packet);
@@ -1488,11 +1465,11 @@ void avatars_server_connection::handleServiceFam(BYTE *pBuffer, WORD wBufferLeng isActive = TRUE; // we are ready to process requests
isLoggedIn = TRUE;
- NetLog_Server(" *** Yeehah, login sequence complete");
+ ppro->debugLogA(" *** Yeehah, login sequence complete");
break;
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_SERVICE_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ ppro->debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_SERVICE_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
}
@@ -1539,7 +1516,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt unpackByte(&pBuffer, &len);
if (wBufferLength < ((pCookieData->hashlen)<<1)+4+len)
{
- NetLog_Server("Received invalid avatar reply.");
+ ppro->debugLogA("Received invalid avatar reply.");
ppro->ProtoBroadcastAck(pCookieData->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, 0);
@@ -1560,7 +1537,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt if (datalen > wBufferLength)
{
datalen = wBufferLength;
- NetLog_Server("Avatar reply broken, trying to do my best.");
+ ppro->debugLogA("Avatar reply broken, trying to do my best.");
}
if (datalen > 4)
@@ -1581,7 +1558,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt if (aValid)
{
- NetLog_Server("Received user avatar, storing (%d bytes).", datalen);
+ ppro->debugLogA("Received user avatar, storing (%d bytes).", datalen);
const TCHAR *ptszExt;
int dwPaFormat = ProtoGetBufferFormat(pBuffer, &ptszExt);
@@ -1611,18 +1588,18 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt if (!ppro->getSetting(pCookieData->hContact, "AvatarHash", &dbv))
{
if (ppro->setSettingBlob(pCookieData->hContact, "AvatarSaved", dbv.pbVal, dbv.cpbVal))
- NetLog_Server("Failed to set file hash.");
+ ppro->debugLogA("Failed to set file hash.");
db_free(&dbv);
}
else
{
- NetLog_Server("Warning: DB error (no hash in DB).");
+ ppro->debugLogA("Warning: DB error (no hash in DB).");
// the hash was lost, try to fix that
if (ppro->setSettingBlob(pCookieData->hContact, "AvatarSaved", pCookieData->hash, pCookieData->hashlen) ||
ppro->setSettingBlob(pCookieData->hContact, "AvatarHash", pCookieData->hash, pCookieData->hashlen))
{
- NetLog_Server("Failed to save avatar hash to DB");
+ ppro->debugLogA("Failed to save avatar hash to DB");
}
}
}
@@ -1632,7 +1609,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt }
else
{ // avatar is broken
- NetLog_Server("Error: Avatar data does not match avatar hash, ignoring.");
+ ppro->debugLogA("Error: Avatar data does not match avatar hash, ignoring.");
if (pCookieData->hContact)
{
@@ -1660,7 +1637,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt }
else
{ // the avatar is empty
- NetLog_Server("Received empty avatar, nothing written (error 0x%x).", bResult);
+ ppro->debugLogA("Received empty avatar, nothing written (error 0x%x).", bResult);
ppro->ProtoBroadcastAck(pCookieData->hContact, ACKTYPE_AVATAR, ACKRESULT_FAILED, (HANDLE)&ai, 0);
}
@@ -1670,7 +1647,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt }
else
{
- NetLog_Server("Warning: Received unexpected Avatar Reply SNAC(x10,x07).");
+ ppro->debugLogA("Warning: Received unexpected Avatar Reply SNAC(x10,x07).");
}
break;
@@ -1690,17 +1667,17 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt }
else
{
- NetLog_Server("Warning: Received unexpected Upload Avatar Reply SNAC(x10,x03).");
+ ppro->debugLogA("Warning: Received unexpected Upload Avatar Reply SNAC(x10,x03).");
}
}
else if (res)
{
- NetLog_Server("Error uploading avatar to server, #%d", res);
+ ppro->debugLogA("Error uploading avatar to server, #%d", res);
ppro->icq_LogMessage(LOG_WARNING, LPGEN("Error uploading avatar to server, server refused to accept the image."));
}
else
- NetLog_Server("Received invalid upload avatar ack.");
+ ppro->debugLogA("Received invalid upload avatar ack.");
break;
}
@@ -1713,13 +1690,13 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt {
if (pCookieData->dwUin)
{
- NetLog_Server("Error: Avatar request failed");
+ ppro->debugLogA("Error: Avatar request failed");
SAFE_FREE(&pCookieData->szFile);
SAFE_FREE((void**)&pCookieData->hash);
}
else
{
- NetLog_Server("Error: Avatar upload failed");
+ ppro->debugLogA("Error: Avatar upload failed");
}
ppro->ReleaseCookie(pSnacHeader->dwRef);
}
@@ -1733,7 +1710,7 @@ void avatars_server_connection::handleAvatarFam(BYTE *pBuffer, WORD wBufferLengt break;
}
default:
- NetLog_Server("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_AVATAR_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
+ ppro->debugLogA("Warning: Ignoring SNAC(x%02x,x%02x) - Unknown SNAC (Flags: %u, Ref: %u)", ICQ_AVATAR_FAMILY, pSnacHeader->wSubtype, pSnacHeader->wFlags, pSnacHeader->dwRef);
break;
}
diff --git a/protocols/IcqOscarJ/src/icq_avatar.h b/protocols/IcqOscarJ/src/icq_avatar.h index b6193c7717..26d805d397 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.h +++ b/protocols/IcqOscarJ/src/icq_avatar.h @@ -49,11 +49,11 @@ protected: WORD wLocalSequence;
icq_critical_section *localSeqMutex;
- BOOL isLoggedIn;
- BOOL isActive;
+ BOOL isLoggedIn;
+ BOOL isActive;
BOOL stopThread; // horrible, but simple - signal for thread to stop
- char *pCookie; // auth to server
+ char *pCookie; // auth to server
WORD wCookieLen;
int sendServerPacket(icq_packet *pPacket);
@@ -69,25 +69,24 @@ protected: rates *m_rates;
icq_critical_section *m_ratesMutex;
- int NetLog_Server(const char *fmt,...);
-
HANDLE runContact[4];
DWORD runTime[4];
int runCount;
- void checkRequestQueue();
+ void checkRequestQueue();
+
public:
- avatars_server_connection(CIcqProto *ppro, HANDLE hConnection, char *pCookie, WORD wCookieLen);
- virtual ~avatars_server_connection();
+ avatars_server_connection(CIcqProto *ppro, HANDLE hConnection, char *pCookie, WORD wCookieLen);
+ virtual ~avatars_server_connection();
- void connectionThread();
- void closeConnection();
- void shutdownConnection();
+ void connectionThread();
+ void closeConnection();
+ void shutdownConnection();
- __inline BOOL isPending() { return !isLoggedIn; };
- __inline BOOL isReady() { return isLoggedIn && isActive && !stopThread; };
+ __inline BOOL isPending() { return !isLoggedIn; };
+ __inline BOOL isReady() { return isLoggedIn && isActive && !stopThread; };
- DWORD sendGetAvatarRequest(HANDLE hContact, DWORD dwUin, char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file);
- DWORD sendUploadAvatarRequest(HANDLE hContact, WORD wRef, const BYTE *data, unsigned int datalen);
+ DWORD sendGetAvatarRequest(HANDLE hContact, DWORD dwUin, char *szUid, const BYTE *hash, unsigned int hashlen, const TCHAR *file);
+ DWORD sendUploadAvatarRequest(HANDLE hContact, WORD wRef, const BYTE *data, unsigned int datalen);
};
__inline static void SAFE_DELETE(avatars_server_connection **p) { SAFE_DELETE((lockable_struct**)p); };
@@ -107,9 +106,10 @@ struct avatars_request : public MZeroedObject WORD wRef;
DWORD timeOut;
avatars_request *pNext;
+
public:
- avatars_request(int type);
- virtual ~avatars_request();
+ avatars_request(int type);
+ virtual ~avatars_request();
};
__inline static void SAFE_DELETE(avatars_request **p) { SAFE_DELETE((MZeroedObject**)p); };
diff --git a/protocols/IcqOscarJ/src/icq_clients.cpp b/protocols/IcqOscarJ/src/icq_clients.cpp index cfdc74da93..c834dd285c 100644 --- a/protocols/IcqOscarJ/src/icq_clients.cpp +++ b/protocols/IcqOscarJ/src/icq_clients.cpp @@ -772,7 +772,7 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC if (CheckContactCapabilities(hContact, CAPF_RTF)) {
// most probably Qnext - try to make that shit at least receiving our msgs
ClearContactCapabilities(hContact, CAPF_SRV_RELAY);
- NetLog_Server("Forcing simple messages (QNext client).");
+ debugLogA("Forcing simple messages (QNext client).");
szClient = "Qnext";
}
else if (CheckContactCapabilities(hContact, CAPF_TYPING) && MatchCapability(caps, wLen, &captZers) && MatchCapability(caps, wLen, &capFakeHtml)) {
@@ -818,7 +818,7 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC if ( !CheckContactCapabilities(hContact, CAPF_RTF) && !CheckContactCapabilities(hContact, CAPF_UTF)) {
// this is bad, but we must do it - try to detect QNext
ClearContactCapabilities(hContact, CAPF_SRV_RELAY);
- NetLog_Server("Forcing simple messages (QNext client).");
+ debugLogA("Forcing simple messages (QNext client).");
szClient = "Qnext";
}
else if (!CheckContactCapabilities(hContact, CAPF_RTF) && CheckContactCapabilities(hContact, CAPF_UTF) && !dwFT1 && !dwFT2 && !dwFT3)
@@ -1003,9 +1003,9 @@ const char* CIcqProto::detectUserClient(HANDLE hContact, int nIsICQ, WORD wUserC // Log the detection result if it has changed or contact just logged on...
if (!szCurrentClient || strcmpnull(szCurrentClient, szClient)) {
if (bClientDetected)
- NetLog_Server("Client identified as %s", szClient);
+ debugLogA("Client identified as %s", szClient);
else
- NetLog_Server("No client identification, put default ICQ client for protocol.");
+ debugLogA("No client identification, put default ICQ client for protocol.");
}
return szClient;
diff --git a/protocols/IcqOscarJ/src/icq_db.cpp b/protocols/IcqOscarJ/src/icq_db.cpp index 8aa8a97687..ecf76ebfc4 100644 --- a/protocols/IcqOscarJ/src/icq_db.cpp +++ b/protocols/IcqOscarJ/src/icq_db.cpp @@ -75,7 +75,7 @@ int CIcqProto::getContactUid(HANDLE hContact, DWORD *pdwUin, uid_str *ppszUid) iRes = 0;
}
else
- NetLog_Server("AOL screennames not accepted");
+ debugLogA("AOL screennames not accepted");
}
db_free(&dbv);
}
diff --git a/protocols/IcqOscarJ/src/icq_infoupdate.cpp b/protocols/IcqOscarJ/src/icq_infoupdate.cpp index cf61c3ea3d..58ed0ec592 100644 --- a/protocols/IcqOscarJ/src/icq_infoupdate.cpp +++ b/protocols/IcqOscarJ/src/icq_infoupdate.cpp @@ -99,7 +99,7 @@ BOOL CIcqProto::icq_QueueUser(HANDLE hContact) m_infoUpdateList[nFirstFree].queued = time(NULL);
nInfoUserCount++;
#ifdef _DEBUG
- NetLog_Server("Queued user %u, place %u, count %u", dwUin, nFirstFree, nInfoUserCount);
+ debugLogA("Queued user %u, place %u, count %u", dwUin, nFirstFree, nInfoUserCount);
#endif
// Notify worker thread
if (hInfoQueueEvent && bInfoUpdateEnabled)
@@ -132,7 +132,7 @@ void CIcqProto::icq_DequeueUser(DWORD dwUin) if (m_infoUpdateList[i].dwUin == dwUin)
{
#ifdef _DEBUG
- NetLog_Server("Dequeued user %u", m_infoUpdateList[i].dwUin);
+ debugLogA("Dequeued user %u", m_infoUpdateList[i].dwUin);
#endif
m_infoUpdateList[i].dwUin = 0;
m_infoUpdateList[i].hContact = NULL;
@@ -188,7 +188,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) int i;
DWORD dwWait = WAIT_OBJECT_0;
- NetLog_Server("%s thread starting.", "Info-Update");
+ debugLogA("%s thread starting.", "Info-Update");
bInfoUpdateRunning = TRUE;
@@ -245,7 +245,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) SleepEx(1000, TRUE);
if (!bInfoUpdateRunning)
{ // need to end as fast as possible
- NetLog_Server("%s thread ended.", "Info-Update");
+ debugLogA("%s thread ended.", "Info-Update");
goto LBL_Exit;
}
continue;
@@ -254,19 +254,19 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) if (FindCookie(dwInfoActiveRequest, NULL, NULL))
{ // only send another request, when the previous is completed
#ifdef _DEBUG
- NetLog_Server("Info-Update: Request 0x%x still in progress.", dwInfoActiveRequest);
+ debugLogA("Info-Update: Request 0x%x still in progress.", dwInfoActiveRequest);
#endif
SleepEx(1000, TRUE);
if (!bInfoUpdateRunning)
{ // need to end as fast as possible
- NetLog_Server("%s thread ended.", "Info-Update");
+ debugLogA("%s thread ended.", "Info-Update");
goto LBL_Exit;
}
continue;
}
#ifdef _DEBUG
- NetLog_Server("Info-Update: Users %u in queue.", nInfoUserCount);
+ debugLogA("Info-Update: Users %u in queue.", nInfoUserCount);
#endif
// Either some user is waiting long enough, or all users are ready (waited at least the minimum time)
m_ratesMutex->Enter();
@@ -282,12 +282,12 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) m_ratesMutex->Leave();
#ifdef _DEBUG
- NetLog_Server("Rates: InfoUpdate delayed %dms", nDelay);
+ debugLogA("Rates: InfoUpdate delayed %dms", nDelay);
#endif
SleepEx(nDelay, TRUE); // do not keep things locked during sleep
if (!bInfoUpdateRunning)
{ // need to end as fast as possible
- NetLog_Server("%s thread ended.", "Info-Update");
+ debugLogA("%s thread ended.", "Info-Update");
goto LBL_Exit;
}
m_ratesMutex->Enter();
@@ -339,7 +339,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) else
{
#ifdef _DEBUG
- NetLog_Server("Dequeued absolete user %u", m_infoUpdateList[i].dwUin);
+ debugLogA("Dequeued absolete user %u", m_infoUpdateList[i].dwUin);
#endif
// Dequeue user and find another one
m_infoUpdateList[i].dwUin = 0;
@@ -351,7 +351,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) }
#ifdef _DEBUG
- NetLog_Server("Request info for %u user(s).", nListIndex);
+ debugLogA("Request info for %u user(s).", nListIndex);
#endif
if (!nListIndex)
{ // no users to request info for
@@ -384,7 +384,7 @@ void __cdecl CIcqProto::InfoUpdateThread( void* ) }
}
- NetLog_Server("%s thread ended.", "Info-Update");
+ debugLogA("%s thread ended.", "Info-Update");
LBL_Exit:
SAFE_DELETE(&infoUpdateMutex);
@@ -394,7 +394,7 @@ LBL_Exit: // Clean up before exit
void CIcqProto::icq_InfoUpdateCleanup(void)
{
- NetLog_Server("%s must die.", "Info-Update");
+ debugLogA("%s must die.", "Info-Update");
bInfoUpdateRunning = FALSE;
if (hInfoQueueEvent)
SetEvent(hInfoQueueEvent); // break queue loop
diff --git a/protocols/IcqOscarJ/src/icq_packet.cpp b/protocols/IcqOscarJ/src/icq_packet.cpp index 0a727cc5aa..c74687cdc3 100644 --- a/protocols/IcqOscarJ/src/icq_packet.cpp +++ b/protocols/IcqOscarJ/src/icq_packet.cpp @@ -884,7 +884,7 @@ BOOL CIcqProto::unpackUID(BYTE **ppBuf, WORD *pwLen, DWORD *pdwUIN, uid_str *pps *ppBuf += nUIDLen;
*pwLen -= nUIDLen;
- NetLog_Server("Malformed UIN in packet");
+ debugLogA("Malformed UIN in packet");
return FALSE;
}
diff --git a/protocols/IcqOscarJ/src/icq_proto.cpp b/protocols/IcqOscarJ/src/icq_proto.cpp index 42f6c95d75..da558cf76e 100644 --- a/protocols/IcqOscarJ/src/icq_proto.cpp +++ b/protocols/IcqOscarJ/src/icq_proto.cpp @@ -78,7 +78,7 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : contactsCache(10, CompareContactsCache),
cheekySearchId(-1)
{
- NetLog_Server( "Setting protocol/module name to '%s'", m_szModuleName );
+ debugLogA( "Setting protocol/module name to '%s'", m_szModuleName );
oftMutex = new icq_critical_section();
@@ -185,7 +185,7 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : nlu.pfnHttpGatewayBegin = icq_httpGatewayBegin;
nlu.pfnHttpGatewayWrapSend = icq_httpGatewayWrapSend;
nlu.pfnHttpGatewayUnwrapRecv = icq_httpGatewayUnwrapRecv;
- m_hServerNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
char szP2PModuleName[MAX_PATH];
mir_snprintf(szP2PModuleName, SIZEOF(szP2PModuleName), "%sP2P", m_szModuleName);
@@ -208,7 +208,7 @@ CIcqProto::CIcqProto( const char* aProtoName, const TCHAR* aUserName ) : CallService(MS_DB_EVENT_REGISTERTYPE, 0, (LPARAM)&eventType);
// Protocol instance is ready
- NetLog_Server("%s: Protocol instance '%s' created.", ICQ_PROTOCOL_NAME, m_szModuleName);
+ debugLogA("%s: Protocol instance '%s' created.", ICQ_PROTOCOL_NAME, m_szModuleName);
}
@@ -230,7 +230,7 @@ CIcqProto::~CIcqProto() // NetLib clean-up
NetLib_SafeCloseHandle(&m_hDirectNetlibUser);
- NetLib_SafeCloseHandle(&m_hServerNetlibUser);
+ NetLib_SafeCloseHandle(&m_hNetlibUser);
// Destroy hookable events
if (m_modeMsgsEvent)
@@ -263,7 +263,7 @@ CIcqProto::~CIcqProto() SAFE_FREE(&m_modeMsgs.szDnd);
SAFE_FREE(&m_modeMsgs.szFfc);
- NetLog_Server("%s: Protocol instance '%s' destroyed.", ICQ_PROTOCOL_NAME, m_szModuleName);
+ debugLogA("%s: Protocol instance '%s' destroyed.", ICQ_PROTOCOL_NAME, m_szModuleName);
}
////////////////////////////////////////////////////////////////////////////////////////
@@ -1127,7 +1127,7 @@ int __cdecl CIcqProto::SendContacts( HANDLE hContact, int flags, int nContacts, icq_packet mData, mNames;
#ifdef _DEBUG
- NetLog_Server("Sending contacts to %s.", strUID(dwUin, szUid));
+ debugLogA("Sending contacts to %s.", strUID(dwUin, szUid));
#endif
// Do not calculate the exact size of the data packet - only the maximal size (easier)
// Sumarize size of group information
@@ -1257,7 +1257,7 @@ int __cdecl CIcqProto::SendContacts( HANDLE hContact, int flags, int nContacts, char* pBuffer;
#ifdef _DEBUG
- NetLog_Server("Sending contacts to %d.", dwUin);
+ debugLogA("Sending contacts to %d.", dwUin);
#endif
// Compute count record's length
_itoa(nContacts, szCount, 10);
@@ -1387,7 +1387,7 @@ HANDLE __cdecl CIcqProto::SendFile( HANDLE hContact, const TCHAR* szDescription, WORD wClientVersion = getWord(hContact, "Version", 7);
if (wClientVersion < 7)
- NetLog_Server("IcqSendFile() can't send to version %u", wClientVersion);
+ debugLogA("IcqSendFile() can't send to version %u", wClientVersion);
else
{
int i;
@@ -1405,7 +1405,7 @@ HANDLE __cdecl CIcqProto::SendFile( HANDLE hContact, const TCHAR* szDescription, ft->pszFiles[i] = (ppszFiles[i]) ? tchar_to_utf8(ppszFiles[i]) : NULL;
if (_tstat(ppszFiles[i], &statbuf))
- NetLog_Server("IcqSendFile() was passed invalid filename(s)");
+ debugLogA("IcqSendFile() was passed invalid filename(s)");
else
ft->dwTotalSize += statbuf.st_size;
}
@@ -1423,7 +1423,7 @@ HANDLE __cdecl CIcqProto::SendFile( HANDLE hContact, const TCHAR* szDescription, char *pszFiles;
- NetLog_Server("Init file send");
+ debugLogA("Init file send");
if (ft->dwFileCount == 1)
{
@@ -1448,7 +1448,7 @@ HANDLE __cdecl CIcqProto::SendFile( HANDLE hContact, const TCHAR* szDescription, int iRes = icq_sendFileSendDirectv7(ft, pszFiles);
if (iRes) return ft; // Success
}
- NetLog_Server("Sending v%u file transfer request through server", 7);
+ debugLogA("Sending v%u file transfer request through server", 7);
icq_sendFileSendServv7(ft, pszFiles);
}
else
@@ -1458,7 +1458,7 @@ HANDLE __cdecl CIcqProto::SendFile( HANDLE hContact, const TCHAR* szDescription, int iRes = icq_sendFileSendDirectv8(ft, pszFiles);
if (iRes) return ft; // Success
}
- NetLog_Server("Sending v%u file transfer request through server", 8);
+ debugLogA("Sending v%u file transfer request through server", 8);
icq_sendFileSendServv8(ft, pszFiles, ACKTYPE_NONE);
}
}
@@ -1530,8 +1530,8 @@ int __cdecl CIcqProto::SendMsg( HANDLE hContact, int flags, const char* pszSrc ) else
{
#ifdef _DEBUG
- NetLog_Server("Send %smessage - Message cap is %u", puszText ? "unicode " : "", CheckContactCapabilities(hContact, CAPF_SRV_RELAY));
- NetLog_Server("Send %smessage - Contact status is %u", puszText ? "unicode " : "", wRecipientStatus);
+ debugLogA("Send %smessage - Message cap is %u", puszText ? "unicode " : "", CheckContactCapabilities(hContact, CAPF_SRV_RELAY));
+ debugLogA("Send %smessage - Contact status is %u", puszText ? "unicode " : "", wRecipientStatus);
#endif
if (dwUin && m_bDCMsgEnabled && IsDirectConnectionOpen(hContact, DIRECTCONN_STANDARD, 0))
{ // send thru direct
@@ -1872,7 +1872,7 @@ int __cdecl CIcqProto::SetStatus(int iNewStatus) int nNewStatus = MirandaStatusToSupported(iNewStatus);
// check if netlib handles are ready
- if (!m_hServerNetlibUser)
+ if (!m_hNetlibUser)
return 0;
if (m_bTempVisListEnabled && icqOnline()) // remove temporary visible users
@@ -1905,7 +1905,7 @@ int __cdecl CIcqProto::SetStatus(int iNewStatus) SetCurrentStatus(ID_STATUS_OFFLINE);
- NetLog_Server("Logged off.");
+ debugLogA("Logged off.");
}
}
else
diff --git a/protocols/IcqOscarJ/src/icq_proto.h b/protocols/IcqOscarJ/src/icq_proto.h index 9d392110cc..a3291a94e7 100644 --- a/protocols/IcqOscarJ/src/icq_proto.h +++ b/protocols/IcqOscarJ/src/icq_proto.h @@ -145,7 +145,7 @@ struct CIcqProto : public PROTO<CIcqProto> int __cdecl OnPreBuildStatusMenu( WPARAM, LPARAM );
//====| Data |========================================================================
- HANDLE m_hServerNetlibUser, m_hDirectNetlibUser;
+ HANDLE m_hDirectNetlibUser;
BYTE m_bGatewayMode;
BYTE m_bSecureLogin;
@@ -875,7 +875,6 @@ struct CIcqProto : public PROTO<CIcqProto> void __cdecl ProtocolAckThread(icq_ack_args* pArguments);
void SendProtoAck(HANDLE hContact, DWORD dwCookie, int nAckResult, int nAckType, char* pszMessage);
- int NetLog_Server(const char *fmt,...);
int NetLog_Direct(const char *fmt,...);
int NetLog_Uni(BOOL bDC, const char *fmt,...);
diff --git a/protocols/IcqOscarJ/src/icq_rates.cpp b/protocols/IcqOscarJ/src/icq_rates.cpp index e2c5734049..043e0dc173 100644 --- a/protocols/IcqOscarJ/src/icq_rates.cpp +++ b/protocols/IcqOscarJ/src/icq_rates.cpp @@ -46,7 +46,7 @@ rates::rates(CIcqProto *ppro, BYTE *pBuffer, WORD wLen) if (wCount > MAX_RATES_GROUP_COUNT)
{ // just sanity check
- ppro->NetLog_Server("Rates: Error: Data packet contains too many rate groups!");
+ ppro->debugLogA("Rates: Error: Data packet contains too many rate groups!");
wCount = MAX_RATES_GROUP_COUNT;
}
@@ -97,7 +97,7 @@ rates::rates(CIcqProto *ppro, BYTE *pBuffer, WORD wLen) pGroup->pPairs[n] = wItem;
}
#ifdef _DEBUG
- ppro->NetLog_Server("Rates: %d# %d pairs.", i+1, wNum);
+ ppro->debugLogA("Rates: %d# %d pairs.", i+1, wNum);
#endif
wLen -= wNum*4;
}
@@ -210,7 +210,7 @@ void rates::updateLevel(WORD wGroup, int nLevel) pGroup->rCurrentLevel = nLevel;
pGroup->tCurrentLevel = GetTickCount();
#ifdef _DEBUG
- ppro->NetLog_Server("Rates: New level %d for #%d", nLevel, wGroup);
+ ppro->debugLogA("Rates: New level %d for #%d", nLevel, wGroup);
#endif
}
}
@@ -304,7 +304,7 @@ rates_queue_item* rates_queue_item::copyItem(rates_queue_item *pDest) void rates_queue_item::execute()
{
#ifdef _DEBUG
- ppro->NetLog_Server("Rates: Error executing abstract event.");
+ ppro->debugLogA("Rates: Error executing abstract event.");
#endif
}
@@ -357,7 +357,7 @@ void __cdecl CIcqProto::rateDelayThread(rate_delay_args *pArgs) void rates_queue::initDelay(int nDelay, IcqRateFunc delaycode)
{
#ifdef _DEBUG
- ppro->NetLog_Server("Rates: Delay %dms", nDelay);
+ ppro->debugLogA("Rates: Delay %dms", nDelay);
#endif
rate_delay_args *pArgs = (rate_delay_args*)SAFE_MALLOC(sizeof(rate_delay_args)); // This will be freed in the new thread
@@ -374,7 +374,7 @@ void rates_queue::cleanup() icq_lock l(listsMutex);
if (pendingListSize)
- ppro->NetLog_Server("Rates: Purging %d %s(s).", pendingListSize, szDescr);
+ ppro->debugLogA("Rates: Purging %d %s(s).", pendingListSize, szDescr);
for (int i=0; i < pendingListSize; i++)
delete pendingList[i];
@@ -423,11 +423,11 @@ void rates_queue::processQueue() if (ppro->icqOnline())
{
- ppro->NetLog_Server("Rates: Resuming %s.", szDescr);
+ ppro->debugLogA("Rates: Resuming %s.", szDescr);
item->execute();
}
else
- ppro->NetLog_Server("Rates: Discarding %s.", szDescr);
+ ppro->debugLogA("Rates: Discarding %s.", szDescr);
if (bSetupTimer)
{
@@ -450,7 +450,7 @@ void rates_queue::putItem(rates_queue_item *pItem, int nMinDelay) if (!ppro->icqOnline())
return;
- ppro->NetLog_Server("Rates: Delaying %s.", szDescr);
+ ppro->debugLogA("Rates: Delaying %s.", szDescr);
listsMutex->Enter();
if (pendingListSize)
diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index 53a5420944..5084742a9c 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -50,14 +50,14 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) ResetSettingsOnConnect();
// Connect to the login server
- NetLog_Server("Authenticating to server");
+ debugLogA("Authenticating to server");
{
NETLIBOPENCONNECTION nloc = infoParam->nloc;
nloc.timeout = 6;
if (m_bGatewayMode)
nloc.flags |= NLOCF_HTTPGATEWAY;
- hServerConn = NetLib_OpenConnection(m_hServerNetlibUser, NULL, &nloc);
+ hServerConn = NetLib_OpenConnection(m_hNetlibUser, NULL, &nloc);
SAFE_FREE((void**)&nloc.szHost);
SAFE_FREE((void**)&infoParam);
@@ -131,13 +131,13 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) if (recvResult == 0)
{
- NetLog_Server("Clean closure of server socket");
+ debugLogA("Clean closure of server socket");
break;
}
if (recvResult == SOCKET_ERROR)
{
- NetLog_Server("Abortive closure of server socket, error: %d", GetLastError());
+ debugLogA("Abortive closure of server socket, error: %d", GetLastError());
break;
}
@@ -149,7 +149,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) m_bConnectionLost = FALSE;
SetCurrentStatus(ID_STATUS_OFFLINE);
- NetLog_Server("Logged off.");
+ debugLogA("Logged off.");
break;
}
@@ -228,7 +228,7 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) FlushServerIDs(); // clear server IDs list
- NetLog_Server("%s thread ended.", "Server");
+ debugLogA("%s thread ended.", "Server");
}
@@ -237,7 +237,7 @@ void CIcqProto::icq_serverDisconnect(BOOL bBlock) if ( !hServerConn)
return;
- NetLog_Server("Server shutdown requested");
+ debugLogA("Server shutdown requested");
Netlib_Shutdown(hServerConn);
if (serverThreadHandle) {
@@ -279,7 +279,7 @@ int CIcqProto::handleServerPackets(BYTE *buf, int len, serverthread_info *info) #ifdef _DEBUG
- NetLog_Server("Server FLAP: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
+ debugLogA("Server FLAP: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
#endif
switch (channel) {
@@ -304,7 +304,7 @@ int CIcqProto::handleServerPackets(BYTE *buf, int len, serverthread_info *info) break;
default:
- NetLog_Server("Warning: Unhandled Server FLAP Channel: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
+ debugLogA("Warning: Unhandled Server FLAP Channel: Channel %u, Seq %u, Length %u bytes", channel, sequence, datalen);
break;
}
@@ -364,7 +364,7 @@ void CIcqProto::sendServPacket(icq_packet *pPacket) else
{
connectionHandleMutex->Leave();
- NetLog_Server("Error: Failed to send packet (no connection)");
+ debugLogA("Error: Failed to send packet (no connection)");
}
SAFE_FREE((void**)&pPacket->pData);
diff --git a/protocols/IcqOscarJ/src/icq_servlist.cpp b/protocols/IcqOscarJ/src/icq_servlist.cpp index ab0ae4387d..44e6ef480e 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.cpp +++ b/protocols/IcqOscarJ/src/icq_servlist.cpp @@ -42,7 +42,7 @@ void CIcqProto::servlistBeginOperation(int operationCount, int bImport) // update count of active operations
servlistEditCount += operationCount;
#ifdef _DEBUG
- NetLog_Server("Server-List: Begin operation processed (%d operations active)", servlistEditCount);
+ debugLogA("Server-List: Begin operation processed (%d operations active)", servlistEditCount);
#endif
}
}
@@ -53,7 +53,7 @@ void CIcqProto::servlistEndOperation(int operationCount) {
if (operationCount > servlistEditCount)
{ // sanity check
- NetLog_Server("Error: Server-List End operation is not paired!");
+ debugLogA("Error: Server-List End operation is not paired!");
operationCount = servlistEditCount;
}
// update count of active operations
@@ -62,7 +62,7 @@ void CIcqProto::servlistEndOperation(int operationCount) if (!servlistEditCount)
icq_sendServerEndOperation();
#ifdef _DEBUG
- NetLog_Server("Server-List: End operation processed (%d operations active)", servlistEditCount);
+ debugLogA("Server-List: End operation processed (%d operations active)", servlistEditCount);
#endif
}
}
@@ -72,7 +72,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) int* queueState = ( int* )param;
#ifdef _DEBUG
- NetLog_Server("Server-List: Starting Update board.");
+ debugLogA("Server-List: Starting Update board.");
#endif
SleepEx(50, FALSE);
@@ -118,7 +118,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) continue;
}
#ifdef _DEBUG
- NetLog_Server("Server-List: %d items in queue.", servlistQueueCount);
+ debugLogA("Server-List: %d items in queue.", servlistQueueCount);
#endif
// take the oldest item (keep the board FIFO)
pItem = servlistQueueList[0]; // take first (queue contains at least one item here)
@@ -139,7 +139,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) servlistQueueMutex->Leave();
if (nDelay < 10) nDelay = 10;
#ifdef _DEBUG
- NetLog_Server("Server-List: Delaying %dms [Rates]", nDelay);
+ debugLogA("Server-List: Delaying %dms [Rates]", nDelay);
#endif
SleepEx(nDelay, FALSE);
// check if the rate is now ok
@@ -271,7 +271,7 @@ void __cdecl CIcqProto::servlistQueueThread(void *param) servlistQueueThreadHandle = NULL;
servlistQueueMutex->Leave();
#ifdef _DEBUG
- NetLog_Server("Server-List: Update Board ending.");
+ debugLogA("Server-List: Update Board ending.");
#endif
}
@@ -301,7 +301,7 @@ void CIcqProto::servlistQueueAddGroupItem(servlistgroupitem* pGroupItem, int dwT if (!pItem) continue;
#ifdef _DEBUG
- NetLog_Server("Server-List: Adding packet to item #%d with operation %x.", i, servlistQueueList[i]->pItems[0]->dwOperation);
+ debugLogA("Server-List: Adding packet to item #%d with operation %x.", i, servlistQueueList[i]->pItems[0]->dwOperation);
#endif
break;
}
@@ -320,7 +320,7 @@ void CIcqProto::servlistQueueAddGroupItem(servlistgroupitem* pGroupItem, int dwT // really add to queue
servlistQueueList[servlistQueueCount++] = pItem;
#ifdef _DEBUG
- NetLog_Server("Server-List: Adding new item to queue.");
+ debugLogA("Server-List: Adding new item to queue.");
#endif
}
else if (pItem->dwTimeout > dwTimeout)
@@ -516,9 +516,9 @@ servlistpendingitem* CIcqProto::servlistPendingRemoveItem(int nType, HANDLE hCon { // move the remaining operations
#ifdef _DEBUG
if (pItem->nType == ITEM_PENDING_CONTACT)
- NetLog_Server("Server-List: Resuming contact %x operation.", pItem->hContact);
+ debugLogA("Server-List: Resuming contact %x operation.", pItem->hContact);
else
- NetLog_Server("Server-List: Resuming group \"%s\" operation.", pItem->szGroup);
+ debugLogA("Server-List: Resuming group \"%s\" operation.", pItem->szGroup);
#endif
pNewItem->nType = pItem->nType;
@@ -539,7 +539,7 @@ servlistpendingitem* CIcqProto::servlistPendingRemoveItem(int nType, HANDLE hCon }
#ifdef _DEBUG
else
- NetLog_Server("Server-List Error: Trying to remove non-existing pending %s.", nType == ITEM_PENDING_CONTACT ? "contact" : "group");
+ debugLogA("Server-List Error: Trying to remove non-existing pending %s.", nType == ITEM_PENDING_CONTACT ? "contact" : "group");
#endif
return pItem;
@@ -568,7 +568,7 @@ void CIcqProto::servlistPendingAddContactOperation(HANDLE hContact, LPARAM param }
else
{
- NetLog_Server("Server-List Error: Trying to add pending operation to a non existing contact.");
+ debugLogA("Server-List Error: Trying to add pending operation to a non existing contact.");
}
}
@@ -594,7 +594,7 @@ void CIcqProto::servlistPendingAddGroupOperation(const char *pszGroup, LPARAM pa }
else
{
- NetLog_Server("Server-List Error: Trying to add pending operation to a non existing group.");
+ debugLogA("Server-List Error: Trying to add pending operation to a non existing group.");
}
}
@@ -612,7 +612,7 @@ int CIcqProto::servlistPendingAddContact(HANDLE hContact, WORD wContactID, WORD if (pItem)
{
#ifdef _DEBUG
- NetLog_Server("Server-List: Pending contact %x already in list; adding as operation.", hContact);
+ debugLogA("Server-List: Pending contact %x already in list; adding as operation.", hContact);
#endif
servlistPendingAddContactOperation(hContact, param, callback, SPOF_AUTO_CREATE_ITEM);
@@ -625,7 +625,7 @@ int CIcqProto::servlistPendingAddContact(HANDLE hContact, WORD wContactID, WORD }
#ifdef _DEBUG
- NetLog_Server("Server-List: Starting contact %x operation.", hContact);
+ debugLogA("Server-List: Starting contact %x operation.", hContact);
#endif
pItem = (servlistpendingitem *)SAFE_MALLOC(sizeof(servlistpendingitem));
@@ -663,7 +663,7 @@ int CIcqProto::servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPAR if (pItem)
{
#ifdef _DEBUG
- NetLog_Server("Server-List: Pending group \"%s\" already in list; adding as operation.", pszGroup);
+ debugLogA("Server-List: Pending group \"%s\" already in list; adding as operation.", pszGroup);
#endif
servlistPendingAddGroupOperation(pszGroup, param, callback, SPOF_AUTO_CREATE_ITEM);
@@ -676,7 +676,7 @@ int CIcqProto::servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPAR }
#ifdef _DEBUG
- NetLog_Server("Server-List: Starting group \"%s\" operation.", pszGroup);
+ debugLogA("Server-List: Starting group \"%s\" operation.", pszGroup);
#endif
pItem = (servlistpendingitem *)SAFE_MALLOC(sizeof(servlistpendingitem));
@@ -703,7 +703,7 @@ int CIcqProto::servlistPendingAddGroup(const char *pszGroup, WORD wGroupID, LPAR void CIcqProto::servlistPendingRemoveContact(HANDLE hContact, WORD wContactID, WORD wGroupID, int nResult)
{
#ifdef _DEBUG
- NetLog_Server("Server-List: %s contact %x operation.", (nResult != PENDING_RESULT_PURGE) ? "Ending" : "Purging", hContact);
+ debugLogA("Server-List: %s contact %x operation.", (nResult != PENDING_RESULT_PURGE) ? "Ending" : "Purging", hContact);
#endif
servlistpendingitem *pItem = servlistPendingRemoveItem(ITEM_PENDING_CONTACT, hContact, NULL);
@@ -733,14 +733,14 @@ void CIcqProto::servlistPendingRemoveContact(HANDLE hContact, WORD wContactID, W SAFE_FREE((void**)&pItem);
}
else
- NetLog_Server("Server-List Error: Trying to remove a non existing pending contact.");
+ debugLogA("Server-List Error: Trying to remove a non existing pending contact.");
}
void CIcqProto::servlistPendingRemoveGroup(const char *pszGroup, WORD wGroupID, int nResult)
{
#ifdef _DEBUG
- NetLog_Server("Server-List: %s group \"%s\" operation.", (nResult != PENDING_RESULT_PURGE) ? "Ending" : "Purging", pszGroup);
+ debugLogA("Server-List: %s group \"%s\" operation.", (nResult != PENDING_RESULT_PURGE) ? "Ending" : "Purging", pszGroup);
#endif
servlistpendingitem *pItem = servlistPendingRemoveItem(ITEM_PENDING_GROUP, NULL, pszGroup);
@@ -771,7 +771,7 @@ void CIcqProto::servlistPendingRemoveGroup(const char *pszGroup, WORD wGroupID, SAFE_FREE((void**)&pItem);
}
else
- NetLog_Server("Server-List Error: Trying to remove a non existing pending group.");
+ debugLogA("Server-List Error: Trying to remove a non existing pending group.");
}
@@ -954,7 +954,7 @@ static int GroupReserveIdsEnumProc(const char *szSetting,LPARAM lParam) }
param->ppro->ReserveServerID((WORD)strtoul(szSetting, NULL, 0x10), SSIT_GROUP, 0);
#ifdef _DEBUG
- param->ppro->NetLog_Server("Loaded group %u:'%s'", strtoul(szSetting, NULL, 0x10), val);
+ param->ppro->debugLogA("Loaded group %u:'%s'", strtoul(szSetting, NULL, 0x10), val);
#endif
}
return 0;
@@ -1045,7 +1045,7 @@ void CIcqProto::LoadServerIDs() db_free(&dbv);
}
- NetLog_Server("Loaded SSI: %d contacts, %d groups, %d permit, %d deny, %d ignore, %d unknown items.", nContacts, nGroups, nPermits, nDenys, nIgnores, nUnhandled);
+ debugLogA("Loaded SSI: %d contacts, %d groups, %d permit, %d deny, %d ignore, %d unknown items.", nContacts, nGroups, nPermits, nDenys, nIgnores, nUnhandled);
}
@@ -1180,7 +1180,7 @@ DWORD CIcqProto::icq_sendServerContact(HANDLE hContact, DWORD dwCookie, WORD wAc // Prepare UID
if (getContactUid(hContact, &dwUin, &szUid))
{
- NetLog_Server("Buddy upload failed (UID missing).");
+ debugLogA("Buddy upload failed (UID missing).");
return 0;
}
@@ -1285,7 +1285,7 @@ DWORD CIcqProto::icq_sendServerGroup(DWORD dwCookie, WORD wAction, WORD wGroupId if (strlennull(szName) == 0 && wGroupId != 0)
{
- NetLog_Server("Group upload failed (GroupName missing).");
+ debugLogA("Group upload failed (GroupName missing).");
return 0; // without name we could not change the group
}
@@ -1496,7 +1496,7 @@ char *CIcqProto::getServListGroupName(WORD wGroupID) if (!wGroupID)
{
- NetLog_Server("Warning: Cannot get group name (Group ID missing)!");
+ debugLogA("Warning: Cannot get group name (Group ID missing)!");
return NULL;
}
@@ -1505,7 +1505,7 @@ char *CIcqProto::getServListGroupName(WORD wGroupID) if (!CheckServerID(wGroupID, 0))
{ // check if valid id, if not give empty and remove
- NetLog_Server("Removing group %u from cache...", wGroupID);
+ debugLogA("Removing group %u from cache...", wGroupID);
db_unset(NULL, szModule, szGroup);
return NULL;
}
@@ -1521,7 +1521,7 @@ void CIcqProto::setServListGroupName(WORD wGroupID, const char *szGroupName) if (!wGroupID)
{
- NetLog_Server("Warning: Cannot set group name (Group ID missing)!");
+ debugLogA("Warning: Cannot set group name (Group ID missing)!");
return;
}
@@ -1550,7 +1550,7 @@ WORD CIcqProto::getServListGroupLinkID(const char *szPath) if (wGroupId && !CheckServerID(wGroupId, 0))
{ // known, check if still valid, if not remove
- NetLog_Server("Removing group \"%s\" from cache...", szPath);
+ debugLogA("Removing group \"%s\" from cache...", szPath);
db_unset(NULL, szModule, szPath);
wGroupId = 0;
}
@@ -1872,7 +1872,7 @@ int CIcqProto::servlistCreateGroup_gotParentGroup(const char *szGroup, WORD wGro if (ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action)))
{ // we have cookie good, go on
#ifdef _DEBUG
- NetLog_Server("Server-List: Creating sub-group \"%s\", parent group \"%s\".", szSubGroupItem, szGroup);
+ debugLogA("Server-List: Creating sub-group \"%s\", parent group \"%s\".", szSubGroupItem, szGroup);
#endif
ReserveServerID(wSubGroupID, SSIT_GROUP, 0);
@@ -1920,7 +1920,7 @@ int CIcqProto::servlistCreateGroup_Ready(const char *szGroup, WORD groupID, LPAR if (ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action)))
{ // we have cookie good, go on
#ifdef _DEBUG
- NetLog_Server("Server-List: Creating root group \"%s\".", szGroup);
+ debugLogA("Server-List: Creating root group \"%s\".", szGroup);
#endif
ack->wGroupId = GenerateServerID(SSIT_GROUP, 0);
ack->szGroup = null_strdup(szGroup); // we need that name
@@ -2007,7 +2007,7 @@ int CIcqProto::servlistAddContact_gotGroup(const char *szGroup, WORD wGroupID, L if (wItemID) /// TODO: redundant ???
{ // Only add the contact if it doesnt already have an ID
servlistPendingRemoveContact(ack->hContact, wItemID, wGroupID, PENDING_RESULT_SUCCESS);
- NetLog_Server("Failed to add contact to server side list (%s)", "already there");
+ debugLogA("Failed to add contact to server side list (%s)", "already there");
SAFE_FREE((void**)&ack);
return CALLBACK_RESULT_CONTINUE;
}
@@ -2043,7 +2043,7 @@ int CIcqProto::servlistAddContact_Ready(HANDLE hContact, WORD wContactID, WORD w if (wItemID)
{ // Only add the contact if it doesn't already have an ID
servlistPendingRemoveContact(ack->hContact, wItemID, getWord(hContact, DBSETTING_SERVLIST_GROUP, 0), PENDING_RESULT_SUCCESS);
- NetLog_Server("Failed to add contact to server side list (%s)", "already there");
+ debugLogA("Failed to add contact to server side list (%s)", "already there");
SAFE_FREE((void**)&ack->szGroup);
SAFE_FREE((void**)&ack);
return CALLBACK_RESULT_CONTINUE;
@@ -2066,13 +2066,13 @@ void CIcqProto::servlistAddContact(HANDLE hContact, const char *pszGroup) // Get UID
if (getContactUid(hContact, &dwUin, &szUid))
{ // Could not do anything without uid
- NetLog_Server("Failed to add contact to server side list (%s)", "no UID");
+ debugLogA("Failed to add contact to server side list (%s)", "no UID");
return;
}
if (!(ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action))))
{ // Could not do anything without cookie
- NetLog_Server("Failed to add contact to server side list (%s)", "malloc failed");
+ debugLogA("Failed to add contact to server side list (%s)", "malloc failed");
return;
}
else
@@ -2104,7 +2104,7 @@ int CIcqProto::servlistRemoveContact_Ready(HANDLE hContact, WORD contactID, WORD { // Could not find a usable group ID
servlistPendingRemoveContact(hContact, contactID, groupID, PENDING_RESULT_FAILED);
- NetLog_Server("Failed to remove contact from server side list (%s)", "no group ID");
+ debugLogA("Failed to remove contact from server side list (%s)", "no group ID");
SAFE_FREE((void**)&ack);
return CALLBACK_RESULT_CONTINUE;
}
@@ -2114,7 +2114,7 @@ int CIcqProto::servlistRemoveContact_Ready(HANDLE hContact, WORD contactID, WORD { // Could not find usable item ID
servlistPendingRemoveContact(hContact, contactID, wGroupID, PENDING_RESULT_FAILED);
- NetLog_Server("Failed to remove contact from server side list (%s)", "no item ID");
+ debugLogA("Failed to remove contact from server side list (%s)", "no item ID");
SAFE_FREE((void**)&ack);
return CALLBACK_RESULT_CONTINUE;
}
@@ -2143,13 +2143,13 @@ void CIcqProto::servlistRemoveContact(HANDLE hContact) if (getContactUid(hContact, &dwUin, &szUid))
{
// Could not do anything without uid
- NetLog_Server("Failed to remove contact from server side list (%s)", "no UID");
+ debugLogA("Failed to remove contact from server side list (%s)", "no UID");
return;
}
if (!(ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action))))
{ // Could not do anything without cookie
- NetLog_Server("Failed to remove contact from server side list (%s)", "malloc failed");
+ debugLogA("Failed to remove contact from server side list (%s)", "malloc failed");
return;
}
else
@@ -2186,7 +2186,7 @@ int CIcqProto::servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNew if (!wItemID)
{ // We have no ID, so try to simply add the contact to serv-list
- NetLog_Server("Unable to move contact (no ItemID) -> trying to add");
+ debugLogA("Unable to move contact (no ItemID) -> trying to add");
// we know the GroupID, so directly call add
return servlistAddContact_gotGroup(szGroup, wNewGroupID, lParam, nResult);
}
@@ -2194,7 +2194,7 @@ int CIcqProto::servlistMoveContact_gotTargetGroup(const char *szGroup, WORD wNew if (wGroupID == wNewGroupID)
{ // Only move the contact if it had different GroupID
servlistPendingRemoveContact(ack->hContact, wItemID, wNewGroupID, PENDING_RESULT_SUCCESS);
- NetLog_Server("Contact not moved to group on server side list (same Group)");
+ debugLogA("Contact not moved to group on server side list (same Group)");
return CALLBACK_RESULT_CONTINUE;
}
@@ -2237,7 +2237,7 @@ int CIcqProto::servlistMoveContact_Ready(HANDLE hContact, WORD contactID, WORD g { // Only move the contact if it had an GroupID
servlistPendingRemoveContact(ack->hContact, contactID, groupID, PENDING_RESULT_FAILED);
- NetLog_Server("Failed to move contact to group on server side list (%s)", "no Group");
+ debugLogA("Failed to move contact to group on server side list (%s)", "no Group");
SAFE_FREE(&ack->szGroup);
SAFE_FREE((void**)&ack);
return CALLBACK_RESULT_CONTINUE;
@@ -2261,13 +2261,13 @@ void CIcqProto::servlistMoveContact(HANDLE hContact, const char *pszNewGroup) // Get UID
if (getContactUid(hContact, &dwUin, &szUid))
{ // Could not do anything without uin
- NetLog_Server("Failed to move contact to group on server side list (%s)", "no UID");
+ debugLogA("Failed to move contact to group on server side list (%s)", "no UID");
return;
}
if ((pszNewGroup != NULL) && (pszNewGroup[0]!='\0') && !getCListGroupExists(pszNewGroup))
{ // the contact moved to non existing group, do not do anything: MetaContact hack
- NetLog_Server("Contact not moved - probably hiding by MetaContacts.");
+ debugLogA("Contact not moved - probably hiding by MetaContacts.");
return;
}
@@ -2281,7 +2281,7 @@ void CIcqProto::servlistMoveContact(HANDLE hContact, const char *pszNewGroup) if (!ack)
{ // Could not do anything without cookie
- NetLog_Server("Failed to add contact to server side list (%s)", "malloc failed");
+ debugLogA("Failed to add contact to server side list (%s)", "malloc failed");
return;
}
else
@@ -2312,7 +2312,7 @@ int CIcqProto::servlistUpdateContact_Ready(HANDLE hContact, WORD contactID, WORD {
servlistPendingRemoveContact(hContact, contactID, groupID, PENDING_RESULT_FAILED);
// Could not find a usable group ID
- NetLog_Server("Failed to update contact's details on server side list (%s)", "no group ID");
+ debugLogA("Failed to update contact's details on server side list (%s)", "no group ID");
SAFE_FREE((void**)&ack);
return CALLBACK_RESULT_CONTINUE;
}
@@ -2322,7 +2322,7 @@ int CIcqProto::servlistUpdateContact_Ready(HANDLE hContact, WORD contactID, WORD {
servlistPendingRemoveContact(hContact, contactID, wGroupID, PENDING_RESULT_FAILED);
// Could not find usable item ID
- NetLog_Server("Failed to update contact's details on server side list (%s)", "no item ID");
+ debugLogA("Failed to update contact's details on server side list (%s)", "no item ID");
SAFE_FREE((void**)&ack);
return CALLBACK_RESULT_CONTINUE;
}
@@ -2353,7 +2353,7 @@ void CIcqProto::servlistUpdateContact(HANDLE hContact) if (getContactUid(hContact, &dwUin, &szUid))
{
// Could not set nickname on server without uid
- NetLog_Server("Failed to update contact's details on server side list (%s)", "no UID");
+ debugLogA("Failed to update contact's details on server side list (%s)", "no UID");
return;
}
cookie_servlist_action *ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
@@ -2361,7 +2361,7 @@ void CIcqProto::servlistUpdateContact(HANDLE hContact) if (!ack)
{
// Could not allocate cookie - use old fake
- NetLog_Server("Failed to update contact's details on server side list (%s)", "malloc failed");
+ debugLogA("Failed to update contact's details on server side list (%s)", "malloc failed");
return;
}
else
@@ -2467,7 +2467,7 @@ void CIcqProto::servlistRenameGroup(char *szGroup, WORD wGroupId, char *szNewGro cookie_servlist_action* ack = (cookie_servlist_action*)SAFE_MALLOC(sizeof(cookie_servlist_action));
if (!ack)
{ // cookie failed
- NetLog_Server("Error: Failed to allocate cookie");
+ debugLogA("Error: Failed to allocate cookie");
SAFE_FREE(&szNewGroupName);
return;
@@ -2536,7 +2536,7 @@ void CIcqProto::servlistRemoveGroup(const char *szGroup, WORD wGroupId) if (!ack)
{ // cookie failed
- NetLog_Server("Error: Failed to allocate cookie");
+ debugLogA("Error: Failed to allocate cookie");
return;
}
@@ -2580,7 +2580,7 @@ void CIcqProto::resetServContactAuthState(HANDLE hContact, DWORD dwUin) }
}
else
- NetLog_Server("Error: Failed to allocate cookie");
+ debugLogA("Error: Failed to allocate cookie");
}
}
@@ -2600,9 +2600,9 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) #ifdef _DEBUG
if (cws->value.type == DBVT_DELETED)
- NetLog_Server("DB-Events: Module \"%s\", setting \"%s\" deleted.", cws->szModule, cws->szSetting);
+ debugLogA("DB-Events: Module \"%s\", setting \"%s\" deleted.", cws->szModule, cws->szSetting);
else
- NetLog_Server("DB-Events: Module \"%s\", setting \"%s\" changed, data type %x.", cws->szModule, cws->szSetting, cws->value.type);
+ debugLogA("DB-Events: Module \"%s\", setting \"%s\" changed, data type %x.", cws->szModule, cws->szSetting, cws->value.type);
#endif
if (!strcmpnull(cws->szModule, "CList"))
@@ -2639,7 +2639,7 @@ int CIcqProto::ServListDbSettingChanged(WPARAM wParam, LPARAM lParam) int CIcqProto::ServListDbContactDeleted(WPARAM wParam, LPARAM lParam)
{
#ifdef _DEBUG
- NetLog_Server("DB-Events: Contact %x deleted.", wParam);
+ debugLogA("DB-Events: Contact %x deleted.", wParam);
#endif
DeleteFromContactsCache((HANDLE)wParam);
@@ -2720,7 +2720,7 @@ int CIcqProto::ServListCListGroupChange(WPARAM wParam, LPARAM lParam) WORD wGroupId = getServListGroupLinkID(szOldName);
#ifdef _DEBUG
- NetLog_Server("CList-Events: Group %x:\"%s\" deleted.", wGroupId, szOldName);
+ debugLogA("CList-Events: Group %x:\"%s\" deleted.", wGroupId, szOldName);
#endif
if (wGroupId)
{ // the group is known, remove from server
@@ -2736,7 +2736,7 @@ int CIcqProto::ServListCListGroupChange(WPARAM wParam, LPARAM lParam) WORD wGroupId = getServListGroupLinkID(szOldName);
#ifdef _DEBUG
- NetLog_Server("CList-Events: Group %x:\"%s\" changed to \"%s\".", wGroupId, szOldName, szNewName);
+ debugLogA("CList-Events: Group %x:\"%s\" changed to \"%s\".", wGroupId, szOldName, szNewName);
#endif
if (wGroupId)
{ // group is known, rename on server
@@ -2753,7 +2753,7 @@ int CIcqProto::ServListCListGroupChange(WPARAM wParam, LPARAM lParam) char *szNewName = grpchg->pszNewName ? tchar_to_utf8(grpchg->pszNewName) : NULL;
#ifdef _DEBUG
- NetLog_Server("CList-Events: Contact %x moved to group \"%s\".", hContact, szNewName);
+ debugLogA("CList-Events: Contact %x moved to group \"%s\".", hContact, szNewName);
#endif
servlistMoveContact(hContact, szNewName);
SAFE_FREE(&szNewName);
diff --git a/protocols/IcqOscarJ/src/icq_uploadui.cpp b/protocols/IcqOscarJ/src/icq_uploadui.cpp index 477ef69600..ba8cbc30ff 100644 --- a/protocols/IcqOscarJ/src/icq_uploadui.cpp +++ b/protocols/IcqOscarJ/src/icq_uploadui.cpp @@ -628,7 +628,7 @@ static INT_PTR CALLBACK DlgProcUploadList(HWND hwndDlg,UINT message,WPARAM wPara DeleteLastUploadLogLine(hwndDlg);
AppendToUploadLog(hwndDlg, "%s%s", szLastLogLine, ICQTranslateUtfStatic(LPGEN("FAILED"), str, MAX_PATH));
AppendToUploadLog(hwndDlg, ICQTranslateUtfStatic(LPGEN("No upload group available"), str, MAX_PATH));
- ppro->NetLog_Server("Upload failed, no group");
+ ppro->debugLogA("Upload failed, no group");
currentState = STATE_READY;
}
}
diff --git a/protocols/IcqOscarJ/src/icq_xstatus.cpp b/protocols/IcqOscarJ/src/icq_xstatus.cpp index 255cfb161c..e64b777695 100644 --- a/protocols/IcqOscarJ/src/icq_xstatus.cpp +++ b/protocols/IcqOscarJ/src/icq_xstatus.cpp @@ -430,7 +430,7 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYT db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH));
delSetting(hContact, DBSETTING_XSTATUS_MSG);
- NetLog_Server("%s changed mood to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH));
+ debugLogA("%s changed mood to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH));
bChanged = TRUE;
}
@@ -463,7 +463,7 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYT db_set_utf(hContact, m_szModuleName, DBSETTING_XSTATUS_NAME, ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH));
delSetting(hContact, DBSETTING_XSTATUS_MSG);
- NetLog_Server("%s changed custom status to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH));
+ debugLogA("%s changed custom status to %s.", strUID(dwUIN, szUID), ICQTranslateUtfStatic(nameXStatus[i], str, MAX_PATH));
bChanged = TRUE;
}
@@ -481,7 +481,7 @@ void CIcqProto::handleXStatusCaps(DWORD dwUIN, char *szUID, HANDLE hContact, BYT }
if (nCustomStatusID != 0 && nMoodID != 0 && nCustomStatusID != nMoodID)
- NetLog_Server("Warning: Diverse custom statuses detected, using mood status.");
+ debugLogA("Warning: Diverse custom statuses detected, using mood status.");
if ((nCustomStatusID == 0 && (caps || !m_bXStatusEnabled)) && (nMoodID == 0 && (moods || !m_bMoodsEnabled))) {
if (getByte(hContact, DBSETTING_XSTATUS_ID, -1) != -1)
diff --git a/protocols/IcqOscarJ/src/icq_xtraz.cpp b/protocols/IcqOscarJ/src/icq_xtraz.cpp index 7b3115213d..115fe87984 100644 --- a/protocols/IcqOscarJ/src/icq_xtraz.cpp +++ b/protocols/IcqOscarJ/src/icq_xtraz.cpp @@ -57,8 +57,8 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w szWork = strstrnull(szQuery, "<PluginID>");
szEnd = strstrnull(szQuery, "</PluginID>");
#ifdef _DEBUG
- NetLog_Server("Query: %s", szQuery);
- NetLog_Server("Notify: %s", szNotify);
+ debugLogA("Query: %s", szQuery);
+ debugLogA("Notify: %s", szNotify);
#endif
if (szWork && szEnd)
{ // this is our plugin
@@ -154,27 +154,27 @@ void CIcqProto::handleXtrazNotify(DWORD dwUin, DWORD dwMID, DWORD dwMID2, WORD w handleRateItem(&rr, RQT_RESPONSE, 0, !bThruDC);
}
else if (dwXId)
- NetLog_Server("Privacy: Ignoring XStatus request");
+ debugLogA("Privacy: Ignoring XStatus request");
else
- NetLog_Server("Error: We are not in XStatus, skipping");
+ debugLogA("Error: We are not in XStatus, skipping");
}
else
- NetLog_Server("Error: Invalid sender information");
+ debugLogA("Error: Invalid sender information");
}
else
- NetLog_Server("Error: Missing sender information");
+ debugLogA("Error: Missing sender information");
}
else
- NetLog_Server("Error: Unknown plugin \"%s\" in Xtraz message", szWork);
+ debugLogA("Error: Unknown plugin \"%s\" in Xtraz message", szWork);
}
else
- NetLog_Server("Error: Missing PluginID in Xtraz message");
+ debugLogA("Error: Missing PluginID in Xtraz message");
SAFE_FREE(&szNotify);
SAFE_FREE(&szQuery);
}
else
- NetLog_Server("Error: Invalid Xtraz Notify message");
+ debugLogA("Error: Invalid Xtraz Notify message");
}
@@ -184,7 +184,7 @@ void CIcqProto::handleXtrazNotifyResponse(DWORD dwUin, HANDLE hContact, WORD wCo int nResLen;
#ifdef _DEBUG
- NetLog_Server("Received Xtraz Notify Response");
+ debugLogA("Received Xtraz Notify Response");
#endif
szRes = strstrnull(szMsg, "<RES>");
@@ -200,7 +200,7 @@ void CIcqProto::handleXtrazNotifyResponse(DWORD dwUin, HANDLE hContact, WORD wCo szMem = szRes = DemangleXml(szRes, nResLen);
#ifdef _DEBUG
- NetLog_Server("Response: %s", szRes);
+ debugLogA("Response: %s", szRes);
#endif
ProtoBroadcastAck(hContact, ICQACKTYPE_XTRAZNOTIFY_RESPONSE, ACKRESULT_SUCCESS, (HANDLE)wCookie, (LPARAM)szRes);
@@ -228,7 +228,7 @@ NextVal: *szEnd = '\0';
if (atoi(szNode) != getContactXStatus(hContact))
{ // this is strange - but go on
- NetLog_Server("Warning: XStatusIds do not match!");
+ debugLogA("Warning: XStatusIds do not match!");
}
*szEnd = ' ';
}
@@ -277,16 +277,16 @@ NextVal: goto NextVal;
}
// no next val, we were unable to handle packet, write error
- NetLog_Server("Error: Unknown serverId \"%s\" in Xtraz response", szNode);
+ debugLogA("Error: Unknown serverId \"%s\" in Xtraz response", szNode);
}
}
else
- NetLog_Server("Error: Missing serverId in Xtraz response");
+ debugLogA("Error: Missing serverId in Xtraz response");
SAFE_FREE(&szMem);
}
else
- NetLog_Server("Error: Invalid Xtraz Notify response");
+ debugLogA("Error: Invalid Xtraz Notify response");
}
diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.cpp b/protocols/IcqOscarJ/src/icqosc_svcs.cpp index 66ca0b1a9e..04c39e7e11 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.cpp +++ b/protocols/IcqOscarJ/src/icqosc_svcs.cpp @@ -563,7 +563,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) // if not in our storage, copy
if (lstrcmp(tszFile, tszMyFile) && !CopyFile(tszFile, tszMyFile, FALSE))
{
- NetLog_Server("Failed to copy our avatar to local storage.");
+ debugLogA("Failed to copy our avatar to local storage.");
return iRet;
}
@@ -581,7 +581,7 @@ INT_PTR CIcqProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) if (setSettingBlob(NULL, "AvatarHash", ihash, 0x14))
{
- NetLog_Server("Failed to save avatar hash.");
+ debugLogA("Failed to save avatar hash.");
}
TCHAR tmp[MAX_PATH];
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index b10a20e456..525652c1d1 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -151,9 +151,9 @@ void CIcqProto::UpdateGlobalSettings() }
}
- if (m_hServerNetlibUser) {
+ if (m_hNetlibUser) {
NETLIBUSERSETTINGS nlus = { sizeof(NETLIBUSERSETTINGS) };
- if ( !m_bSecureConnection && CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)m_hServerNetlibUser, (LPARAM)&nlus)) {
+ if ( !m_bSecureConnection && CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)m_hNetlibUser, (LPARAM)&nlus)) {
if (nlus.useProxy && nlus.proxyType == PROXYTYPE_HTTP)
m_bGatewayMode = 1;
else
diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 1c7aef736f..2314019072 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -67,7 +67,7 @@ void __cdecl CIcqProto::icq_LogMessageThread(void* arg) void CIcqProto::icq_LogMessage(int level, const char *szMsg)
{
- NetLog_Server("%s", szMsg);
+ debugLogA("%s", szMsg);
int displayLevel = getByte("ShowLogLevel", LOG_WARNING);
if (level >= displayLevel)
diff --git a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp index 69e7dfc4c8..67cea9db88 100644 --- a/protocols/IcqOscarJ/src/oscar_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/oscar_filetransfer.cpp @@ -394,7 +394,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz char *pszDescription = NULL;
WORD wFilenameLength;
- NetLog_Server("This is a file request");
+ debugLogA("This is a file request");
// This TLV chain may contain the following TLVs:
// TLV(A): Acktype 0x0001 - file request / abort request
@@ -492,7 +492,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz // sanity check
if (!tlv || tlv->wLen < 8)
{
- NetLog_Server("Error: Malformed file request");
+ debugLogA("Error: Malformed file request");
// release structures
SafeReleaseFileTransfer((void**)&ft);
SAFE_FREE(&pszDescription);
@@ -614,7 +614,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz }
}
else
- NetLog_Server("Error: Invalid request, no such transfer");
+ debugLogA("Error: Invalid request, no such transfer");
}
else if (wAckType == 3)
{ // Transfering thru proxy, join tunnel
@@ -642,7 +642,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz }
}
else
- NetLog_Server("Error: Invalid request, no such transfer");
+ debugLogA("Error: Invalid request, no such transfer");
}
else if (wAckType == 4)
{
@@ -662,18 +662,18 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz OpenOscarConnection(hContact, ft, OCT_PROXY_RECV);
}
else
- NetLog_Server("Error: Invalid request, IP missing.");
+ debugLogA("Error: Invalid request, IP missing.");
}
else
- NetLog_Server("Error: Invalid request, no such transfer");
+ debugLogA("Error: Invalid request, no such transfer");
}
else
- NetLog_Server("Error: Uknown Stage %d request", wAckType);
+ debugLogA("Error: Uknown Stage %d request", wAckType);
disposeChain(&chain);
}
else
- NetLog_Server("Error: Missing TLV chain in OFT request");
+ debugLogA("Error: Missing TLV chain in OFT request");
}
else if (wCommand == 1)
{ // transfer cancelled/aborted
@@ -681,7 +681,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz if (ft)
{
- NetLog_Server("OFT: File transfer cancelled by %s", strUID(dwUin, szUID));
+ debugLogA("OFT: File transfer cancelled by %s", strUID(dwUin, szUID));
ProtoBroadcastAck(ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)ft, 0);
// Notify user, that the FT was cancelled // TODO: new ACKRESULT_?
@@ -690,7 +690,7 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz SafeReleaseFileTransfer((void**)&ft);
}
else
- NetLog_Server("Error: Invalid request, no such transfer");
+ debugLogA("Error: Invalid request, no such transfer");
}
else if (wCommand == 2)
{ // transfer accepted - connection established
@@ -714,14 +714,14 @@ void CIcqProto::handleRecvServMsgOFT(BYTE *buf, WORD wLen, DWORD dwUin, char *sz ft->flags |= OFTF_INITIALIZED; // accept was received
}
else
- NetLog_Server("Warning: Received invalid rendezvous accept");
+ debugLogA("Warning: Received invalid rendezvous accept");
}
else
- NetLog_Server("Error: Invalid request, no such transfer");
+ debugLogA("Error: Invalid request, no such transfer");
}
else
{
- NetLog_Server("Error: Unknown wCommand=0x%x in OFT request", wCommand);
+ debugLogA("Error: Unknown wCommand=0x%x in OFT request", wCommand);
}
}
@@ -745,7 +745,7 @@ void CIcqProto::handleRecvServResponseOFT(BYTE *buf, WORD wLen, DWORD dwUin, cha {
case 1:
{ // FT denied (icq5)
- NetLog_Server("OFT: File transfer denied by %s", strUID(dwUin, szUID));
+ debugLogA("OFT: File transfer denied by %s", strUID(dwUin, szUID));
ProtoBroadcastAck(oft->hContact, ACKTYPE_FILE, ACKRESULT_DENIED, (HANDLE)oft, 0);
// Release transfer
@@ -785,7 +785,7 @@ void CIcqProto::handleRecvServResponseOFT(BYTE *buf, WORD wLen, DWORD dwUin, cha default:
{
- NetLog_Server("OFT: Uknown request response code 0x%x", wStatus);
+ debugLogA("OFT: Uknown request response code 0x%x", wStatus);
ProtoBroadcastAck(oft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, (HANDLE)oft, 0);
// Release transfer
@@ -846,7 +846,7 @@ HANDLE CIcqProto::oftInitTransfer(HANDLE hContact, DWORD dwUin, char* szUid, con char ** filesUtf;
// Initialize filetransfer struct
- NetLog_Server("Init file send");
+ debugLogA("Init file send");
ft = CreateOscarTransfer();
ft->hContact = hContact;
@@ -865,7 +865,7 @@ HANDLE CIcqProto::oftInitTransfer(HANDLE hContact, DWORD dwUin, char* szUid, con for (i = 0; i < filesCount; i++)
{
if (_tstati64(files[i], &statbuf))
- NetLog_Server("IcqSendFile() was passed invalid filename \"%s\"", files[i]);
+ debugLogA("IcqSendFile() was passed invalid filename \"%s\"", files[i]);
else
{
if (!(statbuf.st_mode&_S_IFDIR))
@@ -909,7 +909,7 @@ HANDLE CIcqProto::oftInitTransfer(HANDLE hContact, DWORD dwUin, char* szUid, con return 0; // Failure
}
- NetLog_Server("OFT: Found %d files.", ft->wFilesCount);
+ debugLogA("OFT: Found %d files.", ft->wFilesCount);
ft->szDescription = tchar_to_utf8(pszDesc);
ft->flags = OFTF_SENDING;
@@ -1259,7 +1259,7 @@ int CIcqProto::CreateOscarProxyConnection(oscar_connection *oc) if (m_bGatewayMode)
nloc.flags |= NLOCF_HTTPGATEWAY;
- oc->hConnection = NetLib_OpenConnection(m_hServerNetlibUser, "Proxy ", &nloc);
+ oc->hConnection = NetLib_OpenConnection(m_hNetlibUser, "Proxy ", &nloc);
if (!oc->hConnection)
{ // proxy connection failed
return 0;
@@ -1433,7 +1433,7 @@ void __cdecl CIcqProto::oft_connectionThread( oscarthreadstartinfo *otsi ) nloc.wPort = RandRange(1024, 65535);
if (m_bGatewayMode)
nloc.flags |= NLOCF_HTTPGATEWAY;
- oc.hConnection = NetLib_OpenConnection(m_hServerNetlibUser, "Proxy ", &nloc);
+ oc.hConnection = NetLib_OpenConnection(m_hNetlibUser, "Proxy ", &nloc);
if (!oc.hConnection)
{ // proxy connection failed, we are out of possibilities
ProtoBroadcastAck(oc.ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, oc.ft, 0);
@@ -1715,7 +1715,7 @@ int CIcqProto::oft_handleProxyData(oscar_connection *oc, BYTE *buf, int len) // Notify peer
oft_sendFileResponse(oc->dwUin, oc->szUid, oc->ft, 0x06);
- NetLog_Server("Proxy Error: %s (0x%x)", szError, wError);
+ debugLogA("Proxy Error: %s (0x%x)", szError, wError);
// Notify UI
ProtoBroadcastAck(oc->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, oc->ft, 0);
// Release structure
@@ -1743,7 +1743,7 @@ int CIcqProto::oft_handleProxyData(oscar_connection *oc, BYTE *buf, int len) }
else
{
- NetLog_Server("Proxy Tunnel ready, notify peer.");
+ debugLogA("Proxy Tunnel ready, notify peer.");
oft_sendFileRedirect(oc->dwUin, oc->szUid, ft, dwIP, wCode, TRUE);
}
}
@@ -1761,7 +1761,7 @@ int CIcqProto::oft_handleProxyData(oscar_connection *oc, BYTE *buf, int len) ft->flags |= OFTF_INITIALIZED;
}
- NetLog_Server("Proxy Tunnel established");
+ debugLogA("Proxy Tunnel established");
if ((ft->flags & OFTF_INITIALIZED) && (ft->flags & OFTF_SENDING) && !(ft->flags & OFTF_FILE_REQUEST_SENT))
{
@@ -1772,7 +1772,7 @@ int CIcqProto::oft_handleProxyData(oscar_connection *oc, BYTE *buf, int len) break;
default:
- NetLog_Server("Unknown proxy command 0x%x", wCommand);
+ debugLogA("Unknown proxy command 0x%x", wCommand);
}
buf += datalen;
@@ -1935,7 +1935,7 @@ void CIcqProto::handleOFT2FramePacket(oscar_connection *oc, WORD datatype, BYTE { // the 32bits does not match, use them as full size
ft->qwTotalSize = dwSize;
- NetLog_Server("Warning: Invalid total size.");
+ debugLogA("Warning: Invalid total size.");
}
}
else
diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index 35bae4ca14..4de31b3e9a 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -982,12 +982,12 @@ void CIcqProto::icq_sendFileAcceptServ(DWORD dwUin, filetransfer *ft, int nAckTy if (ft->nVersion >= 8)
{
icq_sendFileAcceptServv8(dwUin, ft->pMessage.dwMsgID1, ft->pMessage.dwMsgID2, ft->dwCookie, ft->szFilename, szDesc, ft->dwTotalSize, wListenPort, TRUE, nAckType);
- NetLog_Server("Sent file accept v%u through server, port %u", 8, wListenPort);
+ debugLogA("Sent file accept v%u through server, port %u", 8, wListenPort);
}
else
{
icq_sendFileAcceptServv7(dwUin, ft->pMessage.dwMsgID1, ft->pMessage.dwMsgID2, ft->dwCookie, ft->szFilename, szDesc, ft->dwTotalSize, wListenPort, TRUE, nAckType);
- NetLog_Server("Sent file accept v%u through server, port %u", 7, wListenPort);
+ debugLogA("Sent file accept v%u through server, port %u", 7, wListenPort);
}
}
@@ -997,12 +997,12 @@ void CIcqProto::icq_sendFileDenyServ(DWORD dwUin, filetransfer *ft, const char * if (ft->nVersion >= 8)
{
icq_sendFileAcceptServv8(dwUin, ft->pMessage.dwMsgID1, ft->pMessage.dwMsgID2, ft->dwCookie, ft->szFilename, szReason, ft->dwTotalSize, wListenPort, FALSE, nAckType);
- NetLog_Server("Sent file deny v%u through server", 8);
+ debugLogA("Sent file deny v%u through server", 8);
}
else
{
icq_sendFileAcceptServv7(dwUin, ft->pMessage.dwMsgID1, ft->pMessage.dwMsgID2, ft->dwCookie, ft->szFilename, szReason, ft->dwTotalSize, wListenPort, FALSE, nAckType);
- NetLog_Server("Sent file deny v%u through server", 7);
+ debugLogA("Sent file deny v%u through server", 7);
}
}
diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 7b6e87cf40..1e073e55b0 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -354,7 +354,7 @@ void CIcqProto::AddToContactsCache(HANDLE hContact, DWORD dwUin, const char *szU return;
#ifdef _DEBUG
- NetLog_Server("Adding contact to cache: %u%s%s", dwUin, dwUin ? "" : " - ", dwUin ? "" : szUid);
+ debugLogA("Adding contact to cache: %u%s%s", dwUin, dwUin ? "" : " - ", dwUin ? "" : szUid);
#endif
icq_contacts_cache *cache_item = (icq_contacts_cache*)SAFE_MALLOC(sizeof(icq_contacts_cache));
@@ -432,7 +432,7 @@ void CIcqProto::DeleteFromContactsCache(HANDLE hContact) if (cache_item->hContact == hContact)
{
#ifdef _DEBUG
- NetLog_Server("Removing contact from cache: %u%s%s, position: %u", cache_item->dwUin, cache_item->dwUin ? "" : " - ", cache_item->dwUin ? "" : cache_item->szUid, i);
+ debugLogA("Removing contact from cache: %u%s%s, position: %u", cache_item->dwUin, cache_item->dwUin ? "" : " - ", cache_item->dwUin ? "" : cache_item->szUid, i);
#endif
contactsCache.remove(i);
// Release memory
@@ -486,7 +486,7 @@ HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) hContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0);
if (!hContact)
{
- NetLog_Server("Failed to create ICQ contact %u", dwUin);
+ debugLogA("Failed to create ICQ contact %u", dwUin);
return INVALID_HANDLE_VALUE;
}
@@ -494,7 +494,7 @@ HANDLE CIcqProto::HContactFromUIN(DWORD dwUin, int *Added) {
// For some reason we failed to register the protocol to this contact
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
- NetLog_Server("Failed to register ICQ contact %u", dwUin);
+ debugLogA("Failed to register ICQ contact %u", dwUin);
return INVALID_HANDLE_VALUE;
}
@@ -1033,9 +1033,9 @@ void __cdecl CIcqProto::ProtocolAckThread(icq_ack_args* pArguments) Sleep(150);
if (pArguments->nAckResult == ACKRESULT_SUCCESS)
- NetLog_Server("Sent fake message ack");
+ debugLogA("Sent fake message ack");
else if (pArguments->nAckResult == ACKRESULT_FAILED)
- NetLog_Server("Message delivery failed");
+ debugLogA("Message delivery failed");
ProtoBroadcastAck(pArguments->hContact, pArguments->nAckType, pArguments->nAckResult, pArguments->hSequence, pArguments->pszMessage);
@@ -1141,7 +1141,7 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) m_ratesMutex->Leave();
cookieMutex->Leave();
#ifdef _DEBUG
- NetLog_Server("Rates: SetStatusNote delayed %dms", nDelay);
+ debugLogA("Rates: SetStatusNote delayed %dms", nDelay);
#endif
SleepEx(nDelay, TRUE); // do not keep things locked during sleep
cookieMutex->Enter();
@@ -1175,7 +1175,7 @@ void __cdecl CIcqProto::SetStatusNoteThread(void *pDelay) m_ratesMutex->Leave();
cookieMutex->Leave();
#ifdef _DEBUG
- NetLog_Server("Rates: SetStatusNote delayed %dms", nDelay);
+ debugLogA("Rates: SetStatusNote delayed %dms", nDelay);
#endif
SleepEx(nDelay, TRUE); // do not keep things locked during sleep
cookieMutex->Enter();
@@ -1724,17 +1724,6 @@ void NetLib_SafeCloseHandle(HANDLE *hConnection) }
-int CIcqProto::NetLog_Server(const char *fmt,...)
-{
- va_list va;
- char szText[1024];
-
- va_start(va,fmt);
- mir_vsnprintf(szText,sizeof(szText),fmt,va);
- va_end(va);
- return CallService(MS_NETLIB_LOG,(WPARAM)m_hServerNetlibUser,(LPARAM)szText);
-}
-
int CIcqProto::NetLog_Direct(const char *fmt,...)
{
va_list va;
@@ -1759,7 +1748,7 @@ int CIcqProto::NetLog_Uni(BOOL bDC, const char *fmt,...) if (bDC)
hNetlib = m_hDirectNetlibUser;
else
- hNetlib = m_hServerNetlibUser;
+ hNetlib = m_hNetlibUser;
return CallService(MS_NETLIB_LOG,(WPARAM)hNetlib,(LPARAM)szText);
}
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)
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))
diff --git a/protocols/MSN/src/msn_auth.cpp b/protocols/MSN/src/msn_auth.cpp index 23d1001f83..dd860176c6 100644 --- a/protocols/MSN/src/msn_auth.cpp +++ b/protocols/MSN/src/msn_auth.cpp @@ -255,7 +255,7 @@ int CMsnProto::MSN_GetPassportAuth(void) {
if (errurl)
{
- MSN_DebugLog("Starting URL: '%s'", errurl);
+ debugLogA("Starting URL: '%s'", errurl);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)errurl);
}
@@ -264,7 +264,7 @@ int CMsnProto::MSN_GetPassportAuth(void) if (tokrdr != NULL)
{
strcpy(szPassportHost, ezxml_txt(tokrdr));
- MSN_DebugLog("Redirected to '%s'", szPassportHost);
+ debugLogA("Redirected to '%s'", szPassportHost);
}
else
{
@@ -325,7 +325,7 @@ int CMsnProto::MSN_GetPassportAuth(void) setString("MsnPassportHost", szPassportHost);
mir_free(szPassportHost);
- MSN_DebugLog("MSN_CheckRedirector exited with errorCode = %d", retVal);
+ debugLogA("MSN_CheckRedirector exited with errorCode = %d", retVal);
return retVal;
}
diff --git a/protocols/MSN/src/msn_avatar.cpp b/protocols/MSN/src/msn_avatar.cpp index db57bf4769..5af6b7ad87 100644 --- a/protocols/MSN/src/msn_avatar.cpp +++ b/protocols/MSN/src/msn_avatar.cpp @@ -64,7 +64,7 @@ bool CMsnProto::loadHttpAvatar(AvatarQueueEntry *p) nlhr.headers = (NETLIBHTTPHEADER*)&nlbhHeaders;
nlhr.headersCount = 1;
- NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&nlhr);
+ NETLIBHTTPREQUEST *nlhrReply = (NETLIBHTTPREQUEST*)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&nlhr);
if (nlhrReply == NULL)
return false;
diff --git a/protocols/MSN/src/msn_commands.cpp b/protocols/MSN/src/msn_commands.cpp index 43d413a206..a7e5774f43 100644 --- a/protocols/MSN/src/msn_commands.cpp +++ b/protocols/MSN/src/msn_commands.cpp @@ -30,7 +30,7 @@ void MSN_ConnectionProc(HANDLE hNewConnection, DWORD /* dwRemoteIP */, void* ext {
CMsnProto *proto = (CMsnProto*)extra;
- proto->MSN_DebugLog("File transfer connection accepted");
+ proto->debugLogA("File transfer connection accepted");
NETLIBCONNINFO connInfo = { sizeof(connInfo) };
CallService(MS_NETLIB_GETCONNECTIONINFO, (WPARAM)hNewConnection, (LPARAM)&connInfo);
@@ -43,7 +43,7 @@ void MSN_ConnectionProc(HANDLE hNewConnection, DWORD /* dwRemoteIP */, void* ext }
else
{
- proto->MSN_DebugLog("There's no registered file transfers for incoming port #%u, connection closed", connInfo.wPort);
+ proto->debugLogA("There's no registered file transfers for incoming port #%u, connection closed", connInfo.wPort);
Netlib_CloseHandle(hNewConnection);
}
}
@@ -317,7 +317,7 @@ void CMsnProto::sttCustomSmiley(const char* msgBody, char* email, char* nick, in delete ft;
else
{
- MSN_DebugLog("Custom Smiley p2p invite for object : %s", ft->p2p_object);
+ debugLogA("Custom Smiley p2p invite for object : %s", ft->p2p_object);
p2p_invite(iSmileyType, ft, email);
Sleep(3000);
}
@@ -343,7 +343,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para if (sttDivideWords(params, SIZEOF(tWords), tWords) < 3)
{
- MSN_DebugLog("Invalid %.3s command, ignoring", cmdString);
+ debugLogA("Invalid %.3s command, ignoring", cmdString);
return;
}
@@ -377,7 +377,7 @@ void CMsnProto::MSN_ReceiveMessage(ThreadData* info, char* cmdString, char* para memcpy(msg, msgb, msgBytes);
msg[msgBytes] = 0;
- MSN_DebugLog("Message:\n%s", msg);
+ debugLogA("Message:\n%s", msg);
MimeHeaders tHeader;
char* msgBody = tHeader.readFromBuffer(msg);
@@ -1102,7 +1102,7 @@ int CMsnProto::MSN_HandleCommands(ThreadData* info, char* cmdString) }
else params = cmdString+4;
}
-// MSN_DebugLog("%s", cmdString);
+// debugLogA("%s", cmdString);
switch((*(PDWORD)cmdString & 0x00FFFFFF) | 0x20000000)
{
@@ -1117,7 +1117,7 @@ int CMsnProto::MSN_HandleCommands(ThreadData* info, char* cmdString) char* tWords[1];
if (sttDivideWords(params, 1, tWords) != 1)
{
- MSN_DebugLog("Invalid %.3s command, ignoring", cmdString);
+ debugLogA("Invalid %.3s command, ignoring", cmdString);
}
else
{
@@ -1132,7 +1132,7 @@ int CMsnProto::MSN_HandleCommands(ThreadData* info, char* cmdString) if (sttDivideWords(params, 1, tWords) != 1)
{
LBL_InvalidCommand:
- MSN_DebugLog("Invalid %.3s command, ignoring", cmdString);
+ debugLogA("Invalid %.3s command, ignoring", cmdString);
break;
}
@@ -1270,7 +1270,7 @@ LBL_InvalidCommand: {
m_iStatus = newStatus;
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, newStatus);
- MSN_DebugLog("Status change acknowledged: %s", params);
+ debugLogA("Status change acknowledged: %s", params);
MSN_RemoveEmptyGroups();
}
if (newStatus == ID_STATUS_OFFLINE) return 1;
@@ -1509,7 +1509,7 @@ remove: if (wlid == NULL) //can happen if both parties send first message at the same time
{
- MSN_DebugLog("USR (SB) internal: thread created for no reason");
+ debugLogA("USR (SB) internal: thread created for no reason");
return 1;
}
@@ -1553,7 +1553,7 @@ remove: }
mir_utf8decode(data.userNick, NULL);
- MSN_DebugLog("New contact in channel %s %s", data.userEmail, data.userNick);
+ debugLogA("New contact in channel %s %s", data.userEmail, data.userNick);
if (info->contactJoined(data.userEmail) <= 1)
{
@@ -1603,7 +1603,7 @@ remove: ProtoBroadcastAck(info->getContactHandle(),
ACKTYPE_MESSAGE, ACKRESULT_FAILED,
(HANDLE)trid, (LPARAM)Translate("Message delivery failed"));
- MSN_DebugLog("Message send failed (trid=%d)", trid);
+ debugLogA("Message send failed (trid=%d)", trid);
break;
case ' TON': //********* NOT: notification message
@@ -1622,7 +1622,7 @@ remove: if (!_stricmp(params, "OTH"))
{
ProtoBroadcastAck(NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION);
- MSN_DebugLog("You have been disconnected from the MSN server because you logged on from another location using the same MSN passport.");
+ debugLogA("You have been disconnected from the MSN server because you logged on from another location using the same MSN passport.");
}
if (!_stricmp(params, "MIG")) // ignore it
@@ -1671,7 +1671,7 @@ remove: stripColorCode(data.callerNick);
if (strcmp(data.security, "CKI")) {
- MSN_DebugLog("Unknown security package in RNG command: %s", data.security);
+ debugLogA("Unknown security package in RNG command: %s", data.security);
break;
}
@@ -1685,7 +1685,7 @@ remove: ReleaseSemaphore(newThread->hWaitEvent, MSN_PACKETS_COMBINE, NULL);
- MSN_DebugLog("Opening caller's switchboard server '%s'...", data.newServer);
+ debugLogA("Opening caller's switchboard server '%s'...", data.newServer);
newThread->startThread(&CMsnProto::MSNServerThread, this);
break;
}
@@ -1746,7 +1746,7 @@ remove: case 4:
case 8:
ProtoBroadcastAck( NULL, ACKTYPE_LOGIN, ACKRESULT_FAILED, NULL, LOGINERR_OTHERLOCATION );
- MSN_DebugLog( "You have been disconnected from the MSN server because you logged on from another location using the same MSN passport." );
+ debugLogA( "You have been disconnected from the MSN server because you logged on from another location using the same MSN passport." );
break;
case 6:
@@ -1780,7 +1780,7 @@ remove: if (strcmp(data.status, "OK"))
{
- MSN_DebugLog("Unknown status to USR command (SB): '%s'", data.status);
+ debugLogA("Unknown status to USR command (SB): '%s'", data.status);
break;
}
@@ -1817,7 +1817,7 @@ remove: }
else
{
- MSN_DebugLog("Unknown security package '%s'", data.security);
+ debugLogA("Unknown security package '%s'", data.security);
if (info->mType == SERVER_NOTIFICATION)
{
@@ -1909,7 +1909,7 @@ remove: usingGateway |= (*data.security == 'G');
info->mIsMainThread = false;
- MSN_DebugLog("Switching to notification server '%s'...", data.newServer);
+ debugLogA("Switching to notification server '%s'...", data.newServer);
newThread->startThread(&CMsnProto::MSNServerThread, this);
return 1; //kill the old thread
}
@@ -1923,7 +1923,7 @@ remove: if (strcmp(data.security, "CKI"))
{
- MSN_DebugLog("Unknown XFR SB security package '%s'", data.security);
+ debugLogA("Unknown XFR SB security package '%s'", data.security);
break;
}
@@ -1934,15 +1934,15 @@ remove: newThread->mCaller = 1;
strcpy(newThread->mCookie, data.authChallengeInfo);
- MSN_DebugLog("Opening switchboard server '%s'...", data.newServer);
+ debugLogA("Opening switchboard server '%s'...", data.newServer);
newThread->startThread(&CMsnProto::MSNServerThread, this);
}
- else MSN_DebugLog("Unknown referral server: %s", data.type);
+ else debugLogA("Unknown referral server: %s", data.type);
break;
}
default:
- MSN_DebugLog("Unrecognised message: %s", cmdString);
+ debugLogA("Unrecognised message: %s", cmdString);
break;
}
diff --git a/protocols/MSN/src/msn_errors.cpp b/protocols/MSN/src/msn_errors.cpp index 9a4acbe0c8..ce18c956a3 100644 --- a/protocols/MSN/src/msn_errors.cpp +++ b/protocols/MSN/src/msn_errors.cpp @@ -28,7 +28,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) int errorCode, packetID = -1;
sscanf(cmdString, "%d %d", &errorCode, &packetID);
- MSN_DebugLog("Server error:%s", cmdString);
+ debugLogA("Server error:%s", cmdString);
switch(errorCode) {
case ERR_INTERNAL_SERVER:
@@ -83,7 +83,7 @@ int CMsnProto::MSN_HandleErrors(ThreadData* info, char* cmdString) return 1;
default:
- MSN_DebugLog("Unprocessed error: %s", cmdString);
+ debugLogA("Unprocessed error: %s", cmdString);
if (errorCode >= 500) //all these errors look fatal-ish
MSN_ShowError("Unrecognised error %d. The server has closed our connection", errorCode);
diff --git a/protocols/MSN/src/msn_ftold.cpp b/protocols/MSN/src/msn_ftold.cpp index 25e5f0279d..d2cd516d33 100644 --- a/protocols/MSN/src/msn_ftold.cpp +++ b/protocols/MSN/src/msn_ftold.cpp @@ -154,7 +154,7 @@ int CMsnProto::MSN_HandleMSNFTP(ThreadData *info, char *cmdString) char email[130],authcookie[14];
if (sscanf(params,"%129s %13s",email,authcookie) < 2)
{
- MSN_DebugLog("Invalid USR OK command, ignoring");
+ debugLogA("Invalid USR OK command, ignoring");
break;
}
@@ -169,7 +169,7 @@ int CMsnProto::MSN_HandleMSNFTP(ThreadData *info, char *cmdString) if (sscanf(params, "%6s", protocol1) < 1)
{
LBL_InvalidCommand:
- MSN_DebugLog("Invalid %.3s command, ignoring", cmdString);
+ debugLogA("Invalid %.3s command, ignoring", cmdString);
break;
}
@@ -179,7 +179,7 @@ LBL_InvalidCommand: int tFieldCount = sscanf(params, "%d %6s", &tempInt, protocol1);
if (tFieldCount != 2 || strcmp(protocol1, "MSNFTP") != 0)
{
- MSN_DebugLog("Another side requested the unknown protocol (%s), closing thread", params);
+ debugLogA("Another side requested the unknown protocol (%s), closing thread", params);
return 1;
}
}
@@ -259,13 +259,13 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) {
ThreadData* info = (ThreadData*)arg;
- MSN_DebugLog("Waiting for an incoming connection to '%s'...", info->mServer);
+ debugLogA("Waiting for an incoming connection to '%s'...", info->mServer);
switch(WaitForSingleObject(info->hWaitEvent, 60000))
{
case WAIT_TIMEOUT:
case WAIT_FAILED:
- MSN_DebugLog("Incoming connection timed out, closing file transfer");
+ debugLogA("Incoming connection timed out, closing file transfer");
return;
}
@@ -299,18 +299,18 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) char msg[sizeof(info->mData)];
memcpy(msg, info->mData, peol - info->mData); msg[peol - info->mData] = 0;
if (*++peol != '\n')
- MSN_DebugLog("Dodgy line ending to command: ignoring");
+ debugLogA("Dodgy line ending to command: ignoring");
else
peol++;
info->mBytesInData -= peol - info->mData;
memmove(info->mData, peol, info->mBytesInData);
- MSN_DebugLog("RECV:%s", msg);
+ debugLogA("RECV:%s", msg);
if (!isalnum(msg[0]) || !isalnum(msg[1]) || !isalnum(msg[2]) || (msg[3] && msg[3]!=' '))
{
- MSN_DebugLog("Invalid command name");
+ debugLogA("Invalid command name");
continue;
}
@@ -321,12 +321,12 @@ void __cdecl CMsnProto::msnftp_sendFileThread(void* arg) if (info->mBytesInData == sizeof(info->mData))
{
- MSN_DebugLog("sizeof(data) is too small: the longest line won't fit");
+ debugLogA("sizeof(data) is too small: the longest line won't fit");
break;
}
}
- MSN_DebugLog("Closing file transfer thread");
+ debugLogA("Closing file transfer thread");
}
void CMsnProto::msnftp_startFileSend(ThreadData* info, const char* Invcommand, const char* Invcookie)
@@ -344,9 +344,9 @@ void CMsnProto::msnftp_startFileSend(ThreadData* info, const char* Invcommand, c nlb.pfnNewConnectionV2 = MSN_ConnectionProc;
nlb.pExtra = this;
- sb = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)&nlb);
+ sb = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hNetlibUser, (LPARAM)&nlb);
if (sb == NULL)
- MSN_DebugLog("Unable to bind the port for incoming transfers");
+ debugLogA("Unable to bind the port for incoming transfers");
}
char hostname[256] = "";
diff --git a/protocols/MSN/src/msn_mail.cpp b/protocols/MSN/src/msn_mail.cpp index faf479027b..58488c44a0 100644 --- a/protocols/MSN/src/msn_mail.cpp +++ b/protocols/MSN/src/msn_mail.cpp @@ -372,7 +372,7 @@ void CMsnProto::sttNotificationMessage(char* msgBody, bool isInitial) while (*tParams == ' ') ++tParams;
- MSN_DebugLog("Running mailer \"%s\" with params \"%s\"", tCmd, tParams);
+ debugLogA("Running mailer \"%s\" with params \"%s\"", tCmd, tParams);
ShellExecuteA(NULL, "open", tCmd, tParams, NULL, TRUE);
}
}
diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 96c5e236e0..8a515d7ffa 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -118,21 +118,6 @@ void CMsnProto::MSN_AddAuthRequest(const char *email, const char *nick, const ch }
/////////////////////////////////////////////////////////////////////////////////////////
-// MSN_DebugLog - writes a line of comments to the network log
-
-void CMsnProto::MSN_DebugLog(const char *fmt, ...)
-{
- char str[4096];
- va_list vararg;
-
- va_start(vararg, fmt);
- if (mir_vsnprintf(str, sizeof(str), fmt, vararg) != 0)
- {
- str[sizeof(str)-1] = 0;
- CallService(MS_NETLIB_LOG, (WPARAM)hNetlibUser, (LPARAM)str);
- }
- va_end(vararg);
-}
void CMsnProto::InitCustomFolders(void)
{
@@ -716,7 +701,7 @@ int ThreadData::sendPacket(const char* cmd, const char* fmt,...) void CMsnProto::MSN_SetServerStatus(int newStatus)
{
- MSN_DebugLog("Setting MSN server status %d, logged in = %d", newStatus, msnLoggedIn);
+ debugLogA("Setting MSN server status %d, logged in = %d", newStatus, msnLoggedIn);
if (!msnLoggedIn)
return;
@@ -833,7 +818,7 @@ void CMsnProto::MsnInvokeMyURL(bool ismail, const char* url) mir_free(post);
}
- MSN_DebugLog("Starting URL: '%s'", hippy);
+ debugLogA("Starting URL: '%s'", hippy);
CallService(MS_UTILS_OPENURL, 1, (LPARAM)hippy);
}
@@ -1018,7 +1003,7 @@ filetransfer::filetransfer(CMsnProto* prt) filetransfer::~filetransfer(void)
{
if (p2p_sessionid)
- proto->MSN_DebugLog("Destroying file transfer session %08X", p2p_sessionid);
+ proto->debugLogA("Destroying file transfer session %08X", p2p_sessionid);
WaitForSingleObject(hLockHandle, 2000);
CloseHandle(hLockHandle);
diff --git a/protocols/MSN/src/msn_natdetect.cpp b/protocols/MSN/src/msn_natdetect.cpp index 5837602347..77ef7f1adf 100644 --- a/protocols/MSN/src/msn_natdetect.cpp +++ b/protocols/MSN/src/msn_natdetect.cpp @@ -56,13 +56,13 @@ void CMsnProto::DecryptEchoPacket(UDPProbePkt& pkt) IN_ADDR addr;
- MSN_DebugLog("Echo packet: version: 0x%x service code: 0x%x transaction ID: 0x%x",
+ debugLogA("Echo packet: version: 0x%x service code: 0x%x transaction ID: 0x%x",
pkt.version, pkt.serviceCode, pkt.trId);
addr.S_un.S_addr = pkt.clientIP;
- MSN_DebugLog("Echo packet: client port: %u client addr: %s",
+ debugLogA("Echo packet: client port: %u client addr: %s",
pkt.clientPort, inet_ntoa(addr));
addr.S_un.S_addr = pkt.testIP;
- MSN_DebugLog("Echo packet: discard port: %u test port: %u test addr: %s",
+ debugLogA("Echo packet: discard port: %u test port: %u test addr: %s",
pkt.discardPort, pkt.testPort, inet_ntoa(addr));
}
@@ -97,7 +97,7 @@ void CMsnProto::MSNatDetect(void) PHOSTENT host = gethostbyname("echo.edge.messenger.live.com");
if (host == NULL)
{
- MSN_DebugLog("P2PNAT could not find echo server \"echo.edge.messenger.live.com\"");
+ debugLogA("P2PNAT could not find echo server \"echo.edge.messenger.live.com\"");
return;
}
@@ -106,7 +106,7 @@ void CMsnProto::MSNatDetect(void) addr.sin_port = _htons(7001);
addr.sin_addr = *( PIN_ADDR )host->h_addr_list[0];
- MSN_DebugLog("P2PNAT Detected echo server IP %d.%d.%d.%d",
+ debugLogA("P2PNAT Detected echo server IP %d.%d.%d.%d",
addr.sin_addr.S_un.S_un_b.s_b1, addr.sin_addr.S_un.S_un_b.s_b2,
addr.sin_addr.S_un.S_un_b.s_b3, addr.sin_addr.S_un.S_un_b.s_b4);
@@ -127,7 +127,7 @@ void CMsnProto::MSNatDetect(void) getsockname(s, (SOCKADDR*)&myaddr, &szname);
MyConnection.intIP = myaddr.sin_addr.S_un.S_addr;
- MSN_DebugLog("P2PNAT Detected IP facing internet %d.%d.%d.%d",
+ debugLogA("P2PNAT Detected IP facing internet %d.%d.%d.%d",
myaddr.sin_addr.S_un.S_un_b.s_b1, myaddr.sin_addr.S_un.S_un_b.s_b2,
myaddr.sin_addr.S_un.S_un_b.s_b3, myaddr.sin_addr.S_un.S_un_b.s_b4);
@@ -146,7 +146,7 @@ void CMsnProto::MSNatDetect(void) if (Miranda_Terminated()) break;
// Send echo request to server 1
- MSN_DebugLog("P2PNAT Request 1 attempt %d sent", i);
+ debugLogA("P2PNAT Request 1 attempt %d sent", i);
sendto(s1, (char*)&pkt, sizeof(pkt), 0, (SOCKADDR*)&addr, sizeof(addr));
fd_set fd;
@@ -156,14 +156,14 @@ void CMsnProto::MSNatDetect(void) if (select(1, &fd, NULL, NULL, &tv) == 1)
{
- MSN_DebugLog("P2PNAT Request 1 attempt %d response", i);
+ debugLogA("P2PNAT Request 1 attempt %d response", i);
recv(s1, (char*)&rpkt, sizeof(rpkt), 0);
pkt2 = rpkt;
DecryptEchoPacket(rpkt);
break;
}
else
- MSN_DebugLog("P2PNAT Request 1 attempt %d timeout", i);
+ debugLogA("P2PNAT Request 1 attempt %d timeout", i);
}
closesocket(s);
@@ -196,7 +196,7 @@ void CMsnProto::MSNatDetect(void) nlb.pfnNewConnectionV2 = MSN_ConnectionProc;
nlb.pExtra = this;
- HANDLE sb = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlibUser, (LPARAM)&nlb);
+ HANDLE sb = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM)m_hNetlibUser, (LPARAM)&nlb);
if ( sb != NULL )
{
MyConnection.upnpNAT = htonl(nlb.dwExternalIP) == MyConnection.extIP;
@@ -216,7 +216,7 @@ void CMsnProto::MSNatDetect(void) {
if (Miranda_Terminated()) break;
- MSN_DebugLog("P2PNAT Request 2 attempt %d sent", i);
+ debugLogA("P2PNAT Request 2 attempt %d sent", i);
// Remove IP restriction for server 2
sendto(s1, NULL, 0, 0, (SOCKADDR*)&addr2, sizeof(addr2));
// Send echo request to server 1 for server 2
@@ -229,13 +229,13 @@ void CMsnProto::MSNatDetect(void) if (select(1, &fd, NULL, NULL, &tv) == 1)
{
- MSN_DebugLog("P2PNAT Request 2 attempt %d response", i);
+ debugLogA("P2PNAT Request 2 attempt %d response", i);
recv(s1, (char*)&rpkt2, sizeof(rpkt2), 0);
DecryptEchoPacket(rpkt2);
break;
}
else
- MSN_DebugLog("P2PNAT Request 2 attempt %d timeout", i);
+ debugLogA("P2PNAT Request 2 attempt %d timeout", i);
}
// Response recieved so it's an IP Restricted NAT (Restricted Cone NAT)
@@ -255,7 +255,7 @@ void CMsnProto::MSNatDetect(void) {
if (Miranda_Terminated()) break;
- MSN_DebugLog("P2PNAT Request 3 attempt %d sent", i);
+ debugLogA("P2PNAT Request 3 attempt %d sent", i);
// Send echo request to server 1
sendto(s1, (char*)&pkt, sizeof(pkt), 0, (SOCKADDR*)&addr2, sizeof(addr2));
@@ -266,13 +266,13 @@ void CMsnProto::MSNatDetect(void) if ( select(1, &fd, NULL, NULL, &tv) == 1 )
{
- MSN_DebugLog("P2PNAT Request 3 attempt %d response", i);
+ debugLogA("P2PNAT Request 3 attempt %d response", i);
recv(s1, (char*)&rpkt2, sizeof(rpkt2), 0);
DecryptEchoPacket(rpkt2);
break;
}
else
- MSN_DebugLog("P2PNAT Request 3 attempt %d timeout", i);
+ debugLogA("P2PNAT Request 3 attempt %d timeout", i);
}
if (i < 4)
{
@@ -380,7 +380,7 @@ void CMsnProto::MSNConnDetectThread( void* ) switch (gethst)
{
case 0:
- MSN_DebugLog("P2PNAT User overwrote IP connection is guessed by user settings only");
+ debugLogA("P2PNAT User overwrote IP connection is guessed by user settings only");
// User specified host by himself so check if it matches MSN information
// if it does, move to connection type autodetection,
@@ -444,7 +444,7 @@ void CMsnProto::MSNConnDetectThread( void* ) // If user mapped incoming ports consider direct connection
if (portsMapped)
{
- MSN_DebugLog("P2PNAT User manually mapped ports for incoming connection");
+ debugLogA("P2PNAT User manually mapped ports for incoming connection");
switch(MyConnection.udpConType)
{
case conUnknown:
@@ -462,7 +462,7 @@ void CMsnProto::MSNConnDetectThread( void* ) }
}
- MSN_DebugLog("P2PNAT Connection %s found UPnP: %d ICF: %d", conStr[MyConnection.udpConType],
+ debugLogA("P2PNAT Connection %s found UPnP: %d ICF: %d", conStr[MyConnection.udpConType],
MyConnection.upnpNAT, MyConnection.icf);
MyConnection.CalculateWeight();
diff --git a/protocols/MSN/src/msn_p2p.cpp b/protocols/MSN/src/msn_p2p.cpp index 03f0b74a16..bfc5fc0d96 100644 --- a/protocols/MSN/src/msn_p2p.cpp +++ b/protocols/MSN/src/msn_p2p.cpp @@ -40,44 +40,44 @@ static const char p2pV2Caps[] = { 0x01, 0x0C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0E void P2P_Header::logHeader(CMsnProto *ppro)
{
- ppro->MSN_DebugLog("--- Printing message header");
- ppro->MSN_DebugLog(" SessionID = %08X", mSessionID);
- ppro->MSN_DebugLog(" MessageID = %08X", mID);
+ ppro->debugLogA("--- Printing message header");
+ ppro->debugLogA(" SessionID = %08X", mSessionID);
+ ppro->debugLogA(" MessageID = %08X", mID);
#ifndef __GNUC__
- ppro->MSN_DebugLog(" Offset of data = %I64u", mOffset);
- ppro->MSN_DebugLog(" Total amount of data = %I64u", mTotalSize);
+ ppro->debugLogA(" Offset of data = %I64u", mOffset);
+ ppro->debugLogA(" Total amount of data = %I64u", mTotalSize);
#else
- ppro->MSN_DebugLog(" Offset of data = %llu", mOffset);
- ppro->MSN_DebugLog(" Total amount of data = %llu", hdrdata->mTotalSize);
+ ppro->debugLogA(" Offset of data = %llu", mOffset);
+ ppro->debugLogA(" Total amount of data = %llu", hdrdata->mTotalSize);
#endif
- ppro->MSN_DebugLog(" Data in packet = %lu bytes", mPacketLen);
- ppro->MSN_DebugLog(" Flags = %08X", mFlags);
- ppro->MSN_DebugLog(" Acknowledged session ID: %08X", mAckSessionID);
- ppro->MSN_DebugLog(" Acknowledged message ID: %08X", mAckUniqueID);
+ ppro->debugLogA(" Data in packet = %lu bytes", mPacketLen);
+ ppro->debugLogA(" Flags = %08X", mFlags);
+ ppro->debugLogA(" Acknowledged session ID: %08X", mAckSessionID);
+ ppro->debugLogA(" Acknowledged message ID: %08X", mAckUniqueID);
#ifndef __GNUC__
- ppro->MSN_DebugLog(" Acknowledged data size: %I64u", mAckDataSize);
+ ppro->debugLogA(" Acknowledged data size: %I64u", mAckDataSize);
#else
- ppro->MSN_DebugLog(" Acknowledged data size: %llu", mAckDataSize);
+ ppro->debugLogA(" Acknowledged data size: %llu", mAckDataSize);
#endif
- ppro->MSN_DebugLog("------------------------");
+ ppro->debugLogA("------------------------");
}
void P2PV2_Header::logHeader(CMsnProto *ppro)
{
- ppro->MSN_DebugLog("--- Printing message header");
- ppro->MSN_DebugLog(" SessionID = %08X", mSessionID);
- ppro->MSN_DebugLog(" MessageID = %08X", mID);
+ ppro->debugLogA("--- Printing message header");
+ ppro->debugLogA(" SessionID = %08X", mSessionID);
+ ppro->debugLogA(" MessageID = %08X", mID);
#ifndef __GNUC__
- ppro->MSN_DebugLog(" Remaining amount of data = %I64u", mRemSize);
+ ppro->debugLogA(" Remaining amount of data = %I64u", mRemSize);
#else
- ppro->MSN_DebugLog(" Remaining amount of data = %llu", mTotalSize);
+ ppro->debugLogA(" Remaining amount of data = %llu", mTotalSize);
#endif
- ppro->MSN_DebugLog(" Data in packet = %lu bytes", mPacketLen);
- ppro->MSN_DebugLog(" Packet Number = %lu", mPacketNum);
- ppro->MSN_DebugLog(" Operation Code = %08X", mOpCode);
- ppro->MSN_DebugLog(" TF Code = %08X", mTFCode);
- ppro->MSN_DebugLog(" Acknowledged message ID: %08X", mAckUniqueID);
- ppro->MSN_DebugLog("------------------------");
+ ppro->debugLogA(" Data in packet = %lu bytes", mPacketLen);
+ ppro->debugLogA(" Packet Number = %lu", mPacketNum);
+ ppro->debugLogA(" Operation Code = %08X", mOpCode);
+ ppro->debugLogA(" TF Code = %08X", mTFCode);
+ ppro->debugLogA(" Acknowledged message ID: %08X", mAckUniqueID);
+ ppro->debugLogA("------------------------");
}
bool CMsnProto::p2p_createListener(filetransfer* ft, directconnection *dc, MimeHeaders& chdrs)
@@ -88,10 +88,10 @@ bool CMsnProto::p2p_createListener(filetransfer* ft, directconnection *dc, MimeH nlb.cbSize = sizeof(nlb);
nlb.pfnNewConnectionV2 = MSN_ConnectionProc;
nlb.pExtra = this;
- HANDLE sb = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) hNetlibUser, (LPARAM)&nlb);
+ HANDLE sb = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) m_hNetlibUser, (LPARAM)&nlb);
if (sb == NULL)
{
- MSN_DebugLog("Unable to bind the port for incoming transfers");
+ debugLogA("Unable to bind the port for incoming transfers");
return false;
}
@@ -259,7 +259,7 @@ void CMsnProto::p2p_savePicture2disk(filetransfer* ft) ProtoBroadcastAck(AI.hContact, ACKTYPE_AVATAR, ACKRESULT_SUCCESS, &AI, 0);
char *filename = mir_utf8encodeT(AI.filename);
- MSN_DebugLog("Avatar for contact %08x saved to file '%s'", AI.hContact, filename);
+ debugLogA("Avatar for contact %08x saved to file '%s'", AI.hContact, filename);
mir_free(filename);
}
break;
@@ -450,7 +450,7 @@ void CMsnProto::p2p_sendAbortSession(filetransfer* ft) {
if (ft == NULL)
{
- MSN_DebugLog(sttVoidSession);
+ debugLogA(sttVoidSession);
return;
}
@@ -482,7 +482,7 @@ void CMsnProto::p2p_sendRedirect(filetransfer* ft) {
if (ft == NULL)
{
- MSN_DebugLog(sttVoidSession);
+ debugLogA(sttVoidSession);
return;
}
@@ -510,7 +510,7 @@ void CMsnProto::p2p_sendSlp(int iKind, filetransfer *ft, MimeHeaders &pHeaders, {
if (ft == NULL)
{
- MSN_DebugLog(sttVoidSession);
+ debugLogA(sttVoidSession);
return;
}
@@ -604,7 +604,7 @@ void CMsnProto::p2p_sendBye(filetransfer* ft) {
if (ft == NULL)
{
- MSN_DebugLog(sttVoidSession);
+ debugLogA(sttVoidSession);
return;
}
@@ -631,7 +631,7 @@ void CMsnProto::p2p_sendNoCall(filetransfer* ft) {
if (ft == NULL)
{
- MSN_DebugLog(sttVoidSession);
+ debugLogA(sttVoidSession);
return;
}
@@ -655,7 +655,7 @@ void CMsnProto::p2p_sendStatus(filetransfer* ft, long lStatus) {
if (ft == NULL)
{
- MSN_DebugLog(sttVoidSession);
+ debugLogA(sttVoidSession);
return;
}
@@ -729,13 +729,13 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) tConn.wPort = (WORD)atol(tPortDelim + 1);
}
- MSN_DebugLog("Connecting to %s:%d", tConn.szHost, tConn.wPort);
+ debugLogA("Connecting to %s:%d", tConn.szHost, tConn.wPort);
- info->s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&tConn);
+ info->s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&tConn);
if (info->s == NULL)
{
TWinErrorCode err;
- MSN_DebugLog("Connection Failed (%d): %s", err.mErrorCode, err.getText());
+ debugLogA("Connection Failed (%d): %s", err.mErrorCode, err.getText());
return false;
}
info->send(p2p_greeting, sizeof(p2p_greeting));
@@ -764,7 +764,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) BYTE* p;
if ((p = buf.surelyRead(4)) == NULL)
{
- MSN_DebugLog("Error reading data, closing filetransfer");
+ debugLogA("Error reading data, closing filetransfer");
return false;
}
@@ -796,7 +796,7 @@ bool CMsnProto::p2p_connectTo(ThreadData* info, directconnection *dc) if (!cookieMatch)
{
- MSN_DebugLog("Invalid cookie received, exiting");
+ debugLogA("Invalid cookie received, exiting");
return false;
}
@@ -812,10 +812,10 @@ bool CMsnProto::p2p_listen(ThreadData* info, directconnection *dc) {
case WAIT_TIMEOUT:
case WAIT_FAILED:
- MSN_DebugLog("Incoming connection timed out, closing file transfer");
+ debugLogA("Incoming connection timed out, closing file transfer");
MSN_StartP2PTransferByContact(info->mInitialContactWLID);
LBL_Error:
- MSN_DebugLog("File listen failed");
+ debugLogA("File listen failed");
return false;
}
@@ -827,13 +827,13 @@ LBL_Error: if (memcmp(p, p2p_greeting, 8) != 0)
{
- MSN_DebugLog("Invalid input data, exiting");
+ debugLogA("Invalid input data, exiting");
return false;
}
if ((p = buf.surelyRead(4)) == NULL)
{
- MSN_DebugLog("Error reading data, closing filetransfer");
+ debugLogA("Error reading data, closing filetransfer");
return false;
}
@@ -860,7 +860,7 @@ LBL_Error: if (!cookieMatch)
{
- MSN_DebugLog("Invalid cookie received, exiting");
+ debugLogA("Invalid cookie received, exiting");
return false;
}
@@ -876,7 +876,7 @@ LBL_Error: if (!cookieMatch)
{
- MSN_DebugLog("Invalid cookie received, exiting");
+ debugLogA("Invalid cookie received, exiting");
goto LBL_Error;
}
@@ -964,7 +964,7 @@ LONG CMsnProto::p2p_sendPortion(filetransfer* ft, ThreadData* T, bool isV2) }
}
else
- MSN_DebugLog(" Error sending");
+ debugLogA(" Error sending");
ft->ts = time(NULL);
ft->p2p_waitack = true;
@@ -983,12 +983,12 @@ void __cdecl CMsnProto::p2p_sendFeedThread(void* arg) info->contactJoined(info->mInitialContactWLID);
mir_free(info->mInitialContactWLID); info->mInitialContactWLID = NULL;
- MSN_DebugLog("File send thread started");
+ debugLogA("File send thread started");
switch(WaitForSingleObject(info->hWaitEvent, 6000))
{
case WAIT_FAILED:
- MSN_DebugLog("File send wait failed");
+ debugLogA("File send wait failed");
return;
}
@@ -1034,7 +1034,7 @@ void __cdecl CMsnProto::p2p_sendFeedThread(void* arg) {
if (fault)
{
- MSN_DebugLog("File send failed");
+ debugLogA("File send failed");
break;
}
else
@@ -1062,7 +1062,7 @@ void __cdecl CMsnProto::p2p_sendFeedThread(void* arg) p2p_sessionComplete(ft);
}
- MSN_DebugLog("File send thread completed");
+ debugLogA("File send thread completed");
}
@@ -1129,7 +1129,7 @@ void __cdecl CMsnProto::p2p_fileActiveThread(void* arg) {
ThreadData* info = (ThreadData*)arg;
- MSN_DebugLog("p2p_fileActiveThread() started: connecting to '%s'", info->mServer);
+ debugLogA("p2p_fileActiveThread() started: connecting to '%s'", info->mServer);
directconnection *dc = p2p_getDCByCallID(info->mCookie, info->mInitialContactWLID);
if (dc)
@@ -1146,14 +1146,14 @@ void __cdecl CMsnProto::p2p_fileActiveThread(void* arg) p2p_unregisterDC(dc);
}
- MSN_DebugLog("p2p_fileActiveThread() completed: connecting to '%s'", info->mServer);
+ debugLogA("p2p_fileActiveThread() completed: connecting to '%s'", info->mServer);
}
void __cdecl CMsnProto::p2p_filePassiveThread(void* arg)
{
ThreadData* info = (ThreadData*)arg;
- MSN_DebugLog("p2p_filePassiveThread() started: listening");
+ debugLogA("p2p_filePassiveThread() started: listening");
directconnection *dc = p2p_getDCByCallID(info->mCookie, info->mInitialContactWLID);
if (dc)
@@ -1169,7 +1169,7 @@ void __cdecl CMsnProto::p2p_filePassiveThread(void* arg) p2p_unregisterDC(dc);
}
- MSN_DebugLog("p2p_filePassiveThread() completed");
+ debugLogA("p2p_filePassiveThread() completed");
}
@@ -1191,7 +1191,7 @@ void CMsnProto::p2p_InitFileTransfer( szBranch += 7;
}
if (szCallID == NULL || szBranch == NULL) {
- MSN_DebugLog("Ignoring invalid invitation: CallID='%s', szBranch='%s'", szCallID, szBranch);
+ debugLogA("Ignoring invalid invitation: CallID='%s', szBranch='%s'", szCallID, szBranch);
return;
}
@@ -1202,7 +1202,7 @@ void CMsnProto::p2p_InitFileTransfer( if (szSessionID == NULL || szAppId == NULL || szEufGuid == NULL)
{
- MSN_DebugLog("Ignoring invalid invitation: SessionID='%s', AppID=%s, Branch='%s',Context='%s'",
+ debugLogA("Ignoring invalid invitation: SessionID='%s', AppID=%s, Branch='%s',Context='%s'",
szSessionID, szAppId, szEufGuid, szContext);
return;
}
@@ -1269,14 +1269,14 @@ void CMsnProto::p2p_InitFileTransfer( {
p2p_sendStatus(ft, 603);
MSN_ShowError("Your avatar not set correctly. Avatar should be set in View/Change My Details | Avatar");
- MSN_DebugLog("Unable to open avatar file '%s', error %d", szFileName, errno);
+ debugLogA("Unable to open avatar file '%s', error %d", szFileName, errno);
p2p_unregisterSession(ft);
}
else
{
mir_free(ft->std.tszCurrentFile);
ft->std.tszCurrentFile = mir_tstrdup(szFileName);
-// MSN_DebugLog("My avatar file opened for %s as %08p::%d", szEmail, ft, ft->fileId);
+// debugLogA("My avatar file opened for %s as %08p::%d", szEmail, ft, ft->fileId);
ft->std.totalBytes = ft->std.currentFileSize = _filelengthi64(ft->fileId);
ft->std.flags |= PFTS_SENDING;
@@ -1294,7 +1294,7 @@ void CMsnProto::p2p_InitFileTransfer( else
{
p2p_sendStatus(ft, 603);
- MSN_DebugLog("Requested avatar does not match current avatar");
+ debugLogA("Requested avatar does not match current avatar");
p2p_unregisterSession(ft);
}
}
@@ -1359,7 +1359,7 @@ void CMsnProto::p2p_InitFileTransfer( default:
p2p_sendStatus(ft, 603);
p2p_unregisterSession(ft);
- MSN_DebugLog("Invalid or unknown data transfer request (AppID/EUF-GUID: %ld/%s)", dwAppID, szEufGuid);
+ debugLogA("Invalid or unknown data transfer request (AppID/EUF-GUID: %ld/%s)", dwAppID, szEufGuid);
break;
}
@@ -1384,13 +1384,13 @@ void CMsnProto::p2p_InitDirectTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFil }
if (szCallID == NULL || szBranch == NULL)
{
- MSN_DebugLog("Ignoring invalid invitation: CallID='%s', Branch='%s'", szCallID, szBranch);
+ debugLogA("Ignoring invalid invitation: CallID='%s', Branch='%s'", szCallID, szBranch);
return;
}
if (szConnType == NULL || szUPnPNat == NULL || szICF == NULL || szNetID == NULL)
{
- MSN_DebugLog("Ignoring invalid invitation: ConnType='%s', UPnPNat='%s', ICF='%s', NetID='%s'",
+ debugLogA("Ignoring invalid invitation: ConnType='%s', UPnPNat='%s', ICF='%s', NetID='%s'",
szConnType, szUPnPNat, szICF, szNetID);
return;
}
@@ -1455,7 +1455,7 @@ void CMsnProto::p2p_InitDirectTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFil MimeHeaders chdrs(12);
bool listen = false;
- MSN_DebugLog("Connection weight, his: %d mine: %d", conType.weight, MyConnection.weight);
+ debugLogA("Connection weight, his: %d mine: %d", conType.weight, MyConnection.weight);
if (conType.weight <= MyConnection.weight)
listen = p2p_createListener(ft, dc, chdrs);
@@ -1535,7 +1535,7 @@ void CMsnProto::p2p_InitDirectTransfer2(MimeHeaders& tFileInfo, MimeHeaders& tFi if ((szNonce == NULL && szHashedNonce == NULL) || szListening == NULL)
{
- MSN_DebugLog("Ignoring invalid invitation: Listening='%s', Nonce=%s", szListening, szNonce);
+ debugLogA("Ignoring invalid invitation: Listening='%s', Nonce=%s", szListening, szNonce);
return;
}
@@ -1591,7 +1591,7 @@ void CMsnProto::p2p_AcceptTransfer(MimeHeaders& tFileInfo, MimeHeaders& tFileInf if (szCallID == NULL || szBranch == NULL || szOldContentType == NULL)
{
- MSN_DebugLog("Ignoring invalid invitation: CallID='%s', szBranch='%s'", szCallID, szBranch);
+ debugLogA("Ignoring invalid invitation: CallID='%s', szBranch='%s'", szCallID, szBranch);
LBL_Close:
p2p_sendStatus(ft, 500);
return;
@@ -1665,7 +1665,7 @@ LBL_Close: if ((szNonce == NULL && szHashedNonce == NULL) || szListening == NULL)
{
- MSN_DebugLog("Invalid data packet, exiting...");
+ debugLogA("Invalid data packet, exiting...");
goto LBL_Close;
}
@@ -1767,7 +1767,7 @@ void CMsnProto::p2p_processSIP(ThreadData* info, char* msgbody, P2PB_Header* hdr const char* szContentType = tFileInfo["Content-Type"];
if (szContentType == NULL)
{
- MSN_DebugLog("Invalid or missing Content-Type field, exiting");
+ debugLogA("Invalid or missing Content-Type field, exiting");
return;
}
@@ -1945,7 +1945,7 @@ void CMsnProto::p2p_processMsgV2(ThreadData* info, char* msgbody, const char* w ft->nNotify = clock() + 500;
//---- send an ack: body was transferred correctly
- MSN_DebugLog("Transferred %I64u bytes remaining %I64u", ft->std.currentFileProgress, hdrdata.mRemSize);
+ debugLogA("Transferred %I64u bytes remaining %I64u", ft->std.currentFileProgress, hdrdata.mRemSize);
}
if (hdrdata.mRemSize == 0)
@@ -2119,7 +2119,7 @@ void CMsnProto::p2p_processMsg(ThreadData* info, char* msgbody, const char* wli }
//---- send an ack: body was transferred correctly
- MSN_DebugLog("Transferred %I64u bytes out of %I64u", ft->std.currentFileProgress, hdrdata.mTotalSize);
+ debugLogA("Transferred %I64u bytes out of %I64u", ft->std.currentFileProgress, hdrdata.mTotalSize);
}
if (ft->std.currentFileProgress >= hdrdata.mTotalSize)
diff --git a/protocols/MSN/src/msn_p2ps.cpp b/protocols/MSN/src/msn_p2ps.cpp index b642180695..1f2a3d9577 100644 --- a/protocols/MSN/src/msn_p2ps.cpp +++ b/protocols/MSN/src/msn_p2ps.cpp @@ -68,7 +68,7 @@ filetransfer* CMsnProto::p2p_getSessionByID(unsigned id) LeaveCriticalSection(&sessionLock);
if (ft == NULL)
- MSN_DebugLog("Ignoring unknown session id %08x", id);
+ debugLogA("Ignoring unknown session id %08x", id);
return ft;
}
@@ -93,7 +93,7 @@ filetransfer* CMsnProto::p2p_getSessionByUniqueID(unsigned id) LeaveCriticalSection(&sessionLock);
if (ft == NULL)
- MSN_DebugLog("Ignoring unknown unique id %08x", id);
+ debugLogA("Ignoring unknown unique id %08x", id);
return ft;
}
@@ -295,7 +295,7 @@ filetransfer* CMsnProto::p2p_getSessionByCallID(const char* CallID, const char* LeaveCriticalSection(&sessionLock);
if (ft == NULL)
- MSN_DebugLog("Ignoring unknown session call id %s", CallID);
+ debugLogA("Ignoring unknown session call id %s", CallID);
return ft;
}
diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 8312a02c9b..1ad594116f 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -142,7 +142,7 @@ CMsnProto::CMsnProto(const char* aProtoName, const TCHAR* aUserName) : nlu.pfnHttpGatewayUnwrapRecv = msn_httpGatewayUnwrapRecv;
mir_sntprintf(szBuffer, SIZEOF(szBuffer), TranslateT("%s plugin connections"), m_tszUserName);
- hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
}
CMsnProto::~CMsnProto()
@@ -159,7 +159,7 @@ CMsnProto::~CMsnProto() P2pSessions_Uninit();
CachedMsg_Uninit();
- Netlib_CloseHandle(hNetlibUser);
+ Netlib_CloseHandle(m_hNetlibUser);
Netlib_CloseHandle(hNetlibUserHttps);
mir_free(mailsoundname);
@@ -1017,7 +1017,7 @@ int __cdecl CMsnProto::SetStatus(int iNewStatus) if (m_iDesiredStatus == iNewStatus) return 0;
m_iDesiredStatus = iNewStatus;
- MSN_DebugLog("PS_SETSTATUS(%d,0)", iNewStatus);
+ debugLogA("PS_SETSTATUS(%d,0)", iNewStatus);
if (m_iDesiredStatus == ID_STATUS_OFFLINE)
{
diff --git a/protocols/MSN/src/msn_proto.h b/protocols/MSN/src/msn_proto.h index eef0a1313e..aaaee49351 100644 --- a/protocols/MSN/src/msn_proto.h +++ b/protocols/MSN/src/msn_proto.h @@ -179,7 +179,7 @@ struct CMsnProto : public PROTO<CMsnProto> clock_t mStatusMsgTS;
HANDLE msnSearchId;
- HANDLE hNetlibUser, hNetlibUserHttps;
+ HANDLE hNetlibUserHttps;
HANDLE hHttpsConnection;
HANDLE hMSNNudge;
HANDLE hPopupError, hPopupHotmail, hPopupNotify;
@@ -191,8 +191,6 @@ struct CMsnProto : public PROTO<CMsnProto> void InitCustomFolders(void);
- void MSN_DebugLog(const char* fmt, ...);
-
char* getSslResult(char** parUrl, const char* parAuthInfo, const char* hdrs, unsigned& status);
bool getMyAvatarFile(char *url, TCHAR *fname);
diff --git a/protocols/MSN/src/msn_svcs.cpp b/protocols/MSN/src/msn_svcs.cpp index 5f1db4ff16..436fc36a79 100644 --- a/protocols/MSN/src/msn_svcs.cpp +++ b/protocols/MSN/src/msn_svcs.cpp @@ -400,7 +400,7 @@ int CMsnProto::OnContactDeleted(WPARAM wParam, LPARAM lParam) if (szEmail[0])
{
- MSN_DebugLog("Deleted Handler Email");
+ debugLogA("Deleted Handler Email");
if (Lists_IsInList(LIST_FL, szEmail))
{
diff --git a/protocols/MSN/src/msn_threads.cpp b/protocols/MSN/src/msn_threads.cpp index e25bbb7085..72690d3bc0 100644 --- a/protocols/MSN/src/msn_threads.cpp +++ b/protocols/MSN/src/msn_threads.cpp @@ -72,7 +72,7 @@ void __cdecl CMsnProto::msn_keepAliveThread(void*) }
CloseHandle(hKeepAliveThreadEvt); hKeepAliveThreadEvt = NULL;
- MSN_DebugLog("Closing keep-alive thread");
+ debugLogA("Closing keep-alive thread");
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -133,12 +133,12 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) }
}
- MSN_DebugLog("Thread started: server='%s:%d', type=%d", tConn.szHost, tConn.wPort, info->mType);
+ debugLogA("Thread started: server='%s:%d', type=%d", tConn.szHost, tConn.wPort, info->mType);
- info->s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)hNetlibUser, (LPARAM)&tConn);
+ info->s = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&tConn);
if (info->s == NULL)
{
- MSN_DebugLog("Connection Failed (%d) server='%s:%d'", WSAGetLastError(), tConn.szHost, tConn.wPort);
+ debugLogA("Connection Failed (%d) server='%s:%d'", WSAGetLastError(), tConn.szHost, tConn.wPort);
switch (info->mType)
{
@@ -156,7 +156,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) if (usingGateway)
CallService(MS_NETLIB_SETPOLLINGTIMEOUT, WPARAM(info->s), info->mGatewayTimeout);
- MSN_DebugLog("Connected with handle=%08X", info->s);
+ debugLogA("Connected with handle=%08X", info->s);
if (info->mType == SERVER_NOTIFICATION)
{
@@ -176,20 +176,20 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) msnNsThread = info;
}
- MSN_DebugLog("Entering main recv loop");
+ debugLogA("Entering main recv loop");
info->mBytesInData = 0;
for (;;)
{
int recvResult = info->recv(info->mData + info->mBytesInData, sizeof(info->mData) - info->mBytesInData);
if (recvResult == SOCKET_ERROR)
{
- MSN_DebugLog("Connection %08p [%08X] was abortively closed", info->s, GetCurrentThreadId());
+ debugLogA("Connection %08p [%08X] was abortively closed", info->s, GetCurrentThreadId());
break;
}
if (!recvResult)
{
- MSN_DebugLog("Connection %08p [%08X] was gracefully closed", info->s, GetCurrentThreadId());
+ debugLogA("Connection %08p [%08X] was gracefully closed", info->s, GetCurrentThreadId());
break;
}
@@ -215,17 +215,17 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) memcpy(msg, info->mData, peol-info->mData); msg[peol-info->mData] = 0;
if (*++peol != '\n')
- MSN_DebugLog("Dodgy line ending to command: ignoring");
+ debugLogA("Dodgy line ending to command: ignoring");
else
peol++;
info->mBytesInData -= peol - info->mData;
memmove(info->mData, peol, info->mBytesInData);
- MSN_DebugLog("RECV: %s", msg);
+ debugLogA("RECV: %s", msg);
if (!isalnum(msg[0]) || !isalnum(msg[1]) || !isalnum(msg[2]) || (msg[3] && msg[3] != ' '))
{
- MSN_DebugLog("Invalid command name");
+ debugLogA("Invalid command name");
continue;
}
@@ -251,7 +251,7 @@ void __cdecl CMsnProto::MSNServerThread(void* arg) if (info->mBytesInData == sizeof(info->mData))
{
- MSN_DebugLog("sizeof(data) is too small: the longest line won't fit");
+ debugLogA("sizeof(data) is too small: the longest line won't fit");
break;
}
}
@@ -297,7 +297,7 @@ LBL_Exit: }
}
- MSN_DebugLog("Thread [%08X] ending now", GetCurrentThreadId());
+ debugLogA("Thread [%08X] ending now", GetCurrentThreadId());
}
void CMsnProto::MSN_InitThreads(void)
@@ -638,7 +638,7 @@ ThreadData::~ThreadData() if (s != NULL)
{
- proto->MSN_DebugLog("Closing connection handle %08X", s);
+ proto->debugLogA("Closing connection handle %08X", s);
Netlib_CloseHandle(s);
}
@@ -693,7 +693,7 @@ void ThreadData::applyGatewayData(HANDLE hConn, bool isPoll) char szHttpPostUrl[300];
getGatewayUrl(szHttpPostUrl, sizeof(szHttpPostUrl), isPoll);
- proto->MSN_DebugLog("applying '%s' to %08X [%08X]", szHttpPostUrl, this, GetCurrentThreadId());
+ proto->debugLogA("applying '%s' to %08X [%08X]", szHttpPostUrl, this, GetCurrentThreadId());
NETLIBHTTPPROXYINFO nlhpi = {0};
nlhpi.cbSize = sizeof(nlhpi);
@@ -753,11 +753,11 @@ void __cdecl CMsnProto::ThreadStub(void* arg) {
ThreadData* info = (ThreadData*)arg;
- MSN_DebugLog("Starting thread %08X (%08X)", GetCurrentThreadId(), info->mFunc);
+ debugLogA("Starting thread %08X (%08X)", GetCurrentThreadId(), info->mFunc);
(this->*(info->mFunc))(info);
- MSN_DebugLog("Leaving thread %08X (%08X)", GetCurrentThreadId(), info->mFunc);
+ debugLogA("Leaving thread %08X (%08X)", GetCurrentThreadId(), info->mFunc);
EnterCriticalSection(&sttLock);
sttThreads.LIST<ThreadData>::remove(info);
@@ -814,7 +814,7 @@ BYTE* HReadBuffer::surelyRead(size_t parBytes) if (parBytes > bufferSize)
{
- owner->proto->MSN_DebugLog("HReadBuffer::surelyRead: not enough memory, %d %d %d", parBytes, bufferSize, startOffset);
+ owner->proto->debugLogA("HReadBuffer::surelyRead: not enough memory, %d %d %d", parBytes, bufferSize, startOffset);
return NULL;
}
}
diff --git a/protocols/MSN/src/msn_ws.cpp b/protocols/MSN/src/msn_ws.cpp index 5833dbf626..98d89698a2 100644 --- a/protocols/MSN/src/msn_ws.cpp +++ b/protocols/MSN/src/msn_ws.cpp @@ -42,7 +42,7 @@ int ThreadData::send(const char data[], size_t datalen) if (rlen == SOCKET_ERROR)
{
// should really also check if sendlen is the same as datalen
- proto->MSN_DebugLog("Send failed: %d", WSAGetLastError());
+ proto->debugLogA("Send failed: %d", WSAGetLastError());
return FALSE;
}
@@ -91,7 +91,7 @@ bool ThreadData::isTimeout(void) {
bool sbsess = mType == SERVER_SWITCHBOARD;
- proto->MSN_DebugLog("Dropping the idle %s due to inactivity", sbsess ? "switchboard" : "p2p");
+ proto->debugLogA("Dropping the idle %s due to inactivity", sbsess ? "switchboard" : "p2p");
if (!sbsess || termPending) return true;
if (proto->getByte("EnableSessionPopup", 0))
@@ -132,7 +132,7 @@ int ThreadData::recv(char* data, size_t datalen) int ret = CallService(MS_NETLIB_SELECT, 0, (LPARAM)&nls);
if (ret < 0)
{
- proto->MSN_DebugLog("Connection abortively closed, error %d", WSAGetLastError());
+ proto->debugLogA("Connection abortively closed, error %d", WSAGetLastError());
return ret;
}
else if (ret == 0)
@@ -148,13 +148,13 @@ LBL_RecvAgain: int ret = CallService(MS_NETLIB_RECV, (WPARAM)s, (LPARAM)&nlb);
if (ret == 0)
{
- proto->MSN_DebugLog("Connection closed gracefully");
+ proto->debugLogA("Connection closed gracefully");
return 0;
}
if (ret < 0)
{
- proto->MSN_DebugLog("Connection abortively closed, error %d", WSAGetLastError());
+ proto->debugLogA("Connection abortively closed, error %d", WSAGetLastError());
return ret;
}
diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index fd9b9d9dd2..f0ebd14717 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -84,8 +84,7 @@ OmegleProto::~OmegleProto( ) DWORD_PTR OmegleProto::GetCaps( int type, HANDLE hContact )
{
- switch(type)
- {
+ switch(type) {
case PFLAGNUM_1:
return PF1_CHAT;
case PFLAGNUM_2:
@@ -107,8 +106,7 @@ DWORD_PTR OmegleProto::GetCaps( int type, HANDLE hContact ) int OmegleProto::SetStatus( int new_status )
{
// Routing statuses not supported by Omegle
- switch ( new_status )
- {
+ switch ( new_status ) {
case ID_STATUS_OFFLINE:
case ID_STATUS_CONNECTING:
new_status = ID_STATUS_OFFLINE;
@@ -217,23 +215,3 @@ int OmegleProto::OnContactDeleted(WPARAM wparam,LPARAM) OnLeaveChat(NULL, NULL);
return 0;
}
-
-
-//////////////////////////////////////////////////////////////////////////////
-// OTHER
-
-/*bool OmegleProto::IsMyContact(HANDLE hContact, bool include_chat)
-{
- const char *proto = reinterpret_cast<char*>(GetContactProto(
- reinterpret_cast<WPARAM>(hContact),0));
-
- if ( proto && strcmp(m_szModuleName,proto) == 0 )
- {
- if ( include_chat )
- return true;
- else
- return db_get_b(hContact,m_szModuleName,"ChatRoom",0) == 0;
- } else {
- return false;
- }
-}*/
diff --git a/protocols/Omegle/src/proto.h b/protocols/Omegle/src/proto.h index 85b91bbcb8..5f376e680d 100644 --- a/protocols/Omegle/src/proto.h +++ b/protocols/Omegle/src/proto.h @@ -140,8 +140,6 @@ public: HANDLE log_lock_;
HANDLE events_loop_lock_;
- HANDLE m_hNetlibUser;
-
static void CALLBACK APC_callback(ULONG_PTR p);
// Logging
diff --git a/protocols/Skype/src/skype_account.cpp b/protocols/Skype/src/skype_account.cpp index 218639d919..ceb0748dcb 100644 --- a/protocols/Skype/src/skype_account.cpp +++ b/protocols/Skype/src/skype_account.cpp @@ -118,7 +118,7 @@ bool CSkypeProto::LogIn() this->SetAccountSettings();
- this->Log(L"Login in an account");
+ this->debugLogW(L"Login in an account");
this->account->LoginWithPassword(this->password, false, false);
}
@@ -130,7 +130,7 @@ void CSkypeProto::LogOut() if (this->IsOnline() || this->m_iStatus == ID_STATUS_CONNECTING)
{
this->account->SetAvailability(Contact::OFFLINE);
- this->Log(L"Logout from account");
+ this->debugLogW(L"Logout from account");
this->account->Logout(true);
}
}
@@ -138,19 +138,19 @@ void CSkypeProto::LogOut() void CSkypeProto::SetAccountSettings()
{
int port = this->getWord("Port", rand() % 10000 + 10000);
- this->Log(L"Setting port number to %d", port);
+ this->debugLogW(L"Setting port number to %d", port);
this->SetInt(SETUPKEY_PORT, port);
bool useAlternativePorts = this->getByte("UseAlternativePorts", 1) > 0;
if (useAlternativePorts)
- this->Log(L"Setting listening of alternative ports (80, 443)");
+ this->debugLogW(L"Setting listening of alternative ports (80, 443)");
this->SetInt(SETUPKEY_DISABLE_PORT80, (int)!useAlternativePorts);
// Create default group for new contacts
DBVARIANT dbv = {0};
if ( !getTString(SKYPE_SETTINGS_DEF_GROUP, &dbv) && lstrlen(dbv.ptszVal) > 0)
{
- this->Log(L"Setting default group for new contacts");
+ this->debugLogW(L"Setting default group for new contacts");
::Clist_CreateGroup(0, dbv.ptszVal);
::db_free(&dbv);
}
@@ -158,10 +158,10 @@ void CSkypeProto::SetAccountSettings() void CSkypeProto::InitProxy()
{
- if (this->hNetLibUser)
+ if (this->m_hNetlibUser)
{
NETLIBUSERSETTINGS nlus = { sizeof(NETLIBUSERSETTINGS) };
- ::CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)this->hNetLibUser, (LPARAM)&nlus);
+ ::CallService(MS_NETLIB_GETUSERSETTINGS, (WPARAM)this->m_hNetlibUser, (LPARAM)&nlus);
if (nlus.useProxy)
{
@@ -172,7 +172,7 @@ void CSkypeProto::InitProxy() {
case PROXYTYPE_HTTP:
case PROXYTYPE_HTTPS:
- this->Log(L"Setting https user proxy config");
+ this->debugLogW(L"Setting https user proxy config");
this->SetInt(SETUPKEY_HTTPS_PROXY_ENABLE, 1);
this->SetInt(SETUPKEY_SOCKS_PROXY_ENABLE, 0);
this->SetStr(SETUPKEY_HTTPS_PROXY_ADDR, address);
@@ -186,7 +186,7 @@ void CSkypeProto::InitProxy() case PROXYTYPE_SOCKS4:
case PROXYTYPE_SOCKS5:
- this->Log(L"Setting socks user proxy config");
+ this->debugLogW(L"Setting socks user proxy config");
this->SetInt(SETUPKEY_HTTPS_PROXY_ENABLE, 0);
this->SetInt(SETUPKEY_SOCKS_PROXY_ENABLE, 1);
this->SetStr(SETUPKEY_SOCKS_PROXY_ADDR, address);
@@ -199,7 +199,7 @@ void CSkypeProto::InitProxy() break;
default:
- this->Log(L"Setting automatic proxy detection");
+ this->debugLogW(L"Setting automatic proxy detection");
this->Delete(SETUPKEY_HTTPS_PROXY_ENABLE);
this->Delete(SETUPKEY_HTTPS_PROXY_ADDR);
this->Delete(SETUPKEY_HTTPS_PROXY_USER);
@@ -251,7 +251,7 @@ void CSkypeProto::SetServerStatus(int iNewStatus) CContact::AVAILABILITY availability = CSkypeProto::MirandaToSkypeStatus(iNewStatus);
if (availability != CContact::UNKNOWN)
{
- this->Log(L"Setting status to %d", iNewStatus);
+ this->debugLogW(L"Setting status to %d", iNewStatus);
this->account->SetAvailability(availability);
}
@@ -266,7 +266,7 @@ void CSkypeProto::OnCblUpdated() void CSkypeProto::OnLoggedOut(CAccount::LOGOUTREASON reason)
{
- this->Log(L"Failed to login: %s", CSkypeProto::LogoutReasons[reason]);
+ this->debugLogW(L"Failed to login: %s", CSkypeProto::LogoutReasons[reason]);
if (this->m_iStatus == ID_STATUS_CONNECTING)
this->SendBroadcast(
@@ -327,7 +327,7 @@ void CSkypeProto::OnAccountChanged(int prop) this->account->GetPropPwdchangestatus(status);
if (status != CAccount::PWD_CHANGING)
{
- this->Log(L"Failed to chage password: %s", CSkypeProto::PasswordChangeReasons[status]);
+ this->debugLogW(L"Failed to chage password: %s", CSkypeProto::PasswordChangeReasons[status]);
this->ShowNotification(CSkypeProto::PasswordChangeReasons[status]);
}
}
diff --git a/protocols/Skype/src/skype_avatars.cpp b/protocols/Skype/src/skype_avatars.cpp index 0c3be45a88..9ca9b0dddd 100644 --- a/protocols/Skype/src/skype_avatars.cpp +++ b/protocols/Skype/src/skype_avatars.cpp @@ -129,33 +129,33 @@ INT_PTR __cdecl CSkypeProto::SetMyAvatar(WPARAM, LPARAM lParam) ptrW avatarPath( this->GetContactAvatarFilePath(NULL));
if ( !::wcscmp(path, avatarPath))
{
- this->Log(L"New avatar path are same with old.");
+ this->debugLogW(L"New avatar path are same with old.");
return -1;
}
SEBinary avatar = this->GetAvatarBinary(path);
if (avatar.size() == 0)
{
- this->Log(L"Failed to read avatar file.");
+ this->debugLogW(L"Failed to read avatar file.");
return -1;
}
if (this->IsAvatarChanged(avatar))
{
- this->Log(L"New avatar are same with old.");
+ this->debugLogW(L"New avatar are same with old.");
return -1;
}
if ( !::CopyFile(path, avatarPath, FALSE))
{
- this->Log(L"Failed to copy new avatar to local storage.");
+ this->debugLogW(L"Failed to copy new avatar to local storage.");
return -1;
}
Skype::VALIDATERESULT result = Skype::NOT_VALIDATED;
if (!this->account->SetAvatar(avatar, result))
{
- this->Log(CSkypeProto::ValidationReasons[result]);
+ this->debugLogW(CSkypeProto::ValidationReasons[result]);
return -1;
}
diff --git a/protocols/Skype/src/skype_chat.cpp b/protocols/Skype/src/skype_chat.cpp index c8e5dcda39..3bb2534bbf 100644 --- a/protocols/Skype/src/skype_chat.cpp +++ b/protocols/Skype/src/skype_chat.cpp @@ -182,7 +182,7 @@ void ChatRoom::CreateChatSession(bool showWindow) ::CallServiceSync(MS_GC_EVENT, showWindow ? SESSION_INITDONE : WINDOW_HIDDEN, (LPARAM)&gce);
::CallServiceSync(MS_GC_EVENT, SESSION_ONLINE, (LPARAM)&gce);
- this->ppro->Log(L"Created new chat session %s", this->cid);
+ this->ppro->debugLogW(L"Created new chat session %s", this->cid);
}
void ChatRoom::SetTopic(const wchar_t *topic)
@@ -343,19 +343,19 @@ void ChatRoom::Join(const wchar_t *joinBlob, CSkypeProto *ppro) void ChatRoom::SendMessage(const wchar_t *text)
{
- this->ppro->Log(L"Sending chat message %s", this->cid);
+ this->ppro->debugLogW(L"Sending chat message %s", this->cid);
CMessage::Ref message;
if (this->conversation->PostText((char *)ptrA(::mir_utf8encodeW(text)), message))
- this->ppro->Log(L"Chat message sent %s", this->cid);
+ this->ppro->debugLogW(L"Chat message sent %s", this->cid);
}
void ChatRoom::LeaveChat()
{
- this->ppro->Log(L"Leaving chat session %s", this->cid);
+ this->ppro->debugLogW(L"Leaving chat session %s", this->cid);
if (this->conversation->RetireFrom())
- this->ppro->Log(L"Retired from conversation %s", this->cid);
+ this->ppro->debugLogW(L"Retired from conversation %s", this->cid);
GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
gcd.ptszID = this->cid;
@@ -370,13 +370,13 @@ void ChatRoom::LeaveChat() void ChatRoom::LeaveChatAndDelete()
{
- this->ppro->Log(L"Leaving chat session %s", this->cid);
+ this->ppro->debugLogW(L"Leaving chat session %s", this->cid);
if (this->conversation->RetireFrom())
- this->ppro->Log(L"Retired from conversation %s", this->cid);
+ this->ppro->debugLogW(L"Retired from conversation %s", this->cid);
if (this->conversation->Delete())
- this->ppro->Log(L"Delete conversation %s", this->cid);
+ this->ppro->debugLogW(L"Delete conversation %s", this->cid);
GCDEST gcd = { ppro->m_szModuleName, { NULL }, GC_EVENT_CONTROL };
gcd.ptszID = this->cid;
@@ -781,7 +781,7 @@ void ChatRoom::OnEvent(const ConversationRef &conversation, const MessageRef &me message->GetPropConsumptionStatus(status);
if (status != Message::CONSUMED)
{
- this->ppro->Log(L"Retired other event for conversation %s", this->cid);
+ this->ppro->debugLogW(L"Retired other event for conversation %s", this->cid);
uint timestamp;
message->GetPropTimestamp(timestamp);
@@ -819,7 +819,7 @@ void ChatRoom::OnEvent(const ConversationRef &conversation, const MessageRef &me message->GetPropConsumptionStatus(status);
if (status != Message::CONSUMED)
{
- this->ppro->Log(L"Retired event for conversation %s", this->cid);
+ this->ppro->debugLogW(L"Retired event for conversation %s", this->cid);
uint timestamp;
message->GetPropTimestamp(timestamp);
@@ -1634,7 +1634,7 @@ INT_PTR __cdecl CSkypeProto::OnLeaveChat(WPARAM wParam, LPARAM) void __cdecl CSkypeProto::LoadChatList(void*)
{
- this->Log(L"Updating group chats list");
+ this->debugLogW(L"Updating group chats list");
CConversation::Refs conversations;
this->GetConversationList(conversations);
diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 72a518a80f..33042e728d 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -243,7 +243,7 @@ HANDLE CSkypeProto::AddContact(CContact::Ref contact, bool isTemporary) void __cdecl CSkypeProto::LoadContactList(void* data)
{
- this->Log(L"Updating contacts list");
+ this->debugLogW(L"Updating contacts list");
bool isFirstLoad = data != NULL;
diff --git a/protocols/Skype/src/skype_netlib.cpp b/protocols/Skype/src/skype_netlib.cpp index 8641eb8de8..6a958d0217 100644 --- a/protocols/Skype/src/skype_netlib.cpp +++ b/protocols/Skype/src/skype_netlib.cpp @@ -10,25 +10,13 @@ void CSkypeProto::InitNetLib() nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_HTTPCONNS | NUF_UNICODE;
nlu.ptszDescriptiveName = name;
nlu.szSettingsModule = this->m_szModuleName;
- this->hNetLibUser = (HANDLE)::CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
+ this->m_hNetlibUser = (HANDLE)::CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
- this->Log(L"Setting protocol/module name to '%s'", (TCHAR*)_A2T(m_szModuleName));
+ this->debugLogW(L"Setting protocol/module name to '%s'", (TCHAR*)_A2T(m_szModuleName));
}
void CSkypeProto::UninitNetLib()
{
- ::Netlib_CloseHandle(this->hNetLibUser);
- this->hNetLibUser = NULL;
+ ::Netlib_CloseHandle(this->m_hNetlibUser);
+ this->m_hNetlibUser = NULL;
}
-
-void CSkypeProto::Log(const wchar_t *fmt, ...)
-{
- va_list va;
- wchar_t msg[1024];
-
- va_start(va, fmt);
- ::mir_vsntprintf(msg, SIZEOF(msg), fmt, va);
- va_end(va);
-
- ::CallService(MS_NETLIB_LOGW, (WPARAM)this->hNetLibUser, (LPARAM)msg);
-}
\ No newline at end of file diff --git a/protocols/Skype/src/skype_profile.cpp b/protocols/Skype/src/skype_profile.cpp index f76b238d80..bd59491c34 100644 --- a/protocols/Skype/src/skype_profile.cpp +++ b/protocols/Skype/src/skype_profile.cpp @@ -288,7 +288,7 @@ void CSkypeProto::UpdateProfileTimezone(SEObject *obj, HANDLE hContact) void CSkypeProto::UpdateProfile(SEObject *obj, HANDLE hContact)
{
- this->Log(L"Updating profile for %p", hContact);
+ this->debugLogW(L"Updating profile for %p", hContact);
this->UpdateProfileAvatar(obj, hContact);
uint newTS = hContact ? obj->GetUintProp(Contact::P_PROFILE_TIMESTAMP) : obj->GetUintProp(Account::P_PROFILE_TIMESTAMP);
diff --git a/protocols/Skype/src/skype_proto.cpp b/protocols/Skype/src/skype_proto.cpp index 3c9cab6546..1966d403be 100644 --- a/protocols/Skype/src/skype_proto.cpp +++ b/protocols/Skype/src/skype_proto.cpp @@ -150,7 +150,7 @@ HANDLE __cdecl CSkypeProto::FileAllow( HANDLE hContact, HANDLE hTransfer, const {
uint oid = (uint)hTransfer;
- this->Log(L"Incoming file transfer is accepted");
+ this->debugLogW(L"Incoming file transfer is accepted");
bool success;
wchar_t fullPath[MAX_PATH] = {0};
@@ -187,7 +187,7 @@ HANDLE __cdecl CSkypeProto::FileAllow( HANDLE hContact, HANDLE hTransfer, const //if ( !ProtoBroadcastAck(hContact, ACKTYPE_FILE, ACKRESULT_FILERESUME, (HANDLE)oid, (LPARAM)&pfts))
if ( !transfer->Accept((char *)ptrA(::mir_utf8encodeW(fullPath)), success) || !success)
{
- this->Log(L"Cannot accept file transfer");
+ this->debugLogW(L"Cannot accept file transfer");
this->transferList.remove_val(transfer);
}
}
@@ -210,7 +210,7 @@ int __cdecl CSkypeProto::FileCancel( HANDLE hContact, HANDLE hTransfer ) if (transferStatus <= Transfer::CANCELLED && this->transferList.contains(transfer))
{
if ( !transfer->Cancel())
- this->Log(L"Incoming file transfer is cancelled");
+ this->debugLogW(L"Incoming file transfer is cancelled");
this->transferList.remove_val(transfer);
}
}
@@ -234,7 +234,7 @@ int __cdecl CSkypeProto::FileDeny( HANDLE hContact, HANDLE hTransfer, const T if (transferStatus <= Transfer::CANCELLED && this->transferList.contains(transfer))
{
if ( !transfer->Cancel())
- this->Log(L"Incoming file transfer is denied");
+ this->debugLogW(L"Incoming file transfer is denied");
this->transferList.remove_val(transfer);
}
}
@@ -362,7 +362,7 @@ HWND __cdecl CSkypeProto::CreateExtendedSearchUI( HWND owner ){ return 0; } int __cdecl CSkypeProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* pre)
{
- this->Log(L"Incoming contacts");
+ this->debugLogW(L"Incoming contacts");
::db_unset(hContact, "CList", "Hidden");
return (INT_PTR)this->AddDBEvent(
@@ -376,14 +376,14 @@ int __cdecl CSkypeProto::RecvContacts( HANDLE hContact, PROTORECVEVENT* pre) int __cdecl CSkypeProto::RecvFile( HANDLE hContact, PROTORECVFILET* pre)
{
- this->Log(L"Incoming file transfer");
+ this->debugLogW(L"Incoming file transfer");
::db_unset(hContact, "CList", "Hidden");
return ::Proto_RecvFile(hContact, pre);
}
int __cdecl CSkypeProto::RecvMsg(HANDLE hContact, PROTORECVEVENT* pre)
{
- this->Log(L"Incoming message");
+ this->debugLogW(L"Incoming message");
::db_unset(hContact, "CList", "Hidden");
ReadMessageParam *param = (ReadMessageParam*)pre->lParam;
@@ -409,7 +409,7 @@ int __cdecl CSkypeProto::SendContacts(HANDLE hContact, int flags, int nContacts, {
if (this->IsOnline() && hContact && hContactsList)
{
- this->Log(L"Outcoming contacts");
+ this->debugLogW(L"Outcoming contacts");
ConversationRef conversation;
if ( !this->isChatRoom(hContact))
@@ -460,7 +460,7 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription {
if (this->IsOnline() && hContact && ppszFiles)
{
- this->Log(L"Outcoming file transfer");
+ this->debugLogW(L"Outcoming file transfer");
ConversationRef conversation;
if ( !this->isChatRoom(hContact))
@@ -529,7 +529,7 @@ HANDLE __cdecl CSkypeProto::SendFile(HANDLE hContact, const TCHAR *szDescription int __cdecl CSkypeProto::SendMsg(HANDLE hContact, int flags, const char *msg)
{
- this->Log(L"Outcoming message");
+ this->debugLogW(L"Outcoming message");
SEStringList targets;
targets.append((char *)_T2A(::db_get_wsa(hContact, this->m_szModuleName, SKYPE_SETTINGS_SID)));
diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 186cf34ea3..094fa8c6e8 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -477,13 +477,9 @@ protected: HANDLE CreateEvent(const char* szService);
// netlib
- HANDLE hNetLibUser;
-
void InitNetLib();
void UninitNetLib();
- void Log(const wchar_t *fmt, ...);
-
// services
void InitInstanceServiceList();
diff --git a/protocols/Skype/src/skype_transfers.cpp b/protocols/Skype/src/skype_transfers.cpp index 227edaeea6..a6f5fc5cab 100644 --- a/protocols/Skype/src/skype_transfers.cpp +++ b/protocols/Skype/src/skype_transfers.cpp @@ -46,7 +46,7 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) break;
case Transfer::FAILED:
transfer->GetPropFailurereason(reason);
- this->Log(L"File transfer failed: %s", CSkypeProto::TransferFailureReasons[reason]);
+ this->debugLogW(L"File transfer failed: %s", CSkypeProto::TransferFailureReasons[reason]);
this->transferList.remove_val(transfer);
this->transferts[oid].files[fOid].isCanceled = true;
break;
@@ -58,7 +58,7 @@ void CSkypeProto::OnTransferChanged(const TransferRef &transfer, int prop) case Transfer::CANCELLED:
case Transfer::CANCELLED_BY_REMOTE:
transfer->GetPropFailurereason(reason);
- this->Log(L"File transfer cancelled: %s", CSkypeProto::TransferFailureReasons[reason]);
+ this->debugLogW(L"File transfer cancelled: %s", CSkypeProto::TransferFailureReasons[reason]);
this->transferList.remove_val(transfer);
this->transferts[oid].files[fOid].isCanceled = true;
break;
diff --git a/protocols/Tlen/src/tlen.cpp b/protocols/Tlen/src/tlen.cpp index 92bd5d28d8..dbb36e1108 100644 --- a/protocols/Tlen/src/tlen.cpp +++ b/protocols/Tlen/src/tlen.cpp @@ -211,7 +211,7 @@ INT_PTR TlenProtocol::MenuHandleInbox(WPARAM wParam, LPARAM lParam) req.pData = form;
req.dataLength = (int)strlen(form);
req.szUrl = "http://poczta.o2.pl/login.html";
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)hNetlibUser, (LPARAM)&req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)m_hNetlibUser, (LPARAM)&req);
if (resp != NULL) {
if (resp->resultCode/100 == 2 || resp->resultCode == 302) {
int i;
@@ -264,7 +264,7 @@ int TlenProtocol::OnModulesLoaded(WPARAM wParam, LPARAM lParam) int TlenProtocol::PreShutdown(WPARAM wParam, LPARAM lParam)
{
- TlenLog(this, "TLEN TlenPreShutdown");
+ debugLogA("TLEN TlenPreShutdown");
return 0;
}
diff --git a/protocols/Tlen/src/tlen.h b/protocols/Tlen/src/tlen.h index ddcf6ba3c5..9748f47742 100644 --- a/protocols/Tlen/src/tlen.h +++ b/protocols/Tlen/src/tlen.h @@ -299,7 +299,6 @@ struct TlenProtocol : public PROTO<TlenProtocol> int __cdecl MUCHandleEvent(WPARAM wParam, LPARAM lParam);
//====================================================================================
- HANDLE hNetlibUser;
HANDLE hFileNetlibUser;
TLEN_MODEMSGS modeMsgs;
@@ -452,7 +451,6 @@ void uninitMenuItems(TlenProtocol *proto); HICON GetIcolibIcon(int iconId);
void ReleaseIcolibIcon(HICON hIcon);
-void TlenLog(TlenProtocol *proto, const char *fmt, ...);
void __cdecl TlenServerThread(ThreadData *info);
// tlen_ws.cpp
BOOL TlenWsInit(TlenProtocol *proto);
diff --git a/protocols/Tlen/src/tlen_avatar.cpp b/protocols/Tlen/src/tlen_avatar.cpp index 478ae81e92..f995f7ec2e 100644 --- a/protocols/Tlen/src/tlen_avatar.cpp +++ b/protocols/Tlen/src/tlen_avatar.cpp @@ -243,7 +243,7 @@ static void TlenGetAvatarThread(void *ptr) { req.headers = NULL;
req.dataLength = 0;
req.szUrl = request;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->hNetlibUser, (LPARAM)&req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)&req);
if (item != NULL) {
item->newAvatarDownloading = FALSE;
}
@@ -309,7 +309,7 @@ static void TlenRemoveAvatarRequestThread(void *ptr) { NETLIBHTTPREQUEST *resp;
TLENREMOVEAVATARTHREADDATA *data = (TLENREMOVEAVATARTHREADDATA*)ptr;
NETLIBHTTPREQUEST *req = (NETLIBHTTPREQUEST *)data->req;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->hNetlibUser, (LPARAM)req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)req);
mir_free(req->szUrl);
mir_free(req->headers);
mir_free(req->pData);
@@ -333,7 +333,7 @@ static void TlenUploadAvatarRequestThread(void *ptr) { NETLIBHTTPREQUEST *resp;
TLENUPLOADAVATARTHREADDATA * data = (TLENUPLOADAVATARTHREADDATA *) ptr;
NETLIBHTTPREQUEST *req = data->req;
- resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->hNetlibUser, (LPARAM)req);
+ resp = (NETLIBHTTPREQUEST *)CallService(MS_NETLIB_HTTPTRANSACTION, (WPARAM)data->proto->m_hNetlibUser, (LPARAM)req);
if (resp != NULL) {
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)resp);
SetAvatar(data->proto, NULL, NULL, data->data, data->length, PA_FORMAT_PNG);
diff --git a/protocols/Tlen/src/tlen_file.cpp b/protocols/Tlen/src/tlen_file.cpp index d2f44dddf1..9aa2095994 100644 --- a/protocols/Tlen/src/tlen_file.cpp +++ b/protocols/Tlen/src/tlen_file.cpp @@ -62,7 +62,7 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) TlenP2PPacketSend(ft->s, packet);
TlenP2PPacketFree(packet);
ft->state = FT_INITIALIZING;
- TlenLog(ft->proto, "Change to FT_INITIALIZING");
+ ft->proto->debugLogA("Change to FT_INITIALIZING");
}
}
TlenP2PPacketFree(rpacket);
@@ -89,10 +89,10 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) ft->fileId = _open(fullFileName, _O_BINARY|_O_WRONLY|_O_CREAT|_O_TRUNC, _S_IREAD|_S_IWRITE);
ft->fileReceivedBytes = 0;
ft->fileTotalSize = ft->filesSize[ft->currentFile];
- TlenLog(ft->proto, "Saving to [%s] [%d]", fullFileName, ft->filesSize[ft->currentFile]);
+ ft->proto->debugLogA("Saving to [%s] [%d]", fullFileName, ft->filesSize[ft->currentFile]);
mir_free(fullFileName);
ft->state = FT_RECEIVING;
- TlenLog(ft->proto, "Change to FT_RECEIVING");
+ ft->proto->debugLogA("Change to FT_RECEIVING");
}
else {
ft->state = FT_ERROR;
@@ -111,7 +111,7 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) pfts.szCurrentFile = ft->files[ft->currentFile];
pfts.currentFileSize = ft->filesSize[ft->currentFile];
pfts.currentFileTime = 0;
- TlenLog(ft->proto, "Receiving data...");
+ ft->proto->debugLogA("Receiving data...");
while (ft->state == FT_RECEIVING) {
rpacket = TlenP2PPacketReceive(ft->s);
if (rpacket != NULL) {
@@ -132,14 +132,14 @@ static void TlenFileReceiveParse(TLEN_FILE_TRANSFER *ft) }
else if (rpacket->type == TLEN_FILE_PACKET_END_OF_FILE) { // end of file
_close(ft->fileId);
- TlenLog(ft->proto, "Finishing this file...");
+ ft->proto->debugLogA("Finishing this file...");
if (ft->currentFile >= ft->fileCount-1) {
ft->state = FT_DONE;
}
else {
ft->currentFile++;
ft->state = FT_INITIALIZING;
- TlenLog(ft->proto, "File received, advancing to the next file...");
+ ft->proto->debugLogA("File received, advancing to the next file...");
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
}
}
@@ -162,8 +162,8 @@ static void TlenFileReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, vo if (ft != NULL) {
slisten = ft->s;
ft->s = hConnection;
- TlenLog(ft->proto, "Set ft->s to %d (saving %d)", hConnection, slisten);
- TlenLog(ft->proto, "Entering send loop for this file connection... (ft->s is hConnection)");
+ ft->proto->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
+ ft->proto->debugLogA("Entering send loop for this file connection... (ft->s is hConnection)");
while (ft->state != FT_DONE && ft->state != FT_ERROR) {
TlenFileReceiveParse(ft);
}
@@ -171,9 +171,9 @@ static void TlenFileReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, vo ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
else
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- TlenLog(ft->proto, "Closing connection for this file transfer... (ft->s is now hBind)");
+ ft->proto->debugLogA("Closing connection for this file transfer... (ft->s is now hBind)");
ft->s = slisten;
- TlenLog(ft->proto, "ft->s is restored to %d", ft->s);
+ ft->proto->debugLogA("ft->s is restored to %d", ft->s);
if (ft->s != hConnection) {
Netlib_CloseHandle(hConnection);
}
@@ -187,17 +187,17 @@ static void TlenFileReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, vo static void __cdecl TlenFileReceiveThread(TLEN_FILE_TRANSFER *ft)
{
- TlenLog(ft->proto, "Thread started: type=file_receive server='%s' port='%d'", ft->hostName, ft->wPort);
+ ft->proto->debugLogA("Thread started: type=file_receive server='%s' port='%d'", ft->hostName, ft->wPort);
ft->mode = FT_RECV;
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
- HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
+ HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->m_hNetlibUser, (LPARAM) &nloc);
if (s != NULL) {
ft->s = s;
- TlenLog(ft->proto, "Entering file receive loop");
+ ft->proto->debugLogA("Entering file receive loop");
TlenP2PEstablishOutgoingConnection(ft, TRUE);
while (ft->state != FT_DONE && ft->state != FT_ERROR) {
TlenFileReceiveParse(ft);
@@ -208,7 +208,7 @@ static void __cdecl TlenFileReceiveThread(TLEN_FILE_TRANSFER *ft) ft->s = NULL;
} else {
ft->pfnNewConnectionV2 = TlenFileReceivingConnection;
- TlenLog(ft->proto, "Connection failed - receiving as server");
+ ft->proto->debugLogA("Connection failed - receiving as server");
s = TlenP2PListen(ft);
if (s != NULL) {
HANDLE hEvent;
@@ -221,11 +221,11 @@ static void __cdecl TlenFileReceiveThread(TLEN_FILE_TRANSFER *ft) nick = TlenNickFromJID(ft->jid);
TlenSend(ft->proto, "<f t='%s' i='%s' e='7' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
mir_free(nick);
- TlenLog(ft->proto, "Waiting for the file to be received...");
+ ft->proto->debugLogA("Waiting for the file to be received...");
WaitForSingleObject(hEvent, INFINITE);
ft->hFileEvent = NULL;
CloseHandle(hEvent);
- TlenLog(ft->proto, "Finish all files");
+ ft->proto->debugLogA("Finish all files");
Netlib_CloseHandle(s);
} else {
ft->state = FT_ERROR;
@@ -242,7 +242,7 @@ static void __cdecl TlenFileReceiveThread(TLEN_FILE_TRANSFER *ft) ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
}
- TlenLog(ft->proto, "Thread ended: type=file_receive server='%s'", ft->hostName);
+ ft->proto->debugLogA("Thread ended: type=file_receive server='%s'", ft->hostName);
TlenP2PFreeFileTransfer(ft);
}
@@ -284,7 +284,7 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) ft->allFileReceivedBytes = 0;
ft->state = FT_INITIALIZING;
- TlenLog(ft->proto, "Change to FT_INITIALIZING");
+ ft->proto->debugLogA("Change to FT_INITIALIZING");
}
else {
ft->state = FT_ERROR;
@@ -292,12 +292,12 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) }
else if (ft->state == FT_INITIALIZING) { // FT_INITIALIZING
rpacket = TlenP2PPacketReceive(ft->s);
- TlenLog(ft->proto, "FT_INITIALIZING: recv %d", rpacket);
+ ft->proto->debugLogA("FT_INITIALIZING: recv %d", rpacket);
if (rpacket == NULL) {
ft->state = FT_ERROR;
return;
}
- TlenLog(ft->proto, "FT_INITIALIZING: recv type %d", rpacket->type);
+ ft->proto->debugLogA("FT_INITIALIZING: recv type %d", rpacket->type);
p = rpacket->packet;
// TYPE: TLEN_FILE_PACKET_FILE_LIST_ACK will be ignored
// LEN: 0
@@ -316,14 +316,14 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) currentFile = *((DWORD*)p);
if (currentFile != ft->currentFile) {
- TlenLog(ft->proto, "Requested file (#%d) is invalid (must be %d)", currentFile, ft->currentFile);
+ ft->proto->debugLogA("Requested file (#%d) is invalid (must be %d)", currentFile, ft->currentFile);
ft->state = FT_ERROR;
}
else {
// _stat(ft->files[currentFile], &statbuf); // file size in statbuf.st_size
- TlenLog(ft->proto, "Sending [%s] [%d]", ft->files[currentFile], ft->filesSize[currentFile]);
+ ft->proto->debugLogA("Sending [%s] [%d]", ft->files[currentFile], ft->filesSize[currentFile]);
if ((ft->fileId=_open(ft->files[currentFile], _O_BINARY|_O_RDONLY)) < 0) {
- TlenLog(ft->proto, "File cannot be opened");
+ ft->proto->debugLogA("File cannot be opened");
ft->state = FT_ERROR;
}
else {
@@ -346,7 +346,7 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) else {
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_FILE_DATA);
fileBuffer = (char *) mir_alloc(2048);
- TlenLog(ft->proto, "Sending file data...");
+ ft->proto->debugLogA("Sending file data...");
while ((numRead=_read(ft->fileId, fileBuffer, 2048)) > 0) {
TlenP2PPacketSetLen(packet, 0); // Reuse packet
TlenP2PPacketPackDword(packet, (DWORD) ft->fileReceivedBytes);
@@ -372,11 +372,11 @@ static void TlenFileSendParse(TLEN_FILE_TRANSFER *ft) else {
ft->currentFile++;
ft->state = FT_INITIALIZING;
- TlenLog(ft->proto, "File sent, advancing to the next file...");
+ ft->proto->debugLogA("File sent, advancing to the next file...");
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_NEXTFILE, ft, 0);
}
}
- TlenLog(ft->proto, "Finishing this file...");
+ ft->proto->debugLogA("Finishing this file...");
TlenP2PPacketSetLen(packet, 0); // Reuse packet
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_END_OF_FILE);
TlenP2PPacketPackDword(packet, currentFile);
@@ -403,9 +403,9 @@ static void TlenFileSendingConnection(HANDLE hConnection, DWORD dwRemoteIP, void if (ft != NULL) {
slisten = ft->s;
ft->s = hConnection;
- TlenLog(ft->proto, "Set ft->s to %d (saving %d)", hConnection, slisten);
+ ft->proto->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
- TlenLog(ft->proto, "Entering send loop for this file connection... (ft->s is hConnection)");
+ ft->proto->debugLogA("Entering send loop for this file connection... (ft->s is hConnection)");
while (ft->state != FT_DONE && ft->state != FT_ERROR) {
TlenFileSendParse(ft);
}
@@ -413,9 +413,9 @@ static void TlenFileSendingConnection(HANDLE hConnection, DWORD dwRemoteIP, void ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
else
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- TlenLog(ft->proto, "Closing connection for this file transfer... (ft->s is now hBind)");
+ ft->proto->debugLogA("Closing connection for this file transfer... (ft->s is now hBind)");
ft->s = slisten;
- TlenLog(ft->proto, "ft->s is restored to %d", ft->s);
+ ft->proto->debugLogA("ft->s is restored to %d", ft->s);
if (ft->s != hConnection) {
Netlib_CloseHandle(hConnection);
}
@@ -439,7 +439,7 @@ int TlenFileCancelAll(TlenProtocol *proto) if (ft != NULL) {
if (ft->s) {
//ProtoBroadcastAck(m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- TlenLog(ft->proto, "Closing ft->s = %d", ft->s);
+ ft->proto->debugLogA("Closing ft->s = %d", ft->s);
ft->state = FT_ERROR;
Netlib_CloseHandle(ft->s);
ft->s = NULL;
@@ -449,7 +449,7 @@ int TlenFileCancelAll(TlenProtocol *proto) SetEvent(hEvent);
}
} else {
- TlenLog(ft->proto, "freeing ft struct");
+ ft->proto->debugLogA("freeing ft struct");
TlenP2PFreeFileTransfer(ft);
}
}
@@ -464,7 +464,7 @@ static void __cdecl TlenFileSendingThread(TLEN_FILE_TRANSFER *ft) HANDLE hEvent;
char *nick;
- TlenLog(ft->proto, "Thread started: type=tlen_file_send");
+ ft->proto->debugLogA("Thread started: type=tlen_file_send");
ft->mode = FT_SEND;
ft->pfnNewConnectionV2 = TlenFileSendingConnection;
s = TlenP2PListen(ft);
@@ -482,28 +482,28 @@ static void __cdecl TlenFileSendingThread(TLEN_FILE_TRANSFER *ft) nick = TlenNickFromJID(ft->jid);
TlenSend(ft->proto, "<f t='%s' i='%s' e='6' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
mir_free(nick);
- TlenLog(ft->proto, "Waiting for the file to be sent...");
+ ft->proto->debugLogA("Waiting for the file to be sent...");
WaitForSingleObject(hEvent, INFINITE);
ft->hFileEvent = NULL;
CloseHandle(hEvent);
- TlenLog(ft->proto, "Finish all files");
+ ft->proto->debugLogA("Finish all files");
Netlib_CloseHandle(s);
ft->s = NULL;
- TlenLog(ft->proto, "ft->s is NULL");
+ ft->proto->debugLogA("ft->s is NULL");
if (ft->state == FT_SWITCH) {
- TlenLog(ft->proto, "Sending as client...");
+ ft->proto->debugLogA("Sending as client...");
ft->state = FT_CONNECTING;
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
- HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
+ HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->m_hNetlibUser, (LPARAM) &nloc);
if (s != NULL) {
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = s;
TlenP2PEstablishOutgoingConnection(ft, TRUE);
- TlenLog(ft->proto, "Entering send loop for this file connection...");
+ ft->proto->debugLogA("Entering send loop for this file connection...");
while (ft->state != FT_DONE && ft->state != FT_ERROR) {
TlenFileSendParse(ft);
}
@@ -511,20 +511,20 @@ static void __cdecl TlenFileSendingThread(TLEN_FILE_TRANSFER *ft) ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
else
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- TlenLog(ft->proto, "Closing connection for this file transfer... ");
+ ft->proto->debugLogA("Closing connection for this file transfer... ");
Netlib_CloseHandle(s);
} else {
ft->state = FT_ERROR;
}
}
} else {
- TlenLog(ft->proto, "Cannot allocate port to bind for file server thread, thread ended.");
+ ft->proto->debugLogA("Cannot allocate port to bind for file server thread, thread ended.");
ft->state = FT_ERROR;
}
TlenListRemove(ft->proto, LIST_FILE, ft->iqId);
switch (ft->state) {
case FT_DONE:
- TlenLog(ft->proto, "Finish successfully");
+ ft->proto->debugLogA("Finish successfully");
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
break;
case FT_DENIED:
@@ -534,11 +534,11 @@ static void __cdecl TlenFileSendingThread(TLEN_FILE_TRANSFER *ft) nick = TlenNickFromJID(ft->jid);
TlenSend(ft->proto, "<f t='%s' i='%s' e='8'/>", nick, ft->iqId);
mir_free(nick);
- TlenLog(ft->proto, "Finish with errors");
+ ft->proto->debugLogA("Finish with errors");
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
break;
}
- TlenLog(ft->proto, "Thread ended: type=file_send");
+ ft->proto->debugLogA("Thread ended: type=file_send");
TlenP2PFreeFileTransfer(ft);
}
@@ -610,7 +610,7 @@ void TlenProcessF(XmlNode *node, ThreadData *info) pre.tszDescription = filenameT;
pre.ptszFiles = &filenameT;
pre.lParam = (LPARAM)ft;
- TlenLog(ft->proto, "sending chainrecv");
+ ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
mir_free(filenameT);
} else {
diff --git a/protocols/Tlen/src/tlen_iqid.cpp b/protocols/Tlen/src/tlen_iqid.cpp index a7638ad549..368eb49481 100644 --- a/protocols/Tlen/src/tlen_iqid.cpp +++ b/protocols/Tlen/src/tlen_iqid.cpp @@ -195,7 +195,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) if (!db_get(hContact, proto->m_szModuleName, "AvatarHash", &dbv)) {
if (item->avatarHash) mir_free(item->avatarHash);
item->avatarHash = mir_strdup(dbv.pszVal);
- TlenLog(proto, "Setting hash [%s] = %s", nick, item->avatarHash);
+ proto->debugLogA("Setting hash [%s] = %s", nick, item->avatarHash);
db_free(&dbv);
}
item->avatarFormat = db_get_dw(hContact, proto->m_szModuleName, "AvatarFormat", PA_FORMAT_UNKNOWN);
@@ -211,7 +211,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) ptrA jid( db_get_sa(hContact, proto->m_szModuleName, "jid"));
if (jid != NULL) {
if (!TlenListExist(proto, LIST_ROSTER, jid)) {
- TlenLog(proto, "Syncing roster: deleting 0x%x", hContact);
+ proto->debugLogA("Syncing roster: deleting 0x%x", hContact);
CallService(MS_DB_CONTACT_DELETE, (WPARAM)hContact, 0);
}
}
@@ -226,7 +226,7 @@ void TlenIqResultRoster(TlenProtocol *proto, XmlNode *iqNode) Menu_ModifyItem(proto->hMenuChats, &mi);
proto->isOnline = TRUE;
- TlenLog(proto, "Status changed via THREADSTART");
+ proto->debugLogA("Status changed via THREADSTART");
oldStatus = proto->m_iStatus;
TlenSendPresence(proto, proto->m_iDesiredStatus);
ProtoBroadcastAck(proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, proto->m_iStatus);
diff --git a/protocols/Tlen/src/tlen_misc.cpp b/protocols/Tlen/src/tlen_misc.cpp index 7876d2348e..ad62fbf4c3 100644 --- a/protocols/Tlen/src/tlen_misc.cpp +++ b/protocols/Tlen/src/tlen_misc.cpp @@ -57,7 +57,7 @@ void TlenDBAddAuthRequest(TlenProtocol *proto, char *jid, char *nick) db_unset(hContact, proto->m_szModuleName, "Hidden");
}
db_set_s(hContact, proto->m_szModuleName, "Nick", nick);
- TlenLog(proto, "auth request: %s, %s", jid, nick);
+ proto->debugLogA("auth request: %s, %s", jid, nick);
//blob is: uin(DWORD), hContact(HANDLE), nick(ASCIIZ), first(ASCIIZ), last(ASCIIZ), email(ASCIIZ), reason(ASCIIZ)
//blob is: 0(DWORD), hContact(HANDLE), nick(ASCIIZ), ""(ASCIIZ), ""(ASCIIZ), email(ASCIIZ), ""(ASCIIZ)
cbBlob = sizeof(DWORD) + sizeof(HANDLE) + (int)strlen(nick) + (int)strlen(jid) + 5;
diff --git a/protocols/Tlen/src/tlen_p2p_new.cpp b/protocols/Tlen/src/tlen_p2p_new.cpp index 80021fb004..128bde099d 100644 --- a/protocols/Tlen/src/tlen_p2p_new.cpp +++ b/protocols/Tlen/src/tlen_p2p_new.cpp @@ -48,7 +48,7 @@ static void logInfo(const char *filename, const char *fmt, ...) { void __cdecl TlenNewFileReceiveThread(TLEN_FILE_TRANSFER *ft)
{
- TlenLog(ft->proto, "P2P receive thread started");
+ ft->proto->debugLogA("P2P receive thread started");
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
// ft->mode = FT_RECV;
// ft->currentFile = 0;
@@ -109,13 +109,13 @@ void __cdecl TlenNewFileReceiveThread(TLEN_FILE_TRANSFER *ft) else {
ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
}
- TlenLog(ft->proto, "P2P receive thread ended");
+ ft->proto->debugLogA("P2P receive thread ended");
TlenP2PFreeFileTransfer(ft);
}
void __cdecl TlenNewFileSendThread(TLEN_FILE_TRANSFER *ft)
{
- TlenLog(ft->proto, "P2P send thread started");
+ ft->proto->debugLogA("P2P send thread started");
// ft->mode = FT_RECV;
// ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
// ft->currentFile = 0;
@@ -165,12 +165,12 @@ void __cdecl TlenNewFileSendThread(TLEN_FILE_TRANSFER *ft) SleepEx(1000, TRUE);
}
}
- TlenLog(ft->proto, "P2P send thread ended");
+ ft->proto->debugLogA("P2P send thread ended");
}
void TlenBindUDPSocket(TLEN_FILE_TRANSFER *ft)
{
- TlenLog(ft->proto, "Binding UDP socket");
+ ft->proto->debugLogA("Binding UDP socket");
ft->udps = socket(PF_INET, SOCK_DGRAM, 0);
if (ft->udps != INVALID_SOCKET) {
SOCKADDR_IN sin;
@@ -192,7 +192,7 @@ void TlenBindUDPSocket(TLEN_FILE_TRANSFER *ft) ft->wLocalPort = ntohs(sin.sin_port);
ft->localName= mir_strdup(host_name);
- TlenLog(ft->proto, "UDP socket bound to %s:%d", ft->localName, ft->wLocalPort);
+ ft->proto->debugLogA("UDP socket bound to %s:%d", ft->localName, ft->wLocalPort);
}
}
}
@@ -269,7 +269,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { pre.tszDescription = filenameT;
pre.ptszFiles = &filenameT;
pre.lParam = (LPARAM)ft;
- TlenLog(ft->proto, "sending chainrecv");
+ ft->proto->debugLogA("sending chainrecv");
ProtoChainRecvFile(ft->hContact, &pre);
mir_free(filenameT);
}
@@ -290,7 +290,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { } else if (dcng != NULL) {
char *s, *id, *id2;
- TlenLog(info->proto, "DCNG");
+ info->proto->debugLogA("DCNG");
s = TlenXmlGetAttrValue(dcng, "s");
id2 = TlenXmlGetAttrValue(dcng, "i");
id = TlenXmlGetAttrValue(dcng, "mi");
@@ -321,9 +321,9 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { }
}
} else if (!strcmp(s, "2")) {
- TlenLog(info->proto, "step = 2");
- TlenLog(info->proto, "%s",from);
- TlenLog(info->proto, "%s",id2);
+ info->proto->debugLogA("step = 2");
+ info->proto->debugLogA("%s",from);
+ info->proto->debugLogA("%s",id2);
/* IP and port */
if ((item=TlenListFindItemPtrById2(info->proto, LIST_FILE, id2)) != NULL) {
item->ft->hostName = mir_strdup(TlenXmlGetAttrValue(dcng, "pa"));
@@ -337,7 +337,7 @@ void __cdecl TlenProcessP2P(XmlNode *node, ThreadData *info) { } else if (!strcmp(s, "4")) {
/* IP and port */
if ((item=TlenListFindItemPtrById2(info->proto, LIST_FILE, id2)) != NULL) {
- TlenLog(info->proto, "step = 4");
+ info->proto->debugLogA("step = 4");
item->ft->hostName = mir_strdup(TlenXmlGetAttrValue(dcng, "pa"));
item->ft->wPort = atoi(TlenXmlGetAttrValue(dcng, "pp"));
forkthread((void (__cdecl *)(void*))TlenNewFileReceiveThread, 0, item->ft);
diff --git a/protocols/Tlen/src/tlen_p2p_old.cpp b/protocols/Tlen/src/tlen_p2p_old.cpp index 0d6754599b..88e561803b 100644 --- a/protocols/Tlen/src/tlen_p2p_old.cpp +++ b/protocols/Tlen/src/tlen_p2p_old.cpp @@ -158,7 +158,7 @@ void TlenP2PEstablishOutgoingConnection(TLEN_FILE_TRANSFER *ft, BOOL sendAck) TLEN_FILE_PACKET *packet;
TlenProtocol *proto = ft->proto;
- TlenLog(proto, "Establishing outgoing connection.");
+ proto->debugLogA("Establishing outgoing connection.");
ft->state = FT_ERROR;
if ((packet = TlenP2PPacketCreate(2*sizeof(DWORD) + 20)) != NULL) {
TlenP2PPacketSetType(packet, TLEN_FILE_PACKET_CONNECTION_REQUEST);
@@ -263,7 +263,7 @@ static void __cdecl TlenFileBindSocks4Thread(TLEN_FILE_TRANSFER* ft) ft->state = FT_ERROR;
}
}
- TlenLog(ft->proto, "Closing connection for this file transfer...");
+ ft->proto->debugLogA("Closing connection for this file transfer...");
// Netlib_CloseHandle(ft->s);
if (ft->hFileEvent != NULL)
SetEvent(ft->hFileEvent);
@@ -360,7 +360,7 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) nloc.wPort = sb->wPort;
HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hFileNetlibUser, (LPARAM) &nloc);
if (s == NULL) {
- TlenLog(ft->proto, "Connection failed (%d), thread ended", WSAGetLastError());
+ ft->proto->debugLogA("Connection failed (%d), thread ended", WSAGetLastError());
return NULL;
}
buf[0] = 5; //yep, socks5
@@ -368,13 +368,13 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) buf[2] = sb->useAuth?2:0; // authorization
status = Netlib_Send(s, (char*)buf, 3, MSG_NODUMP);
if (status == SOCKET_ERROR || status < 3) {
- TlenLog(ft->proto, "Send failed (%d), thread ended", WSAGetLastError());
+ ft->proto->debugLogA("Send failed (%d), thread ended", WSAGetLastError());
Netlib_CloseHandle(s);
return NULL;
}
status = Netlib_Recv(s, (char*)buf, 2, MSG_NODUMP);
if (status == SOCKET_ERROR || status < 2 || (buf[1] != 0 && buf[1] != 2)) {
- TlenLog(ft->proto, "SOCKS5 negotiation failed");
+ ft->proto->debugLogA("SOCKS5 negotiation failed");
Netlib_CloseHandle(s);
return NULL;
}
@@ -393,13 +393,13 @@ static HANDLE TlenP2PBindSocks5(SOCKSBIND * sb, TLEN_FILE_TRANSFER *ft) status = Netlib_Send(s, (char*)pAuthBuf, 3+nUserLen+nPassLen, MSG_NODUMP);
mir_free(pAuthBuf);
if (status == SOCKET_ERROR || status < 3 + nUserLen+nPassLen) {
- TlenLog(ft->proto, "Send failed (%d), thread ended", WSAGetLastError());
+ ft->proto->debugLogA("Send failed (%d), thread ended", WSAGetLastError());
Netlib_CloseHandle(s);
return NULL;
}
status = Netlib_Recv(s, (char*)buf, sizeof(buf), MSG_NODUMP);
if (status == SOCKET_ERROR || status < 2 || buf[1] != 0) {
- TlenLog(ft->proto, "SOCKS5 sub-negotiation failed");
+ ft->proto->debugLogA("SOCKS5 sub-negotiation failed");
Netlib_CloseHandle(s);
return NULL;
}
@@ -503,9 +503,9 @@ HANDLE TlenP2PListen(TLEN_FILE_TRANSFER *ft) nlb.pfnNewConnectionV2 = ft->pfnNewConnectionV2;
nlb.wPort = 0; // Use user-specified incoming port ranges, if available
nlb.pExtra = proto;
- TlenLog(ft->proto, "Calling MS_NETLIB_BINDPORT");
- s = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nlb);
- TlenLog(ft->proto, "listening on %d",s);
+ ft->proto->debugLogA("Calling MS_NETLIB_BINDPORT");
+ s = (HANDLE) CallService(MS_NETLIB_BINDPORT, (WPARAM) ft->proto->m_hNetlibUser, (LPARAM) &nlb);
+ ft->proto->debugLogA("listening on %d",s);
}
if (useProxy == 0) {
in.S_un.S_addr = htonl(nlb.dwExternalIP);
diff --git a/protocols/Tlen/src/tlen_picture.cpp b/protocols/Tlen/src/tlen_picture.cpp index ee241ead74..3f0156f3f8 100644 --- a/protocols/Tlen/src/tlen_picture.cpp +++ b/protocols/Tlen/src/tlen_picture.cpp @@ -60,7 +60,7 @@ static void TlenPsPostThread(void *ptr) { char fileBuffer[2048];
mir_snprintf(header, sizeof(header), "<pic st='%s' idt='%s'/>", item->ft->iqId, item->jid);
TlenWsSend(proto, socket, header, (int)strlen(header));
- TlenLog(proto, "Sending picture data...");
+ proto->debugLogA("Sending picture data...");
for (i = item->ft->filesSize[0]; i > 0; ) {
int toread = min(2048, i);
int readcount = (int)fread(fileBuffer, (size_t)1, (size_t)toread, fp);
@@ -116,7 +116,7 @@ static void TlenPsGetThread(void *ptr) { TlenXmlInitState(&xmlState);
mir_snprintf(header, sizeof(header), "<pic auth='%s' t='g' to='%s' pid='1001' idt='%s' rt='%s'/>", proto->threadData->username, item->ft->jid, item->jid, item->ft->id2);
TlenWsSend(proto, socket, header, (int)strlen(header));
- TlenLog(proto, "Reveiving picture data...");
+ proto->debugLogA("Reveiving picture data...");
{
int totalcount = 0;
int size = item->ft->filesSize[0];
@@ -153,7 +153,7 @@ static void TlenPsGetThread(void *ptr) { }
}
Netlib_CloseHandle(socket);
- TlenLog(proto, "Picture received...");
+ proto->debugLogA("Picture received...");
LogPictureMessage(proto, item->ft->jid, item->ft->files[0], FALSE);
} else {
/* cannot connect to ps server */
diff --git a/protocols/Tlen/src/tlen_presence.cpp b/protocols/Tlen/src/tlen_presence.cpp index 52a8ca12c7..4d20d08f6a 100644 --- a/protocols/Tlen/src/tlen_presence.cpp +++ b/protocols/Tlen/src/tlen_presence.cpp @@ -49,7 +49,7 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) if ((hContact=TlenHContactFromJID(proto, from)) == NULL) hContact = TlenDBCreateContact(proto, from, nick, FALSE); if (!TlenListExist(proto, LIST_ROSTER, from)) { - TlenLog(proto, "Receive presence online from %s (who is not in my roster)", from); + proto->debugLogA("Receive presence online from %s (who is not in my roster)", from); TlenListAdd(proto, LIST_ROSTER, from); } status = ID_STATUS_ONLINE; @@ -100,13 +100,13 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) } } } - TlenLog(proto, "%s (%s) online, set contact status to %d", nick, from, status); + proto->debugLogA("%s (%s) online, set contact status to %d", nick, from, status); mir_free(nick); } } else if (!strcmp(type, "unavailable")) { if (!TlenListExist(proto, LIST_ROSTER, from)) { - TlenLog(proto, "Receive presence offline from %s (who is not in my roster)", from); + proto->debugLogA("Receive presence offline from %s (who is not in my roster)", from); TlenListAdd(proto, LIST_ROSTER, from); } else { @@ -144,7 +144,7 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) item->isTyping = FALSE; CallService(MS_PROTO_CONTACTISTYPING, (WPARAM) hContact, PROTOTYPE_CONTACTTYPING_OFF); } - TlenLog(proto, "%s offline, set contact status to %d", from, status); + proto->debugLogA("%s offline, set contact status to %d", from, status); } } else if (!strcmp(type, "subscribe")) { @@ -153,7 +153,7 @@ void TlenProcessPresence(XmlNode *node, TlenProtocol *proto) TlenSend(proto, "<presence to='%s' type='subscribed'/>", from); } else if ((nick=TlenNickFromJID(from)) != NULL) { - TlenLog(proto, "%s (%s) requests authorization", nick, from); + proto->debugLogA("%s (%s) requests authorization", nick, from); TlenDBAddAuthRequest(proto, from, nick); mir_free(nick); } diff --git a/protocols/Tlen/src/tlen_svc.cpp b/protocols/Tlen/src/tlen_svc.cpp index acfa66bc9b..7ee18ce37c 100644 --- a/protocols/Tlen/src/tlen_svc.cpp +++ b/protocols/Tlen/src/tlen_svc.cpp @@ -298,7 +298,7 @@ int TlenProtocol::Authorize(HANDLE hDbEvent) TLEN_LIST_ITEM *item;
if ((item=TlenListGetItemPtr(this, LIST_ROSTER, jid)) == NULL || (item->subscription != SUB_BOTH && item->subscription != SUB_TO)) {
- TlenLog(this, "Try adding contact automatically jid=%s", jid);
+ debugLogA("Try adding contact automatically jid=%s", jid);
if ((hContact=AddToListByJID(this, jid, 0)) != NULL) {
// Trigger actual add by removing the "NotOnList" added by AddToListByJID()
// See AddToListByJID() and TlenDbSettingChanged().
@@ -421,7 +421,7 @@ int TlenProtocol::SetAwayMsg(int iStatus, const PROTOCHAR* msg) char **szMsg;
char *newModeMsg;
- TlenLog(this, "SetAwayMsg called, wParam=%d lParam=%s", iStatus, msg);
+ debugLogA("SetAwayMsg called, wParam=%d lParam=%s", iStatus, msg);
newModeMsg = TlenTextEncode(mir_t2a(msg)); //TODO TCHAR
@@ -763,7 +763,7 @@ int TlenProtocol::FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** sz int TlenProtocol::FileCancel(HANDLE hContact, HANDLE hTransfer)
{
TLEN_FILE_TRANSFER *ft = (TLEN_FILE_TRANSFER *) hTransfer;
- TlenLog(this, "Invoking FileCancel()");
+ debugLogA("Invoking FileCancel()");
if (ft->s != NULL) {
ft->state = FT_ERROR;
Netlib_CloseHandle(ft->s);
@@ -800,7 +800,7 @@ HANDLE TlenProtocol::SendFile(HANDLE hContact, const PROTOCHAR* szDescription, P for (i=j=0; i<ft->fileCount; i++) {
char* ppszFiles_i_A = mir_t2a(ppszFiles[i]);
if (_stat(ppszFiles_i_A, &statbuf))
- TlenLog(this, "'%s' is an invalid filename", ppszFiles[i]);
+ debugLogA("'%s' is an invalid filename", ppszFiles[i]);
else {
ft->filesSize[j] = statbuf.st_size;
ft->files[j++] = mir_strdup(ppszFiles_i_A);
@@ -915,13 +915,13 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) if (nick != NULL) {
// Note: we need to compare with item->group to prevent infinite loop
if (cws->value.type == DBVT_DELETED && item->group != NULL) {
- TlenLog(this, "Group set to nothing");
+ debugLogA("Group set to nothing");
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'></item></query></iq>", nick, item->jid);
}
else if (cws->value.pszVal != NULL) {
char *newGroup = settingToChar(cws);
if (item->group == NULL || strcmp(newGroup, item->group)) {
- TlenLog(this, "Group set to %s", newGroup);
+ debugLogA("Group set to %s", newGroup);
if ((group=TlenGroupEncode(newGroup)) != NULL) {
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, item->jid, group);
mir_free(group);
@@ -958,7 +958,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) // Note: we need to compare with item->nick to prevent infinite loop
if (newNick != NULL && (item->nick == NULL || (item->nick != NULL && strcmp(item->nick, newNick)))) {
if ((nick=TlenTextEncode(newNick)) != NULL) {
- TlenLog(this, "Nick set to %s", newNick);
+ debugLogA("Nick set to %s", newNick);
if (item->group != NULL && (group=TlenGroupEncode(item->group)) != NULL) {
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, group);
mir_free(group);
@@ -981,7 +981,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) if (!db_get(hContact, m_szModuleName, "jid", &dbv)) {
jid = mir_strdup(dbv.pszVal);
db_free(&dbv);
- TlenLog(this, "Add %s permanently to list", jid);
+ debugLogA("Add %s permanently to list", jid);
if (!db_get(hContact, "CList", "MyHandle", &dbv)) {
nick = TlenTextEncode(dbv.pszVal); //Utf8Encode
db_free(&dbv);
@@ -990,7 +990,7 @@ int TlenProtocol::TlenDbSettingChanged(WPARAM wParam, LPARAM lParam) nick = TlenNickFromJID(jid);
}
if (nick != NULL) {
- TlenLog(this, "jid=%s nick=%s", jid, nick);
+ debugLogA("jid=%s nick=%s", jid, nick);
if (!db_get(hContact, "CList", "Group", &dbv)) {
if ((pGroup=TlenGroupEncode(dbv.pszVal)) != NULL) {
TlenSend(this, "<iq type='set'><query xmlns='jabber:iq:roster'><item name='%s' jid='%s'><group>%s</group></item></query></iq>", nick, jid, pGroup);
diff --git a/protocols/Tlen/src/tlen_thread.cpp b/protocols/Tlen/src/tlen_thread.cpp index a08f3763a8..42a34bfa5f 100644 --- a/protocols/Tlen/src/tlen_thread.cpp +++ b/protocols/Tlen/src/tlen_thread.cpp @@ -113,7 +113,7 @@ void __cdecl TlenServerThread(ThreadData *info) int numRetry;
int reconnectTime;
int loginErr = 0;
- TlenLog(info->proto, "Thread started");
+ info->proto->debugLogA("Thread started");
// Normal server connection, we will fetch all connection parameters
// e.g. username, password, etc. from the database.
@@ -124,7 +124,7 @@ void __cdecl TlenServerThread(ThreadData *info) // in case it is asleep in the reconnect loop so that it will immediately
// reconnect.
QueueUserAPC(TlenDummyApcFunc, info->proto->threadData->hThread, 0);
- TlenLog(info->proto, "Thread ended, another normal thread is running");
+ info->proto->debugLogA("Thread ended, another normal thread is running");
mir_free(info);
return;
}
@@ -139,7 +139,7 @@ void __cdecl TlenServerThread(ThreadData *info) db_free(&dbv);
} else {
- TlenLog(info->proto, "Thread ended, login name is not configured");
+ info->proto->debugLogA("Thread ended, login name is not configured");
loginErr = LOGINERR_BADUSERID;
}
@@ -151,7 +151,7 @@ void __cdecl TlenServerThread(ThreadData *info) db_set_s(NULL, info->proto->m_szModuleName, "LoginServer", info->server);
db_free(&dbv);
} else {
- TlenLog(info->proto, "Thread ended, login server is not configured");
+ info->proto->debugLogA("Thread ended, login server is not configured");
loginErr = LOGINERR_NONETWORK;
}
}
@@ -172,7 +172,7 @@ void __cdecl TlenServerThread(ThreadData *info) strncpy(info->password, onlinePassword, sizeof(info->password));
info->password[sizeof(info->password)-1] = '\0';
} else {
- TlenLog(info->proto, "Thread ended, password request dialog was canceled");
+ info->proto->debugLogA("Thread ended, password request dialog was canceled");
loginErr = LOGINERR_BADUSERID;
}
} else {
@@ -182,7 +182,7 @@ void __cdecl TlenServerThread(ThreadData *info) info->password[sizeof(info->password)-1] = '\0';
db_free(&dbv);
} else {
- TlenLog(info->proto, "Thread ended, password is not configured");
+ info->proto->debugLogA("Thread ended, password is not configured");
loginErr = LOGINERR_BADUSERID;
}
}
@@ -190,7 +190,7 @@ void __cdecl TlenServerThread(ThreadData *info) tlenNetworkBufferSize = 2048;
if ((buffer=(char *) mir_alloc(tlenNetworkBufferSize+1)) == NULL) { // +1 is for '\0' when debug logging this buffer
- TlenLog(info->proto, "Thread ended, network buffer cannot be allocated");
+ info->proto->debugLogA("Thread ended, network buffer cannot be allocated");
loginErr = LOGINERR_NONETWORK;
}
@@ -220,7 +220,7 @@ void __cdecl TlenServerThread(ThreadData *info) else
connectHost = info->server;
- TlenLog(info->proto, "Thread server='%s' port='%d'", connectHost, info->port);
+ info->proto->debugLogA("Thread server='%s' port='%d'", connectHost, info->port);
if (!db_get(NULL, info->proto->m_szModuleName, "AvatarHash", &dbv)) {
@@ -237,7 +237,7 @@ void __cdecl TlenServerThread(ThreadData *info) info->s = TlenWsConnect(info->proto, connectHost, info->port);
if (info->s == NULL) {
- TlenLog(info->proto, "Connection failed (%d)", WSAGetLastError());
+ info->proto->debugLogA("Connection failed (%d)", WSAGetLastError());
if (info->proto->threadData == info) {
oldStatus = info->proto->m_iStatus;
info->proto->m_iStatus = ID_STATUS_OFFLINE;
@@ -245,12 +245,12 @@ void __cdecl TlenServerThread(ThreadData *info) ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->m_iStatus);
if (info->proto->tlenOptions.reconnect == TRUE) {
reconnectTime = rand() % reconnectMaxTime;
- TlenLog(info->proto, "Sleeping %d seconds before automatic reconnecting...", reconnectTime);
+ info->proto->debugLogA("Sleeping %d seconds before automatic reconnecting...", reconnectTime);
SleepEx(reconnectTime * 1000, TRUE);
if (reconnectMaxTime < 10*60) // Maximum is 10 minutes
reconnectMaxTime *= 2;
if (info->proto->threadData == info) { // Make sure this is still the active thread for the main Tlen connection
- TlenLog(info->proto, "Reconnecting to the network...");
+ info->proto->debugLogA("Reconnecting to the network...");
if (numRetry < MAX_CONNECT_RETRIES)
numRetry++;
oldStatus = info->proto->m_iStatus;
@@ -259,7 +259,7 @@ void __cdecl TlenServerThread(ThreadData *info) continue;
}
else {
- TlenLog(info->proto, "Thread ended, connection failed");
+ info->proto->debugLogA("Thread ended, connection failed");
mir_free(buffer);
mir_free(info);
return;
@@ -267,7 +267,7 @@ void __cdecl TlenServerThread(ThreadData *info) }
info->proto->threadData = NULL;
}
- TlenLog(info->proto, "Thread ended, connection failed");
+ info->proto->debugLogA("Thread ended, connection failed");
mir_free(buffer);
mir_free(info);
return;
@@ -293,7 +293,7 @@ void __cdecl TlenServerThread(ThreadData *info) TlenSend(info->proto, "<s v='3'>");
}
- TlenLog(info->proto, "Entering main recv loop");
+ info->proto->debugLogA("Entering main recv loop");
datalen = 0;
for (;;) {
@@ -310,10 +310,10 @@ void __cdecl TlenServerThread(ThreadData *info) datalen += recvResult;
buffer[datalen] = '\0';
- TlenLog(info->proto, "RECV:%s", buffer);
+ info->proto->debugLogA("RECV:%s", buffer);
bytesParsed = TlenXmlParse(&xmlState, buffer, datalen);
- TlenLog(info->proto, "bytesParsed = %d", bytesParsed);
+ info->proto->debugLogA("bytesParsed = %d", bytesParsed);
if (bytesParsed > 0) {
if (bytesParsed < datalen)
memmove(buffer, buffer+bytesParsed, datalen-bytesParsed);
@@ -321,14 +321,14 @@ void __cdecl TlenServerThread(ThreadData *info) }
else if (datalen == tlenNetworkBufferSize) {
tlenNetworkBufferSize += 2048;
- TlenLog(info->proto, "Increasing network buffer size to %d", tlenNetworkBufferSize);
+ info->proto->debugLogA("Increasing network buffer size to %d", tlenNetworkBufferSize);
if ((buffer=(char *) mir_realloc(buffer, tlenNetworkBufferSize+1)) == NULL) {
- TlenLog(info->proto, "Cannot reallocate more network buffer, go offline now");
+ info->proto->debugLogA("Cannot reallocate more network buffer, go offline now");
break;
}
}
else {
- TlenLog(info->proto, "Unknown state: bytesParsed=%d, datalen=%d, tlenNetworkBufferSize=%d", bytesParsed, datalen, tlenNetworkBufferSize);
+ info->proto->debugLogA("Unknown state: bytesParsed=%d, datalen=%d, tlenNetworkBufferSize=%d", bytesParsed, datalen, tlenNetworkBufferSize);
}
}
@@ -370,12 +370,12 @@ void __cdecl TlenServerThread(ThreadData *info) if (info->proto->threadData != info) // Make sure this is still the main Tlen connection thread
break;
reconnectTime = rand() % 10;
- TlenLog(info->proto, "Sleeping %d seconds before automatic reconnecting...", reconnectTime);
+ info->proto->debugLogA("Sleeping %d seconds before automatic reconnecting...", reconnectTime);
SleepEx(reconnectTime * 1000, TRUE);
reconnectMaxTime = 20;
if (info->proto->threadData != info) // Make sure this is still the main Tlen connection thread
break;
- TlenLog(info->proto, "Reconnecting to the network...");
+ info->proto->debugLogA("Reconnecting to the network...");
info->proto->m_iDesiredStatus = oldStatus; // Reconnect to my last status
oldStatus = info->proto->m_iStatus;
info->proto->m_iStatus = ID_STATUS_CONNECTING;
@@ -383,7 +383,7 @@ void __cdecl TlenServerThread(ThreadData *info) ProtoBroadcastAck(info->proto->m_szModuleName, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, info->proto->m_iStatus);
}
- TlenLog(info->proto, "Thread ended: server='%s'", info->server);
+ info->proto->debugLogA("Thread ended: server='%s'", info->server);
if (info->proto->threadData == info) {
info->proto->threadData = NULL;
@@ -391,7 +391,7 @@ void __cdecl TlenServerThread(ThreadData *info) mir_free(buffer);
if (info->streamId) mir_free(info->streamId);
- TlenLog(info->proto, "Exiting ServerThread");
+ info->proto->debugLogA("Exiting ServerThread");
mir_free(info);
}
@@ -500,7 +500,7 @@ static void TlenProcessProtocol(XmlNode *node, ThreadData *info) else if (!strcmp(node->name, "cipher"))
TlenProcessCipher(node, info);
else
- TlenLog(info->proto, "Invalid top-level tag (only <message/> <presence/> <iq/> <f/> <w/> <m/> <n/> <p/> <v/> <cipher/> and <avatar/> allowed)");
+ info->proto->debugLogA("Invalid top-level tag (only <message/> <presence/> <iq/> <f/> <w/> <m/> <n/> <p/> <v/> <cipher/> and <avatar/> allowed)");
}
@@ -747,7 +747,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) // MATCH BY ID
/////////////////////////////////////////////////////////////////////////
if ((pfunc=TlenIqFetchFunc(info->proto, id)) != NULL) {
- TlenLog(info->proto, "Handling iq request for id=%d", id);
+ info->proto->debugLogA("Handling iq request for id=%d", id);
pfunc(info->proto, node);
/////////////////////////////////////////////////////////////////////////
// MORE GENERAL ROUTINES, WHEN ID DOES NOT MATCH
@@ -768,7 +768,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) TLEN_LIST_ITEM *item;
char *name;
- TlenLog(info->proto, "<iq/> Got roster push, query has %d children", queryNode->numChild);
+ info->proto->debugLogA("<iq/> Got roster push, query has %d children", queryNode->numChild);
for (i=0; i<queryNode->numChild; i++) {
itemNode = queryNode->child[i];
if (!strcmp(itemNode->name, "item")) {
@@ -816,7 +816,7 @@ static void TlenProcessIq(XmlNode *node, ThreadData *info) else if (!strcmp(str, "to")) item->subscription = SUB_TO;
else if (!strcmp(str, "from")) item->subscription = SUB_FROM;
else item->subscription = SUB_NONE;
- TlenLog(info->proto, "Roster push for jid=%s, set subscription to %s", jid, str);
+ info->proto->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.
@@ -1333,9 +1333,9 @@ static void TlenProcessV(XmlNode *node, ThreadData *info) // FILE_SEND : e='5' : Voice request was accepted
if ((p=TlenXmlGetAttrValue(node, "i")) != NULL) {
if ((item=TlenListGetItemPtr(info->proto, LIST_VOICE, p)) != NULL) {
- TlenLog(info->proto, "should start voice 1 ? %s ?? %s", jid, item->ft->jid);
+ info->proto->debugLogA("should start voice 1 ? %s ?? %s", jid, item->ft->jid);
if (!strcmp(item->ft->jid, jid)) {
- TlenLog(info->proto, "starting voice 1");
+ info->proto->debugLogA("starting voice 1");
TlenVoiceStart(item->ft, 1);
}
}
@@ -1400,6 +1400,6 @@ static void __cdecl TlenKeepAliveThread(void *ptr) if (proto->tlenOptions.sendKeepAlive)
TlenSend(proto, " \t ");
}
- TlenLog(proto, "Exiting KeepAliveThread");
+ proto->debugLogA("Exiting KeepAliveThread");
}
diff --git a/protocols/Tlen/src/tlen_util.cpp b/protocols/Tlen/src/tlen_util.cpp index 6f13a7dd99..5ac920336e 100644 --- a/protocols/Tlen/src/tlen_util.cpp +++ b/protocols/Tlen/src/tlen_util.cpp @@ -49,55 +49,6 @@ unsigned int TlenSerialNext(TlenProtocol *proto) return ret;
}
-
-void TlenLog(TlenProtocol *proto, const char *fmt, ...)
-{
-#ifdef ENABLE_LOGGING
- char *str;
- va_list vararg;
- int strsize;
- char *text;
- char *p, *q;
- int extra;
-
- va_start(vararg, fmt);
- str = (char *) mir_alloc(strsize=2048);
- while (mir_vsnprintf(str, strsize, fmt, vararg) == -1)
- str = (char *) mir_realloc(str, strsize+=2048);
- va_end(vararg);
-
- extra = 0;
- for (p=str; *p != '\0'; p++)
- if (*p == '\n' || *p == '\r')
- extra++;
- size_t size = strlen("TLEN") + 2 + strlen(str) + 2 + extra;
- text = (char *) mir_alloc(size);
- mir_snprintf(text, size, "[%s]", "TLEN");
- for (p=str,q=text+strlen(text); *p != '\0'; p++,q++) {
- if (*p == '\r') {
- *q = '\\';
- *(q+1) = 'r';
- q++;
- }
- else if (*p == '\n') {
- *q = '\\';
- *(q+1) = 'n';
- q++;
- }
- else
- *q = *p;
- }
- *q = '\n';
- *(q+1) = '\0';
- if (proto->hNetlibUser != NULL) {
- CallService(MS_NETLIB_LOG, (WPARAM) proto->hNetlibUser, (LPARAM) text);
- }
- //OutputDebugString(text);
- mir_free(text);
- mir_free(str);
-#endif
-}
-
// Caution: DO NOT use TlenSend() to send binary (non-string) data
int TlenSend(TlenProtocol *proto, const char *fmt, ...)
@@ -118,7 +69,7 @@ int TlenSend(TlenProtocol *proto, const char *fmt, ...) }
va_end(vararg);
- TlenLog(proto, "SEND:%s", str);
+ proto->debugLogA("SEND:%s", str);
size = (int)strlen(str);
if (proto->threadData != NULL) {
if (proto->threadData->useAES) {
diff --git a/protocols/Tlen/src/tlen_voice.cpp b/protocols/Tlen/src/tlen_voice.cpp index e1d7774295..9739aa53a7 100644 --- a/protocols/Tlen/src/tlen_voice.cpp +++ b/protocols/Tlen/src/tlen_voice.cpp @@ -91,7 +91,7 @@ static DWORD WINAPI TlenVoiceRecordingThreadProc(TLEN_VOICE_CONTROL *control) }
}
control->isRunning = 0;
- TlenLog(control->proto, "recording thread ended...");
+ control->proto->debugLogA("recording thread ended...");
return 0;
}
@@ -148,18 +148,18 @@ static int TlenVoicePlaybackStart(TLEN_VOICE_CONTROL *control) }
}
if (!waveOutGetDevCaps(iSelDev, &wic, sizeof(WAVEOUTCAPS))) {
- TlenLog(control->proto, "Playback device ID #%u: %s\r\n", iSelDev, wic.szPname);
+ control->proto->debugLogA("Playback device ID #%u: %s\r\n", iSelDev, wic.szPname);
}
mmres = waveOutOpen(&control->hWaveOut, iSelDev, &wfm, (DWORD) &TlenVoicePlaybackCallback, (DWORD) control, CALLBACK_FUNCTION);
if (mmres != MMSYSERR_NOERROR) {
- TlenLog(control->proto, "TlenVoiceStart FAILED!");
+ control->proto->debugLogA("TlenVoiceStart FAILED!");
return 1;
}
control->waveData = (short *)mir_alloc(control->waveHeadersNum * control->waveFrameSize * 2);
memset(control->waveData, 0, control->waveHeadersNum * control->waveFrameSize * 2);
control->waveHeaders = (WAVEHDR *)mir_alloc(control->waveHeadersNum * sizeof(WAVEHDR));
- TlenLog(control->proto, "TlenVoiceStart OK!");
+ control->proto->debugLogA("TlenVoiceStart OK!");
return 0;
}
@@ -215,14 +215,14 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) }
}
if (!waveInGetDevCaps(iSelDev, &wic, sizeof(WAVEINCAPS))) {
- TlenLog(control->proto, "Recording device ID #%u: %s\r\n", iSelDev, wic.szPname);
+ control->proto->debugLogA("Recording device ID #%u: %s\r\n", iSelDev, wic.szPname);
}
mmres = waveInOpen(&control->hWaveIn, iSelDev, &wfm, (DWORD) control->threadID, 0, CALLBACK_THREAD);
// mmres = waveInOpen(&control->hWaveIn, 3, &wfm, (DWORD) &TlenVoiceRecordingCallback, (DWORD) control, CALLBACK_FUNCTION);
if (mmres != MMSYSERR_NOERROR) {
PostThreadMessage(control->threadID, WIM_CLOSE, 0, 0);
- TlenLog(control->proto, "TlenVoiceStart FAILED %d!", mmres);
+ control->proto->debugLogA("TlenVoiceStart FAILED %d!", mmres);
return 1;
}
control->waveData = (short *)mir_alloc(control->waveHeadersNum * control->waveFrameSize * 2);
@@ -236,7 +236,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) if (mmres != MMSYSERR_NOERROR) {
waveInClose(control->hWaveIn);
// PostThreadMessage(control->threadID, WIM_CLOSE, 0, 0);
- TlenLog(control->proto, "TlenVoiceStart FAILED #2!");
+ control->proto->debugLogA("TlenVoiceStart FAILED #2!");
return 1;
}
}
@@ -244,7 +244,7 @@ static int TlenVoiceRecordingStart(TLEN_VOICE_CONTROL *control) waveInAddBuffer(control->hWaveIn, &control->waveHeaders[i], sizeof(WAVEHDR));
}
waveInStart(control->hWaveIn);
- TlenLog(control->proto, "TlenVoiceRStart OK!");
+ control->proto->debugLogA("TlenVoiceRStart OK!");
return 0;
}
@@ -262,7 +262,7 @@ static TLEN_VOICE_CONTROL *TlenVoiceCreateVC(TlenProtocol *proto, int codec) static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc)
{
int i;
- TlenLog(vc->proto, "-> TlenVoiceFreeVc");
+ vc->proto->debugLogA("-> TlenVoiceFreeVc");
vc->stopThread = 1;
PostThreadMessage(vc->threadID, MM_WIM_CLOSE, 0, 0);
while (vc->isRunning) {
@@ -292,7 +292,7 @@ static void TlenVoiceFreeVc(TLEN_VOICE_CONTROL *vc) if (vc->waveData) mir_free(vc->waveData);
if (vc->waveHeaders) mir_free(vc->waveHeaders);
if (vc->gsmstate) gsm_release(vc->gsmstate);
- TlenLog(vc->proto, "<- TlenVoiceFreeVc");
+ vc->proto->debugLogA("<- TlenVoiceFreeVc");
mir_free(vc);
}
@@ -312,16 +312,16 @@ static void TlenVoiceCrypt(char *buffer, int len) void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft)
{
- TlenLog(ft->proto, "Thread started: type=file_receive server='%s' port='%d'", ft->hostName, ft->wPort);
+ ft->proto->debugLogA("Thread started: type=file_receive server='%s' port='%d'", ft->hostName, ft->wPort);
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
- HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
+ HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->m_hNetlibUser, (LPARAM) &nloc);
if (s != NULL) {
ft->s = s;
- TlenLog(ft->proto, "Entering file receive loop");
+ ft->proto->debugLogA("Entering file receive loop");
TlenP2PEstablishOutgoingConnection(ft, FALSE);
if (ft->state != FT_ERROR) {
ft->proto->playbackControl = NULL;
@@ -340,7 +340,7 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) }
ft->s = NULL;
} else {
- TlenLog(ft->proto, "Connection failed - receiving as server");
+ ft->proto->debugLogA("Connection failed - receiving as server");
ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
s = TlenP2PListen(ft);
if (s != NULL) {
@@ -355,11 +355,11 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) nick = TlenNickFromJID(ft->jid);
TlenSend(ft->proto, "<v t='%s' i='%s' e='7' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
mir_free(nick);
- TlenLog(ft->proto, "Waiting for the file to be received...");
+ ft->proto->debugLogA("Waiting for the file to be received...");
WaitForSingleObject(hEvent, INFINITE);
ft->hFileEvent = NULL;
CloseHandle(hEvent);
- TlenLog(ft->proto, "Finish all files");
+ ft->proto->debugLogA("Finish all files");
Netlib_CloseHandle(s);
} else {
ft->state = FT_ERROR;
@@ -377,7 +377,7 @@ void __cdecl TlenVoiceReceiveThread(TLEN_FILE_TRANSFER *ft) SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Error..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
}
- TlenLog(ft->proto, "Thread ended: type=file_receive server='%s'", ft->hostName);
+ ft->proto->debugLogA("Thread ended: type=file_receive server='%s'", ft->hostName);
TlenP2PFreeFileTransfer(ft);
}
@@ -392,8 +392,8 @@ static void TlenVoiceReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, v if (ft != NULL) {
slisten = ft->s;
ft->s = hConnection;
- TlenLog(ft->proto, "Set ft->s to %d (saving %d)", hConnection, slisten);
- TlenLog(ft->proto, "Entering send loop for this file connection... (ft->s is hConnection)");
+ ft->proto->debugLogA("Set ft->s to %d (saving %d)", hConnection, slisten);
+ ft->proto->debugLogA("Entering send loop for this file connection... (ft->s is hConnection)");
proto->playbackControl = NULL;
proto->recordingControl = TlenVoiceCreateVC(proto, 3);
proto->recordingControl->ft = ft;
@@ -411,9 +411,9 @@ static void TlenVoiceReceivingConnection(HANDLE hConnection, DWORD dwRemoteIP, v // ProtoBroadcastAck(proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Error..."));
}
- TlenLog(ft->proto, "Closing connection for this file transfer... (ft->s is now hBind)");
+ ft->proto->debugLogA("Closing connection for this file transfer... (ft->s is now hBind)");
ft->s = slisten;
- TlenLog(ft->proto, "ft->s is restored to %d", ft->s);
+ ft->proto->debugLogA("ft->s is restored to %d", ft->s);
}
Netlib_CloseHandle(hConnection);
if (ft != NULL && ft->hFileEvent != NULL)
@@ -533,7 +533,7 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) HANDLE hEvent;
char *nick;
- TlenLog(ft->proto, "Thread started: type=voice_send");
+ ft->proto->debugLogA("Thread started: type=voice_send");
ft->pfnNewConnectionV2 = TlenVoiceReceivingConnection;
s = TlenP2PListen(ft);
if (s != NULL) {
@@ -551,30 +551,30 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) nick = TlenNickFromJID(ft->jid);
TlenSend(ft->proto, "<v t='%s' i='%s' e='6' a='%s' p='%d'/>", nick, ft->iqId, ft->localName, ft->wLocalPort);
mir_free(nick);
- TlenLog(ft->proto, "Waiting for the voice data to be sent...");
+ ft->proto->debugLogA("Waiting for the voice data to be sent...");
WaitForSingleObject(hEvent, INFINITE);
ft->hFileEvent = NULL;
CloseHandle(hEvent);
- TlenLog(ft->proto, "Finish voice");
+ ft->proto->debugLogA("Finish voice");
Netlib_CloseHandle(s);
ft->s = NULL;
- TlenLog(ft->proto, "ft->s is NULL");
+ ft->proto->debugLogA("ft->s is NULL");
if (ft->state == FT_SWITCH) {
- TlenLog(ft->proto, "Sending as client...");
+ ft->proto->debugLogA("Sending as client...");
ft->state = FT_CONNECTING;
NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
nloc.szHost = ft->hostName;
nloc.wPort = ft->wPort;
- HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->hNetlibUser, (LPARAM) &nloc);
+ HANDLE s = (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) ft->proto->m_hNetlibUser, (LPARAM) &nloc);
if (s != NULL) {
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Connecting..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, ft, 0);
ft->s = s;
TlenP2PEstablishOutgoingConnection(ft, FALSE);
if (ft->state != FT_ERROR) {
- TlenLog(ft->proto, "Entering send loop for this file connection...");
+ ft->proto->debugLogA("Entering send loop for this file connection...");
ft->proto->playbackControl = NULL;
ft->proto->recordingControl = TlenVoiceCreateVC(ft->proto, 3);
ft->proto->recordingControl->ft = ft;
@@ -583,20 +583,20 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) TlenVoiceReceiveParse(ft);
}
}
- TlenLog(ft->proto, "Closing connection for this file transfer... ");
+ ft->proto->debugLogA("Closing connection for this file transfer... ");
Netlib_CloseHandle(s);
}
else ft->state = FT_ERROR;
}
}
else {
- TlenLog(ft->proto, "Cannot allocate port to bind for file server thread, thread ended.");
+ ft->proto->debugLogA("Cannot allocate port to bind for file server thread, thread ended.");
ft->state = FT_ERROR;
}
TlenListRemove(ft->proto, LIST_VOICE, ft->iqId);
switch (ft->state) {
case FT_DONE:
- TlenLog(ft->proto, "Finish successfully");
+ ft->proto->debugLogA("Finish successfully");
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Finished..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ft, 0);
break;
@@ -608,12 +608,12 @@ void __cdecl TlenVoiceSendingThread(TLEN_FILE_TRANSFER *ft) nick = TlenNickFromJID(ft->jid);
TlenSend(ft->proto, "<v t='%s' i='%s' e='8'/>", nick, ft->iqId);
mir_free(nick);
- TlenLog(ft->proto, "Finish with errors");
+ ft->proto->debugLogA("Finish with errors");
SetDlgItemText(ft->proto->voiceDlgHWND, IDC_STATUS, TranslateT("...Error..."));
//ProtoBroadcastAck(ft->proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
break;
}
- TlenLog(ft->proto, "Thread ended: type=voice_send");
+ ft->proto->debugLogA("Thread ended: type=voice_send");
TlenP2PFreeFileTransfer(ft);
}
@@ -669,7 +669,7 @@ int TlenVoiceCancelAll(TlenProtocol *proto) if (ft != NULL) {
if (ft->s) {
//ProtoBroadcastAck(proto->m_szModuleName, ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ft, 0);
- TlenLog(proto, "Closing ft->s = %d", ft->s);
+ proto->debugLogA("Closing ft->s = %d", ft->s);
ft->state = FT_ERROR;
Netlib_CloseHandle(ft->s);
ft->s = NULL;
@@ -679,7 +679,7 @@ int TlenVoiceCancelAll(TlenProtocol *proto) SetEvent(hEvent);
}
} else {
- TlenLog(proto, "freeing (V) ft struct");
+ proto->debugLogA("freeing (V) ft struct");
TlenP2PFreeFileTransfer(ft);
}
}
@@ -719,7 +719,7 @@ INT_PTR TlenProtocol::VoiceContactMenuHandleVoice(WPARAM wParam, LPARAM lParam) int TlenVoiceIsInUse(TlenProtocol *proto) {
if (TlenListFindNext(proto, LIST_VOICE, 0) >= 0 || proto->voiceDlgHWND != NULL) {
- TlenLog(proto, "voice in use ? %d", proto->voiceDlgHWND);
+ proto->debugLogA("voice in use ? %d", proto->voiceDlgHWND);
return 1;
}
return 0;
@@ -928,7 +928,7 @@ static void __cdecl TlenVoiceDlgThread(void *ptr) int TlenVoiceStart(TLEN_FILE_TRANSFER *ft, int mode)
{
- TlenLog(ft->proto, "starting voice %d", mode);
+ ft->proto->debugLogA("starting voice %d", mode);
if (mode == 0) {
forkthread((void (__cdecl *)(void*))TlenVoiceReceiveThread, 0, ft);
} else if (mode == 1) {
diff --git a/protocols/Tlen/src/tlen_ws.cpp b/protocols/Tlen/src/tlen_ws.cpp index 7c8449e3e5..7e31aedd37 100644 --- a/protocols/Tlen/src/tlen_ws.cpp +++ b/protocols/Tlen/src/tlen_ws.cpp @@ -35,7 +35,7 @@ BOOL TlenWsInit(TlenProtocol *proto) mir_sntprintf(name, SIZEOF(name), TranslateT("%s connection"), proto->m_tszUserName);
nlu.ptszDescriptiveName = name;
nlu.szSettingsModule = proto->m_szModuleName;
- proto->hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
+ proto->m_hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) &nlu);
nlu.flags = NUF_OUTGOING | NUF_INCOMING | NUF_NOOPTIONS | NUF_TCHAR;
mir_sntprintf(name, SIZEOF(name), TranslateT("%s SOCKS connection"), proto->m_tszUserName);
@@ -45,14 +45,14 @@ BOOL TlenWsInit(TlenProtocol *proto) nlus.useProxy = 0;
CallService(MS_NETLIB_SETUSERSETTINGS, (WPARAM) proto->hFileNetlibUser, (LPARAM) &nlus);
- return (proto->hNetlibUser != NULL)?TRUE:FALSE;
+ return (proto->m_hNetlibUser != NULL)?TRUE:FALSE;
}
void TlenWsUninit(TlenProtocol *proto)
{
- if (proto->hNetlibUser != NULL) Netlib_CloseHandle(proto->hNetlibUser);
+ if (proto->m_hNetlibUser != NULL) Netlib_CloseHandle(proto->m_hNetlibUser);
if (proto->hFileNetlibUser != NULL) Netlib_CloseHandle(proto->hFileNetlibUser);
- proto->hNetlibUser = NULL;
+ proto->m_hNetlibUser = NULL;
proto->hFileNetlibUser = NULL;
}
@@ -65,7 +65,7 @@ HANDLE TlenWsConnect(TlenProtocol *proto, char *host, WORD port) nloc.wPort = port;
nloc.flags = 0;
nloc.timeout = 6;
- return (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) proto->hNetlibUser, (LPARAM) &nloc);
+ return (HANDLE) CallService(MS_NETLIB_OPENCONNECTION, (WPARAM) proto->m_hNetlibUser, (LPARAM) &nloc);
}
@@ -73,7 +73,7 @@ int TlenWsSend(TlenProtocol *proto, HANDLE s, char *data, int datalen) {
int len;
if ((len=Netlib_Send(s, data, datalen, /*MSG_NODUMP|*/MSG_DUMPASTEXT)) == SOCKET_ERROR || len != datalen) {
- TlenLog(proto, "Netlib_Send() failed, error=%d", WSAGetLastError());
+ proto->debugLogA("Netlib_Send() failed, error=%d", WSAGetLastError());
return FALSE;
}
return TRUE;
@@ -84,11 +84,11 @@ int TlenWsRecv(TlenProtocol *proto, HANDLE s, char *data, long datalen) int ret;
ret = Netlib_Recv(s, data, datalen, /*MSG_NODUMP|*/MSG_DUMPASTEXT);
if (ret == SOCKET_ERROR) {
- TlenLog(proto, "Netlib_Recv() failed, error=%d", WSAGetLastError());
+ proto->debugLogA("Netlib_Recv() failed, error=%d", WSAGetLastError());
return 0;
}
if (ret == 0) {
- TlenLog(proto, "Connection closed gracefully");
+ proto->debugLogA("Connection closed gracefully");
return 0;
}
return ret;
@@ -115,9 +115,9 @@ int TlenWsSendAES(TlenProtocol *proto, char *data, int datalen, aes_context *aes len += 16;
}
if (len > 0) {
- TlenLog(proto, "Sending %d bytes", len);
+ proto->debugLogA("Sending %d bytes", len);
if ((sendlen=Netlib_Send(proto->threadData->s, (char *)aes_output, len, MSG_NODUMP)) == SOCKET_ERROR || len != sendlen) {
- TlenLog(proto, "Netlib_Send() failed, error=%d", WSAGetLastError());
+ proto->debugLogA("Netlib_Send() failed, error=%d", WSAGetLastError());
return FALSE;
}
}
@@ -136,11 +136,11 @@ int TlenWsRecvAES(TlenProtocol *proto, char *data, long datalen, aes_context *ae for (maxlen = maxlen & ~0xF; maxlen != 0; maxlen = maxlen & 0xF) {
ret = Netlib_Recv(proto->threadData->s, data, maxlen, MSG_NODUMP);
if (ret == SOCKET_ERROR) {
- TlenLog(proto, "Netlib_Recv() failed, error=%d", WSAGetLastError());
+ proto->debugLogA("Netlib_Recv() failed, error=%d", WSAGetLastError());
return 0;
}
if (ret == 0) {
- TlenLog(proto, "Connection closed gracefully");
+ proto->debugLogA("Connection closed gracefully");
return 0;
}
data += ret;
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp index 2f0f186f8d..e657414295 100644 --- a/protocols/Twitter/src/chat.cpp +++ b/protocols/Twitter/src/chat.cpp @@ -67,7 +67,7 @@ int TwitterProto::OnChatOutgoing(WPARAM wParam,LPARAM lParam) switch(hook->pDest->iType) {
case GC_USER_MESSAGE:
- LOG ( _T("**Chat - Outgoing message: %s"), hook->ptszText);
+ debugLog( _T("**Chat - Outgoing message: %s"), hook->ptszText);
{
ptrA text( mir_utf8encodeT(hook->ptszText));
diff --git a/protocols/Twitter/src/common.h b/protocols/Twitter/src/common.h index 1e2111ef18..d28a821032 100644 --- a/protocols/Twitter/src/common.h +++ b/protocols/Twitter/src/common.h @@ -43,7 +43,6 @@ using std::min; #include <m_clist.h>
#include <m_clistint.h>
#include <m_clui.h>
-//#include "m_cluiframes.h"
#include <m_database.h>
#include <m_history.h>
#include <m_langpack.h>
@@ -54,6 +53,7 @@ using std::min; #include <m_protocols.h>
#include <m_protomod.h>
#include <m_protosvc.h>
+#include <m_protoint.h>
#include <m_skin.h>
#include <statusmodes.h>
#include <m_system.h>
diff --git a/protocols/Twitter/src/connection.cpp b/protocols/Twitter/src/connection.cpp index 0af2eb2e15..0d86488993 100644 --- a/protocols/Twitter/src/connection.cpp +++ b/protocols/Twitter/src/connection.cpp @@ -21,7 +21,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. void CALLBACK TwitterProto::APC_callback(ULONG_PTR p)
{
- reinterpret_cast<TwitterProto*>(p)->LOG( _T("***** Executing APC"));
+ reinterpret_cast<TwitterProto*>(p)->debugLogA( _T("***** Executing APC"));
}
template<typename T>
@@ -48,16 +48,16 @@ inline static INT_PTR db_pod_set(HANDLE hContact,const char *module,const char * void TwitterProto::SignOn(void*)
{
- LOG( _T("***** Beginning SignOn process"));
+ debugLogA( _T("***** Beginning SignOn process"));
WaitForSingleObject(&signon_lock_,INFINITE);
// Kill the old thread if it's still around
// this doesn't seem to work.. should we wait infinitely?
if(hMsgLoop_)
{
- LOG( _T("***** Requesting MessageLoop to exit"));
+ debugLogA( _T("***** Requesting MessageLoop to exit"));
QueueUserAPC(APC_callback,hMsgLoop_,(ULONG_PTR)this);
- LOG( _T("***** Waiting for old MessageLoop to exit"));
+ debugLogA( _T("***** Waiting for old MessageLoop to exit"));
//WaitForSingleObject(hMsgLoop_,INFINITE);
WaitForSingleObject(hMsgLoop_,180000);
CloseHandle(hMsgLoop_);
@@ -72,12 +72,12 @@ void TwitterProto::SignOn(void*) }
ReleaseMutex(signon_lock_);
- LOG( _T("***** SignOn complete"));
+ debugLogA( _T("***** SignOn complete"));
}
bool TwitterProto::NegotiateConnection()
{
- LOG( _T("***** Negotiating connection with Twitter"));
+ debugLogA( _T("***** Negotiating connection with Twitter"));
disconnectionCount = 0;
// saving the current status to a temp var
@@ -94,28 +94,28 @@ bool TwitterProto::NegotiateConnection() if (!dbTOK) {
oauthToken = dbv.pwszVal;
db_free(&dbv);
- //WLOG("**NegotiateConnection - we have an oauthToken already in the db - %s", oauthToken);
+ //debugLogW("**NegotiateConnection - we have an oauthToken already in the db - %s", oauthToken);
}
INT_PTR dbTOKSec = db_get_ws(0,m_szModuleName,TWITTER_KEY_OAUTH_TOK_SECRET,&dbv);
if (!dbTOKSec) {
oauthTokenSecret = dbv.pwszVal;
db_free(&dbv);
- //WLOG("**NegotiateConnection - we have an oauthTokenSecret already in the db - %s", oauthTokenSecret);
+ //debugLogW("**NegotiateConnection - we have an oauthTokenSecret already in the db - %s", oauthTokenSecret);
}
INT_PTR dbName = db_get_s(0,m_szModuleName,TWITTER_KEY_NICK,&dbv);
if (!dbName) {
screenName = dbv.pszVal;
db_free(&dbv);
- //WLOG("**NegotiateConnection - we have a username already in the db - %s", screenName);
+ //debugLogW("**NegotiateConnection - we have a username already in the db - %s", screenName);
}
else {
dbName = db_get_s(0,m_szModuleName,TWITTER_KEY_UN,&dbv);
if (!dbName) {
screenName = dbv.pszVal;
db_set_s(0,m_szModuleName,TWITTER_KEY_NICK,dbv.pszVal);
- //WLOG("**NegotiateConnection - we have a username already in the db - %s", screenName);
+ //debugLogW("**NegotiateConnection - we have a username already in the db - %s", screenName);
}
db_free(&dbv);
}
@@ -131,35 +131,35 @@ bool TwitterProto::NegotiateConnection() if((oauthToken.size() <= 1) || (oauthTokenSecret.size() <= 1)) {
// first, reset all the keys so we can start fresh
resetOAuthKeys();
- LOG( _T("**NegotiateConnection - Reset OAuth Keys"));
+ debugLogA( _T("**NegotiateConnection - Reset OAuth Keys"));
//twit_.set_credentials(ConsumerKey, ConsumerSecret, oauthAccessToken, oauthAccessTokenSecret, L"", false);
// i think i was doin the wrong thing here.. i was setting the credentials as oauthAccessToken instead of oauthToken
// have to test..
- LOG( _T("**NegotiateConnection - Setting Consumer Keys..."));
- /*WLOG("**NegotiateConnection - sending set_cred: consumerKey is %s", ConsumerKey);
- WLOG("**NegotiateConnection - sending set_cred: consumerSecret is %s", ConsumerSecret);
- WLOG("**NegotiateConnection - sending set_cred: oauthToken is %s", oauthToken);
- WLOG("**NegotiateConnection - sending set_cred: oauthTokenSecret is %s", oauthTokenSecret);
- LOG("**NegotiateConnection - sending set_cred: no pin");*/
+ debugLogA( _T("**NegotiateConnection - Setting Consumer Keys..."));
+ /*debugLogW("**NegotiateConnection - sending set_cred: consumerKey is %s", ConsumerKey);
+ debugLogW("**NegotiateConnection - sending set_cred: consumerSecret is %s", ConsumerSecret);
+ debugLogW("**NegotiateConnection - sending set_cred: oauthToken is %s", oauthToken);
+ debugLogW("**NegotiateConnection - sending set_cred: oauthTokenSecret is %s", oauthTokenSecret);
+ debugLogA("**NegotiateConnection - sending set_cred: no pin");*/
twit_.set_credentials("", ConsumerKey, ConsumerSecret, oauthToken, oauthTokenSecret, L"", false);
- LOG( _T("**NegotiateConnection - Requesting oauthTokens"));
+ debugLogA( _T("**NegotiateConnection - Requesting oauthTokens"));
http::response resp = twit_.request_token();
//wstring rdata_WSTR(resp.data.length(),L' ');
//std::copy(resp.data.begin(), resp.data.end(), rdata_WSTR.begin());
wstring rdata_WSTR = UTF8ToWide(resp.data);
- //WLOG("**NegotiateConnection - REQUEST TOKEN IS %s", rdata_WSTR);
+ //debugLogW("**NegotiateConnection - REQUEST TOKEN IS %s", rdata_WSTR);
OAuthParameters response = twit_.ParseQueryString(rdata_WSTR);
oauthToken = response[L"oauth_token"];
oauthTokenSecret = response[L"oauth_token_secret"];
- //WLOG("**NegotiateConnection - oauthToken is %s", oauthToken);
- //WLOG("**NegotiateConnection - oauthTokenSecret is %s", oauthTokenSecret);
+ //debugLogW("**NegotiateConnection - oauthToken is %s", oauthToken);
+ //debugLogW("**NegotiateConnection - oauthTokenSecret is %s", oauthTokenSecret);
if (oauthToken.length() < 1) {
ShowPopup("OAuth Tokens not received, check your internet connection?", 1);
- LOG( _T("**NegotiateConnection - OAuth tokens not received, stopping before we open the web browser.."));
+ debugLogA( _T("**NegotiateConnection - OAuth tokens not received, stopping before we open the web browser.."));
return false;
}
@@ -171,7 +171,7 @@ bool TwitterProto::NegotiateConnection() wchar_t buf[1024] = {};
mir_snwprintf(buf, SIZEOF(buf), AuthorizeUrl.c_str(), oauthToken.c_str());
- WLOG( _T("**NegotiateConnection - Launching %s"), buf);
+ debugLogW( _T("**NegotiateConnection - Launching %s"), buf);
ShellExecute(NULL, L"open", buf, NULL, NULL, SW_SHOWNORMAL);
ShowPinDialog();
@@ -193,9 +193,9 @@ bool TwitterProto::NegotiateConnection() // this bit is saying "if we have found the db key, but it contains no data, then set dbTOK to 1"
if (oauthAccessToken.size() > 1) {
realAccessTok = true;
- //WLOG("**NegotiateConnection - we have an oauthAccessToken already in the db - %s", oauthAccessToken);
+ //debugLogW("**NegotiateConnection - we have an oauthAccessToken already in the db - %s", oauthAccessToken);
}
- else { LOG( _T("**NegotiateConnection - oauthAccesToken too small? this is.. weird.")); }
+ else { debugLogA( _T("**NegotiateConnection - oauthAccesToken too small? this is.. weird.")); }
}
dbTOKSec = db_get_ws(0,m_szModuleName,TWITTER_KEY_OAUTH_ACCESS_TOK_SECRET,&dbv);
@@ -204,22 +204,22 @@ bool TwitterProto::NegotiateConnection() db_free(&dbv);
if (oauthAccessTokenSecret.size() > 1) {
realAccessTokSecret = true;
- //WLOG("**NegotiateConnection - we have an oauthAccessTokenSecret already in the db - %s", oauthAccessTokenSecret);
+ //debugLogW("**NegotiateConnection - we have an oauthAccessTokenSecret already in the db - %s", oauthAccessTokenSecret);
}
- else { LOG( _T("**NegotiateConnection - oauthAccessTokenSecret too small? weird")); }
+ else { debugLogA( _T("**NegotiateConnection - oauthAccessTokenSecret too small? weird")); }
}
if (!realAccessTok || !realAccessTokSecret) { // if we don't have one of these beasties then lets go get 'em!
wstring pin;
- LOG( _T("**NegotiateConnection - either the accessToken or accessTokenSecret was not there.."));
+ debugLogA( _T("**NegotiateConnection - either the accessToken or accessTokenSecret was not there.."));
if (!db_get_ws(0,m_szModuleName,TWITTER_KEY_OAUTH_PIN,&dbv)) {
pin = dbv.pwszVal;
- //WLOG("**NegotiateConnection - we have an pin already in the db - %s", pin);
+ //debugLogW("**NegotiateConnection - we have an pin already in the db - %s", pin);
db_free(&dbv);
}
else {
ShowPopup(TranslateT("OAuth variables are out of sequence, they have been reset. Please reconnect and reauthorize Miranda to Twitter.com (do the PIN stuff again)"));
- LOG( _T("**NegotiateConnection - We don't have a PIN? this doesn't make sense. Resetting OAuth keys and setting offline."));
+ debugLogA( _T("**NegotiateConnection - We don't have a PIN? this doesn't make sense. Resetting OAuth keys and setting offline."));
resetOAuthKeys();
ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus);
@@ -232,19 +232,19 @@ bool TwitterProto::NegotiateConnection() return false;
}
- LOG( _T("**NegotiateConnection - Setting Consumer Keys and PIN..."));
- /*WLOG("**NegotiateConnection - sending set_cred: consumerKey is %s", ConsumerKey);
- WLOG("**NegotiateConnection - sending set_cred: consumerSecret is %s", ConsumerSecret);
- WLOG("**NegotiateConnection - sending set_cred: oauthToken is %s", oauthToken);
- WLOG("**NegotiateConnection - sending set_cred: oauthTokenSecret is %s", oauthTokenSecret);
- WLOG("**NegotiateConnection - sending set_cred: pin is %s", pin);*/
+ debugLogA( _T("**NegotiateConnection - Setting Consumer Keys and PIN..."));
+ /*debugLogW("**NegotiateConnection - sending set_cred: consumerKey is %s", ConsumerKey);
+ debugLogW("**NegotiateConnection - sending set_cred: consumerSecret is %s", ConsumerSecret);
+ debugLogW("**NegotiateConnection - sending set_cred: oauthToken is %s", oauthToken);
+ debugLogW("**NegotiateConnection - sending set_cred: oauthTokenSecret is %s", oauthTokenSecret);
+ debugLogW("**NegotiateConnection - sending set_cred: pin is %s", pin);*/
twit_.set_credentials("", ConsumerKey, ConsumerSecret, oauthToken, oauthTokenSecret, pin, false);
- LOG( _T("**NegotiateConnection - requesting access tokens..."));
+ debugLogA( _T("**NegotiateConnection - requesting access tokens..."));
http::response accessResp = twit_.request_access_tokens();
if (accessResp.code != 200) {
- LOG( _T("**NegotiateConnection - Failed to get Access Tokens, HTTP response code is: %d"), accessResp.code);
+ debugLogA( _T("**NegotiateConnection - Failed to get Access Tokens, HTTP response code is: %d"), accessResp.code);
ShowPopup(TranslateT("Failed to get Twitter Access Tokens, please go offline and try again. If this keeps happening, check your internet connection."));
resetOAuthKeys();
@@ -259,21 +259,21 @@ bool TwitterProto::NegotiateConnection() return false;
}
else {
- LOG( _T("**NegotiateConnection - Successfully retrieved Access Tokens"));
+ debugLogA( _T("**NegotiateConnection - Successfully retrieved Access Tokens"));
wstring rdata_WSTR2 = UTF8ToWide(accessResp.data);
- //WLOG("**NegotiateConnection - accessToken STring is %s", rdata_WSTR2);
+ //debugLogW("**NegotiateConnection - accessToken STring is %s", rdata_WSTR2);
OAuthParameters accessTokenParameters = twit_.ParseQueryString(rdata_WSTR2);
oauthAccessToken = accessTokenParameters[L"oauth_token"];
- //WLOG("**NegotiateConnection - oauthAccessToken is %s", oauthAccessToken);
+ //debugLogW("**NegotiateConnection - oauthAccessToken is %s", oauthAccessToken);
oauthAccessTokenSecret = accessTokenParameters[L"oauth_token_secret"];
- //WLOG("**NegotiateConnection - oauthAccessTokenSecret is %s", oauthAccessTokenSecret);
+ //debugLogW("**NegotiateConnection - oauthAccessTokenSecret is %s", oauthAccessTokenSecret);
screenName = WideToUTF8(accessTokenParameters[L"screen_name"]);
- LOG( _T("**NegotiateConnection - screen name is %s"), screenName.c_str());
+ debugLogA( _T("**NegotiateConnection - screen name is %s"), screenName.c_str());
//save em
db_set_ws(0,m_szModuleName,TWITTER_KEY_OAUTH_ACCESS_TOK,oauthAccessToken.c_str());
@@ -301,16 +301,16 @@ bool TwitterProto::NegotiateConnection() db_free(&dbv);
}
- LOG( _T("**NegotiateConnection - Setting Consumer Keys and verifying creds..."));
- /*WLOG("**NegotiateConnection - sending set_cred: consumerKey is %s", ConsumerKey);
- WLOG("**NegotiateConnection - sending set_cred: consumerSecret is %s", ConsumerSecret);
- WLOG("**NegotiateConnection - sending set_cred: oauthAccessToken is %s", oauthAccessToken);
- WLOG("**NegotiateConnection - sending set_cred: oauthAccessTokenSecret is %s", oauthAccessTokenSecret);
- LOG("**NegotiateConnection - sending set_cred: no pin");*/
+ debugLogA( _T("**NegotiateConnection - Setting Consumer Keys and verifying creds..."));
+ /*debugLogW("**NegotiateConnection - sending set_cred: consumerKey is %s", ConsumerKey);
+ debugLogW("**NegotiateConnection - sending set_cred: consumerSecret is %s", ConsumerSecret);
+ debugLogW("**NegotiateConnection - sending set_cred: oauthAccessToken is %s", oauthAccessToken);
+ debugLogW("**NegotiateConnection - sending set_cred: oauthAccessTokenSecret is %s", oauthAccessTokenSecret);
+ debugLogA("**NegotiateConnection - sending set_cred: no pin");*/
if (screenName.empty()) {
ShowPopup(TranslateT("You're missing the Nick key in the database. This isn't really a big deal, but you'll notice some minor quirks (self contact in list, no group chat outgoing message highlighting, etc). To fix it either add it manually or reset your twitter account in the miranda account options"));
- LOG( _T("**NegotiateConnection - Missing the Nick key in the database. Everything will still work, but it's nice to have"));
+ debugLogA( _T("**NegotiateConnection - Missing the Nick key in the database. Everything will still work, but it's nice to have"));
}
bool success;
@@ -322,7 +322,7 @@ bool TwitterProto::NegotiateConnection() if(!success) {
//ShowPopup(TranslateT("Something went wrong with authorisation, OAuth keys have been reset. Please try to reconnect. If problems persist, please se your doctor"));
- LOG( _T("**NegotiateConnection - Verifying credentials failed! No internet maybe?"));
+ debugLogA( _T("**NegotiateConnection - Verifying credentials failed! No internet maybe?"));
//resetOAuthKeys();
ProtoBroadcastAck(0,ACKTYPE_STATUS,ACKRESULT_FAILED,(HANDLE)old_status,m_iStatus);
@@ -345,7 +345,7 @@ bool TwitterProto::NegotiateConnection() void TwitterProto::MessageLoop(void*)
{
- LOG( _T("***** Entering Twitter::MessageLoop"));
+ debugLogA( _T("***** Entering Twitter::MessageLoop"));
since_id_ = db_pod_get<twitter_id>(0,m_szModuleName,TWITTER_KEY_SINCEID,0);
dm_since_id_ = db_pod_get<twitter_id>(0,m_szModuleName,TWITTER_KEY_DMSINCEID,0);
@@ -384,10 +384,10 @@ void TwitterProto::MessageLoop(void*) if(m_iStatus != ID_STATUS_ONLINE)
break;
- LOG( _T("***** TwitterProto::MessageLoop going to sleep..."));
+ debugLogA( _T("***** TwitterProto::MessageLoop going to sleep..."));
if(SleepEx(poll_rate*1000,true) == WAIT_IO_COMPLETION)
break;
- LOG( _T("***** TwitterProto::MessageLoop waking up..."));
+ debugLogA( _T("***** TwitterProto::MessageLoop waking up..."));
popups = true;
}
@@ -396,7 +396,7 @@ void TwitterProto::MessageLoop(void*) ScopedLock s(twitter_lock_);
twit_.set_credentials("",L"",L"",L"",L"",L"", false);
}
- LOG( _T("***** Exiting TwitterProto::MessageLoop"));
+ debugLogA( _T("***** Exiting TwitterProto::MessageLoop"));
}
struct update_avatar
@@ -429,17 +429,17 @@ void TwitterProto::UpdateAvatarWorker(void *p) ai.format = ProtoGetAvatarFormat(filename.c_str());
if (ai.format == PA_FORMAT_UNKNOWN) {
- LOG( _T("***** Update avatar: Terminated for this contact, extension format unknown for %s"), data->url.c_str());
+ debugLogA( _T("***** Update avatar: Terminated for this contact, extension format unknown for %s"), data->url.c_str());
return; // lets just ignore unknown formats... if not it crashes miranda. should probably speak to borkra about this.
}
_tcsncpy(ai.filename,filename.c_str(),MAX_PATH); // puts the local file name in the avatar struct, to a max of 260 chars (as of now)
- LOG( _T("***** Updating avatar: %s"), data->url.c_str());
+ debugLogA( _T("***** Updating avatar: %s"), data->url.c_str());
WaitForSingleObjectEx(avatar_lock_,INFINITE,true);
if(CallService(MS_SYSTEM_TERMINATED,0,0)) // if miranda is shutting down...
{
- LOG( _T("***** Terminating avatar update early: %s"),data->url.c_str());
+ debugLogA( _T("***** Terminating avatar update early: %s"),data->url.c_str());
return;
}
@@ -451,7 +451,7 @@ void TwitterProto::UpdateAvatarWorker(void *p) else
ProtoBroadcastAck(data->hContact,ACKTYPE_AVATAR,ACKRESULT_FAILED, &ai,0);
ReleaseMutex(avatar_lock_);
- LOG( _T("***** Done avatar: %s"),data->url.c_str());
+ debugLogA( _T("***** Done avatar: %s"),data->url.c_str());
}
void TwitterProto::UpdateAvatar(HANDLE hContact,const std::string &url,bool force)
@@ -460,7 +460,7 @@ void TwitterProto::UpdateAvatar(HANDLE hContact,const std::string &url,bool forc if( !force && (!db_get_s(hContact,m_szModuleName,TWITTER_KEY_AV_URL,&dbv) && url == dbv.pszVal))
{
- LOG( _T("***** Avatar already up-to-date: %s"), url.c_str());
+ debugLogA( _T("***** Avatar already up-to-date: %s"), url.c_str());
}
else
{
@@ -497,21 +497,21 @@ void TwitterProto::UpdateFriends() UpdateAvatar(hContact,i->profile_image_url);
}
disconnectionCount = 0;
- LOG( _T("***** Friends list updated"));
+ debugLogA( _T("***** Friends list updated"));
}
catch(const bad_response &)
{
++disconnectionCount;
- LOG( _T("***** UpdateFriends - Bad response from server, this has happened %d time(s)"), disconnectionCount);
+ debugLogA( _T("***** UpdateFriends - Bad response from server, this has happened %d time(s)"), disconnectionCount);
if (disconnectionCount > 2) {
- LOG( _T("***** UpdateFriends - Too many bad responses from the server, signing off"));
+ debugLogA( _T("***** UpdateFriends - Too many bad responses from the server, signing off"));
SetStatus(ID_STATUS_OFFLINE);
}
}
catch(const std::exception &e)
{
ShowPopup( (std::string("While updating friends list, an error occurred: ")+e.what()).c_str());
- LOG( _T("***** Error updating friends list: %s"), e.what());
+ debugLogA( _T("***** Error updating friends list: %s"), e.what());
}
}
@@ -588,14 +588,14 @@ void TwitterProto::UpdateStatuses(bool pre_read, bool popups, bool tweetToMsg) db_pod_set(0,m_szModuleName,TWITTER_KEY_SINCEID,since_id_);
disconnectionCount = 0;
- LOG( _T("***** Status messages updated"));
+ debugLogA( _T("***** Status messages updated"));
}
catch(const bad_response &)
{
++disconnectionCount;
- LOG( _T("***** UpdateStatuses - Bad response from server, this has happened %d time(s)"), disconnectionCount);
+ debugLogA( _T("***** UpdateStatuses - Bad response from server, this has happened %d time(s)"), disconnectionCount);
if (disconnectionCount > 2) {
- LOG( _T("***** UpdateStatuses - Too many bad responses from the server, signing off"));
+ debugLogA( _T("***** UpdateStatuses - Too many bad responses from the server, signing off"));
SetStatus(ID_STATUS_OFFLINE);
}
}
@@ -603,7 +603,7 @@ void TwitterProto::UpdateStatuses(bool pre_read, bool popups, bool tweetToMsg) {
ShowPopup( (std::string("While updating status messages, an error occurred: ")
+e.what()).c_str());
- LOG( _T("***** Error updating status messages: %s"), e.what());
+ debugLogA( _T("***** Error updating status messages: %s"), e.what());
}
}
@@ -633,21 +633,21 @@ void TwitterProto::UpdateMessages(bool pre_read) db_pod_set(0,m_szModuleName,TWITTER_KEY_DMSINCEID,dm_since_id_);
disconnectionCount = 0;
- LOG( _T("***** Direct messages updated"));
+ debugLogA( _T("***** Direct messages updated"));
}
catch(const bad_response &)
{
++disconnectionCount;
- LOG( _T("***** UpdateMessages - Bad response from server, this has happened %d time(s)"), disconnectionCount);
+ debugLogA( _T("***** UpdateMessages - Bad response from server, this has happened %d time(s)"), disconnectionCount);
if (disconnectionCount > 2) {
- LOG( _T("***** UpdateMessages - Too many bad responses from the server, signing off"));
+ debugLogA( _T("***** UpdateMessages - Too many bad responses from the server, signing off"));
SetStatus(ID_STATUS_OFFLINE);
}
}
catch(const std::exception &e)
{
ShowPopup( (std::string("While updating direct messages, an error occurred: ")+e.what()).c_str());
- LOG( _T("***** Error updating direct messages: %s"), e.what());
+ debugLogA( _T("***** Error updating direct messages: %s"), e.what());
}
}
diff --git a/protocols/Twitter/src/contacts.cpp b/protocols/Twitter/src/contacts.cpp index 763ce1f699..f9772bf7b6 100644 --- a/protocols/Twitter/src/contacts.cpp +++ b/protocols/Twitter/src/contacts.cpp @@ -38,7 +38,7 @@ void TwitterProto::AddToListWorker(void *p) catch(const std::exception &e)
{
ShowPopup((std::string("While adding a friend, an error occurred: ") + e.what()).c_str());
- LOG( _T("***** Error adding friend: %s"),e.what());
+ debugLogA( _T("***** Error adding friend: %s"),e.what());
}
mir_free(name);
}
@@ -127,7 +127,7 @@ void TwitterProto::DoSearch(void *p) catch(const std::exception &e)
{
ShowPopup( (std::string("While searching for contacts, an error occurred: ") + e.what()).c_str());
- LOG( _T("***** Error searching for contacts: %s"), e.what());
+ debugLogA( _T("***** Error searching for contacts: %s"), e.what());
found = false;
}
diff --git a/protocols/Twitter/src/oauth.cpp b/protocols/Twitter/src/oauth.cpp index a0ff221cd2..798f837499 100644 --- a/protocols/Twitter/src/oauth.cpp +++ b/protocols/Twitter/src/oauth.cpp @@ -34,7 +34,7 @@ OAuthParameters mir_twitter::BuildSignedOAuthParameters( const OAuthParameters& // add the request token if found
if (!requestToken.empty())
{
- oauthParameters[L"oauth_token"] = requestToken; /*WLOG("requestToken not empty: %s", requestToken);*/
+ oauthParameters[L"oauth_token"] = requestToken; /*debugLogW("requestToken not empty: %s", requestToken);*/
}
// add the authorization pin if found
@@ -48,7 +48,7 @@ OAuthParameters mir_twitter::BuildSignedOAuthParameters( const OAuthParameters& OAuthParameters allParameters = requestParameters;
if(Compare(httpMethod, L"POST", false) && postData) {
- //LOG("in post section of buildOAuthParams");
+ //debugLogA("in post section of buildOAuthParams");
allParameters.insert(postData->begin(), postData->end());
}
@@ -57,15 +57,15 @@ OAuthParameters mir_twitter::BuildSignedOAuthParameters( const OAuthParameters& // prepare a signature base, a carefully formatted string containing
// all of the necessary information needed to generate a valid signature
wstring normalUrl = OAuthNormalizeUrl(url);
- //WLOG("normalURL is %s", normalUrl);
+ //debugLogW("normalURL is %s", normalUrl);
wstring normalizedParameters = OAuthNormalizeRequestParameters(allParameters);
- //WLOG("normalisedparams is %s", normalizedParameters);
+ //debugLogW("normalisedparams is %s", normalizedParameters);
wstring signatureBase = OAuthConcatenateRequestElements(httpMethod, normalUrl, normalizedParameters);
- //WLOG("sigBase is %s", signatureBase);
+ //debugLogW("sigBase is %s", signatureBase);
// obtain a signature and add it to header requestParameters
wstring signature = OAuthCreateSignature(signatureBase, consumerSecret, requestTokenSecret);
- //WLOG("**BuildSignedOAuthParameters - sig is %s", signature);
+ //debugLogW("**BuildSignedOAuthParameters - sig is %s", signature);
oauthParameters[L"oauth_signature"] = signature;
return oauthParameters;
@@ -90,7 +90,7 @@ wstring mir_twitter::UrlGetQuery( const wstring& url ) map<wstring, wstring> brokenURL = CrackURL(url);
query = brokenURL[L"extraInfo"];
- //WLOG("inside crack, url is %s", url);
+ //debugLogW("inside crack, url is %s", url);
wstring::size_type q = query.find_first_of(L'?');
if(q != wstring::npos)
{
@@ -122,9 +122,9 @@ wstring mir_twitter::OAuthWebRequestSubmit( const wstring& pin
)
{
- //WLOG("URL is %s", url);
+ //debugLogW("URL is %s", url);
wstring query = UrlGetQuery(url);
- //WLOG("query is %s", query);
+ //debugLogW("query is %s", query);
OAuthParameters originalParameters = ParseQueryString(query);
OAuthParameters oauthSignedParameters = BuildSignedOAuthParameters(
@@ -142,7 +142,7 @@ wstring mir_twitter::OAuthWebRequestSubmit( const wstring& url
)
{
- //WLOG("OAuthWebRequestSubmit(%s)", url);
+ //debugLogW("OAuthWebRequestSubmit(%s)", url);
//wstring oauthHeader = L"Authorization: OAuth ";
wstring oauthHeader = L"OAuth ";
@@ -151,9 +151,9 @@ wstring mir_twitter::OAuthWebRequestSubmit( it != parameters.end();
++it)
{
- //WLOG("%s = ", it->first);
- //WLOG("%s", it->second);
- //LOG("---------");
+ //debugLogW("%s = ", it->first);
+ //debugLogW("%s", it->second);
+ //debugLogA("---------");
if(it != parameters.begin())
{
@@ -165,7 +165,7 @@ wstring mir_twitter::OAuthWebRequestSubmit( oauthHeader += pair;
}
- //WLOG("oauthheader is %s", oauthHeader);
+ //debugLogW("oauthheader is %s", oauthHeader);
return oauthHeader;
}
@@ -174,14 +174,14 @@ wstring mir_twitter::OAuthWebRequestSubmit( std::wstring mir_twitter::BuildQueryString( const OAuthParameters ¶meters )
{
wstring query;
- //LOG("do we ever get here?");
+ //debugLogA("do we ever get here?");
for(OAuthParameters::const_iterator it = parameters.begin();
it != parameters.end();
++it)
{
- //LOG("aww como ONNNNNN");
- //LOG("%s = %s", it->first.c_str(), it->second.c_str());
- //WLOG("in buildqueryString bit, first is %s", it->first);
+ //debugLogA("aww como ONNNNNN");
+ //debugLogA("%s = %s", it->first.c_str(), it->second.c_str());
+ //debugLogW("in buildqueryString bit, first is %s", it->first);
if(it != parameters.begin())
{
@@ -198,10 +198,10 @@ std::wstring mir_twitter::BuildQueryString( const OAuthParameters ¶meters ) wstring mir_twitter::OAuthConcatenateRequestElements( const wstring& httpMethod, wstring url, const wstring& parameters )
{
wstring escapedUrl = UrlEncode(url);
- //WLOG("before OAUTHConcat, params are %s", parameters);
+ //debugLogW("before OAUTHConcat, params are %s", parameters);
wstring escapedParameters = UrlEncode(parameters);
- //LOG(")))))))))))))))))))))))))))))))))))))))))))))))");
- //WLOG("after url encode, its %s", escapedParameters);
+ //debugLogA(")))))))))))))))))))))))))))))))))))))))))))))))");
+ //debugLogW("after url encode, its %s", escapedParameters);
wstring ret = httpMethod + L"&" + escapedUrl + L"&" + escapedParameters;
return ret;
}
@@ -221,10 +221,10 @@ map<wstring, wstring> mir_twitter::CrackURL(wstring url) { vector<wstring> urlToks, urlToks2, extraInfoToks;
Split(url, urlToks, L':', false);
- //WLOG("**CRACK - URL to split is %s", url);
+ //debugLogW("**CRACK - URL to split is %s", url);
scheme1 = urlToks[0];
- //WLOG("**CRACK - scheme is %s", scheme1);
+ //debugLogW("**CRACK - scheme is %s", scheme1);
if (urlToks.size() == 2) { // if there is only 1 ":" in the url
if (Compare(scheme1, L"http", false)) {
@@ -234,25 +234,22 @@ map<wstring, wstring> mir_twitter::CrackURL(wstring url) { port1 = L"443";
}
- //WLOG("**CRACK::2 - port is %s", port1);
+ //debugLogW("**CRACK::2 - port is %s", port1);
Split(urlToks[1], urlToks2, L'/', false);
domain1 = urlToks2[0];
- //WLOG("**CRACK::2 - domain is %s", domain1);
+ //debugLogW("**CRACK::2 - domain is %s", domain1);
explicitPort = L"0";
}
else if (urlToks.size() == 3) { // if there are 2 ":"s in the URL, ie a port is explicitly set
domain1 = urlToks[1].substr(2, urlToks[1].size());
- //WLOG("**CRACK::3 - domain is %s", domain1);
+ //debugLogW("**CRACK::3 - domain is %s", domain1);
Split(urlToks[2], urlToks2, L'/', false);
port1 = urlToks2[0];
- //WLOG("**CRACK::3 - port is %s", port1);
+ //debugLogW("**CRACK::3 - port is %s", port1);
explicitPort = L"1";
}
- else {
- WLOG("**CRACK - not a proper URL? doesn't have a colon. URL is %s", url);
-
- }
+ else ppro_->debugLogW(L"**CRACK - not a proper URL? doesn't have a colon. URL is %s", url);
for (size_t i = 1; i < urlToks2.size(); ++i) {
if (i > 1) {
@@ -260,7 +257,7 @@ map<wstring, wstring> mir_twitter::CrackURL(wstring url) { }
path1 += urlToks2[i];
}
- //WLOG("**CRACK - path is %s", path1);
+ //debugLogW("**CRACK - path is %s", path1);
wstring::size_type foundHash = path1.find(L"#");
wstring::size_type foundQ = path1.find(L"?");
@@ -285,7 +282,7 @@ map<wstring, wstring> mir_twitter::CrackURL(wstring url) { extraInfo = L"";
}
- //WLOG("**CRACK - extraInfo is %s", extraInfo);
+ //debugLogW("**CRACK - extraInfo is %s", extraInfo);
map<wstring, wstring> result;
result[L"scheme"] = scheme1;
@@ -342,7 +339,7 @@ wstring mir_twitter::OAuthNormalizeUrl( const wstring& url ) }
normalUrl = brokenURL[L"scheme"] + L"://" + brokenURL[L"domain"] + port + L"/" + pathOnly;
- //WLOG("**OAuthNOrmailseURL - normalUrl is %s", normalUrl);
+ //debugLogW("**OAuthNOrmailseURL - normalUrl is %s", normalUrl);
//}
return normalUrl;
}
diff --git a/protocols/Twitter/src/proto.cpp b/protocols/Twitter/src/proto.cpp index c4279e6bf8..d90c67b6e1 100644 --- a/protocols/Twitter/src/proto.cpp +++ b/protocols/Twitter/src/proto.cpp @@ -78,8 +78,8 @@ TwitterProto::~TwitterProto() {
twit_.Disconnect();
- if(hNetlib_)
- Netlib_CloseHandle(hNetlib_);
+ if(m_hNetlibUser)
+ Netlib_CloseHandle(m_hNetlibUser);
if(hAvatarNetlib_)
Netlib_CloseHandle(hAvatarNetlib_);
@@ -358,8 +358,8 @@ int TwitterProto::OnModulesLoaded(WPARAM,LPARAM) // Create standard network connection
mir_sntprintf(descr,SIZEOF(descr),TranslateT("%s server connection"),m_tszUserName);
nlu.ptszDescriptiveName = descr;
- hNetlib_ = (HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu);
- if(hNetlib_ == 0)
+ m_hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER,0,(LPARAM)&nlu);
+ if(m_hNetlibUser == 0)
MessageBox(0, TranslateT("Unable to get Netlib connection for Twitter"), TranslateT("Twitter"), 0);
// Create avatar network connection (TODO: probably remove this)
@@ -372,7 +372,7 @@ int TwitterProto::OnModulesLoaded(WPARAM,LPARAM) if(hAvatarNetlib_ == 0)
MessageBox(0, TranslateT("Unable to get avatar Netlib connection for Twitter"), TranslateT("Twitter"), 0);
- twit_.set_handle(hNetlib_);
+ twit_.set_handle(this, m_hNetlibUser);
GCREGISTER gcr = {sizeof(gcr)};
gcr.pszModule = m_szModuleName;
@@ -391,7 +391,7 @@ int TwitterProto::OnModulesLoaded(WPARAM,LPARAM) int TwitterProto::OnPreShutdown(WPARAM,LPARAM)
{
- Netlib_Shutdown(hNetlib_);
+ Netlib_Shutdown(m_hNetlibUser);
Netlib_Shutdown(hAvatarNetlib_);
return 0;
}
@@ -447,9 +447,9 @@ void TwitterProto::ShowPopup(const char *text, int Error) MessageBox(0,popup.lptzText,popup.lptzContactName,0);
}
-void TwitterProto::LOG(TCHAR *fmt,...)
+void TwitterProto::debugLogA(TCHAR *fmt,...)
{
- if (!hNetlib_)
+ if (!m_hNetlibUser)
return;
va_list va;
@@ -459,7 +459,7 @@ void TwitterProto::LOG(TCHAR *fmt,...) mir_vsntprintf(text,SIZEOF(text),fmt,va);
va_end(va);
- CallService(MS_NETLIB_LOGW, (WPARAM)hNetlib_, (LPARAM)text);
+ CallService(MS_NETLIB_LOGW, (WPARAM)m_hNetlibUser, (LPARAM)text);
}
// TODO: the more I think about it, the more I think all twit.* methods should
diff --git a/protocols/Twitter/src/proto.h b/protocols/Twitter/src/proto.h index 71b22cd3ea..ff10081aed 100644 --- a/protocols/Twitter/src/proto.h +++ b/protocols/Twitter/src/proto.h @@ -135,8 +135,8 @@ private: HANDLE AddToClientList(const char *,const char *);
void SetAllContactStatuses(int);
- void LOG(TCHAR *fmt,...);
- __inline void WLOG(TCHAR* first, const tstring& last) { LOG(first, last.c_str()); }
+ void debugLogA(TCHAR *fmt,...);
+ __inline void debugLogW(TCHAR* first, const tstring& last) { debugLogA(first, last.c_str()); }
static void CALLBACK APC_callback(ULONG_PTR p);
void UpdateChat(const twitter_user &update);
@@ -152,7 +152,6 @@ private: HANDLE avatar_lock_;
HANDLE twitter_lock_;
- HANDLE hNetlib_;
HANDLE hAvatarNetlib_;
HANDLE hMsgLoop_;
mir_twitter twit_;
diff --git a/protocols/Twitter/src/twitter.cpp b/protocols/Twitter/src/twitter.cpp index 81e55a2cad..f5157b8caf 100644 --- a/protocols/Twitter/src/twitter.cpp +++ b/protocols/Twitter/src/twitter.cpp @@ -145,7 +145,7 @@ const std::string & twitter::get_base_url() const // if i will have to parse it myself and add them one by one :(
IDs = retrieve<js::array>(friendIDs,"ids");
for(js::array::const_iterator i=IDs.begin(); i!=IDs.end(); ++i) {
- //LOG("friends ID: " + i);
+ //debugLogA("friends ID: " + i);
// add array to master array
js::object one = boost::any_cast<js::object>(**i);
masterIDs.push_back(one); // i don't understand this. how do we push into the array? should i just use C++ arrays (list?) and bail on boost?
diff --git a/protocols/Twitter/src/utility.cpp b/protocols/Twitter/src/utility.cpp index ecfc3f9576..7d91be4f67 100644 --- a/protocols/Twitter/src/utility.cpp +++ b/protocols/Twitter/src/utility.cpp @@ -25,8 +25,7 @@ std::string b64encode(const std::string &s) return std::string( ptrA( mir_base64_encode((BYTE*)s.c_str(), (unsigned)s.length())));
}
-http::response mir_twitter::slurp(const std::string &url,http::method meth,
- OAuthParameters postParams)
+http::response mir_twitter::slurp(const std::string &url, http::method meth, OAuthParameters postParams)
{
NETLIBHTTPREQUEST req = {sizeof(req)};
req.requestType = (meth == http::get) ? REQUEST_GET:REQUEST_POST;
@@ -40,16 +39,16 @@ http::response mir_twitter::slurp(const std::string &url,http::method meth, std::wstring auth;
if (meth == http::get) {
- if (url_WSTR.size()>0) { WLOG("**SLURP::GET - we have a URL: %s", url_WSTR); }
- if (consumerKey_.size()>0) { LOG("**SLURP::GET - we have a consumerKey"); }
- if (consumerSecret_.size()>0) { LOG("**SLURP::GET - we have a consumerSecret"); }
- if (oauthAccessToken_.size()>0) { LOG("**SLURP::GET - we have a oauthAccessToken"); }
- if (oauthAccessTokenSecret_.size()>0) { LOG("**SLURP::GET - we have a oauthAccessTokenSecret"); }
- if (pin_.size()>0) { LOG("**SLURP::GET - we have a pin"); }
- //WLOG("consumerSEcret is %s", consumerSecret_);
- //WLOG("oauthAccessTok is %s", oauthAccessToken_);
- //WLOG("oautAccessTokSEc is %s", oauthAccessTokenSecret_);
- //WLOG("pin is %s", pin_);
+ if (url_WSTR.size()>0) { ppro_->debugLogW(L"**SLURP::GET - we have a URL: %s", url_WSTR); }
+ if (consumerKey_.size()>0) { ppro_->debugLogA("**SLURP::GET - we have a consumerKey"); }
+ if (consumerSecret_.size()>0) { ppro_->debugLogA("**SLURP::GET - we have a consumerSecret"); }
+ if (oauthAccessToken_.size()>0) { ppro_->debugLogA("**SLURP::GET - we have a oauthAccessToken"); }
+ if (oauthAccessTokenSecret_.size()>0) { ppro_->debugLogA("**SLURP::GET - we have a oauthAccessTokenSecret"); }
+ if (pin_.size()>0) { ppro_->debugLogA("**SLURP::GET - we have a pin"); }
+ //debugLogW("consumerSEcret is %s", consumerSecret_);
+ //debugLogW("oauthAccessTok is %s", oauthAccessToken_);
+ //debugLogW("oautAccessTokSEc is %s", oauthAccessTokenSecret_);
+ //debugLogW("pin is %s", pin_);
auth = OAuthWebRequestSubmit(url_WSTR, L"GET", NULL, consumerKey_, consumerSecret_,
oauthAccessToken_, oauthAccessTokenSecret_, pin_);
@@ -57,17 +56,17 @@ http::response mir_twitter::slurp(const std::string &url,http::method meth, else if (meth == http::post) {
//OAuthParameters postParams;
- if (url_WSTR.size()>0) { WLOG("**SLURP::POST - we have a URL: %s", url_WSTR); }
- if (consumerKey_.size()>0) { LOG("**SLURP::POST - we have a consumerKey"); }
- if (consumerSecret_.size()>0) { LOG("**SLURP::POST - we have a consumerSecret"); }
- if (oauthAccessToken_.size()>0) { LOG("**SLURP::POST - we have a oauthAccessToken"); }
- if (oauthAccessTokenSecret_.size()>0) { LOG("**SLURP::POST - we have a oauthAccessTokenSecret"); }
- if (pin_.size()>0) { LOG("**SLURP::POST - we have a pin"); }
-
- //WLOG("consumerKey is %s", consumerKey_);
- //WLOG("consumerSEcret is %s", consumerSecret_);
- //WLOG("oauthAccessTok is %s", oauthAccessToken_);
- //WLOG("oautAccessTokSEc is %s", oauthAccessTokenSecret_);
+ if (url_WSTR.size()>0) { ppro_->debugLogW(L"**SLURP::POST - we have a URL: %s", url_WSTR); }
+ if (consumerKey_.size()>0) { ppro_->debugLogA("**SLURP::POST - we have a consumerKey"); }
+ if (consumerSecret_.size()>0) { ppro_->debugLogA("**SLURP::POST - we have a consumerSecret"); }
+ if (oauthAccessToken_.size()>0) { ppro_->debugLogA("**SLURP::POST - we have a oauthAccessToken"); }
+ if (oauthAccessTokenSecret_.size()>0) { ppro_->debugLogA("**SLURP::POST - we have a oauthAccessTokenSecret"); }
+ if (pin_.size()>0) { ppro_->debugLogA("**SLURP::POST - we have a pin"); }
+
+ //debugLogW("consumerKey is %s", consumerKey_);
+ //debugLogW("consumerSEcret is %s", consumerSecret_);
+ //debugLogW("oauthAccessTok is %s", oauthAccessToken_);
+ //debugLogW("oautAccessTokSEc is %s", oauthAccessTokenSecret_);
//std::wstring pdata_WSTR(post_data.length(),L' ');
//std::copy(post_data.begin(), post_data.end(), pdata_WSTR.begin());
@@ -77,14 +76,14 @@ http::response mir_twitter::slurp(const std::string &url,http::method meth, pdata_WSTR = BuildQueryString(postParams);
- WLOG("**SLURP::POST - post data is: %s", pdata_WSTR);
+ ppro_->debugLogW(L"**SLURP::POST - post data is: %s", pdata_WSTR);
auth = OAuthWebRequestSubmit(url_WSTR, L"POST", &postParams, consumerKey_, consumerSecret_,
oauthAccessToken_, oauthAccessTokenSecret_);
- //WLOG("**SLURP::POST auth is %s", auth);
+ //debugLogW("**SLURP::POST auth is %s", auth);
}
else {
- LOG("**SLURP - There is something really wrong.. the http method was neither get or post.. WHY??");
+ ppro_->debugLogA("**SLURP - There is something really wrong.. the http method was neither get or post.. WHY??");
}
//std::string auth_STR(auth.length(), ' ');
@@ -114,19 +113,19 @@ http::response mir_twitter::slurp(const std::string &url,http::method meth, req.headersCount = 3;
req.dataLength = (int)pdata_STR.size();
req.pData = const_cast<char*>(pdata_STR.c_str());
- LOG("**SLURP::POST - req.pdata is %s", req.pData);
+ ppro_->debugLogA("**SLURP::POST - req.pdata is %s", req.pData);
}
req.flags = NLHRF_HTTP11 | NLHRF_PERSISTENT | NLHRF_REDIRECT;
req.nlc = httpPOST_;
http::response resp_data;
- LOG("**SLURP - just before calling HTTPTRANSACTION");
+ ppro_->debugLogA("**SLURP - just before calling HTTPTRANSACTION");
NETLIBHTTPREQUEST *resp = reinterpret_cast<NETLIBHTTPREQUEST*>(CallService(MS_NETLIB_HTTPTRANSACTION,
reinterpret_cast<WPARAM>(handle_), reinterpret_cast<LPARAM>(&req)));
- LOG("**SLURP - HTTPTRANSACTION complete.");
+ ppro_->debugLogA("**SLURP - HTTPTRANSACTION complete.");
if(resp)
{
- LOG("**SLURP - the server has responded!");
+ ppro_->debugLogA("**SLURP - the server has responded!");
httpPOST_ = resp->nlc;
resp_data.code = resp->resultCode;
resp_data.data = resp->pData ? resp->pData:"";
@@ -135,34 +134,12 @@ http::response mir_twitter::slurp(const std::string &url,http::method meth, }
else {
httpPOST_ = NULL;
- LOG("SLURP - there was no response!");
+ ppro_->debugLogA("SLURP - there was no response!");
}
return resp_data;
}
-INT_PTR mir_twitter::LOG(const char *fmt,...)
-{
- va_list va;
- char text[1024];
- if (!handle_)
- return 0;
-
- va_start(va,fmt);
- mir_vsnprintf(text,sizeof(text),fmt,va);
- va_end(va);
-
- return CallService(MS_NETLIB_LOG,(WPARAM)handle_,(LPARAM)text);
-}
-
-INT_PTR mir_twitter::WLOG(const char* first, const std::wstring last)
-{
- char *str1 = new char[1024*96];
- mir_snprintf(str1, 1024*96, "%ls", last.c_str());
-
- return LOG(first, str1);
-}
-
bool save_url(HANDLE hNetlib,const std::string &url,const std::tstring &filename)
{
NETLIBHTTPREQUEST req = {sizeof(req)};
diff --git a/protocols/Twitter/src/utility.h b/protocols/Twitter/src/utility.h index 42d2313002..ba6ecc3651 100644 --- a/protocols/Twitter/src/utility.h +++ b/protocols/Twitter/src/utility.h @@ -27,8 +27,9 @@ class mir_twitter : public twitter {
public:
mir_twitter() : twitter(), handle_(NULL), httpPOST_(NULL) {}
- void set_handle(HANDLE h)
+ void set_handle(PROTO_INTERFACE *ppro, HANDLE h)
{
+ ppro_ = ppro;
handle_ = h;
}
@@ -80,11 +81,10 @@ public: protected:
http::response slurp(const std::string &,http::method, OAuthParameters );
- INT_PTR LOG(const char *fmt,...);
- INT_PTR WLOG(const char* first, const std::wstring last);
HANDLE httpPOST_;
HANDLE handle_;
+ PROTO_INTERFACE *ppro_;
};
inline void mbcs_to_tcs(UINT code_page,const char *mbstr,TCHAR *tstr,int tlen)
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h index d6a6a3259e..23e3144b81 100644 --- a/protocols/VKontakte/src/vk_proto.h +++ b/protocols/VKontakte/src/vk_proto.h @@ -98,6 +98,13 @@ struct CVkProto : public PROTO<CVkProto> void RetrieveFriends();
void OnReceiveFriends(NETLIBHTTPREQUEST*, void*);
+ void RetrievePollingInfo();
+ void OnReceivePollingInfo(NETLIBHTTPREQUEST*, void*);
+
+ void __cdecl PollingThread(void*);
+ void PollServer();
+ void OnReceivePolling(NETLIBHTTPREQUEST*, void*);
+
int SetServerStatus(int);
__forceinline bool IsOnline() const { return m_bOnline; }
@@ -144,8 +151,11 @@ private: bool m_bOnline;
- HANDLE m_hNetlibUser, m_hNetlibConn;
+ HANDLE m_hNetlibConn;
ptrA m_szAccessToken, m_myUserId;
ptrT m_defaultGroup;
UINT_PTR m_timer;
+
+ ptrA m_pollingServer, m_pollingKey, m_pollingTs;
+ HANDLE m_pollingConn;
};
diff --git a/protocols/VKontakte/src/vk_queue.cpp b/protocols/VKontakte/src/vk_queue.cpp index e81bc61b0c..0e204109f2 100644 --- a/protocols/VKontakte/src/vk_queue.cpp +++ b/protocols/VKontakte/src/vk_queue.cpp @@ -72,21 +72,22 @@ bool CVkProto::PushAsyncHttpRequest(int iRequestType, LPCSTR szUrl, bool bSecure pReq->flags |= NLHRF_SSL;
CMStringA url;
- if (nParams > 0) {
+ if (*szUrl == '/') {
url = VK_API_URL;
url += szUrl;
- for (int i=0; i < nParams; i++) {
- url.AppendChar((i == 0) ? '?' : '&');
- url += pParams[i].szName;
- url.AppendChar('=');
- url += ptrA( mir_urlEncode(pParams[i].szValue));
- }
pReq->nlc = m_hNetlibConn;
}
else {
url = szUrl;
pReq->flags |= NLHRF_REMOVEHOST | NLHRF_SMARTREMOVEHOST;
}
+
+ for (int i=0; i < nParams; i++) {
+ url.AppendChar((i == 0) ? '?' : '&');
+ url += pParams[i].szName;
+ url.AppendChar('=');
+ url += ptrA( mir_urlEncode(pParams[i].szValue));
+ }
pReq->requestType = iRequestType;
pReq->szUrl = mir_strdup(url);
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 4ef6be5c89..d191f70b2c 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -207,6 +207,7 @@ void CVkProto::OnReceiveMyInfo(NETLIBHTTPREQUEST *reply, void*) RetrieveUserInfo(m_myUserId);
RetrieveFriends();
+ RetrievePollingInfo();
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -315,3 +316,83 @@ void CVkProto::OnReceiveFriends(NETLIBHTTPREQUEST *reply, void*) if (szValue && *szValue) setTString(hContact, "Phone1", szValue);
}
}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CVkProto::RetrievePollingInfo()
+{
+ Netlib_Logf(m_hNetlibUser, "CVkProto::RetrievePollingInfo");
+
+ HttpParam param = { "access_token", m_szAccessToken };
+ PushAsyncHttpRequest(REQUEST_GET, "/method/messages.getLongPollServer.json", true, &CVkProto::OnReceivePollingInfo, 1, ¶m);
+}
+
+void CVkProto::OnReceivePollingInfo(NETLIBHTTPREQUEST *reply, void*)
+{
+ Netlib_Logf(m_hNetlibUser, "CVkProto::OnReceivePollingInfo %d", reply->resultCode);
+ if (reply->resultCode != 200)
+ return;
+
+ JSONROOT pRoot(reply->pData);
+ if ( !CheckJsonResult(pRoot))
+ return;
+
+ JSONNODE *pResponse = json_get(pRoot, "response");
+ if (pResponse == NULL)
+ return;
+
+ m_pollingTs = mir_t2a( ptrT( json_as_string( json_get(pResponse, "ts"))));
+ m_pollingKey = mir_t2a( ptrT( json_as_string( json_get(pResponse, "key"))));
+ m_pollingServer = mir_t2a( ptrT( json_as_string( json_get(pResponse, "server"))));
+ if (m_pollingTs != NULL && m_pollingKey != NULL && m_pollingServer != NULL)
+ ForkThread(&CVkProto::PollingThread, 0);
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+void CVkProto::PollServer()
+{
+ Netlib_Logf(m_hNetlibUser, "CVkProto::PollServer");
+
+ HttpParam params[] = {
+ { "act", "a_check" },
+ { "key", m_pollingKey },
+ { "ts", m_pollingTs },
+ { "wait", "25" },
+ { "access_token", m_szAccessToken }
+ };
+ PushAsyncHttpRequest(REQUEST_GET, m_pollingServer, true, &CVkProto::OnReceivePolling, SIZEOF(params), params);
+}
+
+void CVkProto::OnReceivePolling(NETLIBHTTPREQUEST *reply, void*)
+{
+ Netlib_Logf(m_hNetlibUser, "CVkProto::OnReceivePolling %d", reply->resultCode);
+ if (reply->resultCode != 200)
+ return;
+
+ JSONROOT pRoot(reply->pData);
+ if ( !CheckJsonResult(pRoot))
+ return;
+
+ JSONNODE *pResponse = json_get(pRoot, "response");
+ if (pResponse != NULL)
+ m_pollingTs = mir_t2a( ptrT( json_as_string( json_get(pResponse, "ts"))));
+}
+
+void CVkProto::PollingThread(void*)
+{
+ NETLIBOPENCONNECTION nloc = { sizeof(nloc) };
+ nloc.flags = NLOCF_SSL | NLOCF_HTTP | NLOCF_V2;
+ nloc.szHost = VK_API_URL;
+ nloc.wPort = 443;
+ nloc.timeout = 60*1000;
+ m_pollingConn = (HANDLE)CallService(MS_NETLIB_OPENCONNECTION, (WPARAM)m_hNetlibUser, (LPARAM)&nloc);
+ if (m_pollingConn == NULL)
+ return;
+
+ while (!m_bTerminated)
+ PollServer();
+
+ CallService(MS_NETLIB_CLOSEHANDLE, (WPARAM)m_pollingConn, 0);
+ m_pollingConn = NULL;
+}
diff --git a/protocols/WhatsApp/src/chat.cpp b/protocols/WhatsApp/src/chat.cpp index 27d1cc3b22..e978c9f0ee 100644 --- a/protocols/WhatsApp/src/chat.cpp +++ b/protocols/WhatsApp/src/chat.cpp @@ -38,7 +38,7 @@ int WhatsAppProto::OnChatOutgoing(WPARAM wParam, LPARAM lParam) HANDLE hContact = this->ContactIDToHContact(chat_id);
if (hContact)
{
- LOG("**Chat - Outgoing message: %s", text);
+ debugLogA("**Chat - Outgoing message: %s", text);
this->SendMsg(hContact, IS_CHAT, msg.c_str());
// #TODO Move to SendMsgWorker, otherwise all messages are "acknowledged" by Miranda
diff --git a/protocols/WhatsApp/src/connection.cpp b/protocols/WhatsApp/src/connection.cpp index d7cfd7c93e..9aae55ac32 100644 --- a/protocols/WhatsApp/src/connection.cpp +++ b/protocols/WhatsApp/src/connection.cpp @@ -33,7 +33,7 @@ void WhatsAppProto::ChangeStatus(void*) {
SetEvent(update_loop_lock_);
this->conn->forceShutdown();
- LOG("Forced shutdown");
+ debugLogA("Forced shutdown");
}
}
}
@@ -128,7 +128,7 @@ void WhatsAppProto::stayConnectedLoop(void*) desiredStatus = this->m_iDesiredStatus;
if (desiredStatus == ID_STATUS_OFFLINE || error)
{
- LOG("Set status to offline");
+ debugLogA("Set status to offline");
SetAllContactStatuses( ID_STATUS_OFFLINE, true );
this->ToggleStatusMenuItems(false);
int prevStatus = this->m_iStatus;
@@ -137,7 +137,7 @@ void WhatsAppProto::stayConnectedLoop(void*) break;
}
- LOG("Connecting...");
+ debugLogA("Connecting...");
this->m_iStatus = ID_STATUS_CONNECTING;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) ID_STATUS_OFFLINE, m_iStatus);
@@ -167,7 +167,7 @@ void WhatsAppProto::stayConnectedLoop(void*) connection->sendAvailableForChat();
}
- LOG("Set status to online");
+ debugLogA("Set status to online");
this->m_iStatus = desiredStatus;
ProtoBroadcastAck(0, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE )m_iStatus, ID_STATUS_CONNECTING);
this->ToggleStatusMenuItems(true);
@@ -181,7 +181,7 @@ void WhatsAppProto::stayConnectedLoop(void*) this->lastPongTime = time(NULL);
cont = connection->read();
}
- LOG("Exit from read-loop");
+ debugLogA("Exit from read-loop");
CODE_BLOCK_CATCH(WAException)
error = true;
@@ -191,7 +191,7 @@ void WhatsAppProto::stayConnectedLoop(void*) error = true;
CODE_BLOCK_END
}
- LOG("Break out from loop");
+ debugLogA("Break out from loop");
}
void WhatsAppProto::sentinelLoop(void*)
@@ -207,7 +207,7 @@ void WhatsAppProto::sentinelLoop(void*) if (quietInterval >= MAX_SILENT_INTERVAL)
{
CODE_BLOCK_TRY
- LOG("send ping");
+ debugLogA("send ping");
this->lastPongTime = time(NULL);
this->connection->sendPing();
CODE_BLOCK_CATCH(exception)
@@ -224,14 +224,14 @@ void WhatsAppProto::sentinelLoop(void*) }
}
ResetEvent(update_loop_lock_);
- LOG("Exiting sentinel loop");
+ debugLogA("Exiting sentinel loop");
}
void WhatsAppProto::onPing(const std::string& id)
{
if (this->isOnline()) {
CODE_BLOCK_TRY
- LOG("Sending pong with id %s", id.c_str());
+ debugLogA("Sending pong with id %s", id.c_str());
this->connection->sendPong(id);
CODE_BLOCK_CATCH_ALL
}
diff --git a/protocols/WhatsApp/src/contacts.cpp b/protocols/WhatsApp/src/contacts.cpp index 8ed8b0e918..ead537fc1d 100644 --- a/protocols/WhatsApp/src/contacts.cpp +++ b/protocols/WhatsApp/src/contacts.cpp @@ -61,7 +61,7 @@ HANDLE WhatsAppProto::AddToContactList(const std::string& jid, BYTE type, bool d if (CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hContact, (LPARAM)m_szModuleName) == 0)
{
setString(hContact, "ID", jid.c_str());
- LOG("Added contact %s", jid.c_str());
+ debugLogA("Added contact %s", jid.c_str());
setString(hContact, "MirVer", "WhatsApp");
db_unset(hContact, "CList", "MyHandle");
db_set_b(hContact, "CList", "NotOnList", 1);
@@ -315,7 +315,7 @@ void WhatsAppProto::onSendGetPicture(const std::string& jid, const std::vector<u HANDLE hContact = this->ContactIDToHContact(jid);
if (hContact)
{
- LOG("Updating avatar for jid %s", jid.c_str());
+ debugLogA("Updating avatar for jid %s", jid.c_str());
// Save avatar
std::tstring filename = this->GetAvatarFolder() ;
@@ -396,11 +396,11 @@ void WhatsAppProto::SendGetGroupInfoWorker(void* data) void WhatsAppProto::onGroupInfo(const std::string& gjid, const std::string& ownerJid, const std::string& subject, const std::string& createrJid, int paramInt1, int paramInt2)
{
- LOG("'%s', '%s', '%s', '%s'", gjid.c_str(), ownerJid.c_str(), subject.c_str(), createrJid.c_str());
+ debugLogA("'%s', '%s', '%s', '%s'", gjid.c_str(), ownerJid.c_str(), subject.c_str(), createrJid.c_str());
HANDLE hContact = ContactIDToHContact(gjid);
if (!hContact)
{
- LOG("Group info requested for non existing contact '%s'", gjid.c_str());
+ debugLogA("Group info requested for non existing contact '%s'", gjid.c_str());
return;
}
setByte(hContact, "SimpleChatRoom", ownerJid.compare(this->jid) == 0 ? 2 : 1);
@@ -411,18 +411,18 @@ void WhatsAppProto::onGroupInfo(const std::string& gjid, const std::string& owne void WhatsAppProto::onGroupInfoFromList(const std::string& paramString1, const std::string& paramString2, const std::string& paramString3, const std::string& paramString4, int paramInt1, int paramInt2)
{
// Called before onOwningGroups() or onParticipatingGroups() is called!
- LOG("");
+ debugLogA("");
}
void WhatsAppProto::onGroupNewSubject(const std::string& from, const std::string& author, const std::string& newSubject, int paramInt)
{
- LOG("'%s', '%s', '%s'", from.c_str(), author.c_str(), newSubject.c_str());
+ debugLogA("'%s', '%s', '%s'", from.c_str(), author.c_str(), newSubject.c_str());
HANDLE hContact = this->AddToContactList(from, 0, false, newSubject.c_str(), true);
}
void WhatsAppProto::onGroupAddUser(const std::string& paramString1, const std::string& paramString2)
{
- LOG("%s - user: %s", paramString1.c_str(), paramString2.c_str());
+ debugLogA("%s - user: %s", paramString1.c_str(), paramString2.c_str());
HANDLE hContact = this->AddToContactList(paramString1);
std::string groupName(this->GetContactDisplayName(hContact));
@@ -445,7 +445,7 @@ void WhatsAppProto::onGroupAddUser(const std::string& paramString1, const std::s void WhatsAppProto::onGroupRemoveUser(const std::string& paramString1, const std::string& paramString2)
{
- LOG("%s - user: %s", paramString1.c_str(), paramString2.c_str());
+ debugLogA("%s - user: %s", paramString1.c_str(), paramString2.c_str());
HANDLE hContact = this->ContactIDToHContact(paramString1);
if (!hContact)
return;
@@ -472,7 +472,7 @@ void WhatsAppProto::onGroupRemoveUser(const std::string& paramString1, const std void WhatsAppProto::onLeaveGroup(const std::string& paramString)
{
// Won't be called for unknown reasons!
- LOG("%s", this->GetContactDisplayName(paramString).c_str());
+ debugLogA("%s", this->GetContactDisplayName(paramString).c_str());
HANDLE hContact = this->ContactIDToHContact(paramString);
if (hContact)
setByte(hContact, "IsGroupMember", 0);
@@ -480,7 +480,7 @@ void WhatsAppProto::onLeaveGroup(const std::string& paramString) void WhatsAppProto::onGetParticipants(const std::string& gjid, const std::vector<string>& participants)
{
- LOG("%s", this->GetContactDisplayName(gjid).c_str());
+ debugLogA("%s", this->GetContactDisplayName(gjid).c_str());
HANDLE hUserContact;
HANDLE hContact = this->ContactIDToHContact(gjid);
@@ -536,7 +536,7 @@ INT_PTR __cdecl WhatsAppProto::OnAddContactToGroup(WPARAM wParam, LPARAM, LPARAM {
string a = GetContactDisplayName((HANDLE) wParam);
string b = GetContactDisplayName((HANDLE) lParam);
- LOG("Request add user %s to group %s", a.c_str(), b.c_str());
+ debugLogA("Request add user %s to group %s", a.c_str(), b.c_str());
if (!this->isOnline())
return NULL;
@@ -564,7 +564,7 @@ INT_PTR __cdecl WhatsAppProto::OnRemoveContactFromGroup(WPARAM wParam, LPARAM, L {
string a = GetContactDisplayName((HANDLE) wParam);
string b = GetContactDisplayName((HANDLE) lParam);
- LOG("Request remove user %s from group %s", a.c_str(), b.c_str());
+ debugLogA("Request remove user %s from group %s", a.c_str(), b.c_str());
if (!this->isOnline())
return NULL;
@@ -589,13 +589,13 @@ INT_PTR __cdecl WhatsAppProto::OnRemoveContactFromGroup(WPARAM wParam, LPARAM, L void WhatsAppProto::onOwningGroups(const std::vector<string>& paramVector)
{
- LOG("");
+ debugLogA("");
this->HandleReceiveGroups(paramVector, true);
}
void WhatsAppProto::onParticipatingGroups(const std::vector<string>& paramVector)
{
- LOG("");
+ debugLogA("");
this->HandleReceiveGroups(paramVector, false);
}
@@ -629,7 +629,7 @@ void WhatsAppProto::HandleReceiveGroups(const std::vector<string>& groups, bool {
if (IsMyContact(hContact) && getByte(hContact, "SimpleChatRoom", 0) > 0)
{
- //LOG("Set IsGroupMember to 0 for '%s'", this->GetContactDisplayName(hContact).c_str());
+ //debugLogA("Set IsGroupMember to 0 for '%s'", this->GetContactDisplayName(hContact).c_str());
setByte(hContact, "IsGroupMember", isMember.find(hContact) == isMember.end() ? 0 : 1);
}
}
@@ -639,7 +639,7 @@ void WhatsAppProto::HandleReceiveGroups(const std::vector<string>& groups, bool void WhatsAppProto::onGroupCreated(const std::string& paramString1, const std::string& paramString2)
{
// Must be received after onOwningGroups() :/
- LOG("%s / %s", paramString1.c_str(), paramString2.c_str());
+ debugLogA("%s / %s", paramString1.c_str(), paramString2.c_str());
string jid = paramString2 +string("@")+ paramString1;
HANDLE hContact = this->AddToContactList(jid, 0, false, NULL, true);
setByte(hContact, "SimpleChatRoom", 2);
@@ -648,7 +648,7 @@ void WhatsAppProto::onGroupCreated(const std::string& paramString1, const std::s // Menu-handler
INT_PTR __cdecl WhatsAppProto::OnCreateGroup(WPARAM wParam, LPARAM lParam)
{
- LOG("");
+ debugLogA("");
input_box* ib = new input_box;
ib->defaultValue = _T("");
ib->limit = WHATSAPP_GROUP_NAME_LIMIT;
diff --git a/protocols/WhatsApp/src/definitions.h b/protocols/WhatsApp/src/definitions.h index 4e24139d67..4817f56a98 100644 --- a/protocols/WhatsApp/src/definitions.h +++ b/protocols/WhatsApp/src/definitions.h @@ -4,13 +4,12 @@ #define FLAG_CONTAINS(x,y) ( ( x & y ) == y )
#define REMOVE_FLAG(x,y) ( x = ( x & ~y ))
-#define LOG(fmt, ...) Log(__FUNCTION__, fmt, ##__VA_ARGS__)
#define CODE_BLOCK_TRY try {
-#define CODE_BLOCK_CATCH(ex) } catch (ex& e) { LOG("Exception: %s", e.what());
-#define CODE_BLOCK_CATCH_UNKNOWN } catch (...) { LOG("Unknown exception");
-#define CODE_BLOCK_CATCH_ALL } catch (WAException& e) { LOG("Exception: %s", e.what()); \
- } catch (exception& e) { LOG("Exception: %s", e.what()); \
- } catch (...) { LOG("Unknown exception"); }
+#define CODE_BLOCK_CATCH(ex) } catch (ex& e) { debugLogA("Exception: %s", e.what());
+#define CODE_BLOCK_CATCH_UNKNOWN } catch (...) { debugLogA("Unknown exception");
+#define CODE_BLOCK_CATCH_ALL } catch (WAException& e) { debugLogA("Exception: %s", e.what()); \
+ } catch (exception& e) { debugLogA("Exception: %s", e.what()); \
+ } catch (...) { debugLogA("Unknown exception"); }
#define CODE_BLOCK_END }
#define NIIF_INTERN_TCHAR NIIF_INTERN_UNICODE
diff --git a/protocols/WhatsApp/src/messages.cpp b/protocols/WhatsApp/src/messages.cpp index ba0b4210f5..00ddab1e12 100644 --- a/protocols/WhatsApp/src/messages.cpp +++ b/protocols/WhatsApp/src/messages.cpp @@ -42,7 +42,7 @@ void WhatsAppProto::onMessageForMe(FMessage* paramFMessage, bool paramBoolean) int WhatsAppProto::SendMsg(HANDLE hContact, int flags, const char *msg)
{
- LOG("");
+ debugLogA("");
int msgId = ++(this->msgId);
ForkThread( &WhatsAppProto::SendMsgWorker, new send_direct(hContact, msg, (HANDLE) msgId, flags & IS_CHAT));
@@ -51,7 +51,7 @@ int WhatsAppProto::SendMsg(HANDLE hContact, int flags, const char *msg) void WhatsAppProto::SendMsgWorker(void* p)
{
- LOG("");
+ debugLogA("");
if (p == NULL)
return;
@@ -60,7 +60,7 @@ void WhatsAppProto::SendMsgWorker(void* p) if (getByte(data->hContact, "SimpleChatRoom", 0) > 0 && getByte(data->hContact, "IsGroupMember", 0) == 0)
{
- LOG("not a group member");
+ debugLogA("not a group member");
ProtoBroadcastAck(data->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED,
(HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) "You cannot send messages to groups if you are not a member.");
}
@@ -85,20 +85,20 @@ void WhatsAppProto::SendMsgWorker(void* p) }
catch (exception &e)
{
- LOG("exception: %s", e.what());
+ debugLogA("exception: %s", e.what());
ProtoBroadcastAck(data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED,
(HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) e.what());
}
catch (...)
{
- LOG("unknown exception");
+ debugLogA("unknown exception");
ProtoBroadcastAck(data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED,
(HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) "Failed sending message");
}
}
else
{
- LOG("No connection");
+ debugLogA("No connection");
ProtoBroadcastAck(data->hContact,ACKTYPE_MESSAGE,ACKRESULT_FAILED,
(HANDLE) (this->msgIdHeader + this->msgId), (LPARAM) "You cannot send messages when you are offline.");
}
@@ -163,7 +163,7 @@ void WhatsAppProto::SendTypingWorker(void* p) void WhatsAppProto::onMessageStatusUpdate(FMessage* fmsg)
{
- LOG("");
+ debugLogA("");
HANDLE hContact = this->ContactIDToHContact(fmsg->key->remote_jid);
if (hContact == 0)
diff --git a/protocols/WhatsApp/src/proto.cpp b/protocols/WhatsApp/src/proto.cpp index b362c7a059..936248b082 100644 --- a/protocols/WhatsApp/src/proto.cpp +++ b/protocols/WhatsApp/src/proto.cpp @@ -90,7 +90,7 @@ DWORD_PTR WhatsAppProto::GetCaps( int type, HANDLE hContact ) int WhatsAppProto::SetStatus( int new_status )
{
- LOG("===== Beginning SetStatus process");
+ debugLogA("===== Beginning SetStatus process");
// Routing statuses not supported by WhatsApp
switch ( new_status )
@@ -119,13 +119,13 @@ int WhatsAppProto::SetStatus( int new_status ) if (m_iStatus == ID_STATUS_CONNECTING)
{
- LOG("===== Status is connecting, no change");
+ debugLogA("===== Status is connecting, no change");
return 0;
}
if (m_iStatus == m_iDesiredStatus)
{
- LOG("===== Statuses are same, no change");
+ debugLogA("===== Statuses are same, no change");
return 0;
}
@@ -227,7 +227,7 @@ string WhatsAppProto::Register(int state, string cc, string number, string code) return ret;
}
- LOG("Server response: %s", pnlhr->pData);
+ debugLogA("Server response: %s", pnlhr->pData);
MessageBoxA(NULL, pnlhr->pData, "Debug", MB_OK);
JSONROOT resp(pnlhr->pData);
@@ -284,7 +284,7 @@ INT_PTR WhatsAppProto::SvcCreateAccMgrUI(WPARAM wParam,LPARAM lParam) int WhatsAppProto::RefreshBuddyList(WPARAM, LPARAM )
{
- LOG("");
+ debugLogA("");
if (!isOffline())
{
//ForkThread(
@@ -316,28 +316,6 @@ std::tstring WhatsAppProto::GetAvatarFolder() return def_avatar_folder_;
}
-int WhatsAppProto::Log(const char* fn, const char *fmt,...)
-{
-#if !defined(_DEBUG)
- if (!getByte(WHATSAPP_KEY_LOGGING_ENABLE, 0))
- return EXIT_SUCCESS;
-#endif
-
- va_list va;
- char text[65535];
- ScopedLock s(log_lock_);
-
- va_start(va,fmt);
- mir_vsnprintf(text,sizeof(text),fmt,va);
- va_end(va);
-
- // Write into network log
- //CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)text);
-
- // Write into log file
- return utils::debug::log(m_szModuleName, std::string(fn).append(" - ").append(text));
-}
-
LRESULT CALLBACK PopupDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
diff --git a/protocols/WhatsApp/src/proto.h b/protocols/WhatsApp/src/proto.h index a2be9e9e5a..10969f44fb 100644 --- a/protocols/WhatsApp/src/proto.h +++ b/protocols/WhatsApp/src/proto.h @@ -152,7 +152,6 @@ public: std::tstring def_avatar_folder_;
- HANDLE m_hNetlibUser;
WASocketConnection* conn;
WAConnection* connection;
Mutex connMutex;
@@ -171,41 +170,40 @@ public: // WhatsApp Events
virtual void onMessageForMe(FMessage* paramFMessage, bool paramBoolean);
virtual void onMessageStatusUpdate(FMessage* paramFMessage);
- virtual void onMessageError(FMessage* message, int paramInt) { LOG(""); }
+ virtual void onMessageError(FMessage* message, int paramInt) { debugLogA(""); }
virtual void onPing(const std::string& id) throw (WAException);
- virtual void onPingResponseReceived() { LOG(""); }
+ virtual void onPingResponseReceived() { debugLogA(""); }
virtual void onAvailable(const std::string& paramString, bool paramBoolean);
- virtual void onClientConfigReceived(const std::string& paramString) { LOG(""); }
+ virtual void onClientConfigReceived(const std::string& paramString) { debugLogA(""); }
virtual void onLastSeen(const std::string& paramString1, int paramInt, std::string* paramString2);
virtual void onIsTyping(const std::string& paramString, bool paramBoolean);
- virtual void onAccountChange(int paramInt, time_t expire_date) { LOG(""); }
- virtual void onPrivacyBlockListAdd(const std::string& paramString) { LOG(""); }
- virtual void onPrivacyBlockListClear() { LOG(""); }
- virtual void onDirty(const std::map<string,string>& paramHashtable) { LOG(""); }
- virtual void onDirtyResponse(int paramHashtable) { LOG(""); }
- virtual void onRelayRequest(const std::string& paramString1, int paramInt, const std::string& paramString2) { LOG(""); }
+ virtual void onAccountChange(int paramInt, time_t expire_date) { debugLogA(""); }
+ virtual void onPrivacyBlockListAdd(const std::string& paramString) { debugLogA(""); }
+ virtual void onPrivacyBlockListClear() { debugLogA(""); }
+ virtual void onDirty(const std::map<string,string>& paramHashtable) { debugLogA(""); }
+ virtual void onDirtyResponse(int paramHashtable) { debugLogA(""); }
+ virtual void onRelayRequest(const std::string& paramString1, int paramInt, const std::string& paramString2) { debugLogA(""); }
virtual void onSendGetPictureIds(std::map<string,string>* ids);
virtual void onSendGetPicture(const std::string& jid, const std::vector<unsigned char>& data, const std::string& oldId, const std::string& newId);
virtual void onPictureChanged(const std::string& from, const std::string& author, bool set);
- virtual void onDeleteAccount(bool result) { LOG(""); }
+ virtual void onDeleteAccount(bool result) { debugLogA(""); }
virtual void onGroupAddUser(const std::string& paramString1, const std::string& paramString2);
virtual void onGroupRemoveUser(const std::string& paramString1, const std::string& paramString2);
virtual void onGroupNewSubject(const std::string& from, const std::string& author, const std::string& newSubject, int paramInt);
- virtual void onServerProperties(std::map<std::string, std::string>* nameValueMap) { LOG(""); }
+ virtual void onServerProperties(std::map<std::string, std::string>* nameValueMap) { debugLogA(""); }
virtual void onGroupCreated(const std::string& paramString1, const std::string& paramString2);
virtual void onGroupInfo(const std::string& paramString1, const std::string& paramString2, const std::string& paramString3, const std::string& paramString4, int paramInt1, int paramInt2);
virtual void onGroupInfoFromList(const std::string& paramString1, const std::string& paramString2, const std::string& paramString3, const std::string& paramString4, int paramInt1, int paramInt2);
virtual void onOwningGroups(const std::vector<string>& paramVector);
- virtual void onSetSubject(const std::string& paramString) { LOG(""); }
- virtual void onAddGroupParticipants(const std::string& paramString, const std::vector<string>& paramVector, int paramHashtable) { LOG(""); }
- virtual void onRemoveGroupParticipants(const std::string& paramString, const std::vector<string>& paramVector, int paramHashtable) { LOG(""); }
+ virtual void onSetSubject(const std::string& paramString) { debugLogA(""); }
+ virtual void onAddGroupParticipants(const std::string& paramString, const std::vector<string>& paramVector, int paramHashtable) { debugLogA(""); }
+ virtual void onRemoveGroupParticipants(const std::string& paramString, const std::vector<string>& paramVector, int paramHashtable) { debugLogA(""); }
virtual void onGetParticipants(const std::string& gjid, const std::vector<string>& participants);
virtual void onParticipatingGroups(const std::vector<string>& paramVector);
virtual void onLeaveGroup(const std::string& paramString);
// Information providing
- int Log(const char* fn, const char *fmt,...);
void NotifyEvent(TCHAR* title, TCHAR* info, HANDLE contact, DWORD flags, TCHAR* url=NULL);
void NotifyEvent(const string& title, const string& info, HANDLE contact, DWORD flags, TCHAR* url=NULL);
diff --git a/protocols/WhatsApp/src/theme.cpp b/protocols/WhatsApp/src/theme.cpp index 1738577262..e5285ddf0a 100644 --- a/protocols/WhatsApp/src/theme.cpp +++ b/protocols/WhatsApp/src/theme.cpp @@ -106,9 +106,9 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) {
HANDLE hContact = reinterpret_cast<HANDLE>(wParam);
if (hContact)
- LOG(this->GetContactDisplayName(hContact).c_str());
+ debugLogA(this->GetContactDisplayName(hContact).c_str());
else
- LOG("No contact found");
+ debugLogA("No contact found");
if (g_hContactMenuItems[CMI_ADD_CONTACT_TO_GROUP] != NULL)
CallService("CList/RemoveContactMenuItem", (WPARAM) g_hContactMenuItems[CMI_ADD_CONTACT_TO_GROUP], (LPARAM) 0);
@@ -187,7 +187,7 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) map<HANDLE, map<HANDLE, bool>>::iterator groupsIt = this->isMemberByGroupContact.find(hContact);
if (groupsIt == this->isMemberByGroupContact.end())
{
- LOG("Group exists only on contact list");
+ debugLogA("Group exists only on contact list");
}
else
{
@@ -227,7 +227,7 @@ int WhatsAppProto::OnPrebuildContactMenu(WPARAM wParam,LPARAM lParam) int WhatsAppProto::OnBuildStatusMenu(WPARAM wParam,LPARAM lParam)
{
- LOG("");
+ debugLogA("");
char text[200];
strcpy(text,m_szModuleName);
char *tDest = text+strlen(text);
diff --git a/protocols/Xfire/src/Xfire_proxy.cpp b/protocols/Xfire/src/Xfire_proxy.cpp index 3198f4dc80..3df221039a 100644 --- a/protocols/Xfire/src/Xfire_proxy.cpp +++ b/protocols/Xfire/src/Xfire_proxy.cpp @@ -71,11 +71,11 @@ int AfterSystemModulesLoaded(WPARAM wParam,LPARAM lParam) {
//init netlib handle
NETLIBUSER nlu = {0};
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_INCOMING;
- nlu.szSettingsModule = protocolname;
- nlu.szDescriptiveName = "XFire server connection";
- hNetlib = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu);
+ nlu.cbSize = sizeof(nlu);
+ nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_INCOMING;
+ nlu.szSettingsModule = protocolname;
+ nlu.szDescriptiveName = "XFire server connection";
+ hNetlib = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu);
//init socet server
NETLIBBIND nb = {0};
@@ -84,12 +84,11 @@ int AfterSystemModulesLoaded(WPARAM wParam,LPARAM lParam) nb.pExtra = NULL;
nb.wPort = 25999;
hBindPort = (HANDLE)CallService(MS_NETLIB_BINDPORT, (WPARAM)hNetlib,(LPARAM) &nb);
-
-
return 0;
}
-int initXfireProxy() {
+int initXfireProxy()
+{
//inits nach dem alle module geladen wurden
HookEvent(ME_SYSTEM_MODULESLOADED, AfterSystemModulesLoaded);
return 0;
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp index 2b3f93ee3a..1b1c48147a 100644 --- a/protocols/Xfire/src/main.cpp +++ b/protocols/Xfire/src/main.cpp @@ -921,18 +921,8 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) strcat(servicefunction, PS_SETAWAYMSG);
CreateServiceFunction(servicefunction, SetAwayMsg);
- /*NETLIBUSER nlu;
- ZeroMemory(&nlu, sizeof(nlu));
- nlu.cbSize = sizeof(nlu);
- nlu.flags = NUF_NOHTTPSOPTION;
- nlu.szSettingsModule = protocolname;
- nlu.szDescriptiveName = "XFire Gamedetectionthread";
- hNetlibUser = (HANDLE) CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM) & nlu);*/
-
-
// Variables support
- if (ServiceExists(MS_VARS_REGISTERTOKEN))
- {
+ if (ServiceExists(MS_VARS_REGISTERTOKEN)) {
TOKENREGISTER tr = {0};
tr.cbSize = sizeof(TOKENREGISTER);
tr.memType = TR_MEM_MIRANDA;
@@ -977,7 +967,6 @@ static int OnSystemModulesLoaded(WPARAM wParam,LPARAM lParam) tr.parseFunction = Varmyxfirevoiceip;
tr.szHelpText = LPGEN("XFire")"\t"LPGEN("My Voice ServerIP");
CallService(MS_VARS_REGISTERTOKEN, 0, (LPARAM) &tr);
-
}
//File Association Manager support
diff --git a/protocols/Yahoo/src/avatar.cpp b/protocols/Yahoo/src/avatar.cpp index 2e3c71cacf..47318c1b3e 100644 --- a/protocols/Yahoo/src/avatar.cpp +++ b/protocols/Yahoo/src/avatar.cpp @@ -107,7 +107,7 @@ void __cdecl CYahooProto::send_avt_thread(void *psf) {
struct yahoo_file_info *sf = ( yahoo_file_info* )psf;
if (sf == NULL) {
- DebugLog("[yahoo_send_avt_thread] SF IS NULL!!!");
+ debugLogA("[yahoo_send_avt_thread] SF IS NULL!!!");
return;
}
@@ -139,7 +139,7 @@ void CYahooProto::SendAvatar(const TCHAR *szFile) WideCharToMultiByte(CP_ACP, 0, tszFilename, -1, szFilename, MAX_PATH, 0, 0);
sf->filename = strdup(szFilename);
- DebugLog("[Uploading avatar] filename: %s size: %ld", sf->filename, sf->filesize);
+ debugLogA("[Uploading avatar] filename: %s size: %ld", sf->filename, sf->filesize);
ForkThread(&CYahooProto::send_avt_thread, sf);
}
@@ -159,12 +159,12 @@ void __cdecl CYahooProto::recv_avatarthread(void *pavt) TCHAR buf[4096];
if (avt == NULL) {
- DebugLog("AVT IS NULL!!!");
+ debugLogA("AVT IS NULL!!!");
return;
}
if (!m_bLoggedIn) {
- DebugLog("We are not logged in!!!");
+ debugLogA("We are not logged in!!!");
return;
}
@@ -358,7 +358,7 @@ void CYahooProto::ext_got_picture(const char *me, const char *who, const char *p if (getDword(hContact, "PictCK", 0) != cksum || _taccess( z, 0) != 0) {
- DebugLog("[ext_yahoo_got_picture] Checksums don't match or avatar file is missing. Current: %d, New: %d",
+ debugLogA("[ext_yahoo_got_picture] Checksums don't match or avatar file is missing. Current: %d, New: %d",
getDword(hContact, "PictCK", 0), cksum);
struct avatar_info *avt = ( avatar_info* )malloc(sizeof(struct avatar_info));
@@ -630,24 +630,24 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) int avtType;
if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) {
- DebugLog("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal);
+ debugLogA("[YAHOO_GETAVATARINFO] For: %s", dbv.pszVal);
db_free(&dbv);
}else {
- DebugLog("[YAHOO_GETAVATARINFO]");
+ debugLogA("[YAHOO_GETAVATARINFO]");
}
if (!getByte("ShowAvatars", 1 ) || !m_bLoggedIn) {
- DebugLog("[YAHOO_GETAVATARINFO] %s", m_bLoggedIn ? "We are not using/showing avatars!" : "We are not logged in. Can't load avatars now!");
+ debugLogA("[YAHOO_GETAVATARINFO] %s", m_bLoggedIn ? "We are not using/showing avatars!" : "We are not logged in. Can't load avatars now!");
return GAIR_NOAVATAR;
}
avtType = getByte(AI->hContact, "AvatarType", 0);
- DebugLog("[YAHOO_GETAVATARINFO] Avatar Type: %d", avtType);
+ debugLogA("[YAHOO_GETAVATARINFO] Avatar Type: %d", avtType);
if ( avtType != 2) {
if (avtType != 0)
- DebugLog("[YAHOO_GETAVATARINFO] Not handling this type yet!");
+ debugLogA("[YAHOO_GETAVATARINFO] Not handling this type yet!");
return GAIR_NOAVATAR;
}
@@ -657,7 +657,7 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) GetAvatarFileName(AI->hContact, AI->filename, SIZEOF(AI->filename), getByte(AI->hContact, "AvatarType", 0));
AI->format = PA_FORMAT_PNG;
- DebugLog("[YAHOO_GETAVATARINFO] filename: %s", AI->filename);
+ debugLogA("[YAHOO_GETAVATARINFO] filename: %s", AI->filename);
if (_taccess( AI->filename, 0) == 0)
return GAIR_SUCCESS;
@@ -666,25 +666,25 @@ INT_PTR __cdecl CYahooProto::GetAvatarInfo(WPARAM wParam,LPARAM lParam) /* need to request it again? */
if (getDword(AI->hContact, "PictLoading", 0) != 0 &&
(time(NULL) - getDword(AI->hContact, "PictLastCheck", 0) < 500)) {
- DebugLog("[YAHOO_GETAVATARINFO] Waiting for avatar to load!");
+ debugLogA("[YAHOO_GETAVATARINFO] Waiting for avatar to load!");
return GAIR_WAITFOR;
} else if ( m_bLoggedIn ) {
DBVARIANT dbv;
if (!getString(AI->hContact, YAHOO_LOGINID, &dbv)) {
- DebugLog("[YAHOO_GETAVATARINFO] Requesting avatar!");
+ debugLogA("[YAHOO_GETAVATARINFO] Requesting avatar!");
request_avatar(dbv.pszVal);
db_free(&dbv);
return GAIR_WAITFOR;
} else {
- DebugLog("[YAHOO_GETAVATARINFO] Can't retrieve user id?!");
+ debugLogA("[YAHOO_GETAVATARINFO] Can't retrieve user id?!");
}
}
}
- DebugLog("[YAHOO_GETAVATARINFO] NO AVATAR???");
+ debugLogA("[YAHOO_GETAVATARINFO] NO AVATAR???");
return GAIR_NOAVATAR;
}
@@ -751,7 +751,7 @@ INT_PTR __cdecl CYahooProto::GetMyAvatar(WPARAM wParam, LPARAM lParam) TCHAR *buffer = ( TCHAR* )wParam;
int size = (int)lParam;
- DebugLog("[YahooGetMyAvatar]");
+ debugLogA("[YahooGetMyAvatar]");
if (buffer == NULL || size <= 0)
return -1;
@@ -792,7 +792,7 @@ INT_PTR __cdecl CYahooProto::SetMyAvatar(WPARAM wParam, LPARAM lParam) GetAvatarFileName(NULL, tszMyFile, MAX_PATH, 2);
if (tszFile == NULL) {
- DebugLog("[Deleting Avatar Info]");
+ debugLogA("[Deleting Avatar Info]");
/* remove ALL our Avatar Info Keys */
delSetting("AvatarFile");
diff --git a/protocols/Yahoo/src/file_transfer.cpp b/protocols/Yahoo/src/file_transfer.cpp index b629e39a7b..a3ac8bc57b 100644 --- a/protocols/Yahoo/src/file_transfer.cpp +++ b/protocols/Yahoo/src/file_transfer.cpp @@ -463,7 +463,7 @@ void __cdecl CYahooProto::recv_filethread(void *psf) ProtoBroadcastAck(sf->hContact, ACKTYPE_FILE, ACKRESULT_CONNECTING, sf, 0);
- DebugLog("[yahoo_recv_filethread] who: %s, msg: %s, filename: %s ", sf->who, sf->msg, fi->filename);
+ debugLogA("[yahoo_recv_filethread] who: %s, msg: %s, filename: %s ", sf->who, sf->msg, fi->filename);
yahoo_get_url_handle(m_id, sf->url, &dl_file, sf);
@@ -471,7 +471,7 @@ void __cdecl CYahooProto::recv_filethread(void *psf) if (sf->pfts.currentFileNumber >= sf->pfts.totalFiles)
free_ft(sf);
else
- DebugLog("[yahoo_recv_filethread] More files coming?");
+ debugLogA("[yahoo_recv_filethread] More files coming?");
}
void CYahooProto::ext_got_file(const char *me, const char *who, const char *url, long expires, const char *msg, const char *fname, unsigned long fesize, const char *ft_token, int y7)
@@ -512,7 +512,7 @@ void CYahooProto::ext_got_file(const char *me, const char *who, const char *url, y_filetransfer *ft = new_ft(this, m_id, hContact, who, msg, url, ft_token, y7, files, 0 /* downloading */);
if (ft == NULL) {
- DebugLog("SF IS NULL!!!");
+ debugLogA("SF IS NULL!!!");
return;
}
@@ -547,7 +547,7 @@ void CYahooProto::ext_got_files(const char *me, const char *who, const char *ft_ ft = new_ft(this, m_id, hContact, who, NULL, NULL, ft_token, y7, files, 0 /* downloading */);
if (ft == NULL) {
- DebugLog("SF IS NULL!!!");
+ debugLogA("SF IS NULL!!!");
return;
}
@@ -690,7 +690,7 @@ void __cdecl CYahooProto::send_filethread(void *psf) if (sf->pfts.currentFileNumber >= sf->pfts.totalFiles) {
free_ft(sf);
} else {
- DebugLog("[yahoo_send_filethread] More files coming?");
+ debugLogA("[yahoo_send_filethread] More files coming?");
}
}
@@ -742,7 +742,7 @@ HANDLE __cdecl CYahooProto::SendFile( HANDLE hContact, const PROTOCHAR* szDescri db_free(&dbv);
if (sf == NULL) {
- DebugLog("SF IS NULL!!!");
+ debugLogA("SF IS NULL!!!");
return 0;
}
@@ -768,7 +768,7 @@ HANDLE __cdecl CYahooProto::FileAllow( HANDLE /*hContact*/, HANDLE hTransfer, co y_filetransfer *ft = (y_filetransfer *)hTransfer;
size_t len;
- DebugLog("[YahooFileAllow]");
+ debugLogA("[YahooFileAllow]");
//LOG(LOG_INFO, "[%s] Requesting file from %s", ft->cookie, ft->user);
ft->pfts.tszWorkingDir = _tcsdup( szPath );
@@ -778,7 +778,7 @@ HANDLE __cdecl CYahooProto::FileAllow( HANDLE /*hContact*/, HANDLE hTransfer, co ft->pfts.tszWorkingDir[len] = 0;
if (ft->y7) {
- DebugLog("[YahooFileAllow] Trying to relay Y7 transfer.");
+ debugLogA("[YahooFileAllow] Trying to relay Y7 transfer.");
//void yahoo_ft7dc_accept(int id, const char *buddy, const char *ft_token);
yahoo_ft7dc_accept(ft->id, ft->who, ft->ftoken);
@@ -794,7 +794,7 @@ HANDLE __cdecl CYahooProto::FileAllow( HANDLE /*hContact*/, HANDLE hTransfer, co int __cdecl CYahooProto::FileCancel( HANDLE /*hContact*/, HANDLE hTransfer )
{
- DebugLog("[YahooFileCancel]");
+ debugLogA("[YahooFileCancel]");
y_filetransfer* ft = (y_filetransfer*)hTransfer;
@@ -820,15 +820,15 @@ int __cdecl CYahooProto::FileDeny( HANDLE /*hContact*/, HANDLE hTransfer, const /* deny file receive request.. just ignore it! */
y_filetransfer *ft = (y_filetransfer *)hTransfer;
- DebugLog("[YahooFileDeny]");
+ debugLogA("[YahooFileDeny]");
if ( !m_bLoggedIn || ft == NULL) {
- DebugLog("[YahooFileDeny] Not logged-in or some other error!");
+ debugLogA("[YahooFileDeny] Not logged-in or some other error!");
return 1;
}
if (ft->y7) {
- DebugLog("[YahooFileDeny] Y7 Transfer detected.");
+ debugLogA("[YahooFileDeny] Y7 Transfer detected.");
//void yahoo_ft7dc_accept(int id, const char *buddy, const char *ft_token);
yahoo_ft7dc_deny(ft->id, ft->who, ft->ftoken);
return 0;
@@ -837,7 +837,7 @@ int __cdecl CYahooProto::FileDeny( HANDLE /*hContact*/, HANDLE hTransfer, const if (ft->ftoken != NULL) {
struct yahoo_file_info *fi = (struct yahoo_file_info *)ft->files->data;
- DebugLog("[YahooFileDeny] DC Detected: Denying File Transfer!");
+ debugLogA("[YahooFileDeny] DC Detected: Denying File Transfer!");
yahoo_ftdc_deny(m_id, ft->who, fi->filename, ft->ftoken, 2);
}
return 0;
@@ -850,19 +850,19 @@ int __cdecl CYahooProto::FileResume( HANDLE hTransfer, int* action, const PROTOC {
y_filetransfer *ft = (y_filetransfer *)hTransfer;
- DebugLog("[YahooFileResume] Action: %d", *action);
+ debugLogA("[YahooFileResume] Action: %d", *action);
if ( !m_bLoggedIn || ft == NULL) {
- DebugLog("[YahooFileResume] Not loggedin or some other error!");
+ debugLogA("[YahooFileResume] Not loggedin or some other error!");
return 1;
}
ft->action = *action;
- DebugLog("[YahooFileResume] Action: %d", *action);
+ debugLogA("[YahooFileResume] Action: %d", *action);
if ( *action == FILERESUME_RENAME ) {
- DebugLog("[YahooFileResume] Renamed file!");
+ debugLogA("[YahooFileResume] Renamed file!");
FREE(ft->pfts.tszCurrentFile);
ft->pfts.tszCurrentFile = _tcsdup( *szFilename );
diff --git a/protocols/Yahoo/src/http_gateway.cpp b/protocols/Yahoo/src/http_gateway.cpp index ab096a3261..bbdc47c861 100644 --- a/protocols/Yahoo/src/http_gateway.cpp +++ b/protocols/Yahoo/src/http_gateway.cpp @@ -19,7 +19,7 @@ int YAHOO_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPRE {
NETLIBHTTPPROXYINFO nlhpi;
- DebugLog("YAHOO_httpGatewayInit!!!");
+ debugLogA("YAHOO_httpGatewayInit!!!");
ZeroMemory(&nlhpi, sizeof(nlhpi));
nlhpi.cbSize = sizeof(nlhpi);
@@ -30,7 +30,7 @@ int YAHOO_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPRE int YAHOO_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDASERVICE pfnNetlibSend)
{
- DebugLog("YAHOO_httpGatewayWrapSend!!! Len: %d", len);
+ debugLogA("YAHOO_httpGatewayWrapSend!!! Len: %d", len);
if (len == 0 && m_id > 0) { // we need to send something!!!
int n;
@@ -38,12 +38,12 @@ int YAHOO_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRAN int ret = 0;
if (z != NULL) {
- DebugLog("YAHOO_httpGatewayWrapSend!!! Got Len: %d", n);
+ debugLogA("YAHOO_httpGatewayWrapSend!!! Got Len: %d", n);
NETLIBBUFFER tBuf = { ( char* )z, n, flags };
ret = pfnNetlibSend((LPARAM)hConn, (WPARAM) &tBuf );
FREE(z);
} else {
- DebugLog("YAHOO_httpGatewayWrapSend!!! GOT NULL???");
+ debugLogA("YAHOO_httpGatewayWrapSend!!! GOT NULL???");
}
return ret;
@@ -56,15 +56,15 @@ int YAHOO_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRAN PBYTE YAHOO_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, int *outBufLen, void *(*NetlibRealloc)(void *, size_t))
{
- DebugLog("YAHOO_httpGatewayUnwrapRecv!!! Len: %d", len);
+ debugLogA("YAHOO_httpGatewayUnwrapRecv!!! Len: %d", len);
- DebugLog("Got headers: %d", nlhr->headersCount);
+ debugLogA("Got headers: %d", nlhr->headersCount);
/* we need to get the first 4 bytes! */
if (len < 4)
return NULL;
ylad->rpkts = buf[0] + buf[1] *256;
- DebugLog("Got packets: %d", ylad->rpkts);
+ debugLogA("Got packets: %d", ylad->rpkts);
if (len == 4) {
*outBufLen = 0;
diff --git a/protocols/Yahoo/src/ignore.cpp b/protocols/Yahoo/src/ignore.cpp index 3a0a6f2cdb..4c7cb47225 100644 --- a/protocols/Yahoo/src/ignore.cpp +++ b/protocols/Yahoo/src/ignore.cpp @@ -56,11 +56,11 @@ void CYahooProto::ext_got_ignore(YList * igns) while (l != NULL) {
struct yahoo_buddy *b = (struct yahoo_buddy *) l->data;
- YAHOO_DEBUGLOG("[ext_yahoo_got_ignore] Buddy: %s", b->id );
+ debugLogA("[ext_yahoo_got_ignore] Buddy: %s", b->id );
l = l->next;
}
- YAHOO_DEBUGLOG("[ext_yahoo_got_ignore] End Of Ignore List");
+ debugLogA("[ext_yahoo_got_ignore] End Of Ignore List");
}
diff --git a/protocols/Yahoo/src/im.cpp b/protocols/Yahoo/src/im.cpp index 08ab726172..63ef43875b 100644 --- a/protocols/Yahoo/src/im.cpp +++ b/protocols/Yahoo/src/im.cpp @@ -213,7 +213,7 @@ int __cdecl CYahooProto::RecvMsg( HANDLE hContact, PROTORECVEVENT* pre ) // NUDGES
if ( !lstrcmpA(pre->szMessage, "<ding>") && ServiceExists("NUDGE/Send")) {
- DebugLog("[YahooRecvMessage] Doing Nudge Service!");
+ debugLogA("[YahooRecvMessage] Doing Nudge Service!");
NotifyEventHooks(hYahooNudge, (WPARAM)hContact, pre->timestamp);
return 0;
}
@@ -229,7 +229,7 @@ INT_PTR __cdecl CYahooProto::SendNudge(WPARAM wParam, LPARAM lParam) {
HANDLE hContact = (HANDLE) wParam;
- DebugLog("[YAHOO_SENDNUDGE]");
+ debugLogA("[YAHOO_SENDNUDGE]");
if (!m_bLoggedIn) {/* don't send nudge if we not connected! */
ForkThread( &CYahooProto::im_sendackfail, hContact );
diff --git a/protocols/Yahoo/src/proto.cpp b/protocols/Yahoo/src/proto.cpp index 22dfba71f1..37e234cd89 100644 --- a/protocols/Yahoo/src/proto.cpp +++ b/protocols/Yahoo/src/proto.cpp @@ -46,7 +46,7 @@ CYahooProto::~CYahooProto() if (m_bLoggedIn)
logout();
- DebugLog("Logged out");
+ debugLogA("Logged out");
DestroyHookableEvent(hYahooNudge);
@@ -103,15 +103,15 @@ int CYahooProto::OnModulesLoadedEx( WPARAM, LPARAM ) HANDLE CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr )
{
- DebugLog("[YahooAddToList] Flags: %d", flags);
+ debugLogA("[YahooAddToList] Flags: %d", flags);
if (!m_bLoggedIn) {
- DebugLog("[YahooAddToList] WARNING: WE ARE OFFLINE!");
+ debugLogA("[YahooAddToList] WARNING: WE ARE OFFLINE!");
return 0;
}
if (psr == NULL || psr->cbSize != sizeof( PROTOSEARCHRESULT )) {
- DebugLog("[YahooAddToList] Empty data passed?");
+ debugLogA("[YahooAddToList] Empty data passed?");
return 0;
}
@@ -119,19 +119,19 @@ HANDLE CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) HANDLE hContact = getbuddyH(id);
if (hContact != NULL) {
if (db_get_b(hContact, "CList", "NotOnList", 0)) {
- DebugLog("[YahooAddToList] Temporary Buddy:%s already on our buddy list", id);
+ debugLogA("[YahooAddToList] Temporary Buddy:%s already on our buddy list", id);
//return 0;
} else {
- DebugLog("[YahooAddToList] Buddy:%s already on our buddy list", id);
+ debugLogA("[YahooAddToList] Buddy:%s already on our buddy list", id);
mir_free(id);
return 0;
}
} else if (flags & PALF_TEMPORARY) { /* not on our list */
- DebugLog("[YahooAddToList] Adding Temporary Buddy:%s ", id);
+ debugLogA("[YahooAddToList] Adding Temporary Buddy:%s ", id);
}
int protocol = psr->reserved[0];
- DebugLog("Adding buddy:%s", id);
+ debugLogA("Adding buddy:%s", id);
hContact = add_buddy(id, id, protocol, flags);
mir_free(id);
return hContact;
@@ -139,38 +139,38 @@ HANDLE CYahooProto::AddToList( int flags, PROTOSEARCHRESULT* psr ) HANDLE __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HANDLE hDbEvent )
{
- DebugLog("[YahooAddToListByEvent]");
+ debugLogA("[YahooAddToListByEvent]");
if (!m_bLoggedIn)
return 0;
DBEVENTINFO dbei = { sizeof( dbei ) };
if ((dbei.cbBlob = db_event_getBlobSize(hDbEvent)) == -1 ) {
- DebugLog("[YahooAddToListByEvent] ERROR: Can't get blob size.");
+ debugLogA("[YahooAddToListByEvent] ERROR: Can't get blob size.");
return 0;
}
- DebugLog("[YahooAddToListByEvent] Got blob size: %lu", dbei.cbBlob);
+ debugLogA("[YahooAddToListByEvent] Got blob size: %lu", dbei.cbBlob);
dbei.pBlob = ( PBYTE )_alloca( dbei.cbBlob );
if (db_event_get(hDbEvent, &dbei)) {
- DebugLog("[YahooAddToListByEvent] ERROR: Can't get event.");
+ debugLogA("[YahooAddToListByEvent] ERROR: Can't get event.");
return 0;
}
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
- DebugLog("[YahooAddToListByEvent] ERROR: Not an authorization request.");
+ debugLogA("[YahooAddToListByEvent] ERROR: Not an authorization request.");
return 0;
}
if ( strcmp(dbei.szModule, m_szModuleName)) {
- DebugLog("[YahooAddToListByEvent] ERROR: Not Yahoo protocol.");
+ debugLogA("[YahooAddToListByEvent] ERROR: Not Yahoo protocol.");
return 0;
}
HANDLE hContact = DbGetAuthEventContact(&dbei);
if (hContact != NULL)
- DebugLog("Temp Buddy found at: %p ", hContact);
+ debugLogA("Temp Buddy found at: %p ", hContact);
else
- DebugLog("hContact NULL???");
+ debugLogA("hContact NULL???");
return hContact;
}
@@ -180,9 +180,9 @@ HANDLE __cdecl CYahooProto::AddToListByEvent( int flags, int /*iContact*/, HANDL int CYahooProto::Authorize( HANDLE hdbe )
{
- DebugLog("[YahooAuthAllow]");
+ debugLogA("[YahooAuthAllow]");
if ( !m_bLoggedIn ) {
- DebugLog("[YahooAuthAllow] Not Logged In!");
+ debugLogA("[YahooAuthAllow] Not Logged In!");
return 1;
}
@@ -206,7 +206,7 @@ int CYahooProto::Authorize( HANDLE hdbe ) ptrA who( getStringA(hContact, YAHOO_LOGINID));
if (who) {
ptrA myid( getStringA(hContact, "MyIdentity"));
- DebugLog("Accepting buddy:%s", who);
+ debugLogA("Accepting buddy:%s", who);
accept(myid, who, getWord(hContact, "yprotoid", 0));
}
}
@@ -219,29 +219,29 @@ int CYahooProto::Authorize( HANDLE hdbe ) int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason )
{
- DebugLog("[YahooAuthDeny]");
+ debugLogA("[YahooAuthDeny]");
if ( !m_bLoggedIn )
return 1;
DBEVENTINFO dbei = { sizeof( dbei ) };
if (( dbei.cbBlob = db_event_getBlobSize(hdbe)) == -1 ) {
- DebugLog("[YahooAuthDeny] ERROR: Can't get blob size");
+ debugLogA("[YahooAuthDeny] ERROR: Can't get blob size");
return 1;
}
dbei.pBlob = ( PBYTE )alloca( dbei.cbBlob );
if (db_event_get(hdbe, &dbei)) {
- DebugLog("YahooAuthDeny - Can't get db event!");
+ debugLogA("YahooAuthDeny - Can't get db event!");
return 1;
}
if (dbei.eventType != EVENTTYPE_AUTHREQUEST) {
- DebugLog("YahooAuthDeny - not Authorization event");
+ debugLogA("YahooAuthDeny - not Authorization event");
return 1;
}
if (strcmp( dbei.szModule, m_szModuleName)) {
- DebugLog("YahooAuthDeny - wrong module?");
+ debugLogA("YahooAuthDeny - wrong module?");
return 1;
}
@@ -253,7 +253,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) ptrA myid( getStringA(hContact, "MyIdentity"));
ptrA u_reason( mir_utf8encodeT(reason));
- DebugLog("Rejecting buddy:%s msg: %s", who, u_reason);
+ debugLogA("Rejecting buddy:%s msg: %s", who, u_reason);
reject(myid, who, getWord(hContact, "yprotoid", 0), u_reason);
CallService(MS_DB_CONTACT_DELETE, (WPARAM) hContact, 0);
}
@@ -266,7 +266,7 @@ int CYahooProto::AuthDeny( HANDLE hdbe, const TCHAR* reason ) int __cdecl CYahooProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre)
{
- DebugLog("[YahooRecvAuth] ");
+ debugLogA("[YahooRecvAuth] ");
db_unset(hContact,"CList","Hidden");
Proto_AuthRecv(m_szModuleName, pre);
@@ -278,7 +278,7 @@ int __cdecl CYahooProto::AuthRecv(HANDLE hContact, PROTORECVEVENT* pre) int __cdecl CYahooProto::AuthRequest( HANDLE hContact, const TCHAR* msg )
{
- DebugLog("[YahooSendAuthRequest]");
+ debugLogA("[YahooSendAuthRequest]");
if (hContact && m_bLoggedIn) {
AddBuddy(hContact, "miranda", msg);
@@ -581,7 +581,7 @@ void __cdecl CYahooProto::get_status_thread(HANDLE hContact) HANDLE __cdecl CYahooProto::GetAwayMsg( HANDLE hContact )
{
- DebugLog("[YahooGetAwayMessage] ");
+ debugLogA("[YahooGetAwayMessage] ");
if (hContact && m_bLoggedIn) {
if (getWord(hContact, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE)
@@ -609,11 +609,11 @@ int __cdecl CYahooProto::SetAwayMsg( int status, const PROTOCHAR* msg ) {
char *c = msg && msg[0] ? mir_utf8encodeT(msg) : NULL;
- DebugLog("[YahooSetAwayMessage] Status: %S, Msg: %s", pcli->pfnGetStatusModeDescription(status, 0), (char*)c);
+ debugLogA("[YahooSetAwayMessage] Status: %S, Msg: %s", pcli->pfnGetStatusModeDescription(status, 0), (char*)c);
if (!m_bLoggedIn) {
if (m_iStatus == ID_STATUS_OFFLINE) {
- DebugLog("[YahooSetAwayMessage] WARNING: WE ARE OFFLINE!");
+ debugLogA("[YahooSetAwayMessage] WARNING: WE ARE OFFLINE!");
mir_free(c);
return 1;
} else {
diff --git a/protocols/Yahoo/src/proto.h b/protocols/Yahoo/src/proto.h index 4124737890..7bff1a73dd 100644 --- a/protocols/Yahoo/src/proto.h +++ b/protocols/Yahoo/src/proto.h @@ -233,12 +233,6 @@ struct CYahooProto : public PROTO<CYahooProto> int ShowPopup( const TCHAR* nickname, const TCHAR* msg, const char *szURL );
bool IsMyContact(HANDLE hContact);
- #ifdef __GNUC__
- int DebugLog( const char *fmt, ... ) __attribute__ ((format(printf,2,3)));
- #else
- int DebugLog( const char *fmt, ... );
- #endif
-
//====| yahoo.cpp |===================================================================
HANDLE add_buddy( const char *yahoo_id, const char *yahoo_name, int protocol, DWORD flags );
const char *find_buddy( const char *yahoo_id);
@@ -293,7 +287,6 @@ private: long lLastSend;
HANDLE hYahooNudge;
- HANDLE m_hNetlibUser;
HGENMENU mainMenuRoot;
HGENMENU hShowProfileMenuItem;
diff --git a/protocols/Yahoo/src/server.cpp b/protocols/Yahoo/src/server.cpp index 329b797789..aaaac11341 100644 --- a/protocols/Yahoo/src/server.cpp +++ b/protocols/Yahoo/src/server.cpp @@ -54,7 +54,7 @@ void __cdecl CYahooProto::server_main(void *empty) NETLIBSELECTEX nls = {0};
int recvResult, ridx = 0, widx = 0, i;
- DebugLog("Server Thread Starting status: %d", status);
+ debugLogA("Server Thread Starting status: %d", status);
do_yahoo_debug=YAHOO_LOG_DEBUG;
yahoo_set_log_level(( yahoo_log_level )do_yahoo_debug);
@@ -100,13 +100,13 @@ void __cdecl CYahooProto::server_main(void *empty) }
}
- //DebugLog("[Yahoo_Server] ridx:%d widx:%d", ridx, widx);
+ //debugLogA("[Yahoo_Server] ridx:%d widx:%d", ridx, widx);
nls.hReadConns[ridx] = NULL;
nls.hWriteConns[widx] = NULL;
if (m_connections == NULL) {
- DebugLog("Last connection closed.");
+ debugLogA("Last connection closed.");
break;
}
recvResult = CallService(MS_NETLIB_SELECTEX, (WPARAM) 0, (LPARAM)&nls);
@@ -114,7 +114,7 @@ void __cdecl CYahooProto::server_main(void *empty) /* do the timer check */
if (m_id > 0) {
#ifdef HTTP_GATEWAY
- //DebugLog("HTTPGateway: %d", iHTTPGateway);
+ //debugLogA("HTTPGateway: %d", iHTTPGateway);
if (!iHTTPGateway) {
#endif
t = time(NULL);
@@ -135,7 +135,7 @@ void __cdecl CYahooProto::server_main(void *empty) #ifdef HTTP_GATEWAY
} else {
- DebugLog("[SERVER] Got packets: %d", ylad->rpkts);
+ debugLogA("[SERVER] Got packets: %d", ylad->rpkts);
if ( m_bLoggedIn && ( (ylad->rpkts > 0 && (time(NULL) - lLastSend) >=3) ||
( (time(NULL) - lLastSend) >= 13)) ) {
@@ -190,11 +190,11 @@ void __cdecl CYahooProto::server_main(void *empty) /* Check for Miranda Exit Status */
if (Miranda_Terminated()) {
- DebugLog("Miranda Exiting... stopping the loop.");
+ debugLogA("Miranda Exiting... stopping the loop.");
break;
}
}
- DebugLog("Exited loop");
+ debugLogA("Exited loop");
/* cleanup the data stuff and close our connection handles */
while(m_connections) {
@@ -217,5 +217,5 @@ void __cdecl CYahooProto::server_main(void *empty) BroadcastStatus(ID_STATUS_OFFLINE);
logoff_buddies();
- DebugLog("Server thread ending");
+ debugLogA("Server thread ending");
}
diff --git a/protocols/Yahoo/src/services.cpp b/protocols/Yahoo/src/services.cpp index 397f655ad2..0df9cbbf41 100644 --- a/protocols/Yahoo/src/services.cpp +++ b/protocols/Yahoo/src/services.cpp @@ -71,7 +71,7 @@ void CYahooProto::BroadcastStatus(int s) m_iStatus = ID_STATUS_ONLINE;
}
- DebugLog("[yahoo_util_broadcaststatus] Old Status: %S (%d), New Status: %S (%d)",
+ debugLogA("[yahoo_util_broadcaststatus] Old Status: %S (%d), New Status: %S (%d)",
pcli->pfnGetStatusModeDescription(oldStatus, 0), oldStatus,
pcli->pfnGetStatusModeDescription(m_iStatus, 0), m_iStatus);
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE) oldStatus, (LPARAM)m_iStatus);
@@ -85,26 +85,26 @@ int __cdecl CYahooProto::OnContactDeleted( WPARAM wParam, LPARAM lParam ) DBVARIANT dbv;
HANDLE hContact = (HANDLE) wParam;
- DebugLog("[YahooContactDeleted]");
+ debugLogA("[YahooContactDeleted]");
if ( !m_bLoggedIn ) {//should never happen for Yahoo contacts
- DebugLog("[YahooContactDeleted] We are not Logged On!!!");
+ debugLogA("[YahooContactDeleted] We are not Logged On!!!");
return 0;
}
// he is not a permanent contact!
if (db_get_b(hContact, "CList", "NotOnList", 0) != 0) {
- DebugLog("[YahooContactDeleted] Not a permanent buddy!!!");
+ debugLogA("[YahooContactDeleted] Not a permanent buddy!!!");
return 0;
}
if (!getString(hContact, YAHOO_LOGINID, &dbv)) {
- DebugLog("[YahooContactDeleted] Removing %s", dbv.pszVal);
+ debugLogA("[YahooContactDeleted] Removing %s", dbv.pszVal);
remove_buddy(dbv.pszVal, getWord(hContact, "yprotoid", 0));
db_free(&dbv);
} else {
- DebugLog("[YahooContactDeleted] Can't retrieve contact Yahoo ID");
+ debugLogA("[YahooContactDeleted] Can't retrieve contact Yahoo ID");
}
return 0;
}
@@ -219,7 +219,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) {
char tUrl[ 4096 ];
- DebugLog("[YahooOpenURL] url: %s Auto Login: %d", url, autoLogin);
+ debugLogA("[YahooOpenURL] url: %s Auto Login: %d", url, autoLogin);
if (autoLogin && getByte("MailAutoLogin", 0) && m_bLoggedIn && m_id > 0) {
char *y, *t, *u;
@@ -238,7 +238,7 @@ void CYahooProto::OpenURL(const char *url, int autoLogin) mir_snprintf(tUrl, sizeof(tUrl), url);
}
- DebugLog("[YahooOpenURL] url: %s Final URL: %s", url, tUrl);
+ debugLogA("[YahooOpenURL] url: %s Final URL: %s", url, tUrl);
CallService(MS_UTILS_OPENURL, TRUE, (LPARAM)tUrl);
}
@@ -337,7 +337,7 @@ int __cdecl CYahooProto::OnIdleEvent(WPARAM wParam, LPARAM lParam) {
BOOL bIdle = (lParam & IDF_ISIDLE);
- DebugLog("[YAHOO_IDLE_EVENT] Idle: %s", bIdle ?"Yes":"No");
+ debugLogA("[YAHOO_IDLE_EVENT] Idle: %s", bIdle ?"Yes":"No");
if ( lParam & IDF_PRIVACY )
return 0; /* we support Privacy settings */
@@ -345,11 +345,11 @@ int __cdecl CYahooProto::OnIdleEvent(WPARAM wParam, LPARAM lParam) if (m_bLoggedIn) {
/* set me to idle or back */
if (m_iStatus == ID_STATUS_INVISIBLE)
- DebugLog("[YAHOO_IDLE_EVENT] WARNING: INVISIBLE! Don't change my status!");
+ debugLogA("[YAHOO_IDLE_EVENT] WARNING: INVISIBLE! Don't change my status!");
else
set_status(m_iStatus,m_startMsg,(bIdle) ? 2 : (m_iStatus == ID_STATUS_ONLINE) ? 0 : 1);
} else {
- DebugLog("[YAHOO_IDLE_EVENT] WARNING: NOT LOGGED IN???");
+ debugLogA("[YAHOO_IDLE_EVENT] WARNING: NOT LOGGED IN???");
}
return 0;
@@ -499,7 +499,7 @@ int __cdecl CYahooProto::OnPrebuildContactMenu(WPARAM wParam, LPARAM) {
const HANDLE hContact = (HANDLE)wParam;
if (!IsMyContact(hContact)) {
- DebugLog("[OnPrebuildContactMenu] Not a Yahoo Contact!!!");
+ debugLogA("[OnPrebuildContactMenu] Not a Yahoo Contact!!!");
return 0;
}
diff --git a/protocols/Yahoo/src/util.cpp b/protocols/Yahoo/src/util.cpp index 668a6cfe06..044c31ba84 100644 --- a/protocols/Yahoo/src/util.cpp +++ b/protocols/Yahoo/src/util.cpp @@ -22,24 +22,9 @@ #include "resource.h"
-int CYahooProto::DebugLog( const char *fmt, ... )
-{
- char str[ 4096 ];
- va_list vararg;
- va_start( vararg, fmt );
-
- int tBytes = mir_vsnprintf(str, sizeof(str), fmt, vararg);
- if ( tBytes > 0)
- str[ tBytes ] = 0;
-
- va_end( vararg );
-
- return CallService(MS_NETLIB_LOG, (WPARAM)m_hNetlibUser, (LPARAM)str);
-}
-
extern HANDLE g_hNetlibUser;
-int DebugLog( const char *fmt, ... )
+int debugLogA( const char *fmt, ... )
{
char str[ 4096 ];
va_list vararg;
@@ -89,7 +74,7 @@ static LRESULT CALLBACK PopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, {
switch(message) {
case WM_COMMAND:
- DebugLog("[PopupWindowProc] WM_COMMAND");
+ debugLogA("[PopupWindowProc] WM_COMMAND");
if ( HIWORD(wParam) == STN_CLICKED) {
char *szURL = (char*)PUGetPluginData(hWnd);
if (szURL != NULL)
@@ -101,12 +86,12 @@ static LRESULT CALLBACK PopupWindowProc( HWND hWnd, UINT message, WPARAM wParam, break;
case WM_CONTEXTMENU:
- DebugLog("[PopupWindowProc] WM_CONTEXTMENU");
+ debugLogA("[PopupWindowProc] WM_CONTEXTMENU");
PUDeletePopup(hWnd);
return TRUE;
case UM_FREEPLUGINDATA:
- DebugLog("[PopupWindowProc] UM_FREEPLUGINDATA");
+ debugLogA("[PopupWindowProc] UM_FREEPLUGINDATA");
{
char *szURL = (char *)PUGetPluginData(hWnd);
if (szURL != NULL)
@@ -135,7 +120,7 @@ int CYahooProto::ShowPopup(const TCHAR* nickname, const TCHAR* msg, const char * }
else ppd.lchIcon = LoadIconEx("yahoo");
- DebugLog("[MS_POPUP_ADDPOPUP] Generating a popup for [%S] %S", nickname, msg);
+ debugLogA("[MS_POPUP_ADDPOPUP] Generating a popup for [%S] %S", nickname, msg);
PUAddPopupT(&ppd);
return 1;
@@ -174,7 +159,7 @@ int __cdecl CYahooProto::OnSettingChanged(WPARAM wParam, LPARAM lParam) DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*) lParam;
if ( !strcmp(cws->szSetting, "ApparentMode")) {
- DebugLog("DB Setting changed. YAHOO user's visible setting changed.");
+ debugLogA("DB Setting changed. YAHOO user's visible setting changed.");
DBVARIANT dbv;
if (!getString((HANDLE)wParam, YAHOO_LOGINID, &dbv)) {
@@ -205,7 +190,7 @@ void CYahooProto::YAHOO_utils_logversion() char str[256];
mir_snprintf(str, sizeof(str), "Yahoo v%d.%d.%d.%d", (pluginInfo.version >> 24) & 0xFF, (pluginInfo.version >> 16) & 0xFF,
(pluginInfo.version >> 8) & 0xFF, pluginInfo.version & 0xFF);
- DebugLog(str);
+ debugLogA(str);
}
void SetButtonCheck(HWND hwndDlg, int CtrlID, BOOL bCheck)
diff --git a/protocols/Yahoo/src/yahoo.cpp b/protocols/Yahoo/src/yahoo.cpp index d7e797fa79..60f5815421 100644 --- a/protocols/Yahoo/src/yahoo.cpp +++ b/protocols/Yahoo/src/yahoo.cpp @@ -272,7 +272,7 @@ void CYahooProto::AddBuddy(HANDLE hContact, const char *group, const TCHAR *msg) SetStringUtf(hContact, "YGroup", group);
- DebugLog("Adding Permanently %s to list. Auth: %s", who, u_msg ? u_msg : "<None>");
+ debugLogA("Adding Permanently %s to list. Auth: %s", who, u_msg ? u_msg : "<None>");
yahoo_add_buddy(m_id, ident, fname, lname, who, protocol, group, u_msg);
free(fname);
@@ -361,7 +361,7 @@ const char* CYahooProto::find_buddy( const char *yahoo_id) /* Other handlers */
void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, const char *msg, int away, int idle, int mobile, int utf8)
{
- YAHOO_DEBUGLOG("[ext_status_changed] %s (prot: %d) with msg %s utf8: %d, stat: %s (%d), away: %d, idle: %d seconds",
+ debugLogA("[ext_status_changed] %s (prot: %d) with msg %s utf8: %d, stat: %s (%d), away: %d, idle: %d seconds",
who,
protocol,
msg,
@@ -373,7 +373,7 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co HANDLE hContact = getbuddyH(who);
if (hContact == NULL) {
- YAHOO_DEBUGLOG("Buddy Not Found. Adding...");
+ debugLogA("Buddy Not Found. Adding...");
hContact = add_buddy(who, who, protocol, 0);
}
@@ -387,7 +387,7 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co setWord(hContact, "Mobile", mobile);
if (msg) {
- YAHOO_DEBUGLOG("[ext_status_changed] %s custom message '%s'", who, msg);
+ debugLogA("[ext_status_changed] %s custom message '%s'", who, msg);
if (utf8)
db_set_utf( hContact, "CList", "StatusMsg", msg);
@@ -407,7 +407,7 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co if ( (away == 2) || (stat == YAHOO_STATUS_IDLE) || (idle > 0)) {
/* TODO: set Idle=-1, because of key 138=1 and don't set idlets then */
if (stat > 0) {
- YAHOO_DEBUGLOG("[ext_status_changed] %s idle for %d:%02d:%02d", who, idle/3600, (idle/60)%60, idle%60);
+ debugLogA("[ext_status_changed] %s idle for %d:%02d:%02d", who, idle/3600, (idle/60)%60, idle%60);
time(&idlets);
idlets -= idle;
@@ -417,18 +417,18 @@ void CYahooProto::ext_status_changed(const char *who, int protocol, int stat, co setDword(hContact, "IdleTS", idlets);
}
- YAHOO_DEBUGLOG("[ext_status_changed] exiting");
+ debugLogA("[ext_status_changed] exiting");
}
void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, const char *msg, int away, int idle, int mobile, int cksum, int buddy_icon, long client_version, int utf8)
{
- YAHOO_DEBUGLOG("[ext_status_logon] %s (prot: %d) with msg %s utf8: %d, (stat: %d, away: %d, idle: %d seconds, checksum: %d buddy_icon: %d client_version: %ld)", who, protocol, msg, utf8, stat, away, idle, cksum, buddy_icon, client_version);
+ debugLogA("[ext_status_logon] %s (prot: %d) with msg %s utf8: %d, (stat: %d, away: %d, idle: %d seconds, checksum: %d buddy_icon: %d client_version: %ld)", who, protocol, msg, utf8, stat, away, idle, cksum, buddy_icon, client_version);
ext_status_changed(who, protocol, stat, msg, away, idle, mobile, utf8);
HANDLE hContact = getbuddyH(who);
if (hContact == NULL) {
- YAHOO_DEBUGLOG("[ext_status_logon] Can't find handle for %s??? PANIC!!!", who);
+ debugLogA("[ext_status_logon] Can't find handle for %s??? PANIC!!!", who);
return;
}
@@ -528,7 +528,7 @@ void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, cons /* Last thing check the checksum and request new one if we need to */
if (buddy_icon == -1) {
- YAHOO_DEBUGLOG("[ext_status_logon] No avatar information in this packet? Not touching stuff!");
+ debugLogA("[ext_status_logon] No avatar information in this packet? Not touching stuff!");
} else {
// we got some avatartype info
setByte(hContact, "AvatarType", buddy_icon);
@@ -551,7 +551,7 @@ void CYahooProto::ext_status_logon(const char *who, int protocol, int stat, cons reset_avatar(hContact);
}
- YAHOO_DEBUGLOG("[ext_status_logon] exiting");
+ debugLogA("[ext_status_logon] exiting");
}
void CYahooProto::ext_got_audible(const char *me, const char *who, const char *aud, const char *msg, const char *aud_hash)
@@ -610,7 +610,7 @@ void CYahooProto::ext_got_stealth(char *stealthlist) for(s = stealth; s && *s; s++) {
if (lstrcmpiA(*s, dbv.pszVal) == 0) {
- YAHOO_DEBUGLOG("GOT id = %s", dbv.pszVal);
+ debugLogA("GOT id = %s", dbv.pszVal);
found = 1;
break;
}
@@ -618,7 +618,7 @@ void CYahooProto::ext_got_stealth(char *stealthlist) /* Check the stealth list */
if (found) { /* we have him on our Stealth List */
- YAHOO_DEBUGLOG("Setting STEALTH for id = %s", dbv.pszVal);
+ debugLogA("Setting STEALTH for id = %s", dbv.pszVal);
/* need to set the ApparentMode thingy */
if (ID_STATUS_OFFLINE != getWord(hContact, "ApparentMode", 0))
getWord(hContact, "ApparentMode", ID_STATUS_OFFLINE);
@@ -643,7 +643,7 @@ void CYahooProto::ext_got_buddies(YList * buds) return;
}
- YAHOO_DEBUGLOG(("[ext_got_buddies] Walking buddy list..."));
+ debugLogA(("[ext_got_buddies] Walking buddy list..."));
for (; buds; buds = buds->next) {
HANDLE hContact;
@@ -653,7 +653,7 @@ void CYahooProto::ext_got_buddies(YList * buds) continue;
}
- YAHOO_DEBUGLOG("[ext_got_buddies] id = %s, protocol = %d, group = %s, auth = %d", bud->id, bud->protocol, bud->group, bud->auth);
+ debugLogA("[ext_got_buddies] id = %s, protocol = %d, group = %s, auth = %d", bud->id, bud->protocol, bud->group, bud->auth);
hContact = getbuddyH(bud->id);
if (hContact == NULL)
@@ -666,7 +666,7 @@ void CYahooProto::ext_got_buddies(YList * buds) SetStringUtf(hContact, "YGroup", bud->group);
if (bud->stealth) { /* we have him on our Stealth List */
- YAHOO_DEBUGLOG("Setting STEALTH for id = %s", bud->id);
+ debugLogA("Setting STEALTH for id = %s", bud->id);
/* need to set the ApparentMode thingy */
if (ID_STATUS_OFFLINE != getWord(hContact, "ApparentMode", 0))
setWord(hContact, "ApparentMode", (WORD) ID_STATUS_OFFLINE);
@@ -679,11 +679,11 @@ void CYahooProto::ext_got_buddies(YList * buds) }
//if (bud->auth)
- // YAHOO_DEBUGLOG("Auth request waiting for: %s", bud->id );
+ // debugLogA("Auth request waiting for: %s", bud->id );
setByte(hContact, "YAuth", bud->auth);
if (bud->real_name) {
- YAHOO_DEBUGLOG("id = %s name = %s", bud->id, bud->real_name);
+ debugLogA("id = %s name = %s", bud->id, bud->real_name);
SetStringUtf( hContact, "Nick", bud->real_name);
}
@@ -712,7 +712,7 @@ void CYahooProto::ext_got_buddies(YList * buds) }
}
- YAHOO_DEBUGLOG(("[ext_got_buddies] buddy list Finished."));
+ debugLogA(("[ext_got_buddies] buddy list Finished."));
}
void CYahooProto::ext_rejected(const char *who, const char *msg)
@@ -1151,7 +1151,7 @@ void CYahooProto::ext_login_response(int succ, const char *url) delSetting(YAHOO_PWTOKEN);
- YAHOO_DEBUGLOG("ERROR: %s", buff);
+ debugLogA("ERROR: %s", buff);
/*
* Show Error Message
@@ -1195,11 +1195,11 @@ void CYahooProto::ext_error(const char *err, int fatal, int num) break;
case E_CONNECTION:
mir_sntprintf(buff, SIZEOF(buff), TranslateT("Server Connection Error: %s"), (TCHAR*)tszErr);
- YAHOO_DEBUGLOG("Error: %S", buff);
+ debugLogA("Error: %S", buff);
return;
}
- YAHOO_DEBUGLOG("Error: %S", buff);
+ debugLogA("Error: %S", buff);
/*
* Show Error Message
@@ -1837,7 +1837,7 @@ void register_callbacks() yc.ext_yahoo_got_search_result = ext_yahoo_got_search_result;
yc.ext_yahoo_system_message = ext_yahoo_system_message;
yc.ext_yahoo_error = ext_yahoo_error;
- yc.ext_yahoo_log = YAHOO_DEBUGLOG;
+ yc.ext_yahoo_log = debugLogA;
yc.ext_yahoo_add_handler = ext_yahoo_add_handler;
yc.ext_yahoo_remove_handler = ext_yahoo_remove_handler;
//yc.ext_yahoo_connect = ext_yahoo_connect; not needed in fact
diff --git a/protocols/Yahoo/src/yahoo.h b/protocols/Yahoo/src/yahoo.h index de2e1fbfbf..c99d1e13be 100644 --- a/protocols/Yahoo/src/yahoo.h +++ b/protocols/Yahoo/src/yahoo.h @@ -68,13 +68,11 @@ extern "C" #define YAHOO_DEFAULT_JAPAN_LOGIN_SERVER "cs.yahoo.co.jp"
#define YAHOO_CUSTOM_STATUS 99
-#define YAHOO_DEBUGLOG DebugLog
-
extern int do_yahoo_debug;
-#define LOG(x) if (do_yahoo_debug) { YAHOO_DEBUGLOG("%s:%d: ", __FILE__, __LINE__); \
- YAHOO_DEBUGLOG x; \
- YAHOO_DEBUGLOG(" ");}
+#define LOG(x) if (do_yahoo_debug) { debugLogA("%s:%d: ", __FILE__, __LINE__); \
+ debugLogA x; \
+ debugLogA(" ");}
#define YAHOO_SET_CUST_STAT "/SetCustomStatCommand"
#define YAHOO_EDIT_MY_PROFILE "/YahooEditMyProfileCommand"
@@ -120,9 +118,9 @@ yahoo_status miranda_to_yahoo(int myyahooStatus); void register_callbacks();
#ifdef __GNUC__
- int DebugLog( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
+ int debugLogA( const char *fmt, ... ) __attribute__ ((format (printf, 1, 2)));
#else
- int DebugLog( const char *fmt, ... );
+ int debugLogA( const char *fmt, ... );
#endif
void SetButtonCheck(HWND hwndDlg, int CtrlID, BOOL bCheck);
|