From 6967fb68000cdf3431343ede41addcc5db2dfbae Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Sun, 31 May 2015 12:00:47 +0000 Subject: Tox: added support of assocmgr git-svn-id: http://svn.miranda-ng.org/main/trunk@13933 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Tox/src/tox_utils.cpp | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'protocols/Tox/src/tox_utils.cpp') diff --git a/protocols/Tox/src/tox_utils.cpp b/protocols/Tox/src/tox_utils.cpp index 2b22f02849..ed44c09630 100644 --- a/protocols/Tox/src/tox_utils.cpp +++ b/protocols/Tox/src/tox_utils.cpp @@ -75,4 +75,40 @@ MEVENT CToxProto::AddEventToDb(MCONTACT hContact, WORD type, DWORD timestamp, DW dbei.pBlob = pBlob; dbei.flags = flags; return db_event_add(hContact, &dbei); +} + +INT_PTR CToxProto::ParseToxUri(WPARAM, LPARAM lParam) +{ + TCHAR *uri = (TCHAR*)lParam; + if (mir_tstrlen(uri) <= 4) + return 1; + + if (Accounts.getCount() == 0) + return 1; + + CToxProto *proto = NULL; + for (size_t i = 0; i < Accounts.getCount(); i++) + { + if (Accounts[i]->IsOnline()) + { + proto = Accounts[i]; + break; + } + } + if (proto == NULL) + return 1; + + if (_tcschr(uri, _T('@')) != NULL) + return 1; + + PROTOSEARCHRESULT psr = { sizeof(psr) }; + psr.flags = PSR_TCHAR; + psr.id = mir_tstrdup(&uri[4]); + + ADDCONTACTSTRUCT acs = { HANDLE_SEARCHRESULT }; + acs.szProto = proto->m_szModuleName; + acs.psr = &psr; + + CallService(MS_ADDCONTACT_SHOW, 0, (LPARAM)&acs); + return 0; } \ No newline at end of file -- cgit v1.2.3