From 95d43413eeef2a573d8e317088c8a0e108a3c3f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Sun, 6 Jul 2014 07:53:55 +0000 Subject: Facebook: Set "Message read" info (if exists) on opening message window git-svn-id: http://svn.miranda-ng.org/main/trunk@9698 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/FacebookRM/src/proto.cpp | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'protocols/FacebookRM/src/proto.cpp') diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index 9a5fd73d02..4a36cc96d4 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -534,7 +534,10 @@ int FacebookProto::OnProcessSrmmEvent(WPARAM, LPARAM lParam) { MessageWindowEventData *event = (MessageWindowEventData *)lParam; - if (event->uType == MSG_WINDOW_EVT_OPEN) { + if (event->uType == MSG_WINDOW_EVT_OPENING) { + // Set statusbar to "Message read" time (if present) + MessageRead(event->hContact); + } else if (event->uType == MSG_WINDOW_EVT_OPEN) { // Check if we have enabled loading messages on open window if (!getBool(FACEBOOK_KEY_MESSAGES_ON_OPEN, DEFAULT_MESSAGES_ON_OPEN)) return 0; @@ -936,3 +939,23 @@ void FacebookProto::InitSounds() SkinAddNewSoundExT("NewsFeed", m_tszUserName, LPGENT("News Feed")); SkinAddNewSoundExT("OtherEvent", m_tszUserName, LPGENT("Other Event")); } + +/** + * Sets statusbar text of hContact with last read time (from facy.readers map) + */ +void FacebookProto::MessageRead(MCONTACT hContact) +{ + std::map::iterator it = facy.readers.find(hContact); + if (it == facy.readers.end()) + return; + + TCHAR ttime[64]; + _tcsftime(ttime, SIZEOF(ttime), _T("%X"), localtime(&it->second)); + + StatusTextData st = { 0 }; + st.cbSize = sizeof(st); + st.hIcon = Skin_GetIconByHandle(GetIconHandle("read")); + mir_sntprintf(st.tszText, SIZEOF(st.tszText), TranslateT("Message read: %s"), ttime); + + CallService(MS_MSG_SETSTATUSTEXT, (WPARAM)hContact, (LPARAM)&st); +} -- cgit v1.2.3