From 86ceaf46c7f4e97faf5bbd7866e9ae7cfba22709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Mon, 1 Sep 2014 08:31:28 +0000 Subject: TipperYM: add new system substitutions (last_msg_out, last_msg_out_time, last_msg_out_date, last_msg_out_reltime); version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@10353 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/TipperYM/src/subst.cpp | 26 ++++++++++++++------------ plugins/TipperYM/src/version.h | 18 +++++++++--------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'plugins/TipperYM/src') diff --git a/plugins/TipperYM/src/subst.cpp b/plugins/TipperYM/src/subst.cpp index 653ed2a655..01f3344305 100644 --- a/plugins/TipperYM/src/subst.cpp +++ b/plugins/TipperYM/src/subst.cpp @@ -119,12 +119,12 @@ void StripBBCodesInPlace(TCHAR *swzText) } } -DWORD LastMessageTimestamp(MCONTACT hContact) +DWORD LastMessageTimestamp(MCONTACT hContact, bool received) { for (HANDLE hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDbEvent, &dbei); - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) + if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) return dbei.timestamp; } @@ -166,12 +166,12 @@ bool UidName(char *szProto, TCHAR *buff, int bufflen) return false; } -TCHAR *GetLastMessageText(MCONTACT hContact) +TCHAR *GetLastMessageText(MCONTACT hContact, bool received) { for (HANDLE hDbEvent = db_event_last(hContact); hDbEvent; hDbEvent = db_event_prev(hContact, hDbEvent)) { DBEVENTINFO dbei = { sizeof(dbei) }; db_event_get(hDbEvent, &dbei); - if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT)) { + if (dbei.eventType == EVENTTYPE_MESSAGE && !(dbei.flags & DBEF_SENT) == received) { dbei.pBlob = (BYTE *)alloca(dbei.cbBlob); db_event_get(hDbEvent, &dbei); if (dbei.cbBlob == 0 || dbei.pBlob == 0) @@ -252,6 +252,8 @@ TCHAR* GetStatusMessageText(MCONTACT hContact) bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int bufflen) { + bool recv = false; + if (!_tcscmp(swzRawSpec, _T("uid"))) return Uid(hContact, 0, buff, bufflen); @@ -293,8 +295,8 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff return true; } } - else if (!_tcscmp(swzRawSpec, _T("last_msg"))) { - TCHAR *swzMsg = GetLastMessageText(hContact); + else if ((recv = !_tcscmp(swzRawSpec, _T("last_msg"))) || !_tcscmp(swzRawSpec, _T("last_msg_out"))) { + TCHAR *swzMsg = GetLastMessageText(hContact, recv); if (swzMsg) { _tcsncpy(buff, swzMsg, bufflen); mir_free(swzMsg); @@ -324,20 +326,20 @@ bool GetSysSubstText(MCONTACT hContact, TCHAR *swzRawSpec, TCHAR *buff, int buff return false; return GetSysSubstText(hSubContact, _T("account"), buff, bufflen); } - else if (!_tcscmp(swzRawSpec, _T("last_msg_time"))) { - DWORD ts = LastMessageTimestamp(hContact); + else if ((recv = !_tcscmp(swzRawSpec, _T("last_msg_time"))) || !_tcscmp(swzRawSpec, _T("last_msg_out_time"))) { + DWORD ts = LastMessageTimestamp(hContact, recv); if (ts == 0) return false; FormatTimestamp(ts, "t", buff, bufflen); return true; } - else if (!_tcscmp(swzRawSpec, _T("last_msg_date"))) { - DWORD ts = LastMessageTimestamp(hContact); + else if ((recv = !_tcscmp(swzRawSpec, _T("last_msg_date"))) || !_tcscmp(swzRawSpec, _T("last_msg_out_date"))) { + DWORD ts = LastMessageTimestamp(hContact, recv); if (ts == 0) return false; FormatTimestamp(ts, "d", buff, bufflen); return true; } - else if (!_tcscmp(swzRawSpec, _T("last_msg_reltime"))) { - DWORD ts = LastMessageTimestamp(hContact); + else if ((recv = !_tcscmp(swzRawSpec, _T("last_msg_reltime"))) || !_tcscmp(swzRawSpec, _T("last_msg_out_reltime"))) { + DWORD ts = LastMessageTimestamp(hContact, recv); if (ts == 0) return false; DWORD t = (DWORD)time(0); DWORD diff = (t - ts); diff --git a/plugins/TipperYM/src/version.h b/plugins/TipperYM/src/version.h index 050b977e54..f8accebbd3 100644 --- a/plugins/TipperYM/src/version.h +++ b/plugins/TipperYM/src/version.h @@ -1,14 +1,14 @@ #define __MAJOR_VERSION 2 #define __MINOR_VERSION 1 -#define __RELEASE_NUM 0 -#define __BUILD_NUM 5 +#define __RELEASE_NUM 0 +#define __BUILD_NUM 6 #include -#define __PLUGIN_NAME "Tipper" -#define __FILENAME "Tipper.dll" -#define __DESCRIPTION "Tool Tip notification windows." -#define __AUTHOR "Scott Ellis, yaho" -#define __AUTHOREMAIL "yaho@miranda-easy.net" -#define __AUTHORWEB "http://miranda-ng.org/p/Tipper/" -#define __COPYRIGHT "© 2005-2007 Scott Ellis, 2007-2011 Jan Holub" +#define __PLUGIN_NAME "Tipper" +#define __FILENAME "Tipper.dll" +#define __DESCRIPTION "Tool Tip notification windows." +#define __AUTHOR "Scott Ellis, yaho" +#define __AUTHOREMAIL "yaho@miranda-easy.net" +#define __AUTHORWEB "http://miranda-ng.org/p/Tipper/" +#define __COPYRIGHT "© 2005-2007 Scott Ellis, 2007-2011 Jan Holub" -- cgit v1.2.3