2 f26f1205 2022-02-09 op * Copyright (c) 2021 Omar Polo <op@omarpolo.com>
4 f26f1205 2022-02-09 op * Permission to use, copy, modify, and distribute this software for any
5 f26f1205 2022-02-09 op * purpose with or without fee is hereby granted, provided that the above
6 f26f1205 2022-02-09 op * copyright notice and this permission notice appear in all copies.
8 f26f1205 2022-02-09 op * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 f26f1205 2022-02-09 op * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 f26f1205 2022-02-09 op * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 f26f1205 2022-02-09 op * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 f26f1205 2022-02-09 op * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 f26f1205 2022-02-09 op * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 f26f1205 2022-02-09 op * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 f26f1205 2022-02-09 op #ifndef SESSION_H
18 f26f1205 2022-02-09 op #define SESSION_H
22 f26f1205 2022-02-09 op struct session_tab {
23 f26f1205 2022-02-09 op uint32_t flags;
24 f26f1205 2022-02-09 op char uri[GEMINI_URL_LEN];
25 f26f1205 2022-02-09 op char title[TITLE_MAX];
26 f26f1205 2022-02-09 op size_t top_line;
27 f26f1205 2022-02-09 op size_t current_line;
30 f26f1205 2022-02-09 op struct session_tab_hist {
31 f26f1205 2022-02-09 op char uri[GEMINI_URL_LEN];
35 9e97090d 2022-02-26 op struct histitem {
37 9e97090d 2022-02-26 op char uri[GEMINI_URL_LEN];
40 9e97090d 2022-02-26 op struct history_item {
46 9e97090d 2022-02-26 op #define HISTORY_CAP 1000
47 9e97090d 2022-02-26 op struct history {
48 9e97090d 2022-02-26 op struct history_item items[HISTORY_CAP];
53 9e97090d 2022-02-26 op extern struct history history;
55 f26f1205 2022-02-09 op void switch_to_tab(struct tab *);
56 f26f1205 2022-02-09 op unsigned int tab_new_id(void);
57 f26f1205 2022-02-09 op struct tab *new_tab(const char *, const char *base, struct tab *);
58 f26f1205 2022-02-09 op void kill_tab(struct tab *, int);
59 f26f1205 2022-02-09 op struct tab *unkill_tab(void);
60 f26f1205 2022-02-09 op void free_tab(struct tab *);
61 f26f1205 2022-02-09 op void stop_tab(struct tab*);
63 f26f1205 2022-02-09 op void save_session(void);
65 9e97090d 2022-02-26 op void history_push(struct histitem *);
66 9e97090d 2022-02-26 op void history_sort(void);
67 9e97090d 2022-02-26 op void history_add(const char *);
69 f26f1205 2022-02-09 op void autosave_init(void);
70 f26f1205 2022-02-09 op void autosave_timer(int, short, void *);
71 f26f1205 2022-02-09 op void autosave_hook(void);
73 64f4f8e2 2022-04-24 op int load_session(struct ohash *);
74 64f4f8e2 2022-04-24 op int lock_session(void);