diff options
-rw-r--r-- | plugins/TipperYM/docs/tipper_orig_readme.txt | 36 | ||||
-rw-r--r-- | plugins/TipperYM/src/subst.cpp | 26 | ||||
-rw-r--r-- | plugins/TipperYM/src/version.h | 18 |
3 files changed, 43 insertions, 37 deletions
diff --git a/plugins/TipperYM/docs/tipper_orig_readme.txt b/plugins/TipperYM/docs/tipper_orig_readme.txt index 7795975c23..70c75d48de 100644 --- a/plugins/TipperYM/docs/tipper_orig_readme.txt +++ b/plugins/TipperYM/docs/tipper_orig_readme.txt @@ -53,22 +53,26 @@ format: Were name can be any of the following:
-uid - contact's unique identifier
-uidname - name of unique identifier
-proto - contact's protocol
-account - contact's user-defined account name
-time - contact's time
-status_msg - contact's status message
-last_msg - last message received from contact
-last_msg_time - time of last received message
-last_msg_date - date of last received message
-last_msg_reltime - relative time of last message (i.e. time between then and now)
-meta_subname - nickname of active subcontact (for metacontacts)
-meta_subuid - unique id of active subcontact
-meta_subproto - active subcontact protocol (also for metacontacts)
-msg_count_all - number of all messages in db for contact (sent + received)
-msg_count_out - number of sent messages to contact
-msg_count_in - number of received messages from contact
+uid - contact's unique identifier
+uidname - name of unique identifier
+proto - contact's protocol
+account - contact's user-defined account name
+time - contact's time
+status_msg - contact's status message
+last_msg - last message received from contact
+last_msg_out - last message sent to contact
+last_msg_time - time of last received message
+last_msg_out_time - time of last sent message
+last_msg_date - date of last received message
+last_msg_out_date - date of last sent message
+last_msg_reltime - relative time of last message (i.e. time between then and now)
+last_msg_out_reltime - relative time of last sent message (i.e. time between then and now)
+meta_subname - nickname of active subcontact (for metacontacts)
+meta_subuid - unique id of active subcontact
+meta_subproto - active subcontact protocol (also for metacontacts)
+msg_count_all - number of all messages in db for contact (sent + received)
+msg_count_out - number of sent messages to contact
+msg_count_in - number of received messages from contact
If a substitution's value results in no text (or nothing but spaces, tabs, newlines, and carriage returns), the whole item containing that
substitution will not be displayed. If there is an error during the substitution process (e.g. a substitution name that does not exist, an odd
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 <stdver.h>
-#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"
|