summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-31 15:29:24 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-31 15:29:24 +0000
commit9ac20243efe27f58501c59060a4f22c37104c0e3 (patch)
treecf00f03c151d21e062a46f1a85eeb0be8a9342f2 /src
parent2738cf4311501acfc1b0e2de74b51b0edc18cdd2 (diff)
- PROTOCOLDESCRIPTOR_V3_SIZE to identify an ANSI plugin;
- absence of fnInitFunc to identify a protocol without instances; - whole bunch of ansi crutches discarded git-svn-id: http://svn.miranda-ng.org/main/trunk@13937 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/core/stdauth/src/authdialogs.cpp4
-rw-r--r--src/core/stdautoaway/src/autoaway.cpp2
-rw-r--r--src/core/stdaway/src/sendmsg.cpp4
-rw-r--r--src/core/stdfile/src/file.cpp8
-rw-r--r--src/core/stdfile/src/filerecvdlg.cpp2
-rw-r--r--src/core/stdfile/src/filexferdlg.cpp6
-rw-r--r--src/modules/addcontact/addcontact.cpp4
-rw-r--r--src/modules/findadd/findadd.cpp6
-rw-r--r--src/modules/metacontacts/meta_main.cpp3
-rw-r--r--src/modules/protocols/protocols.cpp211
-rw-r--r--src/modules/protocols/protoint.cpp20
11 files changed, 79 insertions, 191 deletions
diff --git a/src/core/stdauth/src/authdialogs.cpp b/src/core/stdauth/src/authdialogs.cpp
index d1b1e3833d..5de5cb0cf3 100644
--- a/src/core/stdauth/src/authdialogs.cpp
+++ b/src/core/stdauth/src/authdialogs.cpp
@@ -266,9 +266,9 @@ INT_PTR CALLBACK DlgProcAuthReq(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
if (IsWindowEnabled(GetDlgItem(hwndDlg, IDC_DENYREASON))) {
TCHAR szReason[256];
GetDlgItemText(hwndDlg, IDC_DENYREASON, szReason, SIZEOF(szReason));
- CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, (LPARAM)szReason);
+ CallProtoService(dbei.szModule, PS_AUTHDENY, (WPARAM)hDbEvent, (LPARAM)szReason);
}
- else CallProtoService(dbei.szModule, PS_AUTHDENYT, (WPARAM)hDbEvent, 0);
+ else CallProtoService(dbei.szModule, PS_AUTHDENY, (WPARAM)hDbEvent, 0);
}
DestroyWindow(hwndDlg);
break;
diff --git a/src/core/stdautoaway/src/autoaway.cpp b/src/core/stdautoaway/src/autoaway.cpp
index a619c831c1..f501ec2bda 100644
--- a/src/core/stdautoaway/src/autoaway.cpp
+++ b/src/core/stdautoaway/src/autoaway.cpp
@@ -49,7 +49,7 @@ static void Proto_SetStatus(const char* szProto, unsigned status)
{
if (CallProtoService(szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
TCHAR *awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGW, status, (LPARAM)szProto);
- CallProtoService(szProto, PS_SETAWAYMSGT, status, (LPARAM)awayMsg);
+ CallProtoService(szProto, PS_SETAWAYMSG, status, (LPARAM)awayMsg);
mir_free(awayMsg);
}
diff --git a/src/core/stdaway/src/sendmsg.cpp b/src/core/stdaway/src/sendmsg.cpp
index a86f79f917..4b36e6aa15 100644
--- a/src/core/stdaway/src/sendmsg.cpp
+++ b/src/core/stdaway/src/sendmsg.cpp
@@ -194,10 +194,10 @@ void ChangeAllProtoMessages(char *szProto, int statusMode, TCHAR *msg)
continue;
if ((CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) && !Proto_IsAccountLocked(pa))
- CallProtoService(pa->szModuleName, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
+ CallProtoService(pa->szModuleName, PS_SETAWAYMSG, statusMode, (LPARAM)msg);
}
}
- else CallProtoService(szProto, PS_SETAWAYMSGT, statusMode, (LPARAM)msg);
+ else CallProtoService(szProto, PS_SETAWAYMSG, statusMode, (LPARAM)msg);
}
struct SetAwayMsgData
diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp
index 0b263cf47b..d867dc18f3 100644
--- a/src/core/stdfile/src/file.cpp
+++ b/src/core/stdfile/src/file.cpp
@@ -392,13 +392,13 @@ static INT_PTR Proto_RecvFileT(WPARAM, LPARAM lParam)
if (bUnicode) {
pszFiles = (char**)alloca(pre->fileCount * sizeof(char*));
for (int i = 0; i < pre->fileCount; i++)
- pszFiles[i] = Utf8EncodeT(pre->ptszFiles[i]);
+ pszFiles[i] = Utf8EncodeT(pre->files.t[i]);
- szDescr = Utf8EncodeT(pre->tszDescription);
+ szDescr = Utf8EncodeT(pre->descr.t);
}
else {
- pszFiles = pre->pszFiles;
- szDescr = pre->szDescription;
+ pszFiles = pre->files.a;
+ szDescr = pre->descr.a;
}
dbei.cbBlob = sizeof(DWORD);
diff --git a/src/core/stdfile/src/filerecvdlg.cpp b/src/core/stdfile/src/filerecvdlg.cpp
index ccfaa427e2..d49fd5f3db 100644
--- a/src/core/stdfile/src/filerecvdlg.cpp
+++ b/src/core/stdfile/src/filerecvdlg.cpp
@@ -376,7 +376,7 @@ INT_PTR CALLBACK DlgProcRecvFile(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
break;
case IDCANCEL:
- if (dat->fs) CallContactService(dat->hContact, PSS_FILEDENYT, (WPARAM)dat->fs, (LPARAM)TranslateT("Canceled"));
+ if (dat->fs) CallContactService(dat->hContact, PSS_FILEDENY, (WPARAM)dat->fs, (LPARAM)TranslateT("Canceled"));
dat->fs = NULL; /* the protocol will free the handle */
DestroyWindow(hwndDlg);
break;
diff --git a/src/core/stdfile/src/filexferdlg.cpp b/src/core/stdfile/src/filexferdlg.cpp
index 507c63ca19..15bfe94d41 100644
--- a/src/core/stdfile/src/filexferdlg.cpp
+++ b/src/core/stdfile/src/filexferdlg.cpp
@@ -236,7 +236,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (dat->send) {
if (db_mc_isMeta(dat->hContact))
dat->hContact = db_mc_getMostOnline(dat->hContact);
- dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILET, (WPARAM)dat->szMsg, (LPARAM)dat->files);
+ dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILE, (WPARAM)dat->szMsg, (LPARAM)dat->files);
SetFtStatus(hwndDlg, LPGENT("Request sent, waiting for acceptance..."), FTS_TEXT);
SetOpenFileButtonStyle(GetDlgItem(hwndDlg, IDC_OPENFILE), 1);
dat->waitingForAcceptance = 1;
@@ -246,7 +246,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
}
else { //recv
CreateDirectoryTreeT(dat->szSavePath);
- dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILEALLOWT, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
+ dat->fs = (HANDLE)CallContactService(dat->hContact, PSS_FILEALLOW, (WPARAM)dat->fs, (LPARAM)dat->szSavePath);
dat->transferStatus.tszWorkingDir = mir_tstrdup(dat->szSavePath);
if (db_get_b(dat->hContact, "CList", "NotOnList", 0)) dat->resumeBehaviour = FILERESUME_ASK;
else dat->resumeBehaviour = db_get_b(NULL, "SRFile", "IfExists", FILERESUME_ASK);
@@ -491,7 +491,7 @@ INT_PTR CALLBACK DlgProcFileTransfer(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
break;
}
mir_free(szOriginalFilename);
- CallProtoService(szProto, PS_FILERESUMET, (WPARAM)dat->fs, (LPARAM)pfr);
+ CallProtoService(szProto, PS_FILERESUME, (WPARAM)dat->fs, (LPARAM)pfr);
if (pfr->szFilename) mir_free((char*)pfr->szFilename);
mir_free(pfr);
}
diff --git a/src/modules/addcontact/addcontact.cpp b/src/modules/addcontact/addcontact.cpp
index 0c905b1c52..9379e3f283 100644
--- a/src/modules/addcontact/addcontact.cpp
+++ b/src/modules/addcontact/addcontact.cpp
@@ -215,9 +215,9 @@ public:
if (m_chkAuth.GetState()) {
DWORD flags = CallProtoServiceInt(NULL, m_acs.szProto, PS_GETCAPS, PFLAGNUM_4, 0);
if (flags & PF4_NOCUSTOMAUTH)
- CallContactService(hContact, PSS_AUTHREQUESTT, 0, 0);
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, 0);
else
- CallContactService(hContact, PSS_AUTHREQUESTT, 0, ptrT(m_authReq.GetText()));
+ CallContactService(hContact, PSS_AUTHREQUEST, 0, ptrT(m_authReq.GetText()));
}
if (m_chkOpen.GetState())
diff --git a/src/modules/findadd/findadd.cpp b/src/modules/findadd/findadd.cpp
index 82820806e6..2805667212 100644
--- a/src/modules/findadd/findadd.cpp
+++ b/src/modules/findadd/findadd.cpp
@@ -699,7 +699,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
- BeginSearch(hwndDlg, dat, szProto, PS_BASICSEARCHT, PF1_BASICSEARCH, str);
+ BeginSearch(hwndDlg, dat, szProto, PS_BASICSEARCH, PF1_BASICSEARCH, str);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYEMAIL)) {
TCHAR str[256];
@@ -708,7 +708,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (str[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
- BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYEMAILT, PF1_SEARCHBYEMAIL, str);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYEMAIL, PF1_SEARCHBYEMAIL, str);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYNAME)) {
TCHAR nick[256], first[256], last[256];
@@ -722,7 +722,7 @@ static INT_PTR CALLBACK DlgProcFindAdd(HWND hwndDlg, UINT msg, WPARAM wParam, LP
if (nick[0] == 0 && first[0] == 0 && last[0] == 0)
MessageBox(hwndDlg, sttErrMsg, sttErrTitle, MB_ICONERROR | MB_OK);
else
- BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAMET, PF1_SEARCHBYNAME, &psbn);
+ BeginSearch(hwndDlg, dat, szProto, PS_SEARCHBYNAME, PF1_SEARCHBYNAME, &psbn);
}
else if (IsDlgButtonChecked(hwndDlg, IDC_BYADVANCED)) {
if (dat->hwndAdvSearch == NULL)
diff --git a/src/modules/metacontacts/meta_main.cpp b/src/modules/metacontacts/meta_main.cpp
index aeb488aad4..8e2cd9c929 100644
--- a/src/modules/metacontacts/meta_main.cpp
+++ b/src/modules/metacontacts/meta_main.cpp
@@ -69,7 +69,8 @@ int LoadMetacontacts(void)
Meta_ReadOptions();
- PROTOCOLDESCRIPTOR pd = { PROTOCOLDESCRIPTOR_V3_SIZE };
+ PROTOCOLDESCRIPTOR pd = { 0 };
+ pd.cbSize = sizeof(pd);
pd.szName = META_FILTER;
pd.type = PROTOTYPE_FILTER;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index b209ce9d38..140efe927b 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -81,28 +81,27 @@ static INT_PTR srvProto_RegisterModule(WPARAM, LPARAM lParam)
if (p == NULL)
return 2;
- if (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) {
- if (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL) {
- // let's create a new container
- PROTO_INTERFACE* ppi = AddDefaultAccount(pd->szName);
- if (ppi) {
- PROTOACCOUNT *pa = Proto_GetAccount(pd->szName);
- if (pa == NULL) {
- pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
- pa->cbSize = sizeof(PROTOACCOUNT);
- pa->szModuleName = mir_strdup(pd->szName);
- pa->szProtoName = mir_strdup(pd->szName);
- pa->tszAccountName = mir_a2t(pd->szName);
- pa->bIsVisible = pa->bIsEnabled = true;
- pa->iOrder = accounts.getCount();
- accounts.insert(pa);
- }
- pa->bOldProto = true;
- pa->bIsVirtual = (p->type == PROTOTYPE_VIRTUAL);
- pa->ppro = ppi;
- p->fnInit = defInitProto;
- p->fnUninit = FreeDefaultAccount;
+ if (p->fnInit == NULL && (p->type == PROTOTYPE_PROTOCOL || p->type == PROTOTYPE_VIRTUAL)) {
+ // let's create a new container
+ PROTO_INTERFACE* ppi = AddDefaultAccount(pd->szName);
+ if (ppi) {
+ ppi->m_iVersion = (pd->cbSize == PROTOCOLDESCRIPTOR_V3_SIZE) ? 1 : 2;
+ PROTOACCOUNT *pa = Proto_GetAccount(pd->szName);
+ if (pa == NULL) {
+ pa = (PROTOACCOUNT*)mir_calloc(sizeof(PROTOACCOUNT));
+ pa->cbSize = sizeof(PROTOACCOUNT);
+ pa->szModuleName = mir_strdup(pd->szName);
+ pa->szProtoName = mir_strdup(pd->szName);
+ pa->tszAccountName = mir_a2t(pd->szName);
+ pa->bIsVisible = pa->bIsEnabled = true;
+ pa->iOrder = accounts.getCount();
+ accounts.insert(pa);
}
+ pa->bOldProto = true;
+ pa->bIsVirtual = (p->type == PROTOTYPE_VIRTUAL);
+ pa->ppro = ppi;
+ p->fnInit = defInitProto;
+ p->fnUninit = FreeDefaultAccount;
}
}
@@ -211,7 +210,7 @@ void Proto_SetStatus(const char *szProto, unsigned status)
{
if (CallProtoServiceInt(NULL, szProto, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) {
TCHAR *awayMsg = (TCHAR*)CallService(MS_AWAYMSG_GETSTATUSMSGT, status, (LPARAM)szProto);
- CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSGT, status, (LPARAM)awayMsg);
+ CallProtoServiceInt(NULL, szProto, PS_SETAWAYMSG, status, (LPARAM)awayMsg);
mir_free(awayMsg);
}
CallProtoServiceInt(NULL, szProto, PS_SETSTATUS, status, 0);
@@ -344,7 +343,7 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
{
PROTOACCOUNT *pa = Proto_GetAccount(szModule);
if (pa && !pa->bOldProto) {
- PROTO_INTERFACE* ppi;
+ PROTO_INTERFACE *ppi;
if ((ppi = pa->ppro) == NULL)
return CALLSERVICE_NOTFOUND;
@@ -392,17 +391,18 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
if (ppi->m_iVersion > 1)
return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, _A2T((char*)lParam));
return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
- case 11: {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- if (ppi->m_iVersion > 1) {
- PROTOCHAR* szFname = mir_a2t((char*)pfr->szFilename);
- INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&szFname);
- mir_free((PROTOCHAR*)pfr->szFilename);
- pfr->szFilename = (PROTOCHAR*)mir_t2a(szFname); mir_free(szFname);
+ case 11:
+ {
+ PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
+ if (ppi->m_iVersion > 1) {
+ PROTOCHAR* szFname = mir_a2t((char*)pfr->szFilename);
+ INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&szFname);
+ mir_free((PROTOCHAR*)pfr->szFilename);
+ pfr->szFilename = (PROTOCHAR*)mir_t2a(szFname); mir_free(szFname);
+ }
+ else return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
}
- else
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
- }
+
case 12: return (INT_PTR)ppi->GetCaps(wParam, lParam);
case 13: return (INT_PTR)Proto_GetIcon(ppi, wParam);
case 14: return (INT_PTR)ppi->GetInfo(hContact, wParam);
@@ -414,13 +414,14 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
if (ppi->m_iVersion > 1)
return (INT_PTR)ppi->SearchByEmail(_A2T((char*)lParam));
return (INT_PTR)ppi->SearchByEmail((TCHAR*)lParam);
- case 17: {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByName(_A2T((char*)psbn->pszNick), _A2T((char*)psbn->pszFirstName), _A2T((char*)psbn->pszLastName));
- else
- return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- }
+ case 17:
+ {
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
+ if (ppi->m_iVersion > 1)
+ return (INT_PTR)ppi->SearchByName(_A2T((char*)psbn->pszNick), _A2T((char*)psbn->pszFirstName), _A2T((char*)psbn->pszLastName));
+ else
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
+ }
case 18: return (INT_PTR)ppi->SearchAdvanced((HWND)lParam);
case 19: return (INT_PTR)ppi->CreateExtendedSearchUI((HWND)lParam);
case 20: return (INT_PTR)ppi->RecvContacts(hContact, (PROTORECVEVENT*)lParam);
@@ -449,126 +450,13 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
case 34: return (INT_PTR)ppi->UserIsTyping(wParam, lParam);
case 35: mir_strncpy((char*)lParam, ppi->m_szModuleName, wParam); return 0;
- case 36: return ppi->m_iStatus;
-
- case 100:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SetAwayMsg(wParam, (TCHAR*)lParam);
- return (INT_PTR)ppi->SetAwayMsg(wParam, StrConvA((TCHAR*)lParam));
- case 102:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
- else {
- char** files = Proto_FilesMatrixA((TCHAR**)lParam);
- INT_PTR res = (INT_PTR)ppi->SendFile(hContact, StrConvA((TCHAR*)wParam), (TCHAR**)files);
- if (res == 0) FreeFilesMatrix((TCHAR***)&files);
- return res;
- }
- case 103:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (TCHAR*)lParam);
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
- case 104:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (TCHAR*)lParam);
- return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, StrConvA((TCHAR*)lParam));
- case 105: {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
- else {
- char* szFname = mir_t2a(pfr->szFilename);
- INT_PTR res = (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action,
- (const PROTOCHAR**)&szFname);
- mir_free(szFname);
- return (INT_PTR) res;
- }
+ case 36:
+ return ppi->m_iStatus;
}
- case 106:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthRequest(hContact, (const TCHAR*)lParam);
- return (INT_PTR)ppi->AuthRequest(hContact, StrConvA((const TCHAR*)lParam));
- case 107:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (const TCHAR*)lParam);
- return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, StrConvA((const TCHAR*)lParam));
- case 108:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchBasic((const TCHAR*)lParam);
- return (INT_PTR)ppi->SearchBasic(StrConvA((const TCHAR*)lParam));
- case 109: {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- return (INT_PTR)ppi->SearchByName(StrConvA((TCHAR*)psbn->pszNick),
- StrConvA((TCHAR*)psbn->pszFirstName), StrConvA((TCHAR*)psbn->pszLastName));
- }
- case 110:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchByEmail((const TCHAR*)lParam);
- return (INT_PTR)ppi->SearchByEmail(StrConvA((const TCHAR*)lParam));
- }
- }
- }
-
- if (!mir_strcmp(szService, PS_ADDTOLIST)) {
- PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- if (!(psr->flags & PSR_UNICODE)) {
- PROTOSEARCHRESULT *psra = (PROTOSEARCHRESULT*)_alloca(psr->cbSize);
- memcpy(psra, psr, psr->cbSize);
- psra->nick.a = mir_u2a(psr->nick.t);
- psra->firstName.a = mir_u2a(psr->firstName.t);
- psra->lastName.a = mir_u2a(psr->lastName.t);
- psra->email.a = mir_u2a(psr->email.t);
-
- INT_PTR res = ProtoCallService(szModule, szService, wParam, (LPARAM)psra);
-
- mir_free(psra->nick.a);
- mir_free(psra->firstName.a);
- mir_free(psra->lastName.a);
- mir_free(psra->email.a);
- return res;
}
}
- INT_PTR res = ProtoCallService(szModule, szService, wParam, lParam);
-
- if (res == CALLSERVICE_NOTFOUND && pa && pa->bOldProto && pa->ppro && strchr(szService, 'W')) {
- TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
- if (!item) return res;
-
- CCSDATA *ccs = (CCSDATA*)lParam;
- switch (item->id) {
- case 100:
- return (INT_PTR)pa->ppro->SetAwayMsg(wParam, (TCHAR*)lParam);
- case 102:
- return (INT_PTR)pa->ppro->SendFile(ccs->hContact, (TCHAR*)ccs->wParam, (TCHAR**)ccs->lParam);
- case 103:
- return (INT_PTR)pa->ppro->FileAllow(ccs->hContact, (HANDLE)ccs->wParam, (TCHAR*)ccs->lParam);
- case 104:
- return (INT_PTR)pa->ppro->FileDeny(ccs->hContact, (HANDLE)ccs->wParam, (TCHAR*)ccs->lParam);
- case 105:
- {
- PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- return (INT_PTR)pa->ppro->FileResume((HANDLE)wParam, &pfr->action, &pfr->szFilename);
- }
- case 106:
- return (INT_PTR)pa->ppro->AuthRequest(ccs->hContact, (const TCHAR*)ccs->lParam);
- case 107:
- return (INT_PTR)pa->ppro->AuthDeny((MEVENT)wParam, (const TCHAR*)lParam);
- case 108:
- return (INT_PTR)pa->ppro->SearchBasic((const TCHAR*)lParam);
- case 109:
- {
- PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
- return (INT_PTR)pa->ppro->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
- }
- case 110:
- return (INT_PTR)pa->ppro->SearchByEmail((const TCHAR*)lParam);
- }
- }
-
- return res;
+ return ProtoCallService(szModule, szService, wParam, lParam);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -623,17 +511,6 @@ int LoadProtocolsModule(void)
InsertServiceListItem(35, PS_GETNAME);
InsertServiceListItem(36, PS_GETSTATUS);
- InsertServiceListItem(100, PS_SETAWAYMSGW);
- InsertServiceListItem(102, PSS_FILEW);
- InsertServiceListItem(103, PSS_FILEALLOWW);
- InsertServiceListItem(104, PSS_FILEDENYW);
- InsertServiceListItem(105, PS_FILERESUMEW);
- InsertServiceListItem(106, PSS_AUTHREQUESTW);
- InsertServiceListItem(107, PS_AUTHDENYW);
- InsertServiceListItem(108, PS_BASICSEARCHW);
- InsertServiceListItem(109, PS_SEARCHBYNAMEW);
- InsertServiceListItem(110, PS_SEARCHBYEMAILW);
-
hTypeEvent = CreateHookableEvent(ME_PROTO_CONTACTISTYPING);
hAccListChanged = CreateHookableEvent(ME_PROTO_ACCLISTCHANGED);
diff --git a/src/modules/protocols/protoint.cpp b/src/modules/protocols/protoint.cpp
index d6b9a9f39f..2252877ce4 100644
--- a/src/modules/protocols/protoint.cpp
+++ b/src/modules/protocols/protoint.cpp
@@ -53,7 +53,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
MCONTACT __cdecl AddToListByEvent(int flags, int iContact, MEVENT hDbEvent)
{
- return (MCONTACT)ProtoCallService(m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), (LPARAM)hDbEvent);
+ return (MCONTACT)ProtoCallService(m_szModuleName, PS_ADDTOLISTBYEVENT, MAKELONG(flags, iContact), hDbEvent);
}
int __cdecl Authorize(MEVENT hDbEvent)
@@ -61,18 +61,21 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PS_AUTHALLOW, (WPARAM)hDbEvent, 0);
}
- int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR* szReason)
+ int __cdecl AuthDeny(MEVENT hDbEvent, const TCHAR *szReason)
{
- return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, (WPARAM)hDbEvent, (LPARAM)StrConvA(szReason));
+ if (m_iVersion > 1)
+ return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, (LPARAM)szReason);
+
+ return (int)ProtoCallService(m_szModuleName, PS_AUTHDENY, hDbEvent, (LPARAM)StrConvA(szReason));
}
- int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT* evt)
+ int __cdecl AuthRecv(MCONTACT hContact, PROTORECVEVENT *evt)
{
CCSDATA ccs = { hContact, PSR_AUTH, 0, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_AUTH, 0, (LPARAM)&ccs);
}
- int __cdecl AuthRequest(MCONTACT hContact, const TCHAR* szMessage)
+ int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage)
{
CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage };
ccs.lParam = (LPARAM)mir_t2a(szMessage);
@@ -134,11 +137,16 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
HANDLE __cdecl SearchBasic(const PROTOCHAR* id)
{
+ if (m_iVersion > 1)
+ return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)id);
+
return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)StrConvA(id));
}
HANDLE __cdecl SearchByEmail(const PROTOCHAR* email)
{
+ if (m_iVersion > 1)
+ return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, (LPARAM)email);
return (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYEMAIL, 0, (LPARAM)StrConvA(email));
}
@@ -245,6 +253,8 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
int __cdecl SetAwayMsg(int iStatus, const TCHAR* msg)
{
+ if (m_iVersion > 1)
+ return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)msg);
return (int)ProtoCallService(m_szModuleName, PS_SETAWAYMSG, iStatus, (LPARAM)StrConvA(msg));
}