From 773421e8ba17637d994088c393d406226b516a30 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 11 Oct 2013 14:01:25 +0000 Subject: - m_hNetlibUser moved to PROTO_INTERFACE; - unified protocol loggers git-svn-id: http://svn.miranda-ng.org/main/trunk@6435 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Gadu-Gadu/src/avatar.cpp | 70 ++++++++--------- protocols/Gadu-Gadu/src/core.cpp | 130 +++++++++++++++---------------- protocols/Gadu-Gadu/src/filetransfer.cpp | 112 +++++++++++++------------- protocols/Gadu-Gadu/src/gg.cpp | 30 +------ protocols/Gadu-Gadu/src/gg_proto.cpp | 70 ++++++++--------- protocols/Gadu-Gadu/src/gg_proto.h | 13 ++-- protocols/Gadu-Gadu/src/groupchat.cpp | 34 ++++---- protocols/Gadu-Gadu/src/image.cpp | 50 ++++++------ protocols/Gadu-Gadu/src/import.cpp | 20 ++--- protocols/Gadu-Gadu/src/keepalive.cpp | 10 +-- protocols/Gadu-Gadu/src/oauth.cpp | 26 +++---- protocols/Gadu-Gadu/src/ownerinfo.cpp | 14 ++-- protocols/Gadu-Gadu/src/services.cpp | 50 ++++++------ protocols/Gadu-Gadu/src/userutils.cpp | 32 ++++---- 14 files changed, 318 insertions(+), 343 deletions(-) (limited to 'protocols/Gadu-Gadu') 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("")); 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 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 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; -- cgit v1.2.3