mu4e: use the new command-parser

Update mu4e-proc to use the new mu4e <-> mu protocol
This commit is contained in:
Dirk-Jan C. Binnema
2020-01-19 17:23:24 +02:00
parent c71f683e39
commit d2ec85f01c
7 changed files with 116 additions and 104 deletions

View File

@ -445,6 +445,33 @@ Mu::size_to_string (const std::string& val, bool is_first)
}
std::string
Mu::quoted (const std::string& str)
{
std::string res{"\""};
for (auto&& c : str) {
if (c == '\\' || c == '\"')
res += '\\';
res += c;
}
return res + '"';
}
// std::string
// Mu::quoted (const char* str)
// {
// if (!str)
// return str;
// char *s{g_strescape(str, NULL)};
// auto res = format("\"%s\"", s ? s : "");
// g_free(s);
// return res;
// }
void
Mu::assert_equal(const std::string& s1, const std::string& s2)
{

View File

@ -93,6 +93,17 @@ std::string format (const char *frm, ...) __attribute__((format(printf, 1, 2)));
std::string format (const char *frm, va_list args) __attribute__((format(printf, 1, 0)));
/**
* Quote a string -- put in "" and escape any special characters by putting '\'
* in front of them.
*
* @param str
*
* @return
*/
std::string quoted (const std::string& str);
/**
* Convert an ISO date to the corresponding time expressed as a string
* with a 10-digit time_t