commit c7586aab80af8e3fd32ac08872c97f4e41484369 from: Omar Polo date: Fri Aug 13 09:44:43 2021 UTC add make_fs_request commit - fb4dc49f8a649b71bbfd87471b6bfbc4ab22f67e commit + c7586aab80af8e3fd32ac08872c97f4e41484369 blob - 322247c14091b63b4dd347083ffe695d0510cc9b blob + 1e88a1b2f0b845eba10466b1a99d092d074b8a74 --- telescope.c +++ telescope.c @@ -110,6 +110,7 @@ static int load_via_proxy(struct tab *, const char * struct proxy *); static int make_request(struct tab *, struct get_req *, int, const char *); +static int make_fs_request(struct tab *, int, const char *); static int do_load_url(struct tab*, const char *, const char *); static void parse_session_line(char *, const char **, uint32_t *); static void load_last_session(void); @@ -578,13 +579,8 @@ static int load_about_url(struct tab *tab, const char *url) { tab->trust = TS_VERIFIED; - parser_init(tab, gemtext_initparser); - - ui_send_fs(IMSG_GET, tab->id, - tab->hist_cur->h, strlen(tab->hist_cur->h)+1); - - return 1; + return make_fs_request(tab, IMSG_GET, url); } static int @@ -709,6 +705,21 @@ make_request(struct tab *tab, struct get_req *req, int return 1; } +static int +make_fs_request(struct tab *tab, int type, const char *r) +{ + stop_tab(tab); + tab->id = tab_new_id(); + + ui_send_fs(type, tab->id, r, strlen(r)+1); + + /* + * So load_{about,file}_url can `return make_fs_request` and + * do_load_url is happy. + */ + return 1; +} + void gopher_send_search_req(struct tab *tab, const char *text) {