diff options
author | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-08 07:32:03 +0200 |
---|---|---|
committer | Sébastien Helleu <flashcode@flashtux.org> | 2024-04-08 07:32:03 +0200 |
commit | a3c9a5b8971acc0dbc9dff3645c6bad135bd8ea0 (patch) | |
tree | 3c6327022e6d196efc5105408068033b4d6c195b /src/plugins | |
parent | 2fe215276e4a32c6ef045dfe595a985a31ecebf6 (diff) | |
download | weechat-a3c9a5b8971acc0dbc9dff3645c6bad135bd8ea0.zip |
relay: fix build when CJSON is disabled
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/relay/relay-remote.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/plugins/relay/relay-remote.c b/src/plugins/relay/relay-remote.c index dcd98a728..34788e74b 100644 --- a/src/plugins/relay/relay-remote.c +++ b/src/plugins/relay/relay-remote.c @@ -597,18 +597,19 @@ relay_remote_set_status (struct t_relay_remote *remote, int relay_remote_connect (struct t_relay_remote *remote) { -#ifndef HAVE_CJSON +#ifdef HAVE_CJSON + if (!remote) + return 0; + + return relay_remote_network_connect (remote); +#else + (void) remote; weechat_printf (NULL, _("%s%s: error: unable to connect to a remote relay via API " "(cJSON support is not enabled)"), weechat_prefix ("error"), RELAY_PLUGIN_NAME); return 0; #endif /* HAVE_CJSON */ - - if (!remote) - return 0; - - return relay_remote_network_connect (remote); } /* @@ -622,12 +623,18 @@ relay_remote_connect (struct t_relay_remote *remote) int relay_remote_send (struct t_relay_remote *remote, const char *json) { +#ifdef HAVE_CJSON if (!remote || (remote->status != RELAY_STATUS_CONNECTED) || !json) return 0; return (relay_remote_network_send (remote, RELAY_MSG_STANDARD, json, strlen (json)) > 0) ? 1 : 0; +#else + (void) remote; + (void) json; + return 0; +#endif /* HAVE_CJSON */ } /* @@ -694,8 +701,12 @@ relay_remote_rename (struct t_relay_remote *remote, const char *name) void relay_remote_disconnect (struct t_relay_remote *remote) { +#ifdef HAVE_CJSON if (remote->sock >= 0) relay_remote_network_disconnect (remote); +#else + (void) remote; +#endif /* HAVE_CJSON */ } /* |