mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 01:03:14 +02:00
core: add comments after some #endif
This commit is contained in:
@@ -130,7 +130,7 @@ weechat_aspell_enchant_dict_describe_cb (const char *lang_tag,
|
||||
if (country)
|
||||
free (country);
|
||||
}
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
/*
|
||||
* Displays list of aspell dictionaries installed on system.
|
||||
@@ -146,7 +146,7 @@ weechat_aspell_command_speller_list_dicts ()
|
||||
AspellDictInfoList *list;
|
||||
AspellDictInfoEnumeration *elements;
|
||||
const AspellDictInfo *dict;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
weechat_printf (NULL, "");
|
||||
weechat_printf (NULL,
|
||||
@@ -203,7 +203,7 @@ weechat_aspell_command_speller_list_dicts ()
|
||||
|
||||
delete_aspell_dict_info_enumeration (elements);
|
||||
delete_aspell_config (config);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -245,7 +245,7 @@ weechat_aspell_command_add_word (struct t_gui_buffer *buffer, const char *dict,
|
||||
EnchantDict *new_speller, *ptr_speller;
|
||||
#else
|
||||
AspellSpeller *new_speller, *ptr_speller;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
new_speller = NULL;
|
||||
|
||||
@@ -310,7 +310,7 @@ weechat_aspell_command_add_word (struct t_gui_buffer *buffer, const char *dict,
|
||||
}
|
||||
else
|
||||
goto error;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
goto end;
|
||||
|
||||
@@ -353,7 +353,7 @@ weechat_aspell_command_cb (void *data, struct t_gui_buffer *buffer,
|
||||
"enchant"
|
||||
#else
|
||||
"aspell"
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
);
|
||||
default_dict = weechat_config_string (weechat_aspell_config_check_default_dict);
|
||||
weechat_printf (NULL,
|
||||
|
||||
@@ -74,7 +74,7 @@ weechat_aspell_completion_enchant_add_dict_cb (const char *lang_tag,
|
||||
weechat_hook_completion_list_add ((struct t_gui_completion *)user_data,
|
||||
lang_tag, 0, WEECHAT_LIST_POS_SORT);
|
||||
}
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
/*
|
||||
* Adds aspell dictionaries (only installed dictionaries) to completion list.
|
||||
@@ -91,7 +91,7 @@ weechat_aspell_completion_dicts_cb (void *data,
|
||||
AspellDictInfoList *list;
|
||||
AspellDictInfoEnumeration *elements;
|
||||
const AspellDictInfo *dict;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
@@ -115,7 +115,7 @@ weechat_aspell_completion_dicts_cb (void *data,
|
||||
|
||||
delete_aspell_dict_info_enumeration (elements);
|
||||
delete_aspell_config (config);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ weechat_aspell_speller_dict_supported (const char *lang)
|
||||
delete_aspell_config (config);
|
||||
|
||||
return rc;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -127,7 +127,7 @@ weechat_aspell_speller_check_dictionaries (const char *dict_list)
|
||||
EnchantDict *
|
||||
#else
|
||||
AspellSpeller *
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
weechat_aspell_speller_new (const char *lang)
|
||||
{
|
||||
#ifdef USE_ENCHANT
|
||||
@@ -136,7 +136,7 @@ weechat_aspell_speller_new (const char *lang)
|
||||
AspellConfig *config;
|
||||
AspellCanHaveError *ret;
|
||||
AspellSpeller *new_speller;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
struct t_infolist *infolist;
|
||||
|
||||
if (!lang)
|
||||
@@ -163,7 +163,7 @@ weechat_aspell_speller_new (const char *lang)
|
||||
/* create a speller instance for the newly created cell */
|
||||
config = new_aspell_config();
|
||||
aspell_config_replace (config, "lang", lang);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
/* apply all options */
|
||||
infolist = weechat_infolist_get ("option", NULL, "aspell.option.*");
|
||||
@@ -177,7 +177,7 @@ weechat_aspell_speller_new (const char *lang)
|
||||
aspell_config_replace (config,
|
||||
weechat_infolist_string (infolist, "option_name"),
|
||||
weechat_infolist_string (infolist, "value"));
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
}
|
||||
weechat_infolist_free (infolist);
|
||||
}
|
||||
@@ -197,14 +197,14 @@ weechat_aspell_speller_new (const char *lang)
|
||||
}
|
||||
|
||||
new_speller = to_aspell_speller (ret);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
weechat_hashtable_set (weechat_aspell_spellers, lang, new_speller);
|
||||
|
||||
#ifndef USE_ENCHANT
|
||||
/* free configuration */
|
||||
delete_aspell_config (config);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
return new_speller;
|
||||
}
|
||||
@@ -314,7 +314,7 @@ weechat_aspell_speller_free_value_cb (struct t_hashtable *hashtable,
|
||||
EnchantDict *ptr_speller;
|
||||
#else
|
||||
AspellSpeller *ptr_speller;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) hashtable;
|
||||
@@ -334,7 +334,7 @@ weechat_aspell_speller_free_value_cb (struct t_hashtable *hashtable,
|
||||
ptr_speller = (AspellSpeller *)value;
|
||||
aspell_speller_save_all_word_lists (ptr_speller);
|
||||
delete_aspell_speller (ptr_speller);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -353,7 +353,7 @@ weechat_aspell_speller_buffer_new (struct t_gui_buffer *buffer)
|
||||
EnchantDict *ptr_speller;
|
||||
#else
|
||||
AspellSpeller *ptr_speller;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
if (!buffer)
|
||||
return NULL;
|
||||
@@ -380,7 +380,7 @@ weechat_aspell_speller_buffer_new (struct t_gui_buffer *buffer)
|
||||
malloc ((num_dicts + 1) * sizeof (EnchantDict *));
|
||||
#else
|
||||
malloc ((num_dicts + 1) * sizeof (AspellSpeller *));
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
if (new_speller_buffer->spellers)
|
||||
{
|
||||
for (i = 0; i < num_dicts; i++)
|
||||
|
||||
@@ -27,7 +27,7 @@ struct t_aspell_speller_buffer
|
||||
EnchantDict **spellers; /* enchant spellers for buffer */
|
||||
#else
|
||||
AspellSpeller **spellers; /* aspell spellers for buffer */
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
char *modifier_string; /* last modifier string */
|
||||
int input_pos; /* position of cursor in input */
|
||||
char *modifier_result; /* last modifier result */
|
||||
@@ -42,7 +42,7 @@ extern void weechat_aspell_speller_check_dictionaries (const char *dict_list);
|
||||
extern EnchantDict *weechat_aspell_speller_new (const char *lang);
|
||||
#else
|
||||
extern AspellSpeller *weechat_aspell_speller_new (const char *lang);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
extern void weechat_aspell_speller_remove_unused ();
|
||||
extern struct t_aspell_speller_buffer *weechat_aspell_speller_buffer_new (struct t_gui_buffer *buffer);
|
||||
extern int weechat_aspell_speller_init ();
|
||||
|
||||
@@ -54,7 +54,7 @@ int aspell_enabled = 0;
|
||||
|
||||
#ifdef USE_ENCHANT
|
||||
EnchantBroker *broker = NULL;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
/*
|
||||
* aspell supported languages, updated on 2012-07-05
|
||||
@@ -483,7 +483,7 @@ weechat_aspell_check_word (struct t_aspell_speller_buffer *speller_buffer,
|
||||
if (enchant_dict_check (speller_buffer->spellers[i], word, strlen (word)) == 0)
|
||||
#else
|
||||
if (aspell_speller_check (speller_buffer->spellers[i], word, -1) == 1)
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -513,7 +513,7 @@ weechat_aspell_get_suggestions (struct t_aspell_speller_buffer *speller_buffer,
|
||||
#else
|
||||
const AspellWordList *list;
|
||||
AspellStringEnumeration *elements;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
max_suggestions = weechat_config_integer (weechat_aspell_config_check_suggestions);
|
||||
if (max_suggestions < 0)
|
||||
@@ -585,7 +585,7 @@ weechat_aspell_get_suggestions (struct t_aspell_speller_buffer *speller_buffer,
|
||||
}
|
||||
delete_aspell_string_enumeration (elements);
|
||||
}
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1039,7 +1039,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
broker = enchant_broker_init ();
|
||||
if (!broker)
|
||||
return WEECHAT_RC_ERROR;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
if (!weechat_aspell_speller_init ())
|
||||
return WEECHAT_RC_ERROR;
|
||||
@@ -1095,7 +1095,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
#ifdef USE_ENCHANT
|
||||
/* release enchant broker */
|
||||
enchant_broker_free (broker);
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#include <enchant.h>
|
||||
#else
|
||||
#include <aspell.h>
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
#define weechat_plugin weechat_aspell_plugin
|
||||
#define ASPELL_PLUGIN_NAME "aspell"
|
||||
@@ -38,7 +38,7 @@ struct t_aspell_code
|
||||
|
||||
#ifdef USE_ENCHANT
|
||||
extern EnchantBroker *broker;
|
||||
#endif
|
||||
#endif /* USE_ENCHANT */
|
||||
|
||||
extern struct t_weechat_plugin *weechat_aspell_plugin;
|
||||
extern int aspell_enabled;
|
||||
|
||||
@@ -797,7 +797,7 @@ weechat_guile_signal_debug_libs_cb (void *data, const char *signal,
|
||||
SCM_MICRO_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", GUILE_PLUGIN_NAME);
|
||||
#endif
|
||||
#endif /* defined(SCM_MAJOR_VERSION) && defined(SCM_MINOR_VERSION) && defined(SCM_MICRO_VERSION) */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -980,7 +980,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
* on unload (or exit)
|
||||
*/
|
||||
scm_install_gmp_memory_functions = 0;
|
||||
#endif
|
||||
#endif /* HAVE_GUILE_GMP_MEMORY_FUNCTIONS */
|
||||
|
||||
scm_init_guile ();
|
||||
|
||||
|
||||
@@ -1049,7 +1049,7 @@ irc_config_check_gnutls_priorities (const char *priorities)
|
||||
(void) priorities;
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1064,10 +1064,10 @@ irc_config_server_check_value_cb (void *data,
|
||||
int index_option, proxy_found;
|
||||
const char *pos_error, *proxy_name;
|
||||
struct t_infolist *infolist;
|
||||
#ifdef HAVE_GNUTLS
|
||||
#ifdef HAVE_GNUTLS
|
||||
char **fingerprints, *str_sizes;
|
||||
int i, j, rc, algo, length;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) option;
|
||||
@@ -1119,7 +1119,7 @@ irc_config_server_check_value_cb (void *data,
|
||||
}
|
||||
break;
|
||||
case IRC_SERVER_OPTION_SSL_FINGERPRINT:
|
||||
#ifdef HAVE_GNUTLS
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (value && value[0])
|
||||
{
|
||||
fingerprints = weechat_string_split (value, ",", 0, 0,
|
||||
@@ -1175,7 +1175,7 @@ irc_config_server_check_value_cb (void *data,
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@
|
||||
#include <gnutls/gnutls.h>
|
||||
#if LIBGNUTLS_VERSION_NUMBER >= 0x020a01 /* 2.10.1 */
|
||||
#include <gnutls/abstract.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020a01 */
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "irc.h"
|
||||
@@ -146,7 +146,7 @@ irc_sasl_mechanism_ecdsa_nist256p_challenge (struct t_irc_server *server,
|
||||
gnutls_ecc_curve_t curve;
|
||||
gnutls_datum_t x, y, k;
|
||||
char *pubkey, *pubkey_base64;
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x030300 */
|
||||
|
||||
answer_base64 = NULL;
|
||||
string = NULL;
|
||||
@@ -236,7 +236,7 @@ irc_sasl_mechanism_ecdsa_nist256p_challenge (struct t_irc_server *server,
|
||||
gnutls_free (y.data);
|
||||
gnutls_free (k.data);
|
||||
}
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x030300 */
|
||||
|
||||
/* import private key in an abstract key structure */
|
||||
ret = gnutls_privkey_import_x509 (privkey, x509_privkey, 0); /* gnutls >= 2.11.0 */
|
||||
@@ -308,7 +308,7 @@ irc_sasl_mechanism_ecdsa_nist256p_challenge (struct t_irc_server *server,
|
||||
weechat_prefix ("error"));
|
||||
|
||||
return NULL;
|
||||
#endif
|
||||
#endif /* defined(HAVE_GNUTLS) && (LIBGNUTLS_VERSION_NUMBER >= 0x030015) */
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#else
|
||||
#include <sys/socket.h>
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#endif /* _WIN32 */
|
||||
#include <sys/types.h>
|
||||
#include <netdb.h>
|
||||
#include <arpa/inet.h>
|
||||
@@ -44,7 +44,7 @@
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#include <gnutls/x509.h>
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "irc.h"
|
||||
@@ -132,7 +132,7 @@ char *irc_fingerprint_digest_algos_name[IRC_FINGERPRINT_NUM_ALGOS] =
|
||||
{ "SHA-1", "SHA-256", "SHA-512" };
|
||||
int irc_fingerprint_digest_algos_size[IRC_FINGERPRINT_NUM_ALGOS] =
|
||||
{ 160, 256, 512 };
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
|
||||
void irc_server_reconnect (struct t_irc_server *server);
|
||||
@@ -1866,7 +1866,7 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
|
||||
if (server->ssl_connected)
|
||||
rc = gnutls_record_send (server->gnutls_sess, buffer, size_buf);
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
rc = send (server->sock, buffer, size_buf, 0);
|
||||
|
||||
if (rc < 0)
|
||||
@@ -1881,7 +1881,7 @@ irc_server_send (struct t_irc_server *server, const char *buffer, int size_buf)
|
||||
rc, gnutls_strerror (rc));
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
{
|
||||
weechat_printf (
|
||||
server->buffer,
|
||||
@@ -2744,7 +2744,7 @@ irc_server_recv_cb (void *data, int fd)
|
||||
num_read = gnutls_record_recv (server->gnutls_sess, buffer,
|
||||
sizeof (buffer) - 2);
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
num_read = recv (server->sock, buffer, sizeof (buffer) - 2, 0);
|
||||
|
||||
if (num_read > 0)
|
||||
@@ -2762,7 +2762,7 @@ irc_server_recv_cb (void *data, int fd)
|
||||
*/
|
||||
end_recv = 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2788,7 +2788,7 @@ irc_server_recv_cb (void *data, int fd)
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
{
|
||||
if ((num_read == 0)
|
||||
|| ((errno != EAGAIN) && (errno != EWOULDBLOCK)))
|
||||
@@ -3159,7 +3159,7 @@ irc_server_close_connection (struct t_irc_server *server)
|
||||
gnutls_bye (server->gnutls_sess, GNUTLS_SHUT_WR);
|
||||
gnutls_deinit (server->gnutls_sess);
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
if (server->sock != -1)
|
||||
{
|
||||
@@ -3167,7 +3167,7 @@ irc_server_close_connection (struct t_irc_server *server)
|
||||
closesocket (server->sock);
|
||||
#else
|
||||
close (server->sock);
|
||||
#endif
|
||||
#endif /* _WIN32 */
|
||||
server->sock = -1;
|
||||
}
|
||||
|
||||
@@ -3542,7 +3542,7 @@ irc_server_connect_cb (void *data, int status, int gnutls_rc, int sock,
|
||||
}
|
||||
#else
|
||||
(void) gnutls_rc;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
irc_server_close_connection (server);
|
||||
server->current_retry++;
|
||||
irc_server_switch_address (server, 1);
|
||||
@@ -3737,7 +3737,7 @@ irc_server_fingerprint_search_algo_with_size (int size)
|
||||
/* digest algorithm not found */
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
/*
|
||||
* Returns a string with sizes of allowed fingerprint,
|
||||
@@ -3769,7 +3769,7 @@ irc_server_fingerprint_str_sizes ()
|
||||
|
||||
return strdup (str_sizes);
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
/*
|
||||
* Compares two fingerprints: one hexadecimal (given by user), the second binary
|
||||
@@ -3919,7 +3919,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
gnutls_retr2_st *answer,
|
||||
#else
|
||||
gnutls_retr_st *answer,
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020b00 */
|
||||
int action)
|
||||
{
|
||||
struct t_irc_server *server;
|
||||
@@ -3927,7 +3927,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
gnutls_retr2_st tls_struct;
|
||||
#else
|
||||
gnutls_retr_st tls_struct;
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020b00 */
|
||||
gnutls_x509_crt_t cert_temp;
|
||||
const gnutls_datum_t *cert_list;
|
||||
gnutls_datum_t filedatum;
|
||||
@@ -3939,7 +3939,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
#if LIBGNUTLS_VERSION_NUMBER >= 0x010706 /* 1.7.6 */
|
||||
gnutls_datum_t cinfo;
|
||||
int rinfo;
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x010706 */
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) req_ca;
|
||||
@@ -4039,7 +4039,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
#else
|
||||
rinfo = gnutls_x509_crt_print (cert_temp,
|
||||
GNUTLS_CRT_PRINT_ONELINE, &cinfo);
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER < 0x020400 */
|
||||
if (rinfo == 0)
|
||||
{
|
||||
weechat_printf (
|
||||
@@ -4052,7 +4052,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
weechat_prefix ("network"), cinfo.data);
|
||||
gnutls_free (cinfo.data);
|
||||
}
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x010706 */
|
||||
/* check dates, only if fingerprint is not set */
|
||||
if (!fingerprint || !fingerprint[0])
|
||||
{
|
||||
@@ -4226,7 +4226,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
tls_struct.key_type = GNUTLS_PRIVKEY_X509;
|
||||
#else
|
||||
tls_struct.type = GNUTLS_CRT_X509;
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020b00 */
|
||||
tls_struct.ncerts = 1;
|
||||
tls_struct.deinit_all = 0;
|
||||
tls_struct.cert.x509 = &server->tls_cert;
|
||||
@@ -4241,7 +4241,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
rinfo = gnutls_x509_crt_print (server->tls_cert,
|
||||
GNUTLS_CRT_PRINT_ONELINE,
|
||||
&cinfo);
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER < 0x020400 */
|
||||
if (rinfo == 0)
|
||||
{
|
||||
weechat_printf (
|
||||
@@ -4253,7 +4253,7 @@ irc_server_gnutls_callback (void *data, gnutls_session_t tls_session,
|
||||
weechat_prefix ("network"), cinfo.data);
|
||||
gnutls_free (cinfo.data);
|
||||
}
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x010706 */
|
||||
memcpy (answer, &tls_struct, sizeof (tls_struct));
|
||||
free (cert_str);
|
||||
}
|
||||
@@ -4417,7 +4417,7 @@ irc_server_connect (struct t_irc_server *server)
|
||||
weechat_prefix ("error"), IRC_PLUGIN_NAME);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
if (proxy_type)
|
||||
{
|
||||
weechat_printf (
|
||||
@@ -4501,7 +4501,7 @@ irc_server_connect (struct t_irc_server *server)
|
||||
IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME),
|
||||
&irc_server_connect_cb,
|
||||
server);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
/* send signal "irc_server_connecting" with server name */
|
||||
(void) weechat_hook_signal_send ("irc_server_connecting",
|
||||
@@ -5206,7 +5206,7 @@ irc_server_hdata_server_cb (void *data, const char *hdata_name)
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, gnutls_sess, OTHER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert, OTHER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, tls_cert_key, OTHER, 0, NULL, NULL);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, unterminated_message, STRING, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_count, INTEGER, 0, NULL, NULL);
|
||||
WEECHAT_HDATA_VAR(struct t_irc_server, nicks_array, STRING, 0, "nicks_count", NULL);
|
||||
@@ -5785,7 +5785,7 @@ irc_server_print_log ()
|
||||
weechat_log_printf (" disconnected . . . . : %d", ptr_server->disconnected);
|
||||
#ifdef HAVE_GNUTLS
|
||||
weechat_log_printf (" gnutls_sess. . . . . : 0x%lx", ptr_server->gnutls_sess);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
weechat_log_printf (" unterminated_message : '%s'", ptr_server->unterminated_message);
|
||||
weechat_log_printf (" nicks_count. . . . . : %d", ptr_server->nicks_count);
|
||||
weechat_log_printf (" nicks_array. . . . . : 0x%lx", ptr_server->nicks_array);
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
#ifndef NI_MAXHOST
|
||||
#define NI_MAXHOST 256
|
||||
#endif
|
||||
#endif /* NI_MAXHOST */
|
||||
|
||||
enum t_irc_server_sasl_fail
|
||||
{
|
||||
@@ -174,7 +174,7 @@ struct t_irc_server
|
||||
gnutls_session_t gnutls_sess; /* gnutls session (only if SSL is used) */
|
||||
gnutls_x509_crt_t tls_cert; /* certificate used if ssl_cert is set */
|
||||
gnutls_x509_privkey_t tls_cert_key; /* key used if ssl_cert is set */
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
char *unterminated_message; /* beginning of a message in input buf */
|
||||
int nicks_count; /* number of nicknames */
|
||||
char **nicks_array; /* nicknames (after split) */
|
||||
@@ -252,13 +252,13 @@ enum t_irc_fingerprint_digest_algo
|
||||
/* number of digest algorithms */
|
||||
IRC_FINGERPRINT_NUM_ALGOS,
|
||||
};
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
extern struct t_irc_server *irc_servers;
|
||||
#ifdef HAVE_GNUTLS
|
||||
extern const int gnutls_cert_type_prio[];
|
||||
extern const int gnutls_prot_prio[];
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
extern struct t_irc_message *irc_recv_msgq, *irc_msgq_last_msg;
|
||||
extern char *irc_server_sasl_fail_string[];
|
||||
extern char *irc_server_options[][2];
|
||||
@@ -323,7 +323,7 @@ extern struct t_gui_buffer *irc_server_create_buffer (struct t_irc_server *serve
|
||||
#ifdef HAVE_GNUTLS
|
||||
int irc_server_fingerprint_search_algo_with_size (int size);
|
||||
char *irc_server_fingerprint_str_sizes ();
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
extern int irc_server_connect (struct t_irc_server *server);
|
||||
extern void irc_server_auto_connect (int auto_connect);
|
||||
extern void irc_server_autojoin_channels ();
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
#define EXPORT extern "C" __declspec (dllexport)
|
||||
#else
|
||||
#define EXPORT extern "C"
|
||||
#endif
|
||||
#endif /* _WIN32 */
|
||||
#else
|
||||
#define EXPORT
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#define weechat_plugin weechat_js_plugin
|
||||
#define JS_PLUGIN_NAME "javascript"
|
||||
|
||||
@@ -359,7 +359,7 @@ logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
|
||||
weechat_config_string (logger_config_file_replacement_char));
|
||||
#else
|
||||
mask_decoded3 = strdup (mask_decoded2);
|
||||
#endif
|
||||
#endif /* __CYGWIN__ */
|
||||
if (!mask_decoded3)
|
||||
goto end;
|
||||
|
||||
|
||||
@@ -294,7 +294,7 @@ weechat_lua_register_lib (lua_State *L, const char *libname,
|
||||
luaL_setfuncs (L, lua_api_funcs, 0);
|
||||
#else
|
||||
luaL_register (L, libname, lua_api_funcs);
|
||||
#endif
|
||||
#endif /* LUA_VERSION_NUM >= 502 */
|
||||
|
||||
luaL_newmetatable (L, "weechat");
|
||||
lua_pushliteral (L, "__index");
|
||||
@@ -375,7 +375,7 @@ weechat_lua_load (const char *filename)
|
||||
luaopen_math (lua_current_interpreter);
|
||||
luaopen_io (lua_current_interpreter);
|
||||
luaopen_debug (lua_current_interpreter);
|
||||
#endif
|
||||
#endif /* LUA_VERSION_NUM */
|
||||
|
||||
weechat_lua_register_lib (lua_current_interpreter, "weechat",
|
||||
weechat_lua_api_funcs,
|
||||
@@ -385,7 +385,7 @@ weechat_lua_load (const char *filename)
|
||||
if (luaL_dostring (lua_current_interpreter, weechat_lua_code) != 0)
|
||||
#else
|
||||
if (lua_dostring (lua_current_interpreter, weechat_lua_code) != 0)
|
||||
#endif
|
||||
#endif /* LUA_VERSION_NUM */
|
||||
{
|
||||
weechat_printf (NULL,
|
||||
weechat_gettext ("%s%s: unable to redirect stdout "
|
||||
@@ -800,7 +800,7 @@ weechat_lua_signal_debug_libs_cb (void *data, const char *signal,
|
||||
weechat_printf (NULL, " %s: %s", LUA_PLUGIN_NAME, LUA_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", LUA_PLUGIN_NAME);
|
||||
#endif
|
||||
#endif /* LUA_VERSION */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@
|
||||
|
||||
#ifdef NO_PERL_MULTIPLICITY
|
||||
#undef MULTIPLICITY
|
||||
#endif
|
||||
#endif /* NO_PERL_MULTIPLICITY */
|
||||
|
||||
extern void boot_DynaLoader (pTHX_ CV* cv);
|
||||
|
||||
@@ -169,7 +169,7 @@ API_FUNC(register)
|
||||
perl_current_script->interpreter = perl_current_interpreter;
|
||||
#else
|
||||
perl_current_script->interpreter = SvPV_nolen (eval_pv ("__PACKAGE__", TRUE));
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ struct t_plugin_script *perl_registered_script = NULL;
|
||||
const char *perl_current_script_filename = NULL;
|
||||
#ifdef MULTIPLICITY
|
||||
PerlInterpreter *perl_current_interpreter = NULL;
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
int perl_quit_or_upgrade = 0;
|
||||
|
||||
/*
|
||||
@@ -78,13 +78,13 @@ char *perl_action_autoload_list = NULL;
|
||||
|
||||
#ifdef NO_PERL_MULTIPLICITY
|
||||
#undef MULTIPLICITY
|
||||
#endif
|
||||
#endif /* NO_PERL_MULTIPLICITY */
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
#define PKG_NAME_PREFIX "WeechatPerlPackage"
|
||||
static PerlInterpreter *perl_main = NULL;
|
||||
int perl_num = 0;
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
char *perl_args[] = { "", "-e", "0", "-w", NULL };
|
||||
int perl_args_count = 4;
|
||||
@@ -93,7 +93,7 @@ char *perl_weechat_code =
|
||||
{
|
||||
#ifndef MULTIPLICITY
|
||||
"package %s;"
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
"$SIG{__WARN__} = sub { weechat::print('', 'perl\twarning: '.$_[0]) };"
|
||||
"$SIG{__DIE__} = sub { weechat::print('', 'perl\terror: '.$_[0]) };"
|
||||
"do '%s';"
|
||||
@@ -204,7 +204,7 @@ weechat_perl_exec (struct t_plugin_script *script,
|
||||
struct t_plugin_script *old_perl_current_script;
|
||||
#ifdef MULTIPLICITY
|
||||
void *old_context;
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
old_perl_current_script = perl_current_script;
|
||||
perl_current_script = script;
|
||||
@@ -224,7 +224,7 @@ weechat_perl_exec (struct t_plugin_script *script,
|
||||
snprintf (func, length, "%s::%s",
|
||||
(char *) ((script->interpreter) ? script->interpreter : perl_main),
|
||||
function);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
dSP;
|
||||
ENTER;
|
||||
@@ -322,7 +322,7 @@ weechat_perl_exec (struct t_plugin_script *script,
|
||||
PERL_SET_CONTEXT (old_context);
|
||||
#else
|
||||
free (func);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
if (!ret_value && (mem_err == 1))
|
||||
{
|
||||
@@ -353,7 +353,7 @@ weechat_perl_load (const char *filename)
|
||||
int length;
|
||||
#ifndef MULTIPLICITY
|
||||
char pkgname[64];
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
temp_script.filename = NULL;
|
||||
temp_script.interpreter = NULL;
|
||||
@@ -414,7 +414,7 @@ weechat_perl_load (const char *filename)
|
||||
if (!perl_code)
|
||||
return 0;
|
||||
snprintf (perl_code, length, perl_weechat_code, pkgname, filename);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
eval_pv (perl_code, TRUE);
|
||||
free (perl_code);
|
||||
|
||||
@@ -432,7 +432,7 @@ weechat_perl_load (const char *filename)
|
||||
#ifdef MULTIPLICITY
|
||||
perl_destruct (perl_current_interpreter);
|
||||
perl_free (perl_current_interpreter);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
if (perl_current_script && (perl_current_script != &temp_script))
|
||||
{
|
||||
plugin_script_remove (weechat_perl_plugin,
|
||||
@@ -453,14 +453,14 @@ weechat_perl_load (const char *filename)
|
||||
#ifdef MULTIPLICITY
|
||||
perl_destruct (perl_current_interpreter);
|
||||
perl_free (perl_current_interpreter);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
return 0;
|
||||
}
|
||||
perl_current_script = perl_registered_script;
|
||||
|
||||
#ifndef MULTIPLICITY
|
||||
perl_current_script->interpreter = strdup (pkgname);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
/*
|
||||
* set input/close callbacks for buffers created by this script
|
||||
@@ -512,7 +512,7 @@ weechat_perl_unload (struct t_plugin_script *script)
|
||||
|
||||
#ifdef MULTIPLICITY
|
||||
PERL_SET_CONTEXT (script->interpreter);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
if (script->shutdown_func && script->shutdown_func[0])
|
||||
{
|
||||
@@ -549,7 +549,7 @@ weechat_perl_unload (struct t_plugin_script *script)
|
||||
#else
|
||||
if (interpreter)
|
||||
free (interpreter);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
(void) weechat_hook_signal_send ("perl_script_unloaded",
|
||||
WEECHAT_HOOK_SIGNAL_STRING, filename);
|
||||
@@ -832,7 +832,7 @@ weechat_perl_signal_debug_libs_cb (void *data, const char *signal,
|
||||
weechat_printf (NULL, " %s: %s", PERL_PLUGIN_NAME, PERL_VERSION_STRING);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", PERL_PLUGIN_NAME);
|
||||
#endif
|
||||
#endif /* PERL_VERSION_STRING */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
@@ -971,13 +971,11 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
int a;
|
||||
char **perl_args_local;
|
||||
char *perl_env[] = {};
|
||||
#endif
|
||||
#ifdef PERL_SYS_INIT3
|
||||
a = perl_args_count;
|
||||
perl_args_local = perl_args;
|
||||
(void) perl_env;
|
||||
PERL_SYS_INIT3 (&a, (char ***)&perl_args_local, (char ***)&perl_env);
|
||||
#endif
|
||||
#endif /* PERL_SYS_INIT3 */
|
||||
|
||||
weechat_perl_plugin = plugin;
|
||||
|
||||
@@ -996,7 +994,7 @@ weechat_plugin_init (struct t_weechat_plugin *plugin, int argc, char *argv[])
|
||||
perl_construct (perl_main);
|
||||
perl_parse (perl_main, weechat_perl_api_init, perl_args_count,
|
||||
perl_args, NULL);
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
init.callback_command = &weechat_perl_command_cb;
|
||||
init.callback_completion = &weechat_perl_completion_cb;
|
||||
@@ -1042,7 +1040,7 @@ weechat_plugin_end (struct t_weechat_plugin *plugin)
|
||||
perl_free (perl_main);
|
||||
perl_main = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
#if defined(PERL_SYS_TERM) && !defined(__FreeBSD__) && !defined(WIN32) && !defined(__CYGWIN__) && !(defined(__APPLE__) && defined(__MACH__))
|
||||
/*
|
||||
|
||||
@@ -35,7 +35,7 @@ extern struct t_plugin_script *perl_registered_script;
|
||||
extern const char *perl_current_script_filename;
|
||||
#ifdef MULTIPLICITY
|
||||
extern PerlInterpreter *perl_current_interpreter;
|
||||
#endif
|
||||
#endif /* MULTIPLICITY */
|
||||
|
||||
extern HV *weechat_perl_hashtable_to_hash (struct t_hashtable *hashtable);
|
||||
extern struct t_hashtable *weechat_perl_hash_to_hashtable (SV *hash, int size,
|
||||
|
||||
@@ -84,7 +84,7 @@ static struct PyModuleDef moduleDefOutputs = {
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
|
||||
/*
|
||||
* string used to execute action "install":
|
||||
@@ -498,7 +498,7 @@ weechat_python_output (PyObject *self, PyObject *args)
|
||||
static PyObject *weechat_python_init_module_weechat ()
|
||||
#else
|
||||
void weechat_python_init_module_weechat ()
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
{
|
||||
PyObject *weechat_module, *weechat_dict;
|
||||
|
||||
@@ -508,7 +508,7 @@ void weechat_python_init_module_weechat ()
|
||||
#else
|
||||
/* python <= 2.x */
|
||||
weechat_module = Py_InitModule ("weechat", weechat_python_funcs);
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
|
||||
if (!weechat_module)
|
||||
{
|
||||
@@ -520,7 +520,7 @@ void weechat_python_init_module_weechat ()
|
||||
return NULL;
|
||||
#else
|
||||
return;
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
}
|
||||
|
||||
/* define some constants */
|
||||
@@ -574,7 +574,7 @@ void weechat_python_init_module_weechat ()
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
return weechat_module;
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -591,7 +591,7 @@ weechat_python_load (const char *filename)
|
||||
char *argv[] = { "__weechat_plugin__" , NULL };
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
wchar_t *wargv[] = { NULL, NULL };
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
FILE *fp;
|
||||
PyObject *weechat_outputs, *python_path, *path;
|
||||
const char *weechat_home;
|
||||
@@ -636,7 +636,7 @@ weechat_python_load (const char *filename)
|
||||
#else
|
||||
/* python <= 2.x */
|
||||
PySys_SetArgv(1, argv);
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
|
||||
if (!python_current_interpreter)
|
||||
{
|
||||
@@ -667,7 +667,7 @@ weechat_python_load (const char *filename)
|
||||
#else
|
||||
/* python <= 2.x */
|
||||
path = PyBytes_FromString (str_home);
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
if (path != NULL)
|
||||
{
|
||||
PyList_Insert (python_path, 0, path);
|
||||
@@ -684,7 +684,7 @@ weechat_python_load (const char *filename)
|
||||
/* python <= 2.x */
|
||||
weechat_outputs = Py_InitModule("weechatOutputs",
|
||||
weechat_python_output_funcs);
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
|
||||
if (!weechat_outputs)
|
||||
{
|
||||
@@ -1149,7 +1149,7 @@ weechat_python_signal_debug_libs_cb (void *data, const char *signal,
|
||||
weechat_printf (NULL, " %s: %s", PYTHON_PLUGIN_NAME, PY_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", PYTHON_PLUGIN_NAME);
|
||||
#endif
|
||||
#endif /* PY_VERSION */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
#define PyBytes_Check PyString_Check
|
||||
#define PyBytes_FromString PyString_FromString
|
||||
#define PyUnicode_FromString PyString_FromString
|
||||
#endif
|
||||
#endif /* PY_VERSION_HEX < 0x02060000 */
|
||||
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
/* check of integer with Python >= 3.x */
|
||||
@@ -40,7 +40,7 @@
|
||||
#else
|
||||
/* check of integer with Python <= 2.x */
|
||||
#define PY_INTEGER_CHECK(x) (PyInt_Check(x) || PyLong_Check(x))
|
||||
#endif
|
||||
#endif /* PY_MAJOR_VERSION >= 3 */
|
||||
|
||||
extern struct t_weechat_plugin *weechat_python_plugin;
|
||||
|
||||
|
||||
@@ -260,7 +260,7 @@ relay_client_handshake_timer_cb (void *data, int remaining_calls)
|
||||
/* handshake in progress, we will try again on next call to timer */
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
/*
|
||||
* Reads text data from a client: splits data on '\n' and keep a partial message
|
||||
@@ -451,7 +451,7 @@ relay_client_recv_cb (void *arg_client, int fd)
|
||||
num_read = gnutls_record_recv (client->gnutls_sess, buffer,
|
||||
sizeof (buffer) - 1);
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
num_read = recv (client->sock, buffer, sizeof (buffer) - 1, 0);
|
||||
|
||||
if (num_read > 0)
|
||||
@@ -555,7 +555,7 @@ relay_client_recv_cb (void *arg_client, int fd)
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
{
|
||||
if ((num_read == 0)
|
||||
|| ((errno != EAGAIN) && (errno != EWOULDBLOCK)))
|
||||
@@ -785,7 +785,7 @@ relay_client_send (struct t_relay_client *client, const char *data,
|
||||
if (client->ssl)
|
||||
num_sent = gnutls_record_send (client->gnutls_sess, ptr_data, data_size);
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
num_sent = send (client->sock, ptr_data, data_size, 0);
|
||||
|
||||
if (num_sent >= 0)
|
||||
@@ -839,7 +839,7 @@ relay_client_send (struct t_relay_client *client, const char *data,
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
{
|
||||
if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
|
||||
{
|
||||
@@ -917,7 +917,7 @@ relay_client_timer_cb (void *data, int remaining_calls)
|
||||
ptr_client->outqueue->data_size);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
{
|
||||
num_sent = send (ptr_client->sock,
|
||||
ptr_client->outqueue->data,
|
||||
@@ -1006,7 +1006,7 @@ relay_client_timer_cb (void *data, int remaining_calls)
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
{
|
||||
if ((errno == EAGAIN) || (errno == EWOULDBLOCK))
|
||||
{
|
||||
@@ -1052,7 +1052,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
#ifdef HAVE_GNUTLS
|
||||
int bits;
|
||||
struct t_config_option *ptr_option;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
new_client = malloc (sizeof (*new_client));
|
||||
if (new_client)
|
||||
@@ -1064,7 +1064,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
#ifdef HAVE_GNUTLS
|
||||
new_client->hook_timer_handshake = NULL;
|
||||
new_client->gnutls_handshake_ok = 0;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
new_client->websocket = 0;
|
||||
new_client->http_headers = NULL;
|
||||
new_client->address = strdup ((address) ? address : "?");
|
||||
@@ -1127,7 +1127,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
#else
|
||||
/* default for old gnutls */
|
||||
bits = 1024;
|
||||
#endif
|
||||
#endif /* LIBGNUTLS_VERSION_NUMBER >= 0x020c00 */
|
||||
gnutls_dh_params_generate2 (*relay_gnutls_dh_params, bits);
|
||||
gnutls_certificate_set_dh_params (relay_gnutls_x509_cred,
|
||||
*relay_gnutls_dh_params);
|
||||
@@ -1148,7 +1148,7 @@ relay_client_new (int sock, const char *address, struct t_relay_server *server)
|
||||
&relay_client_handshake_timer_cb,
|
||||
new_client);
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
new_client->protocol_data = NULL;
|
||||
switch (new_client->protocol)
|
||||
@@ -1232,7 +1232,7 @@ relay_client_new_with_infolist (struct t_infolist *infolist)
|
||||
new_client->gnutls_sess = NULL;
|
||||
new_client->hook_timer_handshake = NULL;
|
||||
new_client->gnutls_handshake_ok = 0;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
new_client->websocket = weechat_infolist_integer (infolist, "websocket");
|
||||
new_client->http_headers = NULL;
|
||||
new_client->address = strdup (weechat_infolist_string (infolist, "address"));
|
||||
@@ -1330,7 +1330,7 @@ relay_client_set_status (struct t_relay_client *client,
|
||||
client->hook_timer_handshake = NULL;
|
||||
}
|
||||
client->gnutls_handshake_ok = 0;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
if (client->hook_fd)
|
||||
{
|
||||
weechat_unhook (client->hook_fd);
|
||||
@@ -1376,13 +1376,13 @@ relay_client_set_status (struct t_relay_client *client,
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (client->ssl && client->gnutls_handshake_ok)
|
||||
gnutls_bye (client->gnutls_sess, GNUTLS_SHUT_WR);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
close (client->sock);
|
||||
client->sock = -1;
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (client->ssl)
|
||||
gnutls_deinit (client->gnutls_sess);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1428,7 +1428,7 @@ relay_client_free (struct t_relay_client *client)
|
||||
#ifdef HAVE_GNUTLS
|
||||
if (client->hook_timer_handshake)
|
||||
weechat_unhook (client->hook_timer_handshake);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
if (client->http_headers)
|
||||
weechat_hashtable_free (client->http_headers);
|
||||
if (client->hook_fd)
|
||||
@@ -1540,7 +1540,7 @@ relay_client_add_to_infolist (struct t_infolist *infolist,
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_integer (ptr_item, "gnutls_handshake_ok", client->gnutls_handshake_ok))
|
||||
return 0;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
if (!weechat_infolist_new_var_integer (ptr_item, "websocket", client->websocket))
|
||||
return 0;
|
||||
if (!weechat_infolist_new_var_string (ptr_item, "address", client->address))
|
||||
@@ -1617,7 +1617,7 @@ relay_client_print_log ()
|
||||
weechat_log_printf (" gnutls_sess . . . . . : 0x%lx", ptr_client->gnutls_sess);
|
||||
weechat_log_printf (" hook_timer_handshake. : 0x%lx", ptr_client->hook_timer_handshake);
|
||||
weechat_log_printf (" gnutls_handshake_ok . : 0x%lx", ptr_client->gnutls_handshake_ok);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
weechat_log_printf (" websocket . . . . . . : %d", ptr_client->websocket);
|
||||
weechat_log_printf (" http_headers. . . . . : 0x%lx (hashtable: '%s')",
|
||||
ptr_client->http_headers,
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
struct t_relay_server;
|
||||
|
||||
@@ -80,7 +80,7 @@ struct t_relay_client
|
||||
gnutls_session_t gnutls_sess; /* gnutls session (only if SSL used) */
|
||||
struct t_hook *hook_timer_handshake; /* timer for doing gnutls handshake*/
|
||||
int gnutls_handshake_ok; /* 1 if handshake was done and OK */
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
int websocket; /* 0=not a ws, 1=init ws, 2=ws ready */
|
||||
struct t_hashtable *http_headers; /* HTTP headers for websocket */
|
||||
char *address; /* string with IP address */
|
||||
|
||||
@@ -237,7 +237,7 @@ relay_config_check_network_ssl_priorities (void *data,
|
||||
(void) value;
|
||||
|
||||
return 1;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -258,7 +258,7 @@ relay_config_change_network_ssl_priorities (void *data,
|
||||
gnutls_priority_deinit (*relay_gnutls_priority_cache);
|
||||
relay_network_set_priority ();
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -490,7 +490,7 @@ relay_config_create_option_port (void *data,
|
||||
weechat_prefix ("error"), RELAY_PLUGIN_NAME);
|
||||
rc = WEECHAT_CONFIG_OPTION_SET_ERROR;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
if (rc != WEECHAT_CONFIG_OPTION_SET_ERROR)
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
#include "../weechat-plugin.h"
|
||||
#include "relay.h"
|
||||
@@ -38,7 +38,7 @@ int relay_network_init_ssl_cert_key_ok = 0;
|
||||
gnutls_certificate_credentials_t relay_gnutls_x509_cred;
|
||||
gnutls_priority_t *relay_gnutls_priority_cache = NULL;
|
||||
gnutls_dh_params_t *relay_gnutls_dh_params = NULL;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
|
||||
/*
|
||||
@@ -100,7 +100,7 @@ relay_network_set_ssl_cert_key (int verbose)
|
||||
#else
|
||||
/* make C compiler happy */
|
||||
(void) verbose;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -122,7 +122,7 @@ relay_network_set_priority ()
|
||||
free (relay_gnutls_priority_cache);
|
||||
relay_gnutls_priority_cache = NULL;
|
||||
}
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -142,7 +142,7 @@ relay_network_init ()
|
||||
relay_gnutls_priority_cache = malloc (sizeof (*relay_gnutls_priority_cache));
|
||||
if (relay_gnutls_priority_cache)
|
||||
relay_network_set_priority ();
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
relay_network_init_ok = 1;
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ relay_network_end ()
|
||||
relay_gnutls_dh_params = NULL;
|
||||
}
|
||||
gnutls_certificate_free_credentials (relay_gnutls_x509_cred);
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
relay_network_init_ok = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#include <gnutls/gnutls.h>
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
extern int relay_network_init_ok;
|
||||
extern int relay_network_init_ssl_cert_key_ok;
|
||||
@@ -31,7 +31,7 @@ extern int relay_network_init_ssl_cert_key_ok;
|
||||
extern gnutls_certificate_credentials_t relay_gnutls_x509_cred;
|
||||
extern gnutls_priority_t *relay_gnutls_priority_cache;
|
||||
extern gnutls_dh_params_t *relay_gnutls_dh_params;
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
extern void relay_network_set_ssl_cert_key (int verbose);
|
||||
extern void relay_network_set_priority ();
|
||||
|
||||
@@ -429,7 +429,7 @@ relay_server_create_socket (struct t_relay_server *server)
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* IPV6_V6ONLY */
|
||||
|
||||
/* set option SO_REUSEADDR to 1 */
|
||||
set = 1;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
|
||||
#ifdef HAVE_GNUTLS
|
||||
#define RELAY_SERVER_GNUTLS_DH_BITS 1024
|
||||
#endif
|
||||
#endif /* HAVE_GNUTLS */
|
||||
|
||||
struct t_relay_server
|
||||
{
|
||||
|
||||
@@ -970,7 +970,7 @@ weechat_ruby_signal_debug_libs_cb (void *data, const char *signal,
|
||||
weechat_printf (NULL, " %s: %s", RUBY_PLUGIN_NAME, ruby_version);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", RUBY_PLUGIN_NAME);
|
||||
#endif
|
||||
#endif /* HAVE_RUBY_VERSION_H */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -713,7 +713,7 @@ weechat_tcl_signal_debug_libs_cb (void *data, const char *signal,
|
||||
weechat_printf (NULL, " %s: %s", TCL_PLUGIN_NAME, TCL_VERSION);
|
||||
#else
|
||||
weechat_printf (NULL, " %s: (?)", TCL_PLUGIN_NAME);
|
||||
#endif
|
||||
#endif /* TCL_VERSION */
|
||||
|
||||
return WEECHAT_RC_OK;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@@ -32,7 +32,7 @@ extern "C" {
|
||||
/* some systems like GNU/Hurd do not define PATH_MAX */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
#endif
|
||||
#endif /* PATH_MAX */
|
||||
|
||||
struct t_config_option;
|
||||
struct t_gui_window;
|
||||
@@ -1816,6 +1816,6 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* WEECHAT_WEECHAT_PLUGIN_H */
|
||||
|
||||
@@ -1140,7 +1140,7 @@ xfer_add_cb (void *data, const char *signal, const char *type_data,
|
||||
free (dir1);
|
||||
free (dir2);
|
||||
}
|
||||
#endif
|
||||
#endif /* _WIN32 */
|
||||
/* check if file exists */
|
||||
if (stat (filename2, &st) == -1)
|
||||
{
|
||||
|
||||
@@ -110,7 +110,7 @@ enum t_xfer_hash_status
|
||||
#else
|
||||
#define DIR_SEPARATOR "/"
|
||||
#define DIR_SEPARATOR_CHAR '/'
|
||||
#endif
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* macros for type/status */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user