summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir_app/src/protocols.cpp99
1 files changed, 48 insertions, 51 deletions
diff --git a/src/mir_app/src/protocols.cpp b/src/mir_app/src/protocols.cpp
index f9553396db..0bf7bcf8da 100644
--- a/src/mir_app/src/protocols.cpp
+++ b/src/mir_app/src/protocols.cpp
@@ -384,60 +384,57 @@ INT_PTR CallContactServiceInt(MCONTACT hContact, const char *szModule, const cha
TServiceListItem *item = (TServiceListItem *)bsearch(&szService, serviceItems, _countof(serviceItems), sizeof(serviceItems[0]), CompareServiceItems);
if (item) {
auto *pa = Proto_GetAccount(szModule);
- auto *ppi = (pa) ? pa->ppro : 0;
- if (ppi == nullptr)
- return CALLSERVICE_NOTFOUND;
-
- 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, (wchar_t *)lParam);
- case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT *)lParam);
- case 6: return (INT_PTR)ppi->AuthRequest(hContact, (wchar_t *)lParam);
- case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (wchar_t *)lParam);
- case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
- case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (wchar_t *)lParam);
- case 11:
- {
- PROTOFILERESUME *pfr = (PROTOFILERESUME *)lParam;
- return (INT_PTR)ppi->FileResume((HANDLE)wParam, pfr->action, (const wchar_t *)pfr->szFilename);
- }
+ if (auto *ppi = (pa) ? pa->ppro : 0)
+ 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, (wchar_t *)lParam);
+ case 5: return (INT_PTR)ppi->AuthRecv(hContact, (PROTORECVEVENT *)lParam);
+ case 6: return (INT_PTR)ppi->AuthRequest(hContact, (wchar_t *)lParam);
+ case 8: return (INT_PTR)ppi->FileAllow(hContact, (HANDLE)wParam, (wchar_t *)lParam);
+ case 9: return (INT_PTR)ppi->FileCancel(hContact, (HANDLE)wParam);
+ case 10: return (INT_PTR)ppi->FileDeny(hContact, (HANDLE)wParam, (wchar_t *)lParam);
+ case 11:
+ {
+ PROTOFILERESUME *pfr = (PROTOFILERESUME *)lParam;
+ return (INT_PTR)ppi->FileResume((HANDLE)wParam, pfr->action, (const wchar_t *)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: return (INT_PTR)ppi->SearchBasic((wchar_t *)lParam);
- case 16: return (INT_PTR)ppi->SearchByEmail((wchar_t *)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, *(DB::FILE_BLOB*)wParam, *(DB::EventInfo*)lParam);
- case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT *)lParam);
- case 23: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (MCONTACT *)lParam);
- case 24: return (INT_PTR)ppi->SendFile(hContact, (wchar_t *)wParam, (wchar_t **)lParam);
- case 25:
- {
- int msgId = ppi->SendMsg(hContact, wParam, (const char *)lParam);
- if (msgId == -1) {
- ppi->ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)-1, (LPARAM)TranslateT("Protocol is offline"));
- return -1;
+ 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((wchar_t *)lParam);
+ case 16: return (INT_PTR)ppi->SearchByEmail((wchar_t *)lParam);
+ case 17:
+ {
+ PROTOSEARCHBYNAME *psbn = (PROTOSEARCHBYNAME *)lParam;
+ return (INT_PTR)ppi->SearchByName(psbn->pszNick, psbn->pszFirstName, psbn->pszLastName);
}
- return msgId;
+ 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, *(DB::FILE_BLOB *)wParam, *(DB::EventInfo *)lParam);
+ case 22: return (INT_PTR)ppi->RecvMsg(hContact, (PROTORECVEVENT *)lParam);
+ case 23: return (INT_PTR)ppi->SendContacts(hContact, LOWORD(wParam), HIWORD(wParam), (MCONTACT *)lParam);
+ case 24: return (INT_PTR)ppi->SendFile(hContact, (wchar_t *)wParam, (wchar_t **)lParam);
+ case 25:
+ {
+ int msgId = ppi->SendMsg(hContact, wParam, (const char *)lParam);
+ if (msgId == -1) {
+ ppi->ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, (HANDLE)-1, (LPARAM)TranslateT("Protocol is offline"));
+ return -1;
+ }
+ return msgId;
+ }
+ case 27: return (INT_PTR)ppi->SetStatus(wParam);
+ case 28: return (INT_PTR)ppi->GetAwayMsg(hContact);
+ case 29: return (INT_PTR)ppi->SetAwayMsg(wParam, (wchar_t *)lParam);
+ case 30: return (INT_PTR)ppi->UserIsTyping(wParam, lParam);
+ case 31: mir_strncpy((char *)lParam, ppi->m_szModuleName, wParam); return 0;
+ case 32:
+ return ppi->m_iStatus;
}
- case 27: return (INT_PTR)ppi->SetStatus(wParam);
- case 28: return (INT_PTR)ppi->GetAwayMsg(hContact);
- case 29: return (INT_PTR)ppi->SetAwayMsg(wParam, (wchar_t *)lParam);
- case 30: return (INT_PTR)ppi->UserIsTyping(wParam, lParam);
- case 31: mir_strncpy((char *)lParam, ppi->m_szModuleName, wParam); return 0;
- case 32:
- return ppi->m_iStatus;
- }
}
return ProtoCallService(szModule, szService, wParam, lParam);