text
stringlengths
0
357
dc_job_add(context, DC_JOB_DELETE_MSG_ON_IMAP, (int)(uintptr_t)carray_get(created_db_entries, 1), NULL, 0);
}
dc_sqlite3_commit(context->sql);
transaction_pending = 0;
cleanup:
if (transaction_pending) { dc_sqlite3_rollback(context->sql); }
dc_mimeparser_unref(mime_parser);
free(rfc724_mid);
free(mime_in_reply_to);
free(mime_references);
dc_array_unref(to_ids);
if (created_db_entries) {
if (create_event_to_send) {
size_t i, icnt = carray_count(created_db_entries);
for (i = 0; i < icnt; i += 2) {
context->cb(context, create_event_to_send, (uintptr_t)carray_get(created_db_entries, i), (uintptr_t)carray_get(created_db_entries, i+1));
}
}
carray_free(created_db_entries);
}
if (rr_event_to_send) {
size_t i, icnt = carray_count(rr_event_to_send);
for (i = 0; i < icnt; i += 2) {
context->cb(context, DC_EVENT_MSG_READ, (uintptr_t)carray_get(rr_event_to_send, i), (uintptr_t)carray_get(rr_event_to_send, i+1));
}
carray_free(rr_event_to_send);
}
free(txt_raw);
sqlite3_finalize(stmt);
}
```
Filename: dc_saxparser.c
```c
/* dc_saxparser_t parses XML and HTML files that may not be wellformed
and spits out all text and tags found.
- Attributes are recognized with single, double or no quotes
- Whitespace ignored inside tags
- Self-closing tags are issued as open-tag plus close-tag
- CDATA is supoorted; DTA, comments, processing instruction are
skipped properly
- The parser does not care about hierarchy, if needed this can be
done by the user.
- Input and output strings must be UTF-8 encoded.
- Tag and attribute names are converted to lower case.
- Parsing does not stop on errors; instead errors are recovered.
NB: SAX = Simple API for XML */
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "dc_context.h"
#include "dc_tools.h"
#include "dc_saxparser.h"
/*******************************************************************************
* Decoding text
******************************************************************************/
static const char* s_ent[] = {
/* Convert entities as &auml; to UTF-8 characters.
- The first strings MUST NOT start with `&` and MUST end with `;`.
- take care not to miss a comma between the strings.
- It's also possible to specify the destination as a character reference as `&#34;` (they are converted in a second pass without a table). */
/* basic XML/HTML */
"lt;", "<", "gt;", ">", "quot;", "\"", "apos;", "'",
"amp;", "&", "nbsp;", " ",
/* advanced HTML */
"iexcl;", "¡", "cent;", "¢", "pound;", "£", "curren;", "¤",
"yen;", "¥", "brvbar;", "¦", "sect;", "§", "uml;", "¨",
"copy;", "©", "ordf;", "ª", "laquo;", "«", "not;", "¬",
"shy;", "-", "reg;", "®", "macr;", "¯", "deg;", "°",
"plusmn;", "±", "sup2;", "²", "sup3;", "³", "acute;", "´",
"micro;", "µ", "para;", "¶", "middot;", "·", "cedil;", "¸",
"sup1;", "¹", "ordm;", "º", "raquo;", "»", "frac14;", "¼",
"frac12;", "½", "frac34;", "¾", "iquest;", "¿", "Agrave;", "À",
"Aacute;", "Á", "Acirc;", "Â", "Atilde;", "Ã", "Auml;", "Ä",
"Aring;", "Å", "AElig;", "Æ", "Ccedil;", "Ç", "Egrave;", "È",
"Eacute;", "É", "Ecirc;", "Ê", "Euml;", "Ë", "Igrave;", "Ì",
"Iacute;", "Í", "Icirc;", "Î", "Iuml;", "Ï", "ETH;", "Ð",
"Ntilde;", "Ñ", "Ograve;", "Ò", "Oacute;", "Ó", "Ocirc;", "Ô",
"Otilde;", "Õ", "Ouml;", "Ö", "times;", "×", "Oslash;", "Ø",
"Ugrave;", "Ù", "Uacute;", "Ú", "Ucirc;", "Û", "Uuml;", "Ü",
"Yacute;", "Ý", "THORN;", "Þ", "szlig;", "ß", "agrave;", "à",