diff options
Diffstat (limited to 'html.c')
| -rw-r--r-- | html.c | 42 |
1 files changed, 41 insertions, 1 deletions
| @@ -207,12 +207,52 @@ d_char *html_msg_icon(snac *snac, d_char *s, char *msg) | |||
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | 209 | ||
| 210 | d_char *html_user_header(snac *snac, d_char *s) | ||
| 211 | /* creates the HTML header */ | ||
| 212 | { | ||
| 213 | char *p, *v; | ||
| 214 | |||
| 215 | s = xs_str_cat(s, "<!DOCTYPE html>\n<html>\n<head>\n"); | ||
| 216 | s = xs_str_cat(s, "<meta name=\"viewport\" " | ||
| 217 | "content=\"width=device-width, initial-scale=1\"/>\n"); | ||
| 218 | s = xs_str_cat(s, "<meta name=\"generator\" " | ||
| 219 | "content=\"" USER_AGENT "\"/>\n"); | ||
| 220 | |||
| 221 | /* add server CSS */ | ||
| 222 | p = xs_dict_get(srv_config, "cssurls"); | ||
| 223 | while (xs_list_iter(&p, &v)) { | ||
| 224 | xs *s1 = xs_fmt("<link rel=\"stylesheet\" type=\"text/css\" href=\"%s\"/>\n", v); | ||
| 225 | s = xs_str_cat(s, s1); | ||
| 226 | } | ||
| 227 | |||
| 228 | /* add the user CSS */ | ||
| 229 | { | ||
| 230 | xs *css = NULL; | ||
| 231 | int size; | ||
| 232 | |||
| 233 | if (valid_status(static_get(snac, "style.css", &css, &size))) { | ||
| 234 | xs *s1 = xs_fmt("<style>%s</style>\n", css); | ||
| 235 | s = xs_str_cat(s, s1); | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | { | ||
| 240 | xs *s1 = xs_fmt("<title>%s</title>\n", xs_dict_get(snac->config, "name")); | ||
| 241 | s = xs_str_cat(s, s1); | ||
| 242 | } | ||
| 243 | |||
| 244 | s = xs_str_cat(s, "</head>\n<body>\n"); | ||
| 245 | |||
| 246 | return s; | ||
| 247 | } | ||
| 248 | |||
| 249 | |||
| 210 | d_char *html_timeline(snac *snac, char *list, int local) | 250 | d_char *html_timeline(snac *snac, char *list, int local) |
| 211 | /* returns the HTML for the timeline */ | 251 | /* returns the HTML for the timeline */ |
| 212 | { | 252 | { |
| 213 | d_char *s = xs_str_new(NULL); | 253 | d_char *s = xs_str_new(NULL); |
| 214 | 254 | ||
| 215 | s = xs_str_cat(s, "<!DOCTYPE html>\n<html>\n"); | 255 | s = html_user_header(snac, s); |
| 216 | 256 | ||
| 217 | s = xs_str_cat(s, "<h1>HI</h1>\n"); | 257 | s = xs_str_cat(s, "<h1>HI</h1>\n"); |
| 218 | 258 | ||