1
0
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:
Timo Sirainen 2000-07-23 13:43:42 +00:00 committed by cras
parent 7f3f53bffe
commit 271ebb5be7
3 changed files with 7 additions and 3 deletions

View File

@ -40,9 +40,8 @@ void dcc_chat_send(DCC_REC *dcc, const char *data)
g_return_if_fail(dcc != NULL); g_return_if_fail(dcc != NULL);
g_return_if_fail(data != NULL); g_return_if_fail(data != NULL);
/* FIXME: we need output queue! */ net_sendbuffer_send(dcc->sendbuf, data, strlen(data));
net_transmit(dcc->handle, data, strlen(data)); net_sendbuffer_send(dcc->sendbuf, "\n", 1);
net_transmit(dcc->handle, "\n", 1);
} }
/* If `item' is a query of a =nick, return DCC chat record of nick */ /* 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->starttime = time(NULL);
dcc->handle = handle; dcc->handle = handle;
dcc->sendbuf = net_sendbuffer_create(handle, 0);
memcpy(&dcc->addr, &ip, sizeof(IPADDR)); memcpy(&dcc->addr, &ip, sizeof(IPADDR));
net_ip2host(&dcc->addr, dcc->addrstr); net_ip2host(&dcc->addr, dcc->addrstr);
dcc->port = port; dcc->port = port;
@ -228,6 +228,7 @@ static void sig_chat_connected(DCC_REC *dcc)
/* connect ok. */ /* connect ok. */
g_source_remove(dcc->tagconn); g_source_remove(dcc->tagconn);
dcc->starttime = time(NULL); dcc->starttime = time(NULL);
dcc->sendbuf = net_sendbuffer_create(dcc->handle, 0);
dcc->tagread = g_input_add(dcc->handle, G_INPUT_READ, dcc->tagread = g_input_add(dcc->handle, G_INPUT_READ,
(GInputFunction) dcc_chat_input, dcc); (GInputFunction) dcc_chat_input, dcc);

View File

@ -22,6 +22,7 @@
#include "signals.h" #include "signals.h"
#include "commands.h" #include "commands.h"
#include "network.h" #include "network.h"
#include "net-sendbuffer.h"
#include "line-split.h" #include "line-split.h"
#include "settings.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->tagconn != -1) g_source_remove(dcc->tagconn);
if (dcc->tagread != -1) g_source_remove(dcc->tagread); if (dcc->tagread != -1) g_source_remove(dcc->tagread);
if (dcc->tagwrite != -1) g_source_remove(dcc->tagwrite); 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) if (dcc->type == DCC_TYPE_CHAT)
line_split_free((LINEBUF_REC *) dcc->databuf); line_split_free((LINEBUF_REC *) dcc->databuf);

View File

@ -41,6 +41,7 @@ typedef struct DCC_REC {
long size, transfd, skipped; /* file size / bytes transferred / skipped at start */ long size, transfd, skipped; /* file size / bytes transferred / skipped at start */
int handle; /* socket handle */ int handle; /* socket handle */
void *sendbuf;
int tagconn, tagread, tagwrite; int tagconn, tagread, tagwrite;
int fhandle; /* file handle */ int fhandle; /* file handle */
time_t starttime; /* transfer start time */ time_t starttime; /* transfer start time */