summaryrefslogtreecommitdiff
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 @@
7#include "xs_html.h" 7#include "xs_html.h"
8#include "xs_json.h" 8#include "xs_json.h"
9#include "xs_time.h" 9#include "xs_time.h"
10#include "xs_match.h"
10 11
11#include "snac.h" 12#include "snac.h"
12 13
@@ -93,7 +94,8 @@ static xs_str *format_line(const char *line, xs_list **attach)
93 "\\*\\*?\\*?[^\\*]+\\*?\\*?\\*" "|" 94 "\\*\\*?\\*?[^\\*]+\\*?\\*?\\*" "|"
94 "!\\[[^]]+\\]\\([^\\)]+\\)" "|" 95 "!\\[[^]]+\\]\\([^\\)]+\\)" "|"
95 "\\[[^]]+\\]\\([^\\)]+\\)" "|" 96 "\\[[^]]+\\]\\([^\\)]+\\)" "|"
96 "[a-z]+:/" "/[^[:space:]]+" 97 "[a-z]+:/" "/[^[:space:]]+" "|"
98 "(mailto|xmpp):[^@[:space:]]+@[^[:space:]]+"
97 ")"); 99 ")");
98 int n = 0; 100 int n = 0;
99 101
@@ -230,6 +232,15 @@ static xs_str *format_line(const char *line, xs_list **attach)
230 } 232 }
231 } 233 }
232 else 234 else
235 if (xs_match(v, "mailto*|xmpp*")) {
236 xs *u = xs_replace_i(xs_replace(v, "#", "#"), "@", "@");
237
238 xs *v2 = xs_strip_chars_i(xs_dup(u), ".,)");
239
240 xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, u);
241 s = xs_str_cat(s, s1);
242 }
243 else
233 s = xs_str_cat(s, v); 244 s = xs_str_cat(s, v);
234 } 245 }
235 else 246 else