1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 15:05:42 +02:00

Add some missing functions in API: hook_connect and infolist creation

This commit is contained in:
Sebastien Helleu
2008-09-26 13:26:41 +02:00
parent 8799fe6963
commit 471a7dda67
10 changed files with 1463 additions and 177 deletions
+4 -3
View File
@@ -120,7 +120,8 @@ struct t_hook_fd
int flags; /* fd flags (read,write,..) */
};
typedef int (t_hook_callback_connect)(void *data, int status, char *ip_address);
typedef int (t_hook_callback_connect)(void *data, int status,
const char *ip_address);
struct t_hook_connect
{
@@ -246,7 +247,7 @@ extern void hook_timer_exec ();
extern struct t_hook *hook_fd (struct t_weechat_plugin *plugin, int fd,
int flag_read, int flag_write,
int flag_exception,
t_hook_callback_fd * callback,
t_hook_callback_fd *callback,
void *callback_data);
extern int hook_fd_set (fd_set *read_fds, fd_set *write_fds,
fd_set *exception_fds);
@@ -256,7 +257,7 @@ extern struct t_hook *hook_connect (struct t_weechat_plugin *plugin,
const char *address, int port,
int sock, int ipv6, void *gnutls_session,
const char *local_hostname,
t_hook_callback_connect * callback,
t_hook_callback_connect *callback,
void *callback_data);
extern struct t_hook *hook_print (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,
+1 -1
View File
@@ -1969,7 +1969,7 @@ irc_server_switch_address (struct t_irc_server *server)
*/
int
irc_server_connect_cb (void *arg_server, int status, char *ip_address)
irc_server_connect_cb (void *arg_server, int status, const char *ip_address)
{
struct t_irc_server *server;
int config_proxy_use;
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -360,6 +360,16 @@ weechat_python_load (const char *filename)
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_MESSAGE", PyString_FromString(WEECHAT_HOTLIST_MESSAGE));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_PRIVATE", PyString_FromString(WEECHAT_HOTLIST_PRIVATE));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOTLIST_HIGHLIGHT", PyString_FromString(WEECHAT_HOTLIST_HIGHLIGHT));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_OK", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_OK));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_ADDRESS_NOT_FOUND));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_IP_ADDRESS_NOT_FOUND));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_CONNECTION_REFUSED));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_PROXY_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_PROXY_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_LOCAL_HOSTNAME_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_GNUTLS_INIT_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_GNUTLS_HANDSHAKE_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_CONNECT_MEMORY_ERROR", PyInt_FromLong((long) WEECHAT_HOOK_CONNECT_MEMORY_ERROR));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_STRING", PyString_FromString(WEECHAT_HOOK_SIGNAL_STRING));
PyDict_SetItemString(weechat_dict, "WEECHAT_HOOK_SIGNAL_INT", PyString_FromString(WEECHAT_HOOK_SIGNAL_INT));
File diff suppressed because it is too large Load Diff
+39
View File
@@ -680,6 +680,45 @@ script_api_hook_fd (struct t_weechat_plugin *weechat_plugin,
return new_hook;
}
/*
* script_api_hook_connect: hook a connection
* return new hook, NULL if error
*/
struct t_hook *
script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *address, int port, int sock, int ipv6,
void *gnutls_sess, const char *local_hostname,
int (*callback)(void *data, int status, const char *ip_address),
const char *function)
{
struct t_script_callback *new_script_callback;
struct t_hook *new_hook;
new_script_callback = script_callback_alloc ();
if (!new_script_callback)
return NULL;
new_hook = weechat_hook_connect (address, port, sock, ipv6, gnutls_sess,
local_hostname, callback,
new_script_callback);
if (!new_hook)
{
script_callback_free_data (new_script_callback);
free (new_script_callback);
return NULL;
}
new_script_callback->script = script;
new_script_callback->function = strdup (function);
new_script_callback->hook = new_hook;
script_callback_add (script, new_script_callback);
return new_hook;
}
/*
* script_api_hook_print: hook a print
* return new hook, NULL if error
+12
View File
@@ -105,6 +105,18 @@ extern struct t_hook *script_api_hook_fd (struct t_weechat_plugin *weechat_plugi
int flag_write, int flag_exception,
int (*callback)(void *data),
const char *function);
extern struct t_hook *script_api_hook_connect (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
const char *address,
int port,
int sock,
int ipv6,
void *gnutls_sess,
const char *local_hostname,
int (*callback)(void *data,
int status,
const char *ip_address),
const char *function);
extern struct t_hook *script_api_hook_print (struct t_weechat_plugin *weechat_plugin,
struct t_plugin_script *script,
struct t_gui_buffer *buffer,
+1 -1
View File
@@ -328,7 +328,7 @@ struct t_weechat_plugin
const char *local_hostname,
int (*callback)(void *data,
int status,
char *ip_address),
const char *ip_address),
void *callback_data);
struct t_hook *(*hook_print) (struct t_weechat_plugin *plugin,
struct t_gui_buffer *buffer,