summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-31 19:17:51 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-31 19:17:51 +0000
commitc207d9fda896e759a2ffdffc0d46608040c1ac65 (patch)
treee2a2a2cac88ff2aa46b4ae6cc9245cfeb21db19a /src/modules
parente5d977a8e28a301ea56e2786756537d03b84540a (diff)
another bunch of crutches buried in a trash can: PROTOCHAR & PROTOFILEEVENT
glory, glory, hallelujah git-svn-id: http://svn.miranda-ng.org/main/trunk@13949 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/protocols/protoaccs.cpp2
-rw-r--r--src/modules/protocols/protocols.cpp149
-rw-r--r--src/modules/protocols/protoint.cpp42
3 files changed, 72 insertions, 121 deletions
diff --git a/src/modules/protocols/protoaccs.cpp b/src/modules/protocols/protoaccs.cpp
index 4e863b235f..06a7268a6f 100644
--- a/src/modules/protocols/protoaccs.cpp
+++ b/src/modules/protocols/protoaccs.cpp
@@ -314,7 +314,7 @@ static INT_PTR stub4(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
static INT_PTR stub11(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
{
PROTOFILERESUME* pfr = (PROTOFILERESUME*)lParam;
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const PROTOCHAR**)&pfr->szFilename);
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const TCHAR**)&pfr->szFilename);
}
static INT_PTR stub12(PROTO_INTERFACE* ppi, WPARAM wParam, LPARAM lParam)
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp
index 140efe927b..314071a55a 100644
--- a/src/modules/protocols/protocols.cpp
+++ b/src/modules/protocols/protocols.cpp
@@ -343,115 +343,54 @@ INT_PTR CallProtoServiceInt(MCONTACT hContact, const char *szModule, const char
{
PROTOACCOUNT *pa = Proto_GetAccount(szModule);
if (pa && !pa->bOldProto) {
- PROTO_INTERFACE *ppi;
- if ((ppi = pa->ppro) == NULL)
- return CALLSERVICE_NOTFOUND;
-
- TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
- if (item) {
- switch (item->id) {
- case 1:
- if (ppi->m_iVersion > 1 || !(((PROTOSEARCHRESULT*)lParam)->flags & PSR_UNICODE))
- return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
- else {
- PROTOSEARCHRESULT *psr = (PROTOSEARCHRESULT*)lParam;
- 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 = (INT_PTR)ppi->AddToList(wParam, psra);
-
- mir_free(psra->nick.a);
- mir_free(psra->firstName.a);
- mir_free(psra->lastName.a);
- mir_free(psra->email.a);
- return res;
- }
-
- case 2: return (INT_PTR)ppi->AddToListByEvent(LOWORD(wParam), HIWORD(wParam), (MEVENT)lParam);
- case 3: return (INT_PTR)ppi->Authorize((MEVENT)wParam);
- case 4:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, _A2T((char*)lParam));
- return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (PROTOCHAR*)lParam);
- case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT*)lParam);
- case 6:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->AuthRequest(hContact, _A2T((char*)lParam));
- return (INT_PTR)ppi->AuthRequest(hContact, (PROTOCHAR*)lParam);
- case 8:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, _A2T((char*)lParam));
- return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (PROTOCHAR*)lParam);
- case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
- case 10:
- 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);
+ PROTO_INTERFACE *ppi = pa->ppro;
+ if (ppi != NULL && ppi->m_iVersion > 1) {
+ TServiceListItem *item = serviceItems.find((TServiceListItem*)&szService);
+ if (item) {
+ switch (item->id) {
+ case 1: return (INT_PTR)ppi->AddToList(wParam, (PROTOSEARCHRESULT*)lParam);
+ case 2: return (INT_PTR)ppi->AddToListByEvent(LOWORD(wParam), HIWORD(wParam), (MEVENT)lParam);
+ case 3: return (INT_PTR)ppi->Authorize((MEVENT)wParam);
+ case 4: return (INT_PTR)ppi->AuthDeny((MEVENT)wParam, (TCHAR*)lParam);
+ case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT*)lParam);
+ case 6: return (INT_PTR)ppi->AuthRequest(hContact, (TCHAR*)lParam);
+ case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (TCHAR*)lParam);
+ case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
+ case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (TCHAR*)lParam);
+ case 11: {
+ PROTOFILERESUME *pfr = (PROTOFILERESUME*)lParam;
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, &pfr->action, (const TCHAR**)&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);
- case 15:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SearchBasic(_A2T((char*)lParam));
- return (INT_PTR)ppi->SearchBasic((TCHAR*)lParam);
- case 16:
- 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
+ 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);
+ case 15: return (INT_PTR)ppi->SearchBasic((TCHAR*)lParam);
+ case 16: return (INT_PTR)ppi->SearchByEmail((TCHAR*)lParam);
+ case 17: {
+ PROTOSEARCHBYNAME* psbn = (PROTOSEARCHBYNAME*)lParam;
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);
+ case 21: return (INT_PTR)ppi->RecvFile(hContact, (PROTORECVFILET*)lParam);
+ case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT*)lParam);
+ case 23: return (INT_PTR)ppi->RecvUrl(hContact, (PROTORECVEVENT*)lParam);
+ case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (MCONTACT*)lParam);
+ case 25: return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
+ case 26: return (INT_PTR)ppi->SendMsg(hContact, wParam, (const char*)lParam);
+ case 27: return (INT_PTR)ppi->SendUrl(hContact, wParam, (const char*)lParam);
+ case 28: return (INT_PTR)ppi->SetApparentMode(hContact, wParam);
+ case 29: return (INT_PTR)ppi->SetStatus(wParam);
+ case 30: return (INT_PTR)ppi->GetAwayMsg(hContact);
+ case 31: return (INT_PTR)ppi->RecvAwayMsg(hContact, wParam, (PROTORECVEVENT*)lParam);
+ case 33: 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 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);
- case 21: return (INT_PTR)ppi->RecvFile(hContact, (PROTOFILEEVENT*)lParam);
- case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT*)lParam);
- case 23: return (INT_PTR)ppi->RecvUrl(hContact, (PROTORECVEVENT*)lParam);
- case 24: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (MCONTACT*)lParam);
- case 25:
- if (ppi->m_iVersion > 1) {
- TCHAR** files = Proto_FilesMatrixU((char**)lParam);
- INT_PTR res = (INT_PTR)ppi->SendFile(hContact, _A2T((char*)wParam), (TCHAR**)files);
- if (res == 0) FreeFilesMatrix(&files);
- return res;
- }
- return (INT_PTR)ppi->SendFile(hContact, (TCHAR*)wParam, (TCHAR**)lParam);
-
- case 26: return (INT_PTR)ppi->SendMsg(hContact, wParam, (const char*)lParam);
- case 27: return (INT_PTR)ppi->SendUrl(hContact, wParam, (const char*)lParam);
- case 28: return (INT_PTR)ppi->SetApparentMode(hContact, wParam);
- case 29: return (INT_PTR)ppi->SetStatus(wParam);
- case 30: return (INT_PTR)ppi->GetAwayMsg(hContact);
- case 31: return (INT_PTR)ppi->RecvAwayMsg(hContact, wParam, (PROTORECVEVENT*)lParam);
- case 33:
- if (ppi->m_iVersion > 1)
- return (INT_PTR)ppi->SetAwayMsg(wParam, _A2T((char*)lParam));
- 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;
}
}
}
diff --git a/src/modules/protocols/protoint.cpp b/src/modules/protocols/protoint.cpp
index 3ad3337ce3..e8c834c45a 100644
--- a/src/modules/protocols/protoint.cpp
+++ b/src/modules/protocols/protoint.cpp
@@ -78,15 +78,21 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
int __cdecl AuthRequest(MCONTACT hContact, const TCHAR *szMessage)
{
CCSDATA ccs = { hContact, PSS_AUTHREQUEST, 0, (LPARAM)szMessage };
+ if (m_iVersion > 1)
+ return (int)ProtoCallService(m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs);
+
ccs.lParam = (LPARAM)mir_t2a(szMessage);
int res = (int)ProtoCallService(m_szModuleName, PSS_AUTHREQUEST, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
}
- HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szPath)
+ HANDLE __cdecl FileAllow(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szPath)
{
CCSDATA ccs = { hContact, PSS_FILEALLOW, (WPARAM)hTransfer, (LPARAM)szPath };
+ if (m_iVersion > 1)
+ return (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
+
ccs.lParam = (LPARAM)mir_t2a(szPath);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PSS_FILEALLOW, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
@@ -99,22 +105,28 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PSS_FILECANCEL, 0, (LPARAM)&ccs);
}
- int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const PROTOCHAR* szReason)
+ int __cdecl FileDeny(MCONTACT hContact, HANDLE hTransfer, const TCHAR* szReason)
{
CCSDATA ccs = { hContact, PSS_FILEDENY, (WPARAM)hTransfer, (LPARAM)szReason };
+ if (m_iVersion > 1)
+ return (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
+
ccs.lParam = (LPARAM)mir_t2a(szReason);
int res = (int)ProtoCallService(m_szModuleName, PSS_FILEDENY, 0, (LPARAM)&ccs);
mir_free((char*)ccs.lParam);
return res;
}
- int __cdecl FileResume(HANDLE hTransfer, int* action, const PROTOCHAR** szFilename)
+ int __cdecl FileResume(HANDLE hTransfer, int* action, const TCHAR** szFilename)
{
PROTOFILERESUME pfr = { *action, *szFilename };
- pfr.szFilename = (PROTOCHAR*)mir_t2a(pfr.szFilename);
+ if (m_iVersion > 1)
+ return (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
+
+ pfr.szFilename = (TCHAR*)mir_t2a(pfr.szFilename);
int res = (int)ProtoCallService(m_szModuleName, PS_FILERESUME, (WPARAM)hTransfer, (LPARAM)&pfr);
- mir_free((PROTOCHAR*)*szFilename);
- *action = pfr.action; *szFilename = (PROTOCHAR*)pfr.szFilename;
+ mir_free((TCHAR*)*szFilename);
+ *action = pfr.action; *szFilename = (TCHAR*)pfr.szFilename;
return res;
}
@@ -135,7 +147,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return ProtoCallService(m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SearchBasic(const PROTOCHAR* id)
+ HANDLE __cdecl SearchBasic(const TCHAR* id)
{
if (m_iVersion > 1)
return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)id);
@@ -143,19 +155,19 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (HANDLE)ProtoCallService(m_szModuleName, PS_BASICSEARCH, 0, (LPARAM)StrConvA(id));
}
- HANDLE __cdecl SearchByEmail(const PROTOCHAR* email)
+ HANDLE __cdecl SearchByEmail(const TCHAR* 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));
}
- HANDLE __cdecl SearchByName(const PROTOCHAR* nick, const PROTOCHAR* firstName, const PROTOCHAR* lastName)
+ HANDLE __cdecl SearchByName(const TCHAR* nick, const TCHAR* firstName, const TCHAR* lastName)
{
PROTOSEARCHBYNAME psn;
- psn.pszNick = (PROTOCHAR*)mir_t2a(nick);
- psn.pszFirstName = (PROTOCHAR*)mir_t2a(firstName);
- psn.pszLastName = (PROTOCHAR*)mir_t2a(lastName);
+ psn.pszNick = (TCHAR*)mir_t2a(nick);
+ psn.pszFirstName = (TCHAR*)mir_t2a(firstName);
+ psn.pszLastName = (TCHAR*)mir_t2a(lastName);
HANDLE res = (HANDLE)ProtoCallService(m_szModuleName, PS_SEARCHBYNAME, 0, (LPARAM)&psn);
mir_free(psn.pszNick);
mir_free(psn.pszFirstName);
@@ -180,7 +192,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PSR_CONTACTS, 0, (LPARAM)&ccs);
}
- int __cdecl RecvFile(MCONTACT hContact, PROTOFILEEVENT* evt)
+ int __cdecl RecvFile(MCONTACT hContact, PROTORECVFILET* evt)
{
CCSDATA ccs = { hContact, PSR_FILE, 0, (LPARAM)evt };
return ProtoCallService(m_szModuleName, PSR_FILE, 0, (LPARAM)&ccs);
@@ -204,7 +216,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
return (int)ProtoCallService(m_szModuleName, PSS_CONTACTS, 0, (LPARAM)&ccs);
}
- HANDLE __cdecl SendFile(MCONTACT hContact, const PROTOCHAR* szDescription, PROTOCHAR** ppszFiles)
+ HANDLE __cdecl SendFile(MCONTACT hContact, const TCHAR* szDescription, TCHAR** ppszFiles)
{
CCSDATA ccs = { hContact, PSS_FILE, (WPARAM)szDescription, (LPARAM)ppszFiles };
@@ -275,7 +287,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE
// creates the default protocol container for compatibility with the old plugins
-PROTO_INTERFACE* AddDefaultAccount(const char* szProtoName)
+PROTO_INTERFACE* AddDefaultAccount(const char *szProtoName)
{
PROTO_INTERFACE* ppi = new DEFAULT_PROTO_INTERFACE;
ppi->m_szModuleName = mir_strdup(szProtoName);