diff options
| author | Emanuele Giaquinta <exg@irssi.org> | 2008-05-22 22:38:29 +0000 |
|---|---|---|
| committer | exg <exg@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2008-05-22 22:38:29 +0000 |
| commit | f053542dcfd1739152c57eede2b882894911ca48 (patch) | |
| tree | ec5f8f8b4a0c78d0dd5dcb76847a29e329de0d1f /src/irc/dcc | |
| parent | 9f99376a8ac3d86d09bb5358753df2c3eaca5cae (diff) | |
| download | irssi-f053542dcfd1739152c57eede2b882894911ca48.zip | |
Extend net_sendbuffer by adding a LINEBUF_REC member and a net_sendbuffer_receive_line
function to read linewise from the associated io channel.
Rewrite irc/dcc/proxy read logic on top of it.
git-svn-id: file:///var/www/svn.irssi.org/SVN/irssi/trunk@4841 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/irc/dcc')
| -rw-r--r-- | src/irc/dcc/dcc-chat.c | 9 | ||||
| -rw-r--r-- | src/irc/dcc/dcc-chat.h | 1 | ||||
| -rw-r--r-- | src/irc/dcc/dcc-server.c | 9 | ||||
| -rw-r--r-- | src/irc/dcc/dcc-server.h | 1 |
4 files changed, 6 insertions, 14 deletions
diff --git a/src/irc/dcc/dcc-chat.c b/src/irc/dcc/dcc-chat.c index 782c33b3..61b69d73 100644 --- a/src/irc/dcc/dcc-chat.c +++ b/src/irc/dcc/dcc-chat.c @@ -24,7 +24,6 @@ #include "recode.h" #include "network.h" #include "net-sendbuffer.h" -#include "line-split.h" #include "misc.h" #include "settings.h" @@ -91,7 +90,6 @@ static void sig_dcc_destroyed(CHAT_DCC_REC *dcc) dcc_remove_chat_refs(dcc); if (dcc->sendbuf != NULL) net_sendbuffer_destroy(dcc->sendbuf, FALSE); - line_split_free(dcc->readbuf); g_free(dcc->id); } @@ -297,15 +295,14 @@ static void cmd_ctcp(const char *data, IRC_SERVER_REC *server) /* input function: DCC CHAT received some data.. */ void dcc_chat_input(CHAT_DCC_REC *dcc) { - char tmpbuf[512], *str; - int recvlen, ret; + char *str; + int ret; g_return_if_fail(IS_DCC_CHAT(dcc)); do { - recvlen = net_receive(dcc->handle, tmpbuf, sizeof(tmpbuf)); + ret = net_sendbuffer_receive_line(dcc->sendbuf, &str, 1); - ret = line_split(tmpbuf, recvlen, &str, &dcc->readbuf); if (ret == -1) { /* connection lost */ dcc->connection_lost = TRUE; diff --git a/src/irc/dcc/dcc-chat.h b/src/irc/dcc/dcc-chat.h index 62cb771f..c8f2cea9 100644 --- a/src/irc/dcc/dcc-chat.h +++ b/src/irc/dcc/dcc-chat.h @@ -13,7 +13,6 @@ struct CHAT_DCC_REC { #include "dcc-rec.h" char *id; /* unique identifier - usually same as nick. */ - LINEBUF_REC *readbuf; NET_SENDBUF_REC *sendbuf; unsigned int mirc_ctcp:1; /* Send CTCPs without the CTCP_MESSAGE prefix */ diff --git a/src/irc/dcc/dcc-server.c b/src/irc/dcc/dcc-server.c index 73a56d62..30224ff9 100644 --- a/src/irc/dcc/dcc-server.c +++ b/src/irc/dcc/dcc-server.c @@ -23,7 +23,6 @@ #include "commands.h" #include "network.h" #include "net-sendbuffer.h" -#include "line-split.h" #include "misc.h" #include "irc-servers.h" @@ -47,7 +46,6 @@ static void sig_dcc_destroyed(SERVER_DCC_REC *dcc) if (dcc->sendbuf != NULL) net_sendbuffer_destroy(dcc->sendbuf, FALSE); - line_split_free(dcc->readbuf); } /* Start listening for incoming connections */ @@ -65,15 +63,14 @@ static GIOChannel *dcc_listen_port(GIOChannel *iface, IPADDR *ip, int port) /* input function: DCC SERVER received some data.. */ static void dcc_server_input(SERVER_DCC_REC *dcc) { - char tmpbuf[512], *str; - int recvlen, ret; + char *str; + int ret; g_return_if_fail(IS_DCC_SERVER(dcc)); do { - recvlen = net_receive(dcc->handle, tmpbuf, sizeof(tmpbuf)); + ret = net_sendbuffer_receive_line(dcc->sendbuf, &str, 1); - ret = line_split(tmpbuf, recvlen, &str, &dcc->readbuf); if (ret == -1) { /* connection lost */ dcc_close(DCC(dcc)); diff --git a/src/irc/dcc/dcc-server.h b/src/irc/dcc/dcc-server.h index 4f6f248e..72435cbf 100644 --- a/src/irc/dcc/dcc-server.h +++ b/src/irc/dcc/dcc-server.h @@ -11,7 +11,6 @@ struct SERVER_DCC_REC { #include "dcc-rec.h" - LINEBUF_REC *readbuf; NET_SENDBUF_REC *sendbuf; unsigned int accept_send:1; /* Accept SEND connections */ |
