From e71ae69a68419f5e42ceb93234f7c470a54ed804 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 19 Dec 2013 21:16:14 +0000 Subject: minor contacts processing improvements git-svn-id: http://svn.miranda-ng.org/main/trunk@7291 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/ContactsPlus/src/send.cpp | 7 ++- plugins/TabSRMM/src/mim.cpp | 2 +- plugins/TabSRMM/src/msglog.cpp | 94 +++++++++++++++++++-------------------- 3 files changed, 49 insertions(+), 54 deletions(-) (limited to 'plugins') diff --git a/plugins/ContactsPlus/src/send.cpp b/plugins/ContactsPlus/src/send.cpp index d391edb177..beefc0aedf 100644 --- a/plugins/ContactsPlus/src/send.cpp +++ b/plugins/ContactsPlus/src/send.cpp @@ -347,12 +347,11 @@ INT_PTR CALLBACK SendDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara HWND hList = GetDlgItem(hwndDlg, IDC_LIST); hContact = FindFirstClistContact(hList, &hItem); - while (hContact) - { + while (hContact) { + // build list of contacts to send if (SendMessage(hList, CLM_GETCHECKMARK, (WPARAM)hItem, 0)) - { // build list of contacts to send wndData->AddContact(hContact); - } + hContact = FindNextClistContact(hList, hContact, &hItem); } /* send contacts */ diff --git a/plugins/TabSRMM/src/mim.cpp b/plugins/TabSRMM/src/mim.cpp index 18242609b0..b3282248e6 100644 --- a/plugins/TabSRMM/src/mim.cpp +++ b/plugins/TabSRMM/src/mim.cpp @@ -541,7 +541,7 @@ int CMimAPI::MessageEventAdded(WPARAM wParam, LPARAM lParam) BOOL isCustomEvent = IsCustomEvent(dbei.eventType); BOOL isShownCustomEvent = DbEventIsForMsgWindow(&dbei); - if (dbei.flags & DBEF_SENT || (isCustomEvent && !isShownCustomEvent) || dbei.flags & DBEF_READ) + if ((dbei.flags & (DBEF_READ | DBEF_SENT)) || (isCustomEvent && !isShownCustomEvent)) return 0; CallServiceSync(MS_CLIST_REMOVEEVENT, wParam, 1); diff --git a/plugins/TabSRMM/src/msglog.cpp b/plugins/TabSRMM/src/msglog.cpp index 6a1d0aa1c3..0b32eab640 100644 --- a/plugins/TabSRMM/src/msglog.cpp +++ b/plugins/TabSRMM/src/msglog.cpp @@ -978,60 +978,56 @@ static char *Template_CreateRTFFromDbEvent(TWindowData *dat, HANDLE hContact, HA if (bIsStatusChangeEvent) dbei.eventType = EVENTTYPE_STATUSCHANGE; switch (dbei.eventType) { - case EVENTTYPE_MESSAGE: - case EVENTTYPE_ERRMSG: - case EVENTTYPE_STATUSCHANGE: { - if (bIsStatusChangeEvent || dbei.eventType == EVENTTYPE_ERRMSG) { - if (dbei.eventType == EVENTTYPE_ERRMSG && dbei.cbBlob == 0) - break; - if (dbei.eventType == EVENTTYPE_ERRMSG) { - if (!skipFont) - AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\line%s ", GetRTFFont(bIsStatusChangeEvent ? H_MSGFONTID_STATUSCHANGES : MSGFONTID_MYMSG)); - else - AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\line "); - } else { - if (!skipFont) - AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(bIsStatusChangeEvent ? H_MSGFONTID_STATUSCHANGES : MSGFONTID_MYMSG)); - } - } else { + case EVENTTYPE_MESSAGE: + case EVENTTYPE_ERRMSG: + case EVENTTYPE_STATUSCHANGE: + if (bIsStatusChangeEvent || dbei.eventType == EVENTTYPE_ERRMSG) { + if (dbei.eventType == EVENTTYPE_ERRMSG && dbei.cbBlob == 0) + break; + if (dbei.eventType == EVENTTYPE_ERRMSG) { if (!skipFont) - AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYMSG + iFontIDOffset : MSGFONTID_YOURMSG + iFontIDOffset)); - } - - if (rtfMessage != NULL) { - AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s", rtfMessage); - } else { - AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, formatted, MAKELONG(isSent, dat->isHistory)); + AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\line%s ", GetRTFFont(bIsStatusChangeEvent ? H_MSGFONTID_STATUSCHANGES : MSGFONTID_MYMSG)); + else + AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "\\line "); } - AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s", "\\b0\\ul0\\i0 "); - break; + else if (!skipFont) + AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(bIsStatusChangeEvent ? H_MSGFONTID_STATUSCHANGES : MSGFONTID_MYMSG)); } - case EVENTTYPE_FILE: - if (!skipFont) - AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYMISC + iFontIDOffset : MSGFONTID_YOURMISC + iFontIDOffset)); - { - char* szFileName = (char *)dbei.pBlob + sizeof(DWORD); - char* szDescr = szFileName + lstrlenA(szFileName) + 1; - TCHAR* tszFileName = DbGetEventStringT( &dbei, szFileName ); - if ( *szDescr != 0 ) { - TCHAR* tszDescr = DbGetEventStringT( &dbei, szDescr ); - TCHAR buf[1000]; - mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), tszFileName, tszDescr); - AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, buf, 0 ); - mir_free(tszDescr); - } - else { - AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, tszFileName, 0 ); - } - mir_free( tszFileName ); + else if (!skipFont) + AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYMSG + iFontIDOffset : MSGFONTID_YOURMSG + iFontIDOffset)); + + if (rtfMessage != NULL) + AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s", rtfMessage); + else + AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, formatted, MAKELONG(isSent, dat->isHistory)); + + AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s", "\\b0\\ul0\\i0 "); + break; + + case EVENTTYPE_FILE: + if (!skipFont) + AppendToBuffer(&buffer, &bufferEnd, &bufferAlloced, "%s ", GetRTFFont(isSent ? MSGFONTID_MYMISC + iFontIDOffset : MSGFONTID_YOURMISC + iFontIDOffset)); + { + char *szFileName = (char *)dbei.pBlob + sizeof(DWORD); + char *szDescr = szFileName + lstrlenA(szFileName) + 1; + TCHAR *tszFileName = DbGetEventStringT(&dbei, szFileName); + if (*szDescr != 0) { + TCHAR *tszDescr = DbGetEventStringT(&dbei, szDescr); + TCHAR buf[1000]; + mir_sntprintf(buf, SIZEOF(buf), _T("%s (%s)"), tszFileName, tszDescr); + AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, buf, 0); + mir_free(tszDescr); } - break; - default: - if (IsCustomEvent(dbei.eventType)) { - TCHAR* tszText = DbGetEventTextT(&dbei, CP_ACP); - AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, tszText, 0); + else { + AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, tszFileName, 0); } - break; + mir_free(tszFileName); + } + break; + + default: + TCHAR* tszText = DbGetEventTextT(&dbei, CP_ACP); + AppendUnicodeToBuffer(&buffer, &bufferEnd, &bufferAlloced, tszText, 0); } break; case '*': // bold -- cgit v1.2.3