From 59de222d916876cc158d03909b661dd8b2cf6a3f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 7 Oct 2013 16:29:17 +0000 Subject: - frient list & statuses; - code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@6396 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'protocols/VKontakte/src/misc.cpp') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index a59a4a16b4..6470a303ad 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -38,6 +38,27 @@ void CVkProto::SetAllContactStatuses(int iStatus) } } +HANDLE CVkProto::FindUser(LPCSTR pUserid, bool bCreate) +{ + for (HANDLE hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName)) { + ptrA dbUserid(getStringA(hContact, "ID")); + if (dbUserid == NULL) + continue; + + if ( !strcmp(dbUserid, pUserid)) + return hContact; + } + + if (!bCreate) + return NULL; + + HANDLE hNewContact = (HANDLE)CallService(MS_DB_CONTACT_ADD, 0, 0); + CallService(MS_PROTO_ADDTOCONTACT, (WPARAM)hNewContact, (LPARAM)m_szModuleName); + setString(hNewContact, "ID", pUserid); + db_set_ts(hNewContact, "CList", "Group", m_defaultGroup); + return hNewContact; +} + int CVkProto::SetServerStatus(int iStatus) { return 0; -- cgit v1.2.3