From a35f8740e62fc7953e4aa94601646e1999e639ed Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 9 Jul 2014 13:32:06 +0000 Subject: - advanced diagnostics; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@9747 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/IcqOscarJ/src/UI/askauthentication.cpp | 7 +- protocols/IcqOscarJ/src/UI/loginpassword.cpp | 8 +- protocols/IcqOscarJ/src/chan_01login.cpp | 8 +- protocols/IcqOscarJ/src/chan_03error.cpp | 7 +- protocols/IcqOscarJ/src/chan_04close.cpp | 9 +- protocols/IcqOscarJ/src/chan_05ping.cpp | 8 +- protocols/IcqOscarJ/src/cookies.h | 8 +- protocols/IcqOscarJ/src/directpackets.cpp | 7 +- protocols/IcqOscarJ/src/fam_09bos.cpp | 7 +- protocols/IcqOscarJ/src/fam_0alookup.cpp | 7 +- protocols/IcqOscarJ/src/fam_0bstatus.cpp | 8 +- protocols/IcqOscarJ/src/fam_13servclist.cpp | 8 +- protocols/IcqOscarJ/src/fam_15icqserver.cpp | 7 +- protocols/IcqOscarJ/src/fam_17signon.cpp | 7 +- protocols/IcqOscarJ/src/icq_advsearch.cpp | 7 +- protocols/IcqOscarJ/src/icq_advsearch.h | 7 -- protocols/IcqOscarJ/src/icq_avatar.cpp | 7 -- protocols/IcqOscarJ/src/icq_direct.cpp | 30 ++---- protocols/IcqOscarJ/src/icq_direct.h | 7 +- protocols/IcqOscarJ/src/icq_directmsg.cpp | 7 +- protocols/IcqOscarJ/src/icq_fieldnames.cpp | 6 -- protocols/IcqOscarJ/src/icq_fieldnames.h | 7 +- protocols/IcqOscarJ/src/icq_filerequests.cpp | 7 +- protocols/IcqOscarJ/src/icq_filetransfer.cpp | 8 +- protocols/IcqOscarJ/src/icq_firstrun.cpp | 7 +- protocols/IcqOscarJ/src/icq_http.h | 7 +- protocols/IcqOscarJ/src/icq_opts.cpp | 7 +- protocols/IcqOscarJ/src/icq_packet.cpp | 14 +-- protocols/IcqOscarJ/src/icq_packet.h | 7 +- protocols/IcqOscarJ/src/icq_server.cpp | 117 +++++++++++------------ protocols/IcqOscarJ/src/icq_servlist.h | 7 +- protocols/IcqOscarJ/src/icqosc_svcs.h | 7 +- protocols/IcqOscarJ/src/init.cpp | 7 +- protocols/IcqOscarJ/src/init.h | 7 +- protocols/IcqOscarJ/src/log.cpp | 7 +- protocols/IcqOscarJ/src/log.h | 7 +- protocols/IcqOscarJ/src/stdpackets.cpp | 7 +- protocols/IcqOscarJ/src/tlv.h | 7 +- protocols/IcqOscarJ/src/utilities.cpp | 8 +- protocols/IcqOscarJ/src/utilities.h | 8 +- 40 files changed, 104 insertions(+), 326 deletions(-) (limited to 'protocols/IcqOscarJ/src') diff --git a/protocols/IcqOscarJ/src/UI/askauthentication.cpp b/protocols/IcqOscarJ/src/UI/askauthentication.cpp index be0b18af78..815bb2fc37 100644 --- a/protocols/IcqOscarJ/src/UI/askauthentication.cpp +++ b/protocols/IcqOscarJ/src/UI/askauthentication.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" struct AskAuthParam diff --git a/protocols/IcqOscarJ/src/UI/loginpassword.cpp b/protocols/IcqOscarJ/src/UI/loginpassword.cpp index 9636e9a41b..53a9dde738 100644 --- a/protocols/IcqOscarJ/src/UI/loginpassword.cpp +++ b/protocols/IcqOscarJ/src/UI/loginpassword.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// // ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// -// ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" INT_PTR CALLBACK LoginPasswdDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam) { diff --git a/protocols/IcqOscarJ/src/chan_01login.cpp b/protocols/IcqOscarJ/src/chan_01login.cpp index b8444f228e..a0e1222aa4 100644 --- a/protocols/IcqOscarJ/src/chan_01login.cpp +++ b/protocols/IcqOscarJ/src/chan_01login.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// // ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// -// ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" void CIcqProto::handleLoginChannel(BYTE *buf, WORD datalen, serverthread_info *info) { diff --git a/protocols/IcqOscarJ/src/chan_03error.cpp b/protocols/IcqOscarJ/src/chan_03error.cpp index a4119f2aa9..a44ae3af3b 100644 --- a/protocols/IcqOscarJ/src/chan_03error.cpp +++ b/protocols/IcqOscarJ/src/chan_03error.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void CIcqProto::handleErrorChannel(unsigned char* buf, WORD datalen) diff --git a/protocols/IcqOscarJ/src/chan_04close.cpp b/protocols/IcqOscarJ/src/chan_04close.cpp index 873df06cab..5979919c62 100644 --- a/protocols/IcqOscarJ/src/chan_04close.cpp +++ b/protocols/IcqOscarJ/src/chan_04close.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" void CIcqProto::handleCloseChannel(BYTE *buf, WORD datalen, serverthread_info *info) { @@ -53,7 +47,6 @@ void CIcqProto::handleCloseChannel(BYTE *buf, WORD datalen, serverthread_info *i info->isMigrating = 0; } info->newServerReady = 0; - return; } diff --git a/protocols/IcqOscarJ/src/chan_05ping.cpp b/protocols/IcqOscarJ/src/chan_05ping.cpp index 7bb06d9a43..bd5539b974 100644 --- a/protocols/IcqOscarJ/src/chan_05ping.cpp +++ b/protocols/IcqOscarJ/src/chan_05ping.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// // ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// -// ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" void CIcqProto::handlePingChannel(BYTE *buf, WORD datalen) { diff --git a/protocols/IcqOscarJ/src/cookies.h b/protocols/IcqOscarJ/src/cookies.h index a16f32b837..aec80dc5be 100644 --- a/protocols/IcqOscarJ/src/cookies.h +++ b/protocols/IcqOscarJ/src/cookies.h @@ -20,17 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __COOKIES_H #define __COOKIES_H - #define CKT_MESSAGE 0x01 #define CKT_FILE 0x02 #define CKT_SEARCH 0x04 diff --git a/protocols/IcqOscarJ/src/directpackets.cpp b/protocols/IcqOscarJ/src/directpackets.cpp index 32a5186511..41bdfa4325 100644 --- a/protocols/IcqOscarJ/src/directpackets.cpp +++ b/protocols/IcqOscarJ/src/directpackets.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void EncryptDirectPacket(directconnect* dc, icq_packet* p); diff --git a/protocols/IcqOscarJ/src/fam_09bos.cpp b/protocols/IcqOscarJ/src/fam_09bos.cpp index 98c0f58126..62fc811cd7 100644 --- a/protocols/IcqOscarJ/src/fam_09bos.cpp +++ b/protocols/IcqOscarJ/src/fam_09bos.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void CIcqProto::handleBosFam(unsigned char *pBuffer, WORD wBufferLength, snac_header* pSnacHeader) diff --git a/protocols/IcqOscarJ/src/fam_0alookup.cpp b/protocols/IcqOscarJ/src/fam_0alookup.cpp index 3eefca98c8..44cd2fcc61 100644 --- a/protocols/IcqOscarJ/src/fam_0alookup.cpp +++ b/protocols/IcqOscarJ/src/fam_0alookup.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void CIcqProto::handleLookupFam(BYTE *pBuffer, WORD wBufferLength, snac_header* pSnacHeader) diff --git a/protocols/IcqOscarJ/src/fam_0bstatus.cpp b/protocols/IcqOscarJ/src/fam_0bstatus.cpp index d50683d3f5..e28253b119 100644 --- a/protocols/IcqOscarJ/src/fam_0bstatus.cpp +++ b/protocols/IcqOscarJ/src/fam_0bstatus.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// // ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// -// ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" void CIcqProto::handleStatusFam(unsigned char *pBuffer, WORD wBufferLength, snac_header* pSnacHeader) { diff --git a/protocols/IcqOscarJ/src/fam_13servclist.cpp b/protocols/IcqOscarJ/src/fam_13servclist.cpp index df29ad0e92..a079f46a6f 100644 --- a/protocols/IcqOscarJ/src/fam_13servclist.cpp +++ b/protocols/IcqOscarJ/src/fam_13servclist.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" static int unpackServerListItem(BYTE **pbuf, WORD *pwLen, char *pszRecordName, WORD *pwGroupId, WORD *pwItemId, WORD *pwItemType, WORD *pwTlvLength); diff --git a/protocols/IcqOscarJ/src/fam_15icqserver.cpp b/protocols/IcqOscarJ/src/fam_15icqserver.cpp index b120bc0fb0..b80ef50ee2 100644 --- a/protocols/IcqOscarJ/src/fam_15icqserver.cpp +++ b/protocols/IcqOscarJ/src/fam_15icqserver.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void CIcqProto::handleIcqExtensionsFam(BYTE *pBuffer, WORD wBufferLength, snac_header* pSnacHeader) diff --git a/protocols/IcqOscarJ/src/fam_17signon.cpp b/protocols/IcqOscarJ/src/fam_17signon.cpp index 2ac1de498d..c531cc00a8 100644 --- a/protocols/IcqOscarJ/src/fam_17signon.cpp +++ b/protocols/IcqOscarJ/src/fam_17signon.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void CIcqProto::handleAuthorizationFam(BYTE *pBuffer, WORD wBufferLength, snac_header *pSnacHeader, serverthread_info *info) diff --git a/protocols/IcqOscarJ/src/icq_advsearch.cpp b/protocols/IcqOscarJ/src/icq_advsearch.cpp index 15eee0bc3d..721285b207 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.cpp +++ b/protocols/IcqOscarJ/src/icq_advsearch.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" static void InitComboBox(HWND hwndCombo, const FieldNamesItem *names) diff --git a/protocols/IcqOscarJ/src/icq_advsearch.h b/protocols/IcqOscarJ/src/icq_advsearch.h index 83bf35af93..268e9fc129 100644 --- a/protocols/IcqOscarJ/src/icq_advsearch.h +++ b/protocols/IcqOscarJ/src/icq_advsearch.h @@ -19,14 +19,7 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// // ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// -// ----------------------------------------------------------------------------- - INT_PTR CALLBACK AdvancedSearchDlgProc(HWND hwndDlg,UINT message,WPARAM wParam,LPARAM lParam); PBYTE createAdvancedSearchStructure(HWND hwndDlg,int *length); diff --git a/protocols/IcqOscarJ/src/icq_avatar.cpp b/protocols/IcqOscarJ/src/icq_avatar.cpp index aa3ee36ba9..776c309275 100644 --- a/protocols/IcqOscarJ/src/icq_avatar.cpp +++ b/protocols/IcqOscarJ/src/icq_avatar.cpp @@ -287,20 +287,13 @@ void CIcqProto::StartAvatarThread(HANDLE hConn, char *cookie, WORD cookieLen) // m_avatarsConnectionPending = FALSE; } - void CIcqProto::StopAvatarThread() { icq_lock l(m_avatarsMutex); // the connection is about to close - if (m_avatarsConnection) - { m_avatarsConnection->shutdownConnection(); // make the thread stop - } - - return; } - #ifdef _DEBUG static void NetLog_Hash(CIcqProto *ppro, const char *pszIdent, const BYTE *pHash, int nHashLen) { diff --git a/protocols/IcqOscarJ/src/icq_direct.cpp b/protocols/IcqOscarJ/src/icq_direct.cpp index 0369bdd8b9..fb4a57ea66 100644 --- a/protocols/IcqOscarJ/src/icq_direct.cpp +++ b/protocols/IcqOscarJ/src/icq_direct.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" struct directthreadstartinfo @@ -52,10 +47,8 @@ void CIcqProto::CloseContactDirectConns(MCONTACT hContact) { icq_lock l(directConnListMutex); - for ( int i = 0; i < directConns.getCount(); i++) - { - if (!hContact || directConns[i]->hContact == hContact) - { + for (int i = 0; i < directConns.getCount(); i++) { + if (!hContact || directConns[i]->hContact == hContact) { HANDLE hConnection = directConns[i]->hConnection; directConns[i]->hConnection = NULL; // do not allow reuse @@ -481,16 +474,13 @@ void __cdecl CIcqProto::icq_directThread( directthreadstartinfo *dtsi ) } // End of packet receiving loop - NetLib_SafeCloseHandle(&hPacketRecver); CloseDirectConnection(&dc); - if (dc.ft) - { - if (dc.ft->fileId != -1) - { + if (dc.ft) { + if (dc.ft->fileId != -1) { _close(dc.ft->fileId); - ProtoBroadcastAck(dc.ft->hContact, ACKTYPE_FILE, dc.ft->dwBytesDone==dc.ft->dwTotalSize ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, dc.ft, 0); + ProtoBroadcastAck(dc.ft->hContact, ACKTYPE_FILE, dc.ft->dwBytesDone == dc.ft->dwTotalSize ? ACKRESULT_SUCCESS : ACKRESULT_FAILED, dc.ft, 0); } else if (dc.ft->hConnection) ProtoBroadcastAck(dc.ft->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, dc.ft, 0); @@ -500,13 +490,11 @@ void __cdecl CIcqProto::icq_directThread( directthreadstartinfo *dtsi ) } LBL_Exit: - { // remove from DC connection list - icq_lock l(directConnListMutex); - directConns.remove( &dc ); - } + // remove from DC connection list + icq_lock l(directConnListMutex); + directConns.remove(&dc); } - void CIcqProto::handleDirectPacket(directconnect* dc, PBYTE buf, WORD wLen) { if (wLen < 1) diff --git a/protocols/IcqOscarJ/src/icq_direct.h b/protocols/IcqOscarJ/src/icq_direct.h index bb8c38d29f..5c8e132476 100644 --- a/protocols/IcqOscarJ/src/icq_direct.h +++ b/protocols/IcqOscarJ/src/icq_direct.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __ICQ_DIRECT_H #define __ICQ_DIRECT_H diff --git a/protocols/IcqOscarJ/src/icq_directmsg.cpp b/protocols/IcqOscarJ/src/icq_directmsg.cpp index df34189cb0..81a2f99149 100644 --- a/protocols/IcqOscarJ/src/icq_directmsg.cpp +++ b/protocols/IcqOscarJ/src/icq_directmsg.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void CIcqProto::handleDirectMessage(directconnect* dc, PBYTE buf, WORD wLen) diff --git a/protocols/IcqOscarJ/src/icq_fieldnames.cpp b/protocols/IcqOscarJ/src/icq_fieldnames.cpp index 136b838af0..f9fae667cc 100644 --- a/protocols/IcqOscarJ/src/icq_fieldnames.cpp +++ b/protocols/IcqOscarJ/src/icq_fieldnames.cpp @@ -20,12 +20,6 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- #include "icqoscar.h" diff --git a/protocols/IcqOscarJ/src/icq_fieldnames.h b/protocols/IcqOscarJ/src/icq_fieldnames.h index 31f29c292e..15a6371826 100644 --- a/protocols/IcqOscarJ/src/icq_fieldnames.h +++ b/protocols/IcqOscarJ/src/icq_fieldnames.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + struct FieldNamesItem { int code; diff --git a/protocols/IcqOscarJ/src/icq_filerequests.cpp b/protocols/IcqOscarJ/src/icq_filerequests.cpp index eeb0f7313d..c67578b221 100644 --- a/protocols/IcqOscarJ/src/icq_filerequests.cpp +++ b/protocols/IcqOscarJ/src/icq_filerequests.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" void CIcqProto::handleFileAck(PBYTE buf, WORD wLen, DWORD dwUin, DWORD dwCookie, WORD wStatus, char* pszText) diff --git a/protocols/IcqOscarJ/src/icq_filetransfer.cpp b/protocols/IcqOscarJ/src/icq_filetransfer.cpp index 39dd4de11b..0b3d6a2496 100644 --- a/protocols/IcqOscarJ/src/icq_filetransfer.cpp +++ b/protocols/IcqOscarJ/src/icq_filetransfer.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// // ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// -// ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" static void file_buildProtoFileTransferStatus(filetransfer* ft, PROTOFILETRANSFERSTATUS* pfts) { diff --git a/protocols/IcqOscarJ/src/icq_firstrun.cpp b/protocols/IcqOscarJ/src/icq_firstrun.cpp index 47dd485da1..d7d2f83fdd 100644 --- a/protocols/IcqOscarJ/src/icq_firstrun.cpp +++ b/protocols/IcqOscarJ/src/icq_firstrun.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" static void accountLoadDetails(CIcqProto *ppro, HWND hwndDlg) diff --git a/protocols/IcqOscarJ/src/icq_http.h b/protocols/IcqOscarJ/src/icq_http.h index 017a5ea5fc..7f6c8f4395 100644 --- a/protocols/IcqOscarJ/src/icq_http.h +++ b/protocols/IcqOscarJ/src/icq_http.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __ICQ_HTTP_H #define __ICQ_HTTP_H diff --git a/protocols/IcqOscarJ/src/icq_opts.cpp b/protocols/IcqOscarJ/src/icq_opts.cpp index 05a1d8b493..54fd540b7d 100644 --- a/protocols/IcqOscarJ/src/icq_opts.cpp +++ b/protocols/IcqOscarJ/src/icq_opts.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" #include diff --git a/protocols/IcqOscarJ/src/icq_packet.cpp b/protocols/IcqOscarJ/src/icq_packet.cpp index c74687cdc3..72391812b9 100644 --- a/protocols/IcqOscarJ/src/icq_packet.cpp +++ b/protocols/IcqOscarJ/src/icq_packet.cpp @@ -20,23 +20,17 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" WORD generate_flap_sequence() { - DWORD n = rand(), s = 0; + DWORD n = rand(), s = 0; - for (DWORD i = n; i >>= 3; s += i); + for (DWORD i = n; i >>= 3; s += i); - return (((0 - s) ^ (BYTE)n) & 7 ^ n) + 2; + return (((0 - s) ^ (BYTE)n) & 7 ^ n) + 2; } void __fastcall init_generic_packet(icq_packet *pPacket, WORD wHeaderLen) diff --git a/protocols/IcqOscarJ/src/icq_packet.h b/protocols/IcqOscarJ/src/icq_packet.h index ccaeb91fcc..3a8d6c231a 100644 --- a/protocols/IcqOscarJ/src/icq_packet.h +++ b/protocols/IcqOscarJ/src/icq_packet.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __ICQ_PACKET_H #define __ICQ_PACKET_H diff --git a/protocols/IcqOscarJ/src/icq_server.cpp b/protocols/IcqOscarJ/src/icq_server.cpp index b82ebcfa1a..ebb6050c02 100644 --- a/protocols/IcqOscarJ/src/icq_server.cpp +++ b/protocols/IcqOscarJ/src/icq_server.cpp @@ -27,8 +27,8 @@ // Manages main server connection, low-level communication // // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" void icq_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pExtra); @@ -38,7 +38,6 @@ void icq_newConnectionReceived(HANDLE hNewConnection, DWORD dwRemoteIP, void *pE void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) { serverthread_info info = {0}; - info.isLoginServer = 1; info.wAuthKeyLen = infoParam->wPassLen; null_strcpy((char*)info.szAuthKey, infoParam->szPass, info.wAuthKeyLen); @@ -83,19 +82,18 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) } // Initialize direct connection ports - { - DWORD dwInternalIP; - BYTE bConstInternalIP = getByte("ConstRealIP", 0); - - info.hDirectBoundPort = NetLib_BindPort(icq_newConnectionReceived, this, &wListenPort, &dwInternalIP); - if (!info.hDirectBoundPort) { - icq_LogUsingErrorCode(LOG_WARNING, GetLastError(), LPGEN("Miranda was unable to allocate a port to listen for direct peer-to-peer connections between clients. You will be able to use most of the ICQ network without problems but you may be unable to send or receive files.\n\nIf you have a firewall this may be blocking Miranda, in which case you should configure your firewall to leave some ports open and tell Miranda which ports to use in M->Options->ICQ->Network.")); - wListenPort = 0; - if (!bConstInternalIP) delSetting("RealIP"); - } - else if (!bConstInternalIP) - setDword("RealIP", dwInternalIP); + DWORD dwInternalIP; + BYTE bConstInternalIP = getByte("ConstRealIP", 0); + + info.hDirectBoundPort = NetLib_BindPort(icq_newConnectionReceived, this, &wListenPort, &dwInternalIP); + if (!info.hDirectBoundPort) { + icq_LogUsingErrorCode(LOG_WARNING, GetLastError(), LPGEN("Miranda was unable to allocate a port to listen for direct peer-to-peer connections between clients. You will be able to use most of the ICQ network without problems but you may be unable to send or receive files.\n\nIf you have a firewall this may be blocking Miranda, in which case you should configure your firewall to leave some ports open and tell Miranda which ports to use in M->Options->ICQ->Network.")); + wListenPort = 0; + if (!bConstInternalIP) + delSetting("RealIP"); } + else if (!bConstInternalIP) + setDword("RealIP", dwInternalIP); // Initialize rate limiting queues { @@ -105,60 +103,57 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) } // This is the "infinite" loop that receives the packets from the ICQ server - { - int recvResult; - NETLIBPACKETRECVER packetRecv = { 0 }; - - info.hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 0x2400); - packetRecv.cbSize = sizeof(packetRecv); - packetRecv.dwTimeout = INFINITE; - while (serverThreadHandle) { - if (info.bReinitRecver) { // we reconnected, reinit struct - info.bReinitRecver = 0; - ZeroMemory(&packetRecv, sizeof(packetRecv)); - packetRecv.cbSize = sizeof(packetRecv); - packetRecv.dwTimeout = INFINITE; - } - - recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)info.hPacketRecver, (LPARAM)&packetRecv); - - if (recvResult == 0) { - debugLogA("Clean closure of server socket"); - break; - } + info.hPacketRecver = (HANDLE)CallService(MS_NETLIB_CREATEPACKETRECVER, (WPARAM)hServerConn, 0x2400); + + NETLIBPACKETRECVER packetRecv = { sizeof(packetRecv) }; + packetRecv.dwTimeout = INFINITE; + while (serverThreadHandle) { + if (info.bReinitRecver) { // we reconnected, reinit struct + info.bReinitRecver = 0; + ZeroMemory(&packetRecv, sizeof(packetRecv)); + packetRecv.cbSize = sizeof(packetRecv); + packetRecv.dwTimeout = INFINITE; + } - if (recvResult == SOCKET_ERROR) { - debugLogA("Abortive closure of server socket, error: %d", GetLastError()); - break; - } + int recvResult = CallService(MS_NETLIB_GETMOREPACKETS, (WPARAM)info.hPacketRecver, (LPARAM)&packetRecv); + if (recvResult == 0) { + debugLogA("Clean closure of server socket"); + break; + } - if (m_iDesiredStatus == ID_STATUS_OFFLINE) { // Disconnect requested, send disconnect packet - icq_sendCloseConnection(); + if (recvResult == SOCKET_ERROR) { + debugLogA("Abortive closure of server socket, error: %d", GetLastError()); + break; + } - // disconnected upon request - m_bConnectionLost = FALSE; - SetCurrentStatus(ID_STATUS_OFFLINE); + if (m_iDesiredStatus == ID_STATUS_OFFLINE) { // Disconnect requested, send disconnect packet + icq_sendCloseConnection(); - debugLogA("Logged off."); - break; - } + // disconnected upon request + m_bConnectionLost = FALSE; + SetCurrentStatus(ID_STATUS_OFFLINE); - // Deal with the packet - packetRecv.bytesUsed = handleServerPackets(packetRecv.buffer, packetRecv.bytesAvailable, &info); + debugLogA("Logged off."); + break; } - serverThreadHandle = NULL; - // Time to shutdown - NetLib_CloseConnection(&hServerConn, TRUE); + // Deal with the packet + packetRecv.bytesUsed = handleServerPackets(packetRecv.buffer, packetRecv.bytesAvailable, &info); + } + serverThreadHandle = NULL; - // Close the packet receiver (connection may still be open) - NetLib_SafeCloseHandle(&info.hPacketRecver); + // Time to shutdown + debugLogA("Closing server connections..."); + NetLib_CloseConnection(&hServerConn, TRUE); - // Close DC port - NetLib_SafeCloseHandle(&info.hDirectBoundPort); - } + // Close the packet receiver (connection may still be open) + NetLib_SafeCloseHandle(&info.hPacketRecver); + + // Close DC port + NetLib_SafeCloseHandle(&info.hDirectBoundPort); // disable auto info-update thread + debugLogA("Stopping info update thread..."); icq_EnableUserLookup(FALSE); if (m_iStatus != ID_STATUS_OFFLINE && m_iDesiredStatus != ID_STATUS_OFFLINE) { @@ -172,24 +167,27 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) } // signal keep-alive thread to stop + debugLogA("Stopping keep-alive thread..."); StopKeepAlive(&info); // Close all open DC connections + debugLogA("Stopping direct connections..."); CloseContactDirectConns(NULL); // Close avatar connection if any + debugLogA("Stopping avatars thread..."); StopAvatarThread(); // Offline all contacts + debugLogA("Setting offline status to contacts..."); for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { DWORD dwUIN; uid_str szUID; if (!getContactUid(hContact, &dwUIN, &szUID)) { if (getContactStatus(hContact) != ID_STATUS_OFFLINE) { - char tmp = 0; - setWord(hContact, "Status", ID_STATUS_OFFLINE); + char tmp = 0; handleXStatusCaps(dwUIN, szUID, hContact, (BYTE*)&tmp, 0, &tmp, 0); } } @@ -202,7 +200,6 @@ void __cdecl CIcqProto::ServerThread(serverthread_start_info *infoParam) // release rates queues { icq_lock l(m_ratesMutex); - delete m_ratesQueue_Request; m_ratesQueue_Request = NULL; delete m_ratesQueue_Response; m_ratesQueue_Response = NULL; delete m_rates; m_rates = NULL; diff --git a/protocols/IcqOscarJ/src/icq_servlist.h b/protocols/IcqOscarJ/src/icq_servlist.h index 8da1f32cf4..ef36e485fb 100644 --- a/protocols/IcqOscarJ/src/icq_servlist.h +++ b/protocols/IcqOscarJ/src/icq_servlist.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __ICQ_SERVLIST_H #define __ICQ_SERVLIST_H diff --git a/protocols/IcqOscarJ/src/icqosc_svcs.h b/protocols/IcqOscarJ/src/icqosc_svcs.h index 844eecee51..bcd9b1a2ab 100644 --- a/protocols/IcqOscarJ/src/icqosc_svcs.h +++ b/protocols/IcqOscarJ/src/icqosc_svcs.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __ICQOSC_SVCS_H #define __ICQOSC_SVCS_H diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp index a377c2c827..ff733af7b4 100644 --- a/protocols/IcqOscarJ/src/init.cpp +++ b/protocols/IcqOscarJ/src/init.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" #include "m_extraicons.h" diff --git a/protocols/IcqOscarJ/src/init.h b/protocols/IcqOscarJ/src/init.h index 0e93a8a89f..f949389cdb 100644 --- a/protocols/IcqOscarJ/src/init.h +++ b/protocols/IcqOscarJ/src/init.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + // Debug defines #define DBG_CAPHTML #define DBG_CAPMTN diff --git a/protocols/IcqOscarJ/src/log.cpp b/protocols/IcqOscarJ/src/log.cpp index 2314019072..acff41fef1 100644 --- a/protocols/IcqOscarJ/src/log.cpp +++ b/protocols/IcqOscarJ/src/log.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" extern BOOL bPopupService; diff --git a/protocols/IcqOscarJ/src/log.h b/protocols/IcqOscarJ/src/log.h index 6da25df0d7..c533c7310a 100644 --- a/protocols/IcqOscarJ/src/log.h +++ b/protocols/IcqOscarJ/src/log.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __LOG_H #define __LOG_H diff --git a/protocols/IcqOscarJ/src/stdpackets.cpp b/protocols/IcqOscarJ/src/stdpackets.cpp index a502a09005..14159d7f00 100644 --- a/protocols/IcqOscarJ/src/stdpackets.cpp +++ b/protocols/IcqOscarJ/src/stdpackets.cpp @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #include "icqoscar.h" extern const int moodXStatus[]; diff --git a/protocols/IcqOscarJ/src/tlv.h b/protocols/IcqOscarJ/src/tlv.h index 5cee00c7c4..ddaf497c59 100644 --- a/protocols/IcqOscarJ/src/tlv.h +++ b/protocols/IcqOscarJ/src/tlv.h @@ -20,13 +20,8 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __TLV_H #define __TLV_H diff --git a/protocols/IcqOscarJ/src/utilities.cpp b/protocols/IcqOscarJ/src/utilities.cpp index 848081765c..1843f443bc 100644 --- a/protocols/IcqOscarJ/src/utilities.cpp +++ b/protocols/IcqOscarJ/src/utilities.cpp @@ -20,15 +20,9 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- -#include "icqoscar.h" +#include "icqoscar.h" struct gateway_index { diff --git a/protocols/IcqOscarJ/src/utilities.h b/protocols/IcqOscarJ/src/utilities.h index b9f063ee74..1c6459d6f0 100644 --- a/protocols/IcqOscarJ/src/utilities.h +++ b/protocols/IcqOscarJ/src/utilities.h @@ -20,17 +20,11 @@ // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -// -// ----------------------------------------------------------------------------- -// DESCRIPTION: -// -// Describe me here please... -// // ----------------------------------------------------------------------------- + #ifndef __UTILITIES_H #define __UTILITIES_H - struct icq_ack_args { MCONTACT hContact; -- cgit v1.2.3