commit - ea63925028272e2324146df682e86f4ca3c60a8c
commit + 92ce02e268a0aab7b86c441c9c01299d3af83d1d
blob - 0f24a1f1b10e35f9093653ca360142ece41f7059
blob + d884b8c2a8640baf5d73d7a9db615ddb4ca8c72e
--- telescope.c
+++ telescope.c
if (operating)
die();
- if (imsg->hdr.type == IMSG_SESSION_END) {
+ switch (imsg->hdr.type) {
+ case IMSG_SESSION_TAB:
+ if (datalen != sizeof(st))
+ die();
+
+ memcpy(&st, imsg->data, sizeof(st));
+ if ((tab = new_tab(st.uri, NULL, NULL)) == NULL)
+ die();
+ strlcpy(tab->buffer.page.title, st.title,
+ sizeof(tab->buffer.page.title));
+ if (st.flags & TAB_CURRENT)
+ curr = tab;
+ break;
+
+ case IMSG_SESSION_END:
if (datalen != sizeof(first_time))
die();
memcpy(&first_time, imsg->data, sizeof(first_time));
if (has_url || TAILQ_EMPTY(&tabshead))
new_tab(url, NULL, NULL);
ui_main_loop();
- return;
- }
+ break;
- if (datalen != sizeof(st))
+ default:
die();
-
- memcpy(&st, imsg->data, sizeof(st));
- if ((tab = new_tab(st.uri, NULL, NULL)) == NULL)
- die();
- strlcpy(tab->buffer.page.title, st.title,
- sizeof(tab->buffer.page.title));
- if (st.flags & TAB_CURRENT)
- curr = tab;
+ }
}
static void