mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Use net-sendbuffer with DCC chat.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@522 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
7f3f53bffe
commit
271ebb5be7
@ -40,9 +40,8 @@ void dcc_chat_send(DCC_REC *dcc, const char *data)
|
||||
g_return_if_fail(dcc != NULL);
|
||||
g_return_if_fail(data != NULL);
|
||||
|
||||
/* FIXME: we need output queue! */
|
||||
net_transmit(dcc->handle, data, strlen(data));
|
||||
net_transmit(dcc->handle, "\n", 1);
|
||||
net_sendbuffer_send(dcc->sendbuf, data, strlen(data));
|
||||
net_sendbuffer_send(dcc->sendbuf, "\n", 1);
|
||||
}
|
||||
|
||||
/* If `item' is a query of a =nick, return DCC chat record of nick */
|
||||
@ -204,6 +203,7 @@ static void dcc_chat_listen(DCC_REC *dcc)
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->handle = handle;
|
||||
dcc->sendbuf = net_sendbuffer_create(handle, 0);
|
||||
memcpy(&dcc->addr, &ip, sizeof(IPADDR));
|
||||
net_ip2host(&dcc->addr, dcc->addrstr);
|
||||
dcc->port = port;
|
||||
@ -228,6 +228,7 @@ static void sig_chat_connected(DCC_REC *dcc)
|
||||
/* connect ok. */
|
||||
g_source_remove(dcc->tagconn);
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->sendbuf = net_sendbuffer_create(dcc->handle, 0);
|
||||
dcc->tagread = g_input_add(dcc->handle, G_INPUT_READ,
|
||||
(GInputFunction) dcc_chat_input, dcc);
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "signals.h"
|
||||
#include "commands.h"
|
||||
#include "network.h"
|
||||
#include "net-sendbuffer.h"
|
||||
#include "line-split.h"
|
||||
#include "settings.h"
|
||||
|
||||
@ -113,6 +114,7 @@ void dcc_destroy(DCC_REC *dcc)
|
||||
if (dcc->tagconn != -1) g_source_remove(dcc->tagconn);
|
||||
if (dcc->tagread != -1) g_source_remove(dcc->tagread);
|
||||
if (dcc->tagwrite != -1) g_source_remove(dcc->tagwrite);
|
||||
if (dcc->sendbuf != NULL) net_sendbuffer_destroy(dcc->sendbuf, FALSE);
|
||||
|
||||
if (dcc->type == DCC_TYPE_CHAT)
|
||||
line_split_free((LINEBUF_REC *) dcc->databuf);
|
||||
|
@ -41,6 +41,7 @@ typedef struct DCC_REC {
|
||||
|
||||
long size, transfd, skipped; /* file size / bytes transferred / skipped at start */
|
||||
int handle; /* socket handle */
|
||||
void *sendbuf;
|
||||
int tagconn, tagread, tagwrite;
|
||||
int fhandle; /* file handle */
|
||||
time_t starttime; /* transfer start time */
|
||||
|
Loading…
Reference in New Issue
Block a user