mirror of
https://github.com/weechat/weechat.git
synced 2026-07-04 08:43:13 +02:00
Give file descriptor to callback of hook_fd
This commit is contained in:
@@ -85,13 +85,16 @@ xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...)
|
||||
*/
|
||||
|
||||
int
|
||||
xfer_chat_recv_cb (void *arg_xfer)
|
||||
xfer_chat_recv_cb (void *arg_xfer, int fd)
|
||||
{
|
||||
struct t_xfer *xfer;
|
||||
static char buffer[4096 + 2];
|
||||
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
|
||||
int num_read;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) fd;
|
||||
|
||||
xfer = (struct t_xfer *)arg_xfer;
|
||||
|
||||
num_read = recv (xfer->sock, buffer, sizeof (buffer) - 2, 0);
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#ifndef __WEECHAT_XFER_CHAT_H
|
||||
#define __WEECHAT_XFER_CHAT_H 1
|
||||
|
||||
extern int xfer_chat_recv_cb (void *arg_xfer);
|
||||
extern int xfer_chat_recv_cb (void *arg_xfer, int fd);
|
||||
extern void xfer_chat_open_buffer (struct t_xfer *xfer);
|
||||
|
||||
#endif /* xfer-chat.h */
|
||||
|
||||
@@ -85,13 +85,16 @@ xfer_network_write_pipe (struct t_xfer *xfer, int status, int error)
|
||||
*/
|
||||
|
||||
int
|
||||
xfer_network_child_read_cb (void *arg_xfer)
|
||||
xfer_network_child_read_cb (void *arg_xfer, int fd)
|
||||
{
|
||||
struct t_xfer *xfer;
|
||||
char bufpipe[1 + 1 + 12 + 1];
|
||||
int num_read;
|
||||
char *error;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) fd;
|
||||
|
||||
xfer = (struct t_xfer *)arg_xfer;
|
||||
|
||||
num_read = read (xfer->child_read, bufpipe, sizeof (bufpipe));
|
||||
@@ -305,13 +308,16 @@ xfer_network_child_kill (struct t_xfer *xfer)
|
||||
*/
|
||||
|
||||
int
|
||||
xfer_network_fd_cb (void *arg_xfer)
|
||||
xfer_network_fd_cb (void *arg_xfer, int fd)
|
||||
{
|
||||
struct t_xfer *xfer;
|
||||
int sock;
|
||||
struct sockaddr_in addr;
|
||||
socklen_t length;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) fd;
|
||||
|
||||
xfer = (struct t_xfer *)arg_xfer;
|
||||
|
||||
if (xfer->status == XFER_STATUS_CONNECTING)
|
||||
|
||||
Reference in New Issue
Block a user