diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2014-08-12 18:28:50 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2014-08-12 18:28:50 +0000 |
commit | 4330c62d2fa5b2752036b43018044c7c01b10695 (patch) | |
tree | 41001600877a55ad94ab03f9ccbbe3fab56585ad /protocols/Tox/src/tox_contacts.cpp | |
parent | c1fdf24779e15d5a1063340b35a4f7b2e3bf9d6a (diff) |
Tox: contact name, status, status message saving
git-svn-id: http://svn.miranda-ng.org/main/trunk@10167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Tox/src/tox_contacts.cpp')
-rw-r--r-- | protocols/Tox/src/tox_contacts.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/protocols/Tox/src/tox_contacts.cpp b/protocols/Tox/src/tox_contacts.cpp index 7249bc47ab..788105b0d4 100644 --- a/protocols/Tox/src/tox_contacts.cpp +++ b/protocols/Tox/src/tox_contacts.cpp @@ -1,8 +1,25 @@ #include "common.h"
+void CToxProto::SetContactStatus(MCONTACT hContact, WORD status)
+{
+ WORD oldStatus = getWord(hContact, "Status", ID_STATUS_OFFLINE);
+ if (oldStatus != status)
+ {
+ setWord(hContact, "Status", status);
+ }
+}
+
+void CToxProto::SetAllContactsStatus(WORD status)
+{
+ for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ {
+ setWord(hContact, "Status", status);
+ }
+}
+
bool CToxProto::IsProtoContact(MCONTACT hContact)
{
- return ::lstrcmpiA(::GetContactProto(hContact), m_szModuleName) == 0;
+ return lstrcmpiA(GetContactProto(hContact), m_szModuleName) == 0;
}
MCONTACT CToxProto::FindContact(const char *clientId)
@@ -23,7 +40,7 @@ MCONTACT CToxProto::FindContact(const char *clientId) return hContact;
}
-MCONTACT CToxProto::AddContact(const char *clientId, const char *nick, bool isHidden)
+MCONTACT CToxProto::AddContact(const char *clientId, bool isHidden)
{
MCONTACT hContact = FindContact(clientId);
if (!hContact)
@@ -39,7 +56,6 @@ MCONTACT CToxProto::AddContact(const char *clientId, const char *nick, bool isHi }*/
setString(hContact, TOX_SETTING_ID, clientId);
- setString(hContact, "Nick", nick);
}
return hContact;
@@ -59,10 +75,7 @@ void CToxProto::LoadContactList() tox_get_client_id(tox, friends[i], &clientId[0]);
std::string toxId = DataToHexString(clientId);
- tox_get_name(tox, friends[i], &username[0]);
- std::string nick(username.begin(), username.end());
-
- MCONTACT hContact = AddContact(toxId.c_str(), nick.c_str());
+ MCONTACT hContact = AddContact(toxId.c_str());
}
}
}
|