Skip to content

Commit a6e2212

Browse files
committed
oxcmail: delete old commented-out code from bodyset_*
1 parent 198c757 commit a6e2212

File tree

1 file changed

+0
-59
lines changed

1 file changed

+0
-59
lines changed

lib/mapi/oxcmail2.cpp

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ ec_error_t bodyset_enriched(TPROPVAL_ARRAY &props,
165165
return ecServerOOM;
166166
}
167167

168-
#ifndef AVOID_LIBXML
169168
static xmlNode *find_element(xmlNode *node, const char *elem)
170169
{
171170
for (node = xmlFirstElementChild(node); node != nullptr;
@@ -184,7 +183,6 @@ static xmlNode *find_element(xmlDoc *doc, const char *elem)
184183
return nullptr;
185184
return find_element(node, elem);
186185
}
187-
#endif
188186

189187
static bool multibody_supported_img(const char *t)
190188
{
@@ -195,52 +193,6 @@ static bool multibody_supported_img(const char *t)
195193
strcasecmp(t, "gif") == 0 || strcasecmp(t, "bmp") == 0;
196194
}
197195

198-
#ifdef AVOID_LIBXML
199-
static ec_error_t multibody_html(std::string &&utfbody, std::string &ag_doc) try
200-
{
201-
ag_doc += std::move(utfbody);
202-
return ecSuccess;
203-
} catch (const std::bad_alloc &) {
204-
mlog(LV_ERR, "E-1774: ENOMEM");
205-
return ecServerOOM;
206-
}
207-
208-
static ec_error_t multibody_plain(std::string &&utfbody, std::string &ag_doc) try
209-
{
210-
ag_doc += "<pre>"s + std::move(utfbody) + "</pre>";
211-
return ecSuccess;
212-
} catch (const std::bad_alloc &) {
213-
mlog(LV_ERR, "E-1775: ENOMEM");
214-
return ecServerOOM;
215-
}
216-
217-
static ec_error_t multibody_image(MIME_ENUM_PARAM &epar, const MIME *mime,
218-
std::string &ag_doc) try
219-
{
220-
std::string ctid;
221-
char ctid_raw[128];
222-
if (!mime->get_field("Content-ID", ctid_raw, std::size(ctid_raw))) {
223-
GUID::random_new().to_str(&ctid_raw[0], std::size(ctid_raw), 32);
224-
ctid_raw[32] = '@';
225-
GUID::random_new().to_str(&ctid_raw[33], std::size(ctid_raw) - 33, 32);
226-
ctid = ctid_raw;
227-
epar.new_ctids.emplace(mime, ctid_raw);
228-
} else if (ctid_raw[0] == '<') {
229-
ctid = &ctid_raw[1];
230-
if (ctid.size() > 0 && ctid_raw[0] == '<' && ctid.back() == '>')
231-
ctid.pop_back();
232-
} else {
233-
ctid = ctid_raw;
234-
}
235-
ag_doc += "<img src=\"cid:" + ctid + "\">";
236-
return ecSuccess;
237-
} catch (const std::bad_alloc &) {
238-
mlog(LV_ERR, "E-1778: ENOMEM");
239-
return ecServerOOM;
240-
}
241-
242-
#else /* AVOID_LIBXML */
243-
244196
static ec_error_t multibody_plain(std::string &&utfbody, xmldocptr &ag_doc) try
245197
{
246198
auto ag_body = find_element(ag_doc.get(), "body");
@@ -383,7 +335,6 @@ static ec_error_t multibody_image(MIME_ENUM_PARAM &epar, const MIME *mime,
383335
mlog(LV_ERR, "E-1773: ENOMEM");
384336
return ecServerOOM;
385337
}
386-
#endif /* AVOID_LIBXML */
387338

388339
/**
389340
* There are some MUAs around that produce HTML mails with multiple text/html
@@ -400,11 +351,7 @@ static ec_error_t multibody_image(MIME_ENUM_PARAM &epar, const MIME *mime,
400351
ec_error_t bodyset_multi(MIME_ENUM_PARAM &epar, TPROPVAL_ARRAY &props,
401352
const char *charset)
402353
{
403-
#ifdef AVOID_LIBXML
404-
std::string ag_doc;
405-
#else
406354
xmldocptr ag_doc;
407-
#endif
408355

409356
for (auto mime : epar.hjoin) {
410357
auto is_html = strcasecmp(mime->content_type, "text/html") == 0;
@@ -447,11 +394,6 @@ ec_error_t bodyset_multi(MIME_ENUM_PARAM &epar, TPROPVAL_ARRAY &props,
447394
return err;
448395
}
449396

450-
#ifdef AVOID_LIBXML
451-
BINARY bin;
452-
bin.pc = ag_doc.data();
453-
bin.cb = ag_doc.size();
454-
#else
455397
std::unique_ptr<xmlChar[], xmlfree> ag_raw;
456398
int ag_rawsize = 0;
457399
htmlDocDumpMemoryFormat(ag_doc.get(), &unique_tie(ag_raw), &ag_rawsize, 1);
@@ -463,7 +405,6 @@ ec_error_t bodyset_multi(MIME_ENUM_PARAM &epar, TPROPVAL_ARRAY &props,
463405
BINARY bin;
464406
bin.cb = ag_rawsize;
465407
bin.pb = ag_raw.get();
466-
#endif /* AVOID_LIBXML */
467408
auto err = props.set(PR_HTML, &bin);
468409
if (err != ecSuccess)
469410
return err;

0 commit comments

Comments
 (0)