[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[no subject]
From: |
Gavin D. Smith |
Date: |
Sun, 20 Mar 2022 04:55:13 -0400 (EDT) |
branch: master
commit 2d6d8cd5c2edb90356b4bc821c691c6251e5b87b
Author: Gavin Smith <gavinsmith0123@gmail.com>
AuthorDate: Sun May 26 11:22:44 2019 +0100
inform main process of manual change
---
js/wkinfo/extension.c | 49 +++++++++++++++++++++++++++++++++++--------------
js/wkinfo/main.c | 8 ++++++++
2 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/js/wkinfo/extension.c b/js/wkinfo/extension.c
index 8bab4cf599..d6f9da464d 100644
--- a/js/wkinfo/extension.c
+++ b/js/wkinfo/extension.c
@@ -32,6 +32,27 @@ remove_our_socket (void)
}
+void
+send_datagram (GString *s)
+{
+ ssize_t result;
+
+ if (s->len > PACKET_SIZE)
+ {
+ g_print ("datagram too big");
+ return;
+ }
+
+ result = sendto (socket_id, s->str, s->len + 1, 0,
+ (struct sockaddr *) &main_name, main_name_size);
+
+ if (result == -1)
+ {
+ g_print ("sending datagram failed: %s\n",
+ strerror(errno));
+ }
+}
+
static char *current_manual;
/* Called from request_callback. */
@@ -54,7 +75,21 @@ load_manual (char *manual, WebKitURIRequest *request)
current_manual = manual;
webkit_uri_request_set_uri (request, s->str);
+
+ /* Inform the main process the manual has changed so that it can
+ load the indices. */
+ GString *s1 = g_string_new (NULL);
+ g_string_append (s1, "new-manual\n");
+ g_string_append (s1, s->str);
+ g_string_append (s1, "\n");
+
+ g_print ("SENDING %s\n", s1->str);
+
+ send_datagram (s1);
+
g_string_free (s, TRUE);
+ g_string_free (s1, TRUE);
+
free (new_manual);
}
@@ -107,20 +142,6 @@ request_callback (WebKitWebPage *web_page,
return FALSE;
}
-void
-send_datagram (GString *s)
-{
- ssize_t result;
- result = sendto (socket_id, s->str, s->len + 1, 0,
- (struct sockaddr *) &main_name, main_name_size);
-
- if (result == -1)
- {
- g_print ("sending datagram failed: %s\n",
- strerror(errno));
- }
-}
-
void
send_index (WebKitDOMHTMLCollection *links, gulong num_links)
{
diff --git a/js/wkinfo/main.c b/js/wkinfo/main.c
index 73f84237b8..ee94577cf0 100644
--- a/js/wkinfo/main.c
+++ b/js/wkinfo/main.c
@@ -225,6 +225,14 @@ socket_cb (GSocket *socket,
save_completions (p);
}
+ else if (!strcmp (buffer, "new-manual"))
+ {
+ g_print ("NEW MANUAL %s\n", p + 1);
+ }
+ else if (!strcmp (buffer, "index-node"))
+ {
+ /* Receive URL of file containing an index. */
+ }
else
{
g_print ("Unknown message type '%s'\n", buffer);
- [no subject], (continued)
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject],
Gavin D. Smith <=
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20
- [no subject], Gavin D. Smith, 2022/03/20