summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_contacts.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-03-17 20:33:47 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-03-17 20:33:47 +0000
commitdd3d0e59dcd34beb222fcf612a51d3fee82c0e43 (patch)
tree0ae5a6e0a83399036d1452256ee3f89dc6da8872 /protocols/SkypeWeb/src/skype_contacts.cpp
parent076fa9b3142f55fc736fbf58b20bfa45973acd68 (diff)
SkypeWeb: initial commit
git-svn-id: http://svn.miranda-ng.org/main/trunk@12424 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_contacts.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_contacts.cpp103
1 files changed, 103 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp
new file mode 100644
index 0000000000..c8aea263e5
--- /dev/null
+++ b/protocols/SkypeWeb/src/skype_contacts.cpp
@@ -0,0 +1,103 @@
+#include "common.h"
+
+WORD CSkypeProto::GetContactStatus(MCONTACT hContact)
+{
+ return getWord(hContact, "Status", ID_STATUS_OFFLINE);
+}
+
+void CSkypeProto::SetContactStatus(MCONTACT hContact, WORD status)
+{
+ WORD oldStatus = GetContactStatus(hContact);
+ if (oldStatus != status)
+ {
+ setWord(hContact, "Status", status);
+ }
+}
+
+void CSkypeProto::SetAllContactsStatus(WORD status)
+{
+ for (MCONTACT hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ {
+ SetContactStatus(hContact, status);
+ }
+}
+
+MCONTACT CSkypeProto::GetContactFromAuthEvent(MEVENT hEvent)
+{
+ DWORD body[3];
+ DBEVENTINFO dbei = { sizeof(DBEVENTINFO) };
+ dbei.cbBlob = sizeof(DWORD) * 2;
+ dbei.pBlob = (PBYTE)&body;
+
+ if (db_event_get(hEvent, &dbei))
+ return INVALID_CONTACT_ID;
+
+ if (dbei.eventType != EVENTTYPE_AUTHREQUEST)
+ return INVALID_CONTACT_ID;
+
+ if (strcmp(dbei.szModule, m_szModuleName) != 0)
+ return INVALID_CONTACT_ID;
+
+ return DbGetAuthEventContact(&dbei);
+}
+
+MCONTACT CSkypeProto::GetContact(const char *login)
+{
+ MCONTACT hContact = NULL;
+ for (hContact = db_find_first(m_szModuleName); hContact; hContact = db_find_next(hContact, m_szModuleName))
+ {
+ ptrA contactLogin(getStringA(hContact, SKYPE_SETTINGS_ID));
+ if (mir_strcmpi(login, contactLogin) == 0)
+ {
+ break;
+ }
+ }
+ return hContact;
+}
+
+MCONTACT CSkypeProto::AddContact(const char *login, bool isTemporary)
+{
+ MCONTACT hContact = GetContact(login);
+ if (!hContact)
+ {
+ hContact = (MCONTACT)CallService(MS_DB_CONTACT_ADD, 0, 0);
+ CallService(MS_PROTO_ADDTOCONTACT, hContact, (LPARAM)m_szModuleName);
+
+ setString(hContact, SKYPE_SETTINGS_ID, login);
+
+ DBVARIANT dbv;
+ if (!getTString(SKYPE_SETTINGS_GROUP, &dbv))
+ {
+ db_set_ts(hContact, "CList", "Group", dbv.ptszVal);
+ db_free(&dbv);
+ }
+
+ setByte(hContact, "Auth", 1);
+ setByte(hContact, "Grant", 1);
+
+ if (isTemporary)
+ {
+ db_set_b(hContact, "CList", "NotOnList", 1);
+ }
+ }
+ return hContact;
+}
+
+void CSkypeProto::LoadFriendList(void*)
+{
+}
+
+INT_PTR CSkypeProto::OnRequestAuth(WPARAM hContact, LPARAM lParam)
+{
+ return 0;
+}
+
+INT_PTR CSkypeProto::OnGrantAuth(WPARAM hContact, LPARAM)
+{
+ return 0;
+}
+
+int CSkypeProto::OnContactDeleted(MCONTACT hContact, LPARAM)
+{
+ return 0;
+} \ No newline at end of file