Skip to content

Commit

Permalink
Merge pull request #571 from stephenegriffin/u/sgriffin/reminder
Browse files Browse the repository at this point in the history
Interesting prop search recursion
  • Loading branch information
stephenegriffin authored Mar 29, 2023
2 parents 1c9cd73 + 4b2531d commit 798be9f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
5 changes: 4 additions & 1 deletion MrMapi/MMContents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ void DumpContentsTable(
if (cli::switchSkip.isSet())
output::DebugPrint(output::dbgLevel::Console, L"DumpContentsTable: Will skip attachments\n");
if (cli::switchList.isSet()) output::DebugPrint(output::dbgLevel::Console, L"DumpContentsTable: List only mode\n");
if (cli::switchRecurse.isSet())
output::DebugPrint(output::dbgLevel::Console, L"DumpContentsTable: Recurse into subfolders\n");
if (ulCount)
output::DebugPrint(output::dbgLevel::Console, L"DumpContentsTable: Limiting output to %u messages.\n", ulCount);

Expand Down Expand Up @@ -70,7 +72,8 @@ void DumpContentsTable(
if (!cli::switchMoreProperties.isSet()) MyDumpStore.DisableStreamRetry();
if (cli::switchSkip.isSet()) MyDumpStore.DisableEmbeddedAttachments();

MyDumpStore.ProcessFolders(cli::switchContents.isSet(), cli::switchAssociatedContents.isSet(), false);
MyDumpStore.ProcessFolders(
cli::switchContents.isSet(), cli::switchAssociatedContents.isSet(), cli::switchRecurse.isSet());
}
}

Expand Down
18 changes: 12 additions & 6 deletions MrMapi/mmcli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace cli
option switchWizard{L"Wizard", cmdmodeEnumAccounts, 0, 0, OPT_NOOPT};
option switchFindProperty{L"FindProperty", cmdmodeContents, 1, USHRT_MAX, OPT_INITALL};
option switchFindNamedProperty{L"FindNamedProperty", cmdmodeContents, 1, USHRT_MAX, OPT_INITALL};
option switchRecurse{L"Recurse", cmdmodeContents, 0, 0, OPT_NOOPT};

// If we want to add aliases for any switches, add them here
option switchHelpAlias{L"Help", cmdmodeHelpFull, 0, 0, OPT_INITMFC};
Expand Down Expand Up @@ -133,6 +134,7 @@ namespace cli
&switchWizard,
&switchFindProperty,
&switchFindNamedProperty,
&switchRecurse,
// If we want to add aliases for any switches, add them here
&switchHelpAlias,
};
Expand Down Expand Up @@ -195,14 +197,11 @@ namespace cli
switchProfile.name(),
switchFolder.name());
wprintf(
L" MrMAPI -%ws | -%ws [-%ws <profile>] [-%ws <folder>] [-%ws <property names>] [-%ws <dispid names>] "
L"[-%ws <output directory>]\n",
L" MrMAPI -%ws | -%ws [-%ws <profile>] [-%ws <folder>] [-%ws <output directory>]\n",
switchContents.name(),
switchAssociatedContents.name(),
switchProfile.name(),
switchFolder.name(),
switchFindProperty.name(),
switchFindNamedProperty.name(),
switchOutput.name());
wprintf(
L" [-%ws <subject>] [-%ws <message class>] [-%ws] [-%ws] [-%ws <count>] [-%ws]\n",
Expand All @@ -212,6 +211,11 @@ namespace cli
switchList.name(),
switchRecent.name(),
switchSkip.name());
wprintf(
L" [-%ws <property names>] [-%ws <dispid names>] [-%ws]\n",
switchFindProperty.name(),
switchFindNamedProperty.name(),
switchRecurse.name());
wprintf(
L" MrMAPI -%ws [-%ws <profile>] [-%ws <folder>]\n",
switchChildFolders.name(),
Expand Down Expand Up @@ -338,20 +342,22 @@ namespace cli
wprintf(
L" -H (or -%ws) Output associated contents table. May be combined with -C. Profile optional\n",
switchAssociatedContents.name());
wprintf(L" -Chi (or -%ws) Recurse into child folders of selected folder.\n", switchChildFolders.name());
wprintf(L" -Su (or -%ws) Subject of messages to output.\n", switchSubject.name());
wprintf(L" -Me (or -%ws) Message class of messages to output.\n", switchMessageClass.name());
wprintf(L" -Ms (or -%ws) Output as .MSG instead of XML.\n", switchMSG.name());
wprintf(L" -L (or -%ws) List details to screen and do not output files.\n", switchList.name());
wprintf(L" -Re (or -%ws) Restrict output to the 'count' most recent messages.\n", switchRecent.name());
wprintf(L" -Res (or -%ws) Restrict output to the 'count' most recent messages.\n", switchRecent.name());
wprintf(
L" -FindP (or -%ws) Restrict output to messages which contain given properties.\n",
switchFindProperty.name());
wprintf(
L" -FindN (or -%ws) Restrict output to messages which contain given named properties.\n",
switchFindNamedProperty.name());
wprintf(L" -Recur (or -%ws) Recurse into subfolders.\n", switchRecurse.name());
wprintf(L"\n");
wprintf(L" Child Folders:\n");
wprintf(L" -Chi (or -%ws) Display child folders of selected folder.\n", switchChildFolders.name());
wprintf(L" -Chi (or -%ws) List child folders of selected folder.\n", switchChildFolders.name());
wprintf(L"\n");
wprintf(L" MSG File Properties\n");
wprintf(L" -X (or -%ws) Output properties of an MSG file as XML.\n", switchXML.name());
Expand Down
1 change: 1 addition & 0 deletions MrMapi/mmcli.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace cli
extern option switchWizard;
extern option switchFindProperty;
extern option switchFindNamedProperty;
extern option switchRecurse;

extern std::vector<option*> g_options;

Expand Down
13 changes: 12 additions & 1 deletion core/mapi/processor/dumpStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ namespace mapi::processor
void dumpStore::EndFolderWork()
{
MAPIFreeBuffer(m_lpInterestingPropTags);
m_lpInterestingPropTags = nullptr;
if (m_bOutputList) return;
if (m_fFolderProps)
{
Expand Down Expand Up @@ -442,7 +443,17 @@ namespace mapi::processor
auto count = static_cast<ULONG>(m_properties.size() + m_namedProperties.size());
if (!m_lpFolder || count == 0) return;

wprintf(L"Filtering for one of %lu interesting properties\n", count);
auto lpDisplayNameW = LPSPropValue{};
std::wstring szDisplayName;
WC_MAPI_S(mapi::HrGetOnePropEx(m_lpFolder, PR_DISPLAY_NAME_W, fMapiUnicode, &lpDisplayNameW));
if (lpDisplayNameW && strings::CheckStringProp(lpDisplayNameW, PT_UNICODE))
{
szDisplayName = lpDisplayNameW->Value.lpszW;
}

MAPIFreeBuffer(lpDisplayNameW);

wprintf(L"Filtering %ws for one of %lu interesting properties\n", szDisplayName.c_str(), count);
count += boringProps.cValues; // We're going to add some boring properties we'll use later for display

auto lpTag = mapi::allocate<LPSPropTagArray>(CbNewSPropTagArray(count));
Expand Down

0 comments on commit 798be9f

Please sign in to comment.