diff options
Diffstat (limited to 'format.c')
| -rw-r--r-- | format.c | 32 |
1 files changed, 18 insertions, 14 deletions
| @@ -161,15 +161,17 @@ static xs_str *format_line(const char *line, xs_list **attach) | |||
| 161 | 161 | ||
| 162 | s = xs_str_cat(s, link); | 162 | s = xs_str_cat(s, link); |
| 163 | 163 | ||
| 164 | /* also add the link as an attachment */ | 164 | if (attach) { |
| 165 | xs *d = xs_dict_new(); | 165 | /* also add the link as an attachment */ |
| 166 | xs *d = xs_dict_new(); | ||
| 166 | 167 | ||
| 167 | d = xs_dict_append(d, "mediaType", "text/html"); | 168 | d = xs_dict_append(d, "mediaType", "text/html"); |
| 168 | d = xs_dict_append(d, "url", url); | 169 | d = xs_dict_append(d, "url", url); |
| 169 | d = xs_dict_append(d, "name", name); | 170 | d = xs_dict_append(d, "name", name); |
| 170 | d = xs_dict_append(d, "type", "Link"); | 171 | d = xs_dict_append(d, "type", "Link"); |
| 171 | 172 | ||
| 172 | *attach = xs_list_append(*attach, d); | 173 | *attach = xs_list_append(*attach, d); |
| 174 | } | ||
| 173 | } | 175 | } |
| 174 | else | 176 | else |
| 175 | s = xs_str_cat(s, v); | 177 | s = xs_str_cat(s, v); |
| @@ -254,15 +256,17 @@ static xs_str *format_line(const char *line, xs_list **attach) | |||
| 254 | xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, u); | 256 | xs *s1 = xs_fmt("<a href=\"%s\" target=\"_blank\">%s</a>", v2, u); |
| 255 | s = xs_str_cat(s, s1); | 257 | s = xs_str_cat(s, s1); |
| 256 | 258 | ||
| 257 | /* also add the link as an attachment */ | 259 | if (attach) { |
| 258 | xs *d = xs_dict_new(); | 260 | /* also add the link as an attachment */ |
| 261 | xs *d = xs_dict_new(); | ||
| 259 | 262 | ||
| 260 | d = xs_dict_append(d, "mediaType", "text/html"); | 263 | d = xs_dict_append(d, "mediaType", "text/html"); |
| 261 | d = xs_dict_append(d, "url", v2); | 264 | d = xs_dict_append(d, "url", v2); |
| 262 | d = xs_dict_append(d, "name", ""); | 265 | d = xs_dict_append(d, "name", ""); |
| 263 | d = xs_dict_append(d, "type", "Link"); | 266 | d = xs_dict_append(d, "type", "Link"); |
| 264 | 267 | ||
| 265 | *attach = xs_list_append(*attach, d); | 268 | *attach = xs_list_append(*attach, d); |
| 269 | } | ||
| 266 | } | 270 | } |
| 267 | } | 271 | } |
| 268 | else | 272 | else |