diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-08-14 19:35:01 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-08-14 19:35:01 +0000 |
commit | 14001c799e72b8eefa523f8ff7ce44c443c78db8 (patch) | |
tree | f0c51ccdc39aadc4e6103cef3625a6df34678dc2 /protocols/Tox/src/tox_contacts.cpp | |
parent | e18bb0689bb3ff2bdd622b5feca554d7559ca8e8 (diff) |
Tox: now you can add contacts from find/add dialog
git-svn-id: http://svn.miranda-ng.org/main/trunk@10183 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_contacts.cpp')
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 50 |
1 files changed, 15 insertions, 35 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 3ae3cf9f21..c0c9335d63 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -50,7 +50,7 @@ MCONTACT CToxProto::FindContact(const char *clientId) for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
{
- ptrA contactId(getStringA(hContact, TOX_SETTING_ID));
+ ptrA contactId(getStringA(hContact, TOX_SETTINGS_ID));
if (lstrcmpiA(contactId, clientId) == 0)
break;
}
@@ -60,22 +60,28 @@ MCONTACT CToxProto::FindContact(const char *clientId) return hContact;
}
-MCONTACT CToxProto::AddContact(const char *clientId, bool isHidden)
+MCONTACT CToxProto::AddContact(const char *clientId, bool isTemporary)
{
MCONTACT hContact = FindContact(clientId);
if (!hContact)
{
- hContact = (MCONTACT)::CallService(MS_DB_CONTACT_ADD, 0, 0);
+ hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName);
- /*db_set_b(hContact, "CList", "NotOnList", 1);
-
- if (isHidden)
+ if (isTemporary)
{
- db_set_b(hContact, "CList", "Hidden", 1);
- }*/
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ db_set_b(hContact, "CList", "Auth", 1);
+ }
- setString(hContact, TOX_SETTING_ID, clientId);
+ setString(hContact, TOX_SETTINGS_ID, clientId);
+
+ DBVARIANT dbv;
+ if (!getTString(TOX_SETTINGS_DEFAULT_GROUP, &dbv))
+ {
+ db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
+ db_free(&dbv);
+ }
}
return hContact;
@@ -108,30 +114,4 @@ void CToxProto::LoadContactList() }
}
}
-}
-
-void __cdecl CToxProto::SearchByUidAsync(void* arg)
-{
- ptrW userId((wchar_t*)arg);
-
- //MCONTACT hContact = GetContactByUserId(userId);
- //if (hContact)
- //{
- // ShowNotification(TranslateT("Contact already in your contact list"), 0, hContact);
- // ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_SUCCESS, (HANDLE)TOX_SEARCH_BYUID, 0);
- // return;
- //}
-
- //// there will be placed code
- //// that will search for contact by userId
- // ...
- // ...
- //// and call
- PROTOSEARCHRESULT psr = {0};
- psr.cbSize = sizeof(psr);
- //// get user id [and nick]
- //psr.id = userId;
- //psr.nick = nick;
-
- ProtoBroadcastAck(NULL, ACKTYPE_SEARCH, ACKRESULT_DATA, (HANDLE)TOX_SEARCH_BYUID, (LPARAM)&psr);
}
\ No newline at end of file |