aboutsummaryrefslogtreecommitdiff
path: root/format.c
diff options
context:
space:
mode:
Diffstat (limited to 'format.c')
-rw-r--r--format.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/format.c b/format.c
index 12783ae..41e4162 100644
--- a/format.c
+++ b/format.c
@@ -7,6 +7,7 @@
#include "xs_html.h"
#include "xs_json.h"
#include "xs_time.h"
+#include "xs_match.h"
#include "snac.h"
@@ -93,7 +94,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
"\\*\\*?\\*?[^\\*]+\\*?\\*?\\*" "|"
"!\\[[^]]+\\]\\([^\\)]+\\)" "|"
"\\[[^]]+\\]\\([^\\)]+\\)" "|"
- "[a-z]+:/" "/[^[:space:]]+"
+ "[a-z]+:/" "/[^[:space:]]+" "|"
+ "(mailto|xmpp):[^@[:space:]]+@[^[:space:]]+"
")");
int n = 0;
@@ -230,6 +232,15 @@ static xs_str *format_line(const char *line, xs_list **attach)
}
}
else
+ if (xs_match(v, "mailto*|xmpp*")) {
+ xs *u = xs_replace_i(xs_replace(v, "#", "#"), "@", "@");
+
+ xs *v2 = xs_strip_chars_i(xs_dup(u), ".,)");
+
+ xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, u);
+ s = xs_str_cat(s, s1);
+ }
+ else
s = xs_str_cat(s, v);
}
else