From 1383e88abf16de34fb680dfb5001ba79d44d933c Mon Sep 17 00:00:00 2001 From: aunsane Date: Sat, 21 Apr 2018 22:34:54 +0300 Subject: core: add Contact_GetStatus function --- src/mir_app/src/contacts.cpp | 13 +++++++++++++ src/mir_app/src/mir_app.def | 1 + 2 files changed, 14 insertions(+) (limited to 'src') diff --git a/src/mir_app/src/contacts.cpp b/src/mir_app/src/contacts.cpp index b53fb0bcd5..2f52b6ca91 100644 --- a/src/mir_app/src/contacts.cpp +++ b/src/mir_app/src/contacts.cpp @@ -285,6 +285,19 @@ MIR_APP_DLL(wchar_t*) Contact_GetInfo(int type, MCONTACT hContact, const char *s return nullptr; } +MIR_APP_DLL(int) Contact_GetStatus(MCONTACT hContact) +{ + if (hContact == 0) + return ID_STATUS_OFFLINE; + + const char *szProto = GetContactProto(hContact); + if (szProto == nullptr) + return ID_STATUS_OFFLINE; + + return db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE); +} + + ///////////////////////////////////////////////////////////////////////////////////////// // Options dialog diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index ec0240613f..f8b2c787d4 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -583,3 +583,4 @@ Proto_GetStatus @601 ?IsReadyToExit@PROTO_INTERFACE@@UAE_NXZ @606 NONAME ?OnModulesLoaded@PROTO_INTERFACE@@UAEXXZ @607 NONAME ?OnShutdown@PROTO_INTERFACE@@UAEXXZ @608 NONAME +Contact_GetStatus @609 -- cgit v1.2.3