summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/misc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/VKontakte/src/misc.cpp')
-rw-r--r--protocols/VKontakte/src/misc.cpp21
1 files changed, 21 insertions, 0 deletions
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;