summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2023-10-13 08:14:31 +0200
committerSébastien Helleu <flashcode@flashtux.org>2023-10-13 08:14:31 +0200
commit6468f7761f9a202bce29f4f958e783112d751fc8 (patch)
tree5ba70f0cd9f624b3db52aec75b4d6daf5be0300a /src/core
parenta83121b847113afee9c2f9f952669389d220b7ea (diff)
downloadweechat-6468f7761f9a202bce29f4f958e783112d751fc8.zip
core: set "error" field of "output" hashtable in hook_url in case of transfer timeout
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hook/wee-hook-process.c2
-rw-r--r--src/core/hook/wee-hook-url.c10
2 files changed, 10 insertions, 2 deletions
diff --git a/src/core/hook/wee-hook-process.c b/src/core/hook/wee-hook-process.c
index 42f0d2a72..21b889fed 100644
--- a/src/core/hook/wee-hook-process.c
+++ b/src/core/hook/wee-hook-process.c
@@ -598,7 +598,7 @@ hook_process_timer_cb (const void *pointer, void *data, int remaining_calls)
if (weechat_debug_core >= 1)
{
gui_chat_printf (NULL,
- _("End of command '%s', timeout reached (%.1fs)"),
+ _("End of command '%s', timeout reached (%.3fs)"),
HOOK_PROCESS(hook_process, command),
((float)HOOK_PROCESS(hook_process, timeout)) / 1000);
}
diff --git a/src/core/hook/wee-hook-url.c b/src/core/hook/wee-hook-url.c
index 385b1e612..0423710f9 100644
--- a/src/core/hook/wee-hook-url.c
+++ b/src/core/hook/wee-hook-url.c
@@ -149,6 +149,7 @@ hook_url_timer_cb (const void *pointer, void *data, int remaining_calls)
{
struct t_hook *hook;
const char *ptr_error;
+ char str_error[1024];
/* make C compiler happy */
(void) data;
@@ -178,12 +179,19 @@ hook_url_timer_cb (const void *pointer, void *data, int remaining_calls)
if (remaining_calls == 0)
{
+ if (!hashtable_has_key (HOOK_URL(hook, output), "error"))
+ {
+ snprintf (str_error, sizeof (str_error),
+ "transfer timeout reached (%.3fs)",
+ ((float)HOOK_URL(hook, timeout)) / 1000);
+ hashtable_set (HOOK_URL(hook, output), "error", str_error);
+ }
hook_url_run_callback (hook);
if (weechat_debug_core >= 1)
{
gui_chat_printf (
NULL,
- _("End of URL transfer '%s', timeout reached (%.1fs)"),
+ _("End of URL transfer '%s', timeout reached (%.3fs)"),
HOOK_URL(hook, url),
((float)HOOK_URL(hook, timeout)) / 1000);
}