From 83310365c69bd40365ee0ae0e16c99c28e24cd0b Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 19 Jun 2015 14:24:12 +0000 Subject: - all static protocol services replaced with functions; - m_protomod.h removed as useless git-svn-id: http://svn.miranda-ng.org/main/trunk@14260 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/ICQCorp/src/corp.cpp | 2 +- protocols/ICQCorp/src/corp.h | 1 - protocols/ICQCorp/src/protocol.cpp | 104 ++++++++++++++++++------------------- protocols/ICQCorp/src/user.cpp | 24 ++++----- 4 files changed, 64 insertions(+), 67 deletions(-) (limited to 'protocols/ICQCorp/src') diff --git a/protocols/ICQCorp/src/corp.cpp b/protocols/ICQCorp/src/corp.cpp index 08619f9d9f..e7652f349c 100644 --- a/protocols/ICQCorp/src/corp.cpp +++ b/protocols/ICQCorp/src/corp.cpp @@ -72,7 +72,7 @@ extern "C" __declspec(dllexport) int Load() PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE }; pd.szName = protoName; pd.type = PROTOTYPE_PROTOCOL; - CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd); + Proto_RegisterModule(&pd); LoadServices(); return 0; diff --git a/protocols/ICQCorp/src/corp.h b/protocols/ICQCorp/src/corp.h index 444f40382b..c703ee04ea 100644 --- a/protocols/ICQCorp/src/corp.h +++ b/protocols/ICQCorp/src/corp.h @@ -32,7 +32,6 @@ #include #include -#include #include #include #include diff --git a/protocols/ICQCorp/src/protocol.cpp b/protocols/ICQCorp/src/protocol.cpp index 1325126aa3..8a4967f5f1 100644 --- a/protocols/ICQCorp/src/protocol.cpp +++ b/protocols/ICQCorp/src/protocol.cpp @@ -1155,23 +1155,23 @@ void ICQ::updateContactList() //HANDLE hContact; ICQUser *u; - for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { - proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - if (proto && !mir_strcmp(proto, protoName)) - { - if ((u = getUserByContact(hContact)) == NULL) - { - u = new ICQUser(); - u->hContact = hContact; - u->uin = db_get_dw(hContact, protoName, "UIN", 0); - icqUsers.push_back(u); - } - if (statusVal <= ID_STATUS_OFFLINE) u->setStatus(ID_STATUS_OFFLINE); - else u->statusVal = db_get_w(hContact, protoName, "Status", ID_STATUS_OFFLINE); - } - } - - if (statusVal <= ID_STATUS_OFFLINE) return; + for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) { + proto = GetContactProto(hContact); + if (proto && !mir_strcmp(proto, protoName)) + { + if ((u = getUserByContact(hContact)) == NULL) + { + u = new ICQUser(); + u->hContact = hContact; + u->uin = db_get_dw(hContact, protoName, "UIN", 0); + icqUsers.push_back(u); + } + if (statusVal <= ID_STATUS_OFFLINE) u->setStatus(ID_STATUS_OFFLINE); + else u->statusVal = db_get_w(hContact, protoName, "Status", ID_STATUS_OFFLINE); + } + } + + if (statusVal <= ID_STATUS_OFFLINE) return; // create user info packet @@ -1298,40 +1298,40 @@ void ICQ::updateUserList(ICQUser *u, char list, char add) ICQUser *ICQ::addUser(unsigned int uin, bool persistent) { - unsigned int i; - ICQUser *u; - - for (i=0; iuin == uin) - { - if (persistent) - { - db_unset(u->hContact, "CList", "NotOnList"); - db_unset(u->hContact, "CList", "Hidden"); - } - return u; - } - } - - u = new ICQUser(); - u->uin = uin; + unsigned int i; + ICQUser *u; + + for (i=0; iuin == uin) + { + if (persistent) + { + db_unset(u->hContact, "CList", "NotOnList"); + db_unset(u->hContact, "CList", "Hidden"); + } + return u; + } + } + + u = new ICQUser(); + u->uin = uin; u->hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0); - icqUsers.push_back(u); + icqUsers.push_back(u); - CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)u->hContact, (LPARAM)protoName); - u->setInfo("UIN", uin); + Proto_AddToContact(u->hContact, protoName); + u->setInfo("UIN", uin); - if (persistent) getUserInfo(u, true); - else - { - db_set_b(u->hContact, "CList", "NotOnList", 1); - db_set_b(u->hContact, "CList", "Hidden", 1); - } + if (persistent) getUserInfo(u, true); + else + { + db_set_b(u->hContact, "CList", "NotOnList", 1); + db_set_b(u->hContact, "CList", "Hidden", 1); + } - updateContactList(); - return u; + updateContactList(); + return u; } /////////////////////////////////////////////////////////////////////////////// @@ -1814,7 +1814,7 @@ void ICQ::authorize(unsigned int uinToAuthorize) void ICQ::processTcpPacket(Packet &packet, unsigned int hSocket) { - unsigned int i, checkUin, senderIp, localIp, userStatus, senderPort, junkLong, thePort, theTCPSequence; + unsigned int i, checkUin, senderIp, localIp, userStatus, senderPort, junkLong, thePort, theTCPSequence = 0; unsigned short version, command, junkShort, newCommand, /*messageLen,*/ cicqVersion; unsigned char cicqChar, junkChar; char *message = NULL; @@ -2190,7 +2190,7 @@ void ICQ::addMessage(ICQUser *u, char *m, unsigned short theCmd, unsigned short pre.timestamp = t; pre.szMessage = (char*)m; pre.lParam = 0; - CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + Proto_ChainRecv(0, &ccs); } /////////////////////////////////////////////////////////////////////////////// @@ -2217,7 +2217,7 @@ void ICQ::addUrl(ICQUser *u, char *m, unsigned short theCmd, unsigned short theS pre.timestamp = t; pre.szMessage = url; pre.lParam = 0; - CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + Proto_ChainRecv(0, &ccs); delete [] url; } @@ -2239,7 +2239,7 @@ void ICQ::addAwayMsg(ICQUser *u, char *m, unsigned short theCmd, unsigned short pre.timestamp = t; pre.szMessage = (char*)m; pre.lParam = theSequence; - CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + Proto_ChainRecv(0, &ccs); } /////////////////////////////////////////////////////////////////////////////// @@ -2313,7 +2313,7 @@ void ICQ::addFileReq(ICQUser *u, char *m, char *filename, unsigned long size, un pre.timestamp = t; pre.szMessage = szBlob; pre.lParam = theSequence; - CallService(MS_PROTO_CHAINRECV, 0, (LPARAM)&ccs); + Proto_ChainRecv(0, &ccs); delete [] szBlob; diff --git a/protocols/ICQCorp/src/user.cpp b/protocols/ICQCorp/src/user.cpp index c70054e095..ba2fd4c2fb 100644 --- a/protocols/ICQCorp/src/user.cpp +++ b/protocols/ICQCorp/src/user.cpp @@ -140,20 +140,18 @@ static BOOL CALLBACK icqUserInfoDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPAR int icqUserInfoInitialise(WPARAM wParam, LPARAM lParam) { - OPTIONSDIALOGPAGE odp = { 0 }; - char *proto; - - proto = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, lParam, 0); - if ((proto == NULL || mir_strcmp(proto, protoName)) && lParam) return 0; - - odp.position = -1900000000; - odp.pszTitle = Translate(protoName); - odp.pfnDlgProc = (DLGPROC)icqUserInfoDlgProc; - odp.pszTemplate = MAKEINTRESOURCE(IDD_INFO_ICQCORP); - odp.hInstance = hInstance; + char *proto = GetContactProto(lParam); + if ((proto == NULL || mir_strcmp(proto, protoName)) && lParam) + return 0; + + OPTIONSDIALOGPAGE odp = { 0 }; + odp.position = -1900000000; + odp.pszTitle = Translate(protoName); + odp.pfnDlgProc = (DLGPROC)icqUserInfoDlgProc; + odp.pszTemplate = MAKEINTRESOURCE(IDD_INFO_ICQCORP); + odp.hInstance = hInstance; Options_AddPage(wParam, &odp); - - return 0; + return 0; } /////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3