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
This commit is contained in:
Emanuele Giaquinta 2008-05-22 22:38:29 +00:00 committed by exg
commit f053542dcf
12 changed files with 33 additions and 50 deletions

View file

@ -50,7 +50,6 @@ static void remove_client(CLIENT_REC *rec)
g_free(rec->proxy_address);
net_sendbuffer_destroy(rec->handle, TRUE);
g_source_remove(rec->recv_tag);
line_split_free(rec->buffer);
g_free_not_null(rec->nick);
g_free_not_null(rec->host);
g_free(rec);
@ -296,14 +295,13 @@ static void handle_client_cmd(CLIENT_REC *client, char *cmd, char *args,
static void sig_listen_client(CLIENT_REC *client)
{
char tmpbuf[1024], *str, *cmd, *args;
int ret, recvlen;
char *str, *cmd, *args;
int ret;
g_return_if_fail(client != NULL);
while (g_slist_find(proxy_clients, client) != NULL) {
recvlen = net_receive(client->handle->handle, tmpbuf, sizeof(tmpbuf));
ret = line_split(tmpbuf, recvlen, &str, &client->buffer);
ret = net_sendbuffer_receive_line(client->handle, &str, 1);
if (ret == -1) {
/* connection lost */
remove_client(client);

View file

@ -3,7 +3,6 @@
#define MODULE_NAME "proxy"
#include "network.h"
#include "line-split.h"
#include "irc.h"
#include "irc-servers.h"
@ -18,8 +17,6 @@ typedef struct {
} LISTEN_REC;
typedef struct {
LINEBUF_REC *buffer;
char *nick, *host;
NET_SENDBUF_REC *handle;
int recv_tag;