summaryrefslogtreecommitdiffstats
path: root/l10n/templates/core.pot
diff options
context:
space:
mode:
Diffstat (limited to 'l10n/templates/core.pot')
-rw-r--r--l10n/templates/core.pot2
1 files changed, 1 insertions, 1 deletions
diff --git a/l10n/templates/core.pot b/l10n/templates/core.pot
index f01edae58ca..0bfb19d9267 100644
--- a/l10n/templates/core.pot
+++ b/l10n/templates/core.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2012-12-08 00:09+0100\n"
+"POT-Creation-Date: 2012-12-09 00:11+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
ost_end + strcspn (host_end, "#" POST_CHAR_S); uri->data = host_end; uri->datalen = prefix_end - host_end; if (*prefix_end == '#') { uri->fragment = prefix_end + 1; uri->fragmentlen = strcspn (uri->fragment, POST_CHAR_S); prefix_end = uri->fragment + uri->fragmentlen; } if (*prefix_end == POST_CHAR) { uri->post = prefix_end + 1; } convert_to_lowercase (uri->string, uri->protocollen); convert_to_lowercase (uri->host, uri->hostlen); /* Decode %HH sequences in host name. This is important not so much to support %HH sequences in host names (which other browser don't), but to support binary characters (which will have been converted to %HH by reencode_escapes). */ if (strchr (uri->host, '%')) { uri->hostlen = url_calculate_escaped_hostlen (uri->host, uri->hostlen); } url_strip (struri (uri)); url_unescape (uri->host); path_simplify (uri->data); return URI_ERRNO_OK; } static const gchar url_braces[] = { '(', ')' , '{', '}' , '[', ']' , '<', '>' , '|', '|' , '\'', '\'' }; static gboolean is_open_brace (gchar c) { if (c == '(' || c == '{' || c == '[' || c == '<' || c == '|' || c == '\'') { return TRUE; } return FALSE; } static gboolean url_file_start (const gchar *begin, const gchar *end, const gchar *pos, url_match_t *match) { match->m_begin = pos; return TRUE; } static gboolean url_file_end (const gchar *begin, const gchar *end, const gchar *pos, url_match_t *match) { const gchar *p; gchar stop; gint i; p = pos + strlen (match->pattern); if (*p == '/') { p ++; } for (i = 0; i < G_N_ELEMENTS (url_braces) / 2; i += 2) { if (*p == url_braces[i]) { stop = url_braces[i + 1]; break; } } while (p < end && *p != stop && is_urlsafe (*p)) { p ++; } if (p == begin) { return FALSE; } match->m_len = p - match->m_begin; return TRUE; } static gboolean url_web_start (const gchar *begin, const gchar *end, const gchar *pos, url_match_t *match) { /* Check what we have found */ if (pos > begin && *pos == 'w' && *(pos + 1) == 'w' && *(pos + 2) == 'w') { if (!is_open_brace (*(pos - 1)) && !g_ascii_isspace (*(pos - 1))) { return FALSE; } } match->m_begin = pos; return TRUE; } static gboolean url_web_end (const gchar *begin, const gchar *end, const gchar *pos, url_match_t *match) { const gchar *p, *c; gchar open_brace = '\0', close_brace = '\0'; gint i, brace_stack = 0; gboolean passwd = FALSE; guint port; p = pos + strlen (match->pattern); for (i = 0; i < G_N_ELEMENTS (url_braces) / 2; i += 2) { if (*p == url_braces[i]) { close_brace = url_braces[i + 1]; open_brace = *p; break; } } /* find the end of the domain */ if (is_atom (*p)) { /* might be a domain or user@domain */ c = p; while (p < end) { if (!is_atom (*p)) { break; } p++; while (p < end && is_atom (*p)) { p++; } if ((p + 1) < end && *p == '.' && (is_atom (*(p + 1)) || *(p + 1) == '/')) { p++; } } if (*p != '@') { p = c; } else { p++; } goto domain; } else if (is_domain (*p)) { domain: while (p < end) { if (!is_domain (*p)) { break; } p++; while (p < end && is_domain (*p)) { p++; } if ((p + 1) < end && *p == '.' && (is_domain (*(p + 1)) || *(p + 1) == '/')) { p++; } } } else { return FALSE; } if (p < end) { switch (*p) { case ':': /* we either have a port or a password */ p++; if (is_digit (*p) || passwd) { port = (*p++ - '0'); while (p < end && is_digit (*p) && port < 65536) { port = (port * 10) + (*p++ - '0'); } if (!passwd && (port >= 65536 || *p == '@')) { if (p < end) { /* this must be a password? */ goto passwd; } p--; } } else { passwd: passwd = TRUE; c = p; while (p < end && is_atom (*p)) { p++; } if ((p + 2) < end) { if (*p == '@') { p++; if (is_domain (*p)) { goto domain; } } return FALSE; } } if (p >= end || *p != '/') { break; } /* we have a '/' so there could be a path - fall through */ case '/': /* we've detected a path component to our url */ p++; case '?': while (p < end && is_urlsafe (*p)) { if (*p == open_brace) { brace_stack++; } else if (*p == close_brace) { brace_stack--; if (brace_stack == -1) { break; } } p++; } break; default: break; } } /* urls are extremely unlikely to end with any * punctuation, so strip any trailing * punctuation off. Also strip off any closing * double-quotes. */ while (p > pos && strchr (",.:;?!-|}])\"", p[-1])) { p--; } match->m_len = (p - pos); return TRUE; } static gboolean url_email_start (const gchar *begin, const gchar *end, const gchar *pos, url_match_t *match) { /* Check what we have found */ if (pos > begin && *pos == '@') { if (is_atom (*(pos - 1)) && is_domain (*(pos + 1))) { match->m_begin = pos + 1; return TRUE; } } else { while (pos < end && is_atom (*pos)) { if (*pos == '@') { match->m_begin = pos + 1; return TRUE; } pos ++; } } return FALSE; } static gboolean url_email_end (const gchar *begin, const gchar *end, const gchar *pos, url_match_t *match) { const gchar *p; p = pos + strlen (match->pattern); while (p < end && (is_domain (*p) || (*p == '.' && p + 1 < end && is_domain (*(p + 1))))) { p ++; } match->m_len = p - match->m_begin; return TRUE; } void url_parse_text (memory_pool_t * pool, struct worker_task *task, struct mime_text_part *part, gboolean is_html) { gint rc, off = 0; gchar *url_str = NULL; struct uri *new; const guint8 *p, *end; if (!part->orig->data || part->orig->len == 0) { msg_warn ("got empty text part"); return; } if (url_init () == 0) { if (is_html) { p = part->orig->data; end = p + part->orig->len; } else { p = part->content->data; end = p + part->content->len; } while (p < end) { if (url_try_text (pool, p, end - p, &off, &url_str)) { if (url_str != NULL && g_tree_lookup (is_html ? part->html_urls : part->urls, url_str) == NULL) { new = memory_pool_alloc0 (pool, sizeof (struct uri)); if (new != NULL) { g_strstrip (url_str); rc = parse_uri (new, url_str, pool); if (rc == URI_ERRNO_OK || rc == URI_ERRNO_NO_SLASHES || rc == URI_ERRNO_NO_HOST_SLASH) { g_tree_insert (is_html ? part->html_urls : part->urls, url_str, new); task->urls = g_list_prepend (task->urls, new); } else { msg_info ("extract of url '%s' failed: %s", url_str, url_strerror (rc)); } } } } else { break; } p += off; } } } gboolean url_try_text (memory_pool_t *pool, const gchar *begin, gsize len, gint *res, gchar **url_str) { const gchar *end, *pos; gint idx; struct url_matcher *matcher; url_match_t m; end = begin + len; if (url_init () == 0) { if ((pos = rspamd_trie_lookup (url_scanner->patterns, begin, len, &idx)) == NULL) { return FALSE; } else { matcher = &matchers[idx]; m.pattern = matcher->pattern; m.prefix = matcher->prefix; if (matcher->start (begin, end, pos, &m) && matcher->end (begin, end, pos, &m)) { *url_str = memory_pool_alloc (pool, m.m_len + 1); memcpy (*url_str, m.m_begin, m.m_len); (*url_str)[m.m_len] = '\0'; } else { *url_str = NULL; } if (res) { *res = strlen (matcher->pattern); } return TRUE; } } return FALSE; } /* * vi: ts=4 */