From 782cd67c8a32808b6779cd286de7228a02006d0b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 17 Apr 2018 21:18:31 +0300 Subject: name conflict resolution --- protocols/Gadu-Gadu/src/core.cpp | 56 ++++++++++++++++---------------- protocols/Gadu-Gadu/src/dialogs.cpp | 4 +-- protocols/Gadu-Gadu/src/filetransfer.cpp | 47 +++++++++++++++++---------- protocols/Gadu-Gadu/src/gg_proto.cpp | 14 ++++---- protocols/Gadu-Gadu/src/gg_proto.h | 10 ++---- protocols/Gadu-Gadu/src/groupchat.cpp | 2 +- protocols/Gadu-Gadu/src/image.cpp | 10 +++--- protocols/Gadu-Gadu/src/import.cpp | 6 ++-- protocols/Gadu-Gadu/src/keepalive.cpp | 2 +- protocols/Gadu-Gadu/src/services.cpp | 4 +-- protocols/Gadu-Gadu/src/sessions.cpp | 4 +-- 11 files changed, 81 insertions(+), 78 deletions(-) (limited to 'protocols/Gadu-Gadu') diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp index 42852de473..cd3d98c6c2 100644 --- a/protocols/Gadu-Gadu/src/core.cpp +++ b/protocols/Gadu-Gadu/src/core.cpp @@ -44,7 +44,7 @@ int GaduProto::isonline() int isonline; gg_EnterCriticalSection(&sess_mutex, "isonline", 76, "sess_mutex", 1); - isonline = (sess != nullptr); + isonline = (m_sess != nullptr); gg_LeaveCriticalSection(&sess_mutex, "isonline", 76, 1, "sess_mutex", 1); return isonline; @@ -132,15 +132,15 @@ void GaduProto::disconnect() // Check if it has message if (szMsg) { - gg_change_status_descr(sess, GG_STATUS_NOT_AVAIL_DESCR, szMsg); + gg_change_status_descr(m_sess, GG_STATUS_NOT_AVAIL_DESCR, szMsg); mir_free(szMsg); // Wait for disconnection acknowledge } else { - gg_change_status(sess, GG_STATUS_NOT_AVAIL); + gg_change_status(m_sess, GG_STATUS_NOT_AVAIL); // Send logoff immediately - gg_logoff(sess); + gg_logoff(m_sess); } gg_LeaveCriticalSection(&sess_mutex, "disconnect", 12, 1, "sess_mutex", 1); } @@ -341,7 +341,7 @@ void __cdecl GaduProto::mainthread(void *) ////////////////////////////// DCC STARTUP ///////////////////////////// // Uin is ok so startup dcc if not started already - if (!dcc) { + if (!m_dcc) { hEvent = CreateEvent(nullptr, TRUE, FALSE, nullptr); dccstart(); @@ -354,7 +354,7 @@ void __cdecl GaduProto::mainthread(void *) } // Check if dcc is running and setup forwarding port - if (dcc && m_gaduOptions.useForwarding) { + if (m_dcc && m_gaduOptions.useForwarding) { CMStringW forwardHost = m_gaduOptions.forwardHost; ptrA pHost(mir_u2a(forwardHost.c_str())); if (!forwardHost.IsEmpty()) { @@ -370,8 +370,8 @@ void __cdecl GaduProto::mainthread(void *) } } // Setup client port - if (dcc) - p.client_port = dcc->port; + if (m_dcc) + p.client_port = m_dcc->port; int hostnum = 0; @@ -470,7 +470,7 @@ retry: logonTime = time(nullptr); setDword(GG_KEY_LOGONTIME, logonTime); gg_EnterCriticalSection(&sess_mutex, "mainthread", 15, "sess_mutex", 1); - sess = local_sess; + m_sess = local_sess; gg_LeaveCriticalSection(&sess_mutex, "mainthread", 15, 1, "sess_mutex", 1); // Subscribe users status notifications notifyall(); @@ -505,14 +505,14 @@ retry: #ifdef DEBUGMODE debugLogA("mainthread(): waiting for gg_watch_fd"); #endif - if (!(e = gg_watch_fd(sess))) { + if (!(e = gg_watch_fd(m_sess))) { #ifdef DEBUGMODE debugLogA("mainthread(): waiting for gg_watch_fd - DONE error"); #endif debugLogA("mainthread() (%x): Connection closed.", this); gg_EnterCriticalSection(&sess_mutex, "mainthread", 16, "sess_mutex", 1); - gg_free_session(sess); - sess = nullptr; + gg_free_session(m_sess); + m_sess = nullptr; gg_LeaveCriticalSection(&sess_mutex, "mainthread", 16, 1, "sess_mutex", 1); break; } @@ -533,15 +533,15 @@ retry: case GG_EVENT_CONN_FAILED: case GG_EVENT_DISCONNECT: gg_EnterCriticalSection(&sess_mutex, "mainthread", 17, "sess_mutex", 1); - gg_free_session(sess); - sess = nullptr; + gg_free_session(m_sess); + m_sess = nullptr; gg_LeaveCriticalSection(&sess_mutex, "mainthread", 17, 1, "sess_mutex", 1); break; // Client allowed to disconnect case GG_EVENT_DISCONNECT_ACK: // Send logoff - gg_logoff(sess); + gg_logoff(m_sess); break; // Received ackowledge @@ -850,7 +850,7 @@ retry: if (((struct gg_msg_richtext_format*)formats)->font & GG_FONT_IMAGE) { struct gg_msg_richtext_image *image = (struct gg_msg_richtext_image *)(formats + add_ptr); gg_EnterCriticalSection(&sess_mutex, "mainthread", 18, "sess_mutex", 1); - gg_image_request(sess, e->event.msg.sender, image->size, image->crc32); + gg_image_request(m_sess, e->event.msg.sender, image->size, image->crc32); gg_LeaveCriticalSection(&sess_mutex, "mainthread", 18, 1, "sess_mutex", 1); debugLogA("mainthread(): image request sent!"); @@ -1266,7 +1266,7 @@ int GaduProto::contactdeleted(WPARAM hContact, LPARAM) if (uin && isonline()) { gg_EnterCriticalSection(&sess_mutex, "contactdeleted", 25, "sess_mutex", 1); - gg_remove_notify_ex(sess, uin, GG_USER_NORMAL); + gg_remove_notify_ex(m_sess, uin, GG_USER_NORMAL); gg_LeaveCriticalSection(&sess_mutex, "contactdeleted", 25, 1, "sess_mutex", 1); } @@ -1406,28 +1406,28 @@ void GaduProto::notifyuser(MCONTACT hContact, int refresh) { gg_EnterCriticalSection(&sess_mutex, "notifyuser", 77, "sess_mutex", 1); if (refresh) { - gg_remove_notify_ex(sess, uin, GG_USER_NORMAL); - gg_remove_notify_ex(sess, uin, GG_USER_BLOCKED); + gg_remove_notify_ex(m_sess, uin, GG_USER_NORMAL); + gg_remove_notify_ex(m_sess, uin, GG_USER_BLOCKED); } - gg_add_notify_ex(sess, uin, GG_USER_OFFLINE); + gg_add_notify_ex(m_sess, uin, GG_USER_OFFLINE); gg_LeaveCriticalSection(&sess_mutex, "notifyuser", 77, 1, "sess_mutex", 1); } else if (getByte(hContact, GG_KEY_BLOCK, 0)) { gg_EnterCriticalSection(&sess_mutex, "notifyuser", 78, "sess_mutex", 1); if (refresh) - gg_remove_notify_ex(sess, uin, GG_USER_OFFLINE); + gg_remove_notify_ex(m_sess, uin, GG_USER_OFFLINE); - gg_add_notify_ex(sess, uin, GG_USER_BLOCKED); + gg_add_notify_ex(m_sess, uin, GG_USER_BLOCKED); gg_LeaveCriticalSection(&sess_mutex, "notifyuser", 78, 1, "sess_mutex", 1); } else { gg_EnterCriticalSection(&sess_mutex, "notifyuser", 79, "sess_mutex", 1); if (refresh) - gg_remove_notify_ex(sess, uin, GG_USER_BLOCKED); + gg_remove_notify_ex(m_sess, uin, GG_USER_BLOCKED); - gg_add_notify_ex(sess, uin, GG_USER_NORMAL); + gg_add_notify_ex(m_sess, uin, GG_USER_NORMAL); gg_LeaveCriticalSection(&sess_mutex, "notifyuser", 79, 1, "sess_mutex", 1); } } @@ -1446,7 +1446,7 @@ void GaduProto::notifyall() if (count == 0) { if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "notifyall", 29, "sess_mutex", 1); - gg_notify_ex(sess, nullptr, nullptr, 0); + gg_notify_ex(m_sess, nullptr, nullptr, 0); gg_LeaveCriticalSection(&sess_mutex, "notifyall", 29, 1, "sess_mutex", 1); } return; @@ -1473,7 +1473,7 @@ void GaduProto::notifyall() // Send notification if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "notifyall", 30, "sess_mutex", 1); - gg_notify_ex(sess, uins, types, count); + gg_notify_ex(m_sess, uins, types, count); gg_LeaveCriticalSection(&sess_mutex, "notifyall", 30, 1, "sess_mutex", 1); } @@ -1534,7 +1534,7 @@ MCONTACT GaduProto::getcontact(uin_t uin, int create, int inlist, wchar_t *szNic gg_pubdir50_add(req, GG_PUBDIR50_UIN, ditoa(uin)); gg_pubdir50_seq_set(req, GG_SEQ_GETNICK); gg_EnterCriticalSection(&sess_mutex, "getcontact", 31, "sess_mutex", 1); - gg_pubdir50(sess, req); + gg_pubdir50(m_sess, req); gg_LeaveCriticalSection(&sess_mutex, "getcontact", 31, 1, "sess_mutex", 1); gg_pubdir50_free(req); wchar_t* uinT = mir_a2u(ditoa(uin)); @@ -1547,7 +1547,7 @@ MCONTACT GaduProto::getcontact(uin_t uin, int create, int inlist, wchar_t *szNic // Add to notify list and pull avatar for the new contact if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "getcontact", 32, "sess_mutex", 1); - gg_add_notify_ex(sess, uin, (char)(inlist ? GG_USER_NORMAL : GG_USER_OFFLINE)); + gg_add_notify_ex(m_sess, uin, (char)(inlist ? GG_USER_NORMAL : GG_USER_OFFLINE)); gg_LeaveCriticalSection(&sess_mutex, "getcontact", 32, 1, "sess_mutex", 1); PROTO_AVATAR_INFORMATION ai = { 0 }; diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp index ba8791114e..28a69f80c9 100644 --- a/protocols/Gadu-Gadu/src/dialogs.cpp +++ b/protocols/Gadu-Gadu/src/dialogs.cpp @@ -450,7 +450,7 @@ static INT_PTR CALLBACK gg_genoptsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, if (IsDlgButtonChecked(hwndDlg, IDC_SHOWLINKS)) status_flags |= GG_STATUS_FLAG_SPAM; gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_genoptsdlgproc", 34, "sess_mutex", 1); - gg_change_status_flags(gg->sess, status_flags); + gg_change_status_flags(gg->m_sess, status_flags); gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_genoptsdlgproc", 34, 1, "sess_mutex", 1); gg->setByte(GG_KEY_ENABLEAVATARS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_ENABLEAVATARS)); @@ -733,7 +733,7 @@ static INT_PTR CALLBACK gg_detailsdlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, // Run update gg_pubdir50_seq_set(req, GG_SEQ_CHINFO); gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_detailsdlgproc", 35, "sess_mutex", 1); - gg_pubdir50(gg->sess, req); + gg_pubdir50(gg->m_sess, req); gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_genoptsdlgproc", 35, 1, "sess_mutex", 1); dat->updating = TRUE; diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp index 3abef753e7..eb25e14c6d 100644 --- a/protocols/Gadu-Gadu/src/filetransfer.cpp +++ b/protocols/Gadu-Gadu/src/filetransfer.cpp @@ -27,7 +27,7 @@ void GaduProto::dccstart() { DWORD exitCode = 0; - if (dcc) + if (m_dcc) return; // Startup dcc thread @@ -150,7 +150,7 @@ void __cdecl GaduProto::dccmainthread(void*) } // Create listen socket on config direct port - if (!(dcc = gg_dcc_socket_create(uin, static_cast(m_gaduOptions.directConnectionPort)))) + if (!(m_dcc = gg_dcc_socket_create(uin, static_cast(m_gaduOptions.directConnectionPort)))) { debugLogA("dccmainthread(): Cannot create DCC listen socket. Exiting."); // Signalize mainthread we haven't start @@ -161,7 +161,7 @@ void __cdecl GaduProto::dccmainthread(void*) return; } - gg_dcc_port = dcc->port; + gg_dcc_port = m_dcc->port; gg_dcc_ip = inet_addr("255.255.255.255"); debugLogA("dccmainthread(): Listening on port %d.", gg_dcc_port); @@ -170,7 +170,7 @@ void __cdecl GaduProto::dccmainthread(void*) SetEvent(hEvent); // Add main dcc handler to watches - list_add(&watches, dcc, 0); + list_add(&watches, m_dcc, 0); // Do while we are in the main server thread gg_event *e; @@ -181,7 +181,7 @@ void __cdecl GaduProto::dccmainthread(void*) DWORD tick; char szFilename[MAX_PATH]; - while (pth_dcc.dwThreadId && dcc) + while (pth_dcc.dwThreadId && m_dcc) { // Timeouts tv.tv_sec = 1; @@ -254,7 +254,8 @@ void __cdecl GaduProto::dccmainthread(void*) gg_dcc_socket_free(local_dcc); // Check if it's main socket - if (local_dcc == dcc) dcc = nullptr; + if (local_dcc == m_dcc) + m_dcc = nullptr; continue; } else { @@ -299,7 +300,7 @@ void __cdecl GaduProto::dccmainthread(void*) // Connection was successfuly ended case GG_EVENT_DCC_DONE: - debugLogA("dccmainthread(): Client: %d, Transfer done ! Closing connection.", dcc->peer_uin); + debugLogA("dccmainthread(): Client: %d, Transfer done ! Closing connection.", m_dcc->peer_uin); // Remove from watches list_remove(&watches, local_dcc, 0); // Close file & success @@ -329,7 +330,9 @@ void __cdecl GaduProto::dccmainthread(void*) gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc - gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr; + gg_free_dcc(local_dcc); + if (local_dcc == m_dcc) + m_dcc = nullptr; break; // Client error @@ -355,7 +358,8 @@ void __cdecl GaduProto::dccmainthread(void*) debugLogA("dccmainthread(): Client: %d, Unknown error.", local_dcc->peer_uin); } // Don't do anything if it's main socket - if (local_dcc == dcc) break; + if (local_dcc == m_dcc) + break; // Remove from watches list_remove(&watches, local_dcc, 0); @@ -369,7 +373,9 @@ void __cdecl GaduProto::dccmainthread(void*) gg_EnterCriticalSection(&ft_mutex, "dccmainthread", 37, "ft_mutex", 1); } // Free dcc - gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr; + gg_free_dcc(local_dcc); + if (local_dcc == m_dcc) + m_dcc = nullptr; break; // Need file acknowledgement @@ -386,7 +392,7 @@ void __cdecl GaduProto::dccmainthread(void*) { // Make new ggtransfer struct local_dcc->contact = (void*)getcontact(local_dcc->peer_uin, 0, 0, nullptr); - wchar_t* filenameT = mir_utf8decodeW((char*)dcc->file_info.filename); + wchar_t* filenameT = mir_utf8decodeW((char*)m_dcc->file_info.filename); PROTORECVFILE pre = { 0 }; pre.dwFlags = PRFF_UNICODE; @@ -413,8 +419,10 @@ void __cdecl GaduProto::dccmainthread(void*) break; // Kill unauthorized dcc - list_remove(&watches, dcc, 0); - gg_free_dcc(local_dcc); if (local_dcc == dcc) dcc = nullptr; + list_remove(&watches, m_dcc, 0); + gg_free_dcc(local_dcc); + if (local_dcc == m_dcc) + m_dcc = nullptr; break; // Client connected as we wished to (callback) @@ -459,7 +467,9 @@ void __cdecl GaduProto::dccmainthread(void*) 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 = nullptr; + gg_free_dcc(local_dcc); + if (local_dcc == m_dcc) + m_dcc = nullptr; } break; } @@ -526,7 +536,7 @@ void __cdecl GaduProto::dccmainthread(void*) // Connection was successfuly ended case GG_EVENT_DCC7_DONE: - debugLogA("dccmainthread(): Client: %d, Transfer done ! Closing connection.", dcc->peer_uin); + debugLogA("dccmainthread(): Client: %d, Transfer done ! Closing connection.", m_dcc->peer_uin); // Remove from watches list_remove(&watches, local_dcc7, 0); // Close file & success @@ -629,7 +639,8 @@ void __cdecl GaduProto::dccmainthread(void*) gg_dcc_socket_free(local_dcc); // Check if it's main socket - if (local_dcc == dcc) dcc = nullptr; + if (local_dcc == m_dcc) + m_dcc = nullptr; } } // Close all waiting for aknowledgle transfers @@ -943,7 +954,7 @@ HANDLE GaduProto::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFil // Use DCC7 if a contact is using at least version 7.6 or unknown version if ((ver & 0x00ffffff) >= 0x29 || !ver) { gg_EnterCriticalSection(&sess_mutex, "SendFile", 46, "sess_mutex", 1); - struct gg_dcc7 *dcc7 = gg_dcc7_send_file(sess, uin, filename, nullptr, nullptr); + struct gg_dcc7 *dcc7 = gg_dcc7_send_file(m_sess, uin, filename, nullptr, nullptr); if (!dcc7) { gg_LeaveCriticalSection(&sess_mutex, "SendFile", 46, 1, "sess_mutex", 1); debugLogA("SendFile(): Failed to send file \"%s\".", filename); @@ -998,7 +1009,7 @@ HANDLE GaduProto::SendFile(MCONTACT hContact, const wchar_t *, wchar_t** ppszFil dcc->type = GG_SESSION_DCC_SEND; 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_dcc_request(m_sess, uin); gg_LeaveCriticalSection(&sess_mutex, "SendFile", 47, 1, "sess_mutex", 1); list_add(&requests, dcc, 0); } diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp index 10fbfc5aba..a54e6100da 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.cpp +++ b/protocols/Gadu-Gadu/src/gg_proto.cpp @@ -192,7 +192,7 @@ int GaduProto::GetInfo(MCONTACT hContact, int) debugLogA("GetInfo(): Requesting user info.", req->seq); if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "GetInfo", 48, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) { + if (!gg_pubdir50(m_sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 48, 1, "sess_mutex", 1); #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 7 GaduProto::cmdgetinfothread"); @@ -219,7 +219,7 @@ int GaduProto::GetInfo(MCONTACT hContact, int) debugLogA("GetInfo(): Requesting owner info.", req->seq); if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "GetInfo", 49, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) { + if (!gg_pubdir50(m_sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "GetInfo", 49, 1, "sess_mutex", 1); #ifdef DEBUGMODE debugLogA("GetInfo(): ForkThread 9 GaduProto::cmdgetinfothread"); @@ -269,7 +269,7 @@ HANDLE GaduProto::SearchBasic(const wchar_t *id) gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); gg_EnterCriticalSection(&sess_mutex, "SearchBasic", 50, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) { + if (!gg_pubdir50(m_sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchBasic", 50, 1, "sess_mutex", 1); #ifdef DEBUGMODE debugLogA("SearchBasic(): ForkThread 11 GaduProto::searchthread"); @@ -337,7 +337,7 @@ HANDLE GaduProto::SearchByName(const wchar_t *nick, const wchar_t *firstName, co gg_pubdir50_seq_set(req, GG_SEQ_SEARCH); gg_EnterCriticalSection(&sess_mutex, "SearchByName", 51, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) { + if (!gg_pubdir50(m_sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchByName", 51, 1, "sess_mutex", 1); #ifdef DEBUGMODE debugLogA("SearchByName(): ForkThread 13 GaduProto::searchthread"); @@ -473,7 +473,7 @@ HWND GaduProto::SearchAdvanced(HWND hwndDlg) if (isonline()) { gg_EnterCriticalSection(&sess_mutex, "SearchAdvanced", 52, "sess_mutex", 1); - if (!gg_pubdir50(sess, req)) { + if (!gg_pubdir50(m_sess, req)) { gg_LeaveCriticalSection(&sess_mutex, "SearchAdvanced", 52, 1, "sess_mutex", 1); #ifdef DEBUGMODE debugLogA("SearchAdvanced(): ForkThread 15 GaduProto::searchthread"); @@ -538,7 +538,7 @@ int GaduProto::SendMsg(MCONTACT hContact, int, const char *msg) return 0; gg_EnterCriticalSection(&sess_mutex, "SendMsg", 53, "sess_mutex", 1); - int seq = gg_send_message(sess, GG_CLASS_CHAT, uin, (BYTE*)msg); + int seq = gg_send_message(m_sess, GG_CLASS_CHAT, uin, (BYTE*)msg); gg_LeaveCriticalSection(&sess_mutex, "SendMsg", 53, 1, "sess_mutex", 1); if (!m_gaduOptions.useMsgDeliveryAcknowledge) { // Auto-ack message without waiting for server ack @@ -689,7 +689,7 @@ int GaduProto::UserIsTyping(MCONTACT hContact, int type) if (type == PROTOTYPE_SELFTYPING_ON || type == PROTOTYPE_SELFTYPING_OFF) { gg_EnterCriticalSection(&sess_mutex, "UserIsTyping", 56, "sess_mutex", 1); - gg_typing_notification(sess, uin, (type == PROTOTYPE_SELFTYPING_ON)); + gg_typing_notification(m_sess, uin, (type == PROTOTYPE_SELFTYPING_ON)); gg_LeaveCriticalSection(&sess_mutex, "UserIsTyping", 56, 1, "sess_mutex", 1); } diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h index 2a2ed13659..ddeaa82cb9 100644 --- a/protocols/Gadu-Gadu/src/gg_proto.h +++ b/protocols/Gadu-Gadu/src/gg_proto.h @@ -134,12 +134,6 @@ struct GaduProto : public PROTO void __cdecl setavatarthread(void*); /* File transfer functions */ - HANDLE fileallow(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szPath); - int filecancel(MCONTACT hContact, HANDLE hTransfer); - int filedeny(MCONTACT hContact, HANDLE hTransfer, const wchar_t* szReason); - int recvfile(MCONTACT hContact, PROTORECVFILE* pre); - HANDLE sendfile(MCONTACT hContact, const wchar_t* szDescription, wchar_t** ppszFiles); - HANDLE dccfileallow(HANDLE hTransfer, const wchar_t* szPath); HANDLE dcc7fileallow(HANDLE hTransfer, const wchar_t* szPath); @@ -226,8 +220,8 @@ struct GaduProto : public PROTO GGTHREAD pth_dcc; GGTHREAD pth_sess; GGTHREAD pth_avatar; - struct gg_session *sess; - struct gg_dcc *dcc; + struct gg_session *m_sess; + struct gg_dcc *m_dcc; HANDLE hEvent; HANDLE hConnStopEvent; SOCKET sock; diff --git a/protocols/Gadu-Gadu/src/groupchat.cpp b/protocols/Gadu-Gadu/src/groupchat.cpp index f1d5e11aec..e8db07c499 100644 --- a/protocols/Gadu-Gadu/src/groupchat.cpp +++ b/protocols/Gadu-Gadu/src/groupchat.cpp @@ -177,7 +177,7 @@ int GaduProto::gc_event(WPARAM, LPARAM lParam) T2Utf pszText_utf8(gch->ptszText); gg_EnterCriticalSection(&sess_mutex, "gc_event", 57, "sess_mutex", 1); - gg_send_message_confer(sess, GG_CLASS_CHAT, chat->recipients_count, chat->recipients, pszText_utf8); + gg_send_message_confer(m_sess, GG_CLASS_CHAT, chat->recipients_count, chat->recipients, pszText_utf8); gg_LeaveCriticalSection(&sess_mutex, "gc_event", 57, 1, "sess_mutex", 1); return 1; } diff --git a/protocols/Gadu-Gadu/src/image.cpp b/protocols/Gadu-Gadu/src/image.cpp index 844d3a4c28..8d86ada520 100644 --- a/protocols/Gadu-Gadu/src/image.cpp +++ b/protocols/Gadu-Gadu/src/image.cpp @@ -534,8 +534,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP return TRUE; case WM_COMMAND: - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case IDC_IMG_CANCEL: EndDialog(hwndDlg, 0); return TRUE; @@ -605,7 +604,6 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP case IDC_IMG_SEND: { unsigned char format[20]; - char *msg = "\xA0\0"; GaduProto *gg = dat->gg; if (dat->lpImages && gg->isonline()) @@ -627,7 +625,7 @@ static INT_PTR CALLBACK gg_img_dlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LP uin_t uin = (uin_t)gg->getDword(dat->hContact, GG_KEY_UIN, 0); gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_img_dlgproc", 59, "sess_mutex", 1); - gg_send_message_richtext(gg->sess, GG_CLASS_CHAT, uin, (unsigned char*)msg, format, len + sizeof(struct gg_msg_richtext)); + gg_send_message_richtext(gg->m_sess, GG_CLASS_CHAT, uin, (unsigned char*)"\xA0\0", format, len + sizeof(struct gg_msg_richtext)); gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_img_dlgproc", 59, 1, "sess_mutex", 1); // Protect dat from releasing @@ -749,7 +747,7 @@ int gg_img_isexists(wchar_t *szPath, GGIMAGEENTRY *dat) if (_wstat(szPath, &st) != 0) return 0; - if (st.st_size == dat->nSize) + if ((long)st.st_size == dat->nSize) { FILE *fp = _wfopen(szPath, L"rb"); if (!fp) return 0; @@ -1169,7 +1167,7 @@ BOOL GaduProto::img_sendonrequest(gg_event* e) char* lpszFileNameA = mir_u2a(dat->lpImages->lpszFileName); gg_EnterCriticalSection(&sess_mutex, "img_sendonrequest", 63, "sess_mutex", 1); - gg_image_reply(sess, e->event.image_request.sender, lpszFileNameA, dat->lpImages->lpData, dat->lpImages->nSize); + gg_image_reply(m_sess, e->event.image_request.sender, lpszFileNameA, dat->lpImages->lpData, dat->lpImages->nSize); gg_LeaveCriticalSection(&sess_mutex, "img_sendonrequest", 63, 1, "sess_mutex", 1); mir_free(lpszFileNameA); diff --git a/protocols/Gadu-Gadu/src/import.cpp b/protocols/Gadu-Gadu/src/import.cpp index ed17ea1aed..832afa9b98 100644 --- a/protocols/Gadu-Gadu/src/import.cpp +++ b/protocols/Gadu-Gadu/src/import.cpp @@ -286,7 +286,7 @@ INT_PTR GaduProto::import_server(WPARAM, LPARAM) // Making contacts list gg_EnterCriticalSection(&sess_mutex, "import_server", 65, "sess_mutex", 1); - if (gg_userlist_request(sess, GG_USERLIST_GET, nullptr) == -1) + if (gg_userlist_request(m_sess, GG_USERLIST_GET, nullptr) == -1) { wchar_t error[128]; gg_LeaveCriticalSection(&sess_mutex, "import_server", 65, 1, "sess_mutex", 1); @@ -324,7 +324,7 @@ INT_PTR GaduProto::remove_server(WPARAM, LPARAM) // Making contacts list gg_EnterCriticalSection(&sess_mutex, "remove_server", 66, "sess_mutex", 1); - if (gg_userlist_request(sess, GG_USERLIST_PUT, nullptr) == -1) + if (gg_userlist_request(m_sess, GG_USERLIST_PUT, nullptr) == -1) { wchar_t error[128]; gg_LeaveCriticalSection(&sess_mutex, "remove_server", 66, 1, "sess_mutex", 1); @@ -513,7 +513,7 @@ INT_PTR GaduProto::export_server(WPARAM, LPARAM) #endif gg_EnterCriticalSection(&sess_mutex, "export_server", 67, "sess_mutex", 1); - if (gg_userlist_request(sess, GG_USERLIST_PUT, contacts) == -1) + if (gg_userlist_request(m_sess, GG_USERLIST_PUT, contacts) == -1) { wchar_t error[128]; gg_LeaveCriticalSection(&sess_mutex, "export_server", 67, 1, "sess_mutex", 1); diff --git a/protocols/Gadu-Gadu/src/keepalive.cpp b/protocols/Gadu-Gadu/src/keepalive.cpp index 4d7a13acff..67e445c221 100644 --- a/protocols/Gadu-Gadu/src/keepalive.cpp +++ b/protocols/Gadu-Gadu/src/keepalive.cpp @@ -44,7 +44,7 @@ static VOID CALLBACK gg_keepalive(HWND, UINT, UINT_PTR idEvent, DWORD) gg->debugLogA("gg_keepalive(): Sending keep-alive"); #endif gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_keepalive", 68, "sess_mutex", 1); - gg_ping(gg->sess); + gg_ping(gg->m_sess); gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_keepalive", 68, 1, "sess_mutex", 1); } } diff --git a/protocols/Gadu-Gadu/src/services.cpp b/protocols/Gadu-Gadu/src/services.cpp index 69bd73cd6d..b127f19852 100644 --- a/protocols/Gadu-Gadu/src/services.cpp +++ b/protocols/Gadu-Gadu/src/services.cpp @@ -109,13 +109,13 @@ int GaduProto::refreshstatus(int status) if (szMsg_utf8) { 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_change_status_descr(m_sess, status_m2gg(status, szMsg_utf8 != NULL), szMsg_utf8); gg_LeaveCriticalSection(&sess_mutex, "refreshstatus", 70, 1, "sess_mutex", 1); } else { debugLogA("refreshstatus(): Setting just status."); gg_EnterCriticalSection(&sess_mutex, "refreshstatus", 71, "sess_mutex", 1); - gg_change_status(sess, status_m2gg(status, 0)); + gg_change_status(m_sess, status_m2gg(status, 0)); gg_LeaveCriticalSection(&sess_mutex, "refreshstatus", 71, 1, "sess_mutex", 1); } // Change status of the contact with our own UIN (if got yourself added to the contact list) diff --git a/protocols/Gadu-Gadu/src/sessions.cpp b/protocols/Gadu-Gadu/src/sessions.cpp index 649032cd5a..2c4f80318c 100644 --- a/protocols/Gadu-Gadu/src/sessions.cpp +++ b/protocols/Gadu-Gadu/src/sessions.cpp @@ -214,7 +214,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w lvi.iItem = i; ListView_GetItem(hList, &lvi); gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_sessions_viewdlg", 74, "sess_mutex", 1); - gg_multilogon_disconnect(gg->sess, *((gg_multilogon_id_t*)lvi.lParam)); + gg_multilogon_disconnect(gg->m_sess, *((gg_multilogon_id_t*)lvi.lParam)); gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_sessions_viewdlg", 74, 1, "sess_mutex", 1); } break; @@ -288,7 +288,7 @@ static INT_PTR CALLBACK gg_sessions_viewdlg(HWND hwndDlg, UINT message, WPARAM w lvi.iItem = nm->iItem; ListView_GetItem(nm->hdr.hwndFrom, &lvi); gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_sessions_viewdlg", 75, "sess_mutex", 1); - gg_multilogon_disconnect(gg->sess, *((gg_multilogon_id_t*)lvi.lParam)); + gg_multilogon_disconnect(gg->m_sess, *((gg_multilogon_id_t*)lvi.lParam)); gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_sessions_viewdlg", 75, 1, "sess_mutex", 1); } break; -- cgit v1.2.3