summaryrefslogtreecommitdiff
path: root/protocols/ICQCorp/src
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/ICQCorp/src')
-rw-r--r--protocols/ICQCorp/src/corp.cpp2
-rw-r--r--protocols/ICQCorp/src/corp.h1
-rw-r--r--protocols/ICQCorp/src/protocol.cpp104
-rw-r--r--protocols/ICQCorp/src/user.cpp24
4 files changed, 64 insertions, 67 deletions
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 <newpluginapi.h>
#include <m_system.h>
-#include <m_protomod.h>
#include <m_protosvc.h>
#include <m_langpack.h>
#include <m_database.h>
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; i<icqUsers.size(); i++)
- {
- u = icqUsers[i];
- if (u->uin == 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; i<icqUsers.size(); i++)
+ {
+ u = icqUsers[i];
+ if (u->uin == 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;
}
///////////////////////////////////////////////////////////////////////////////