mirror of
https://github.com/irssi/irssi.git
synced 2026-08-18 16:12:30 +02:00
Fixed DCC stuff. Added DCCMSGS level for DCC chat messages.
Actions match now either MSGS or PUBLIC level as well as the ACTIONS level always. Added DCCMSGS level to default highlight levels. Highlighting works with other than public messages now even if -nick option is used. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@463 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
1b736a68a7
commit
796d51afe4
10 changed files with 54 additions and 35 deletions
|
|
@ -198,7 +198,7 @@ static void dcc_chat_listen(DCC_REC *dcc)
|
|||
|
||||
/* TODO: add paranoia check - see dcc-files.c */
|
||||
|
||||
g_source_remove(dcc->tagread);
|
||||
g_source_remove(dcc->tagconn);
|
||||
close(dcc->handle);
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
|
|
@ -217,7 +217,6 @@ static void sig_chat_connected(DCC_REC *dcc)
|
|||
{
|
||||
g_return_if_fail(dcc != NULL);
|
||||
|
||||
g_source_remove(dcc->tagread);
|
||||
if (net_geterror(dcc->handle) != 0) {
|
||||
/* error connecting */
|
||||
signal_emit("dcc error connect", 1, dcc);
|
||||
|
|
@ -226,6 +225,7 @@ static void sig_chat_connected(DCC_REC *dcc)
|
|||
}
|
||||
|
||||
/* connect ok. */
|
||||
g_source_remove(dcc->tagconn);
|
||||
dcc->starttime = time(NULL);
|
||||
dcc->tagread = g_input_add(dcc->handle, G_INPUT_READ,
|
||||
(GInputFunction) dcc_chat_input, dcc);
|
||||
|
|
@ -245,7 +245,7 @@ static void dcc_chat_connect(DCC_REC *dcc)
|
|||
dcc->handle = net_connect_ip(&dcc->addr, dcc->port,
|
||||
source_host_ok ? source_host_ip : NULL);
|
||||
if (dcc->handle != -1) {
|
||||
dcc->tagread = g_input_add(dcc->handle, G_INPUT_WRITE|G_INPUT_READ|G_INPUT_EXCEPTION,
|
||||
dcc->tagconn = g_input_add(dcc->handle, G_INPUT_WRITE|G_INPUT_READ|G_INPUT_EXCEPTION,
|
||||
(GInputFunction) sig_chat_connected, dcc);
|
||||
} else {
|
||||
/* error connecting */
|
||||
|
|
@ -290,7 +290,7 @@ static void cmd_dcc_chat(const char *data, IRC_SERVER_REC *server)
|
|||
cmd_param_error(CMDERR_ERRNO);
|
||||
|
||||
dcc = dcc_create(DCC_TYPE_CHAT, handle, nick, "chat", server, NULL);
|
||||
dcc->tagread = g_input_add(dcc->handle, G_INPUT_READ,
|
||||
dcc->tagconn = g_input_add(dcc->handle, G_INPUT_READ,
|
||||
(GInputFunction) dcc_chat_listen, dcc);
|
||||
|
||||
/* send the request */
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ void dcc_get_send_received(DCC_REC *dcc)
|
|||
count_buf should be re-sent.. also, if it's 1, 2 or 3, the
|
||||
last 1-3 bytes should be sent later. these happen probably
|
||||
never, but I just want to do it right.. :) */
|
||||
if (dcc->tagwrite != -1) {
|
||||
if (dcc->tagwrite == -1) {
|
||||
dcc->tagwrite = g_input_add(dcc->handle, G_INPUT_WRITE,
|
||||
(GInputFunction) sig_dccget_send, dcc);
|
||||
}
|
||||
|
|
@ -151,7 +151,6 @@ static void sig_dccget_connected(DCC_REC *dcc)
|
|||
|
||||
g_return_if_fail(dcc != NULL);
|
||||
|
||||
g_source_remove(dcc->tagread);
|
||||
if (net_geterror(dcc->handle) != 0) {
|
||||
/* error connecting */
|
||||
signal_emit("dcc error connect", 1, dcc);
|
||||
|
|
@ -159,6 +158,8 @@ static void sig_dccget_connected(DCC_REC *dcc)
|
|||
return;
|
||||
}
|
||||
|
||||
g_source_remove(dcc->tagconn);
|
||||
|
||||
g_free_not_null(dcc->file);
|
||||
dcc->file = dcc_get_download_path(dcc->arg);
|
||||
|
||||
|
|
@ -196,7 +197,7 @@ static void dcc_get_connect(DCC_REC *dcc)
|
|||
dcc->handle = net_connect_ip(&dcc->addr, dcc->port,
|
||||
source_host_ok ? source_host_ip : NULL);
|
||||
if (dcc->handle != -1) {
|
||||
dcc->tagread = g_input_add(dcc->handle, G_INPUT_WRITE|G_INPUT_READ|G_INPUT_EXCEPTION,
|
||||
dcc->tagconn = g_input_add(dcc->handle, G_INPUT_WRITE|G_INPUT_READ|G_INPUT_EXCEPTION,
|
||||
(GInputFunction) sig_dccget_connected, dcc);
|
||||
} else {
|
||||
/* error connecting */
|
||||
|
|
@ -458,7 +459,7 @@ static void dcc_send_init(DCC_REC *dcc)
|
|||
that the host of the nick who we sent the request matches the
|
||||
address who connected us. */
|
||||
|
||||
g_source_remove(dcc->tagread);
|
||||
g_source_remove(dcc->tagconn);
|
||||
close(dcc->handle);
|
||||
|
||||
dcc->starttime = time(NULL);
|
||||
|
|
@ -562,7 +563,7 @@ static void cmd_dcc_send(const char *data, IRC_SERVER_REC *server, WI_IRC_REC *i
|
|||
dcc->port = port;
|
||||
dcc->size = fsize;
|
||||
dcc->fhandle = hfile;
|
||||
dcc->tagread = g_input_add(hlisten, G_INPUT_READ,
|
||||
dcc->tagconn = g_input_add(hlisten, G_INPUT_READ,
|
||||
(GInputFunction) dcc_send_init, dcc);
|
||||
|
||||
/* send DCC request */
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ DCC_REC *dcc_create(int type, int handle, const char *nick, const char *arg,
|
|||
dcc->nick = g_strdup(nick);
|
||||
dcc->handle = handle;
|
||||
dcc->fhandle = -1;
|
||||
dcc->tagread = dcc->tagwrite = -1;
|
||||
dcc->tagconn = dcc->tagread = dcc->tagwrite = -1;
|
||||
dcc->server = server;
|
||||
dcc->mynick = g_strdup(server != NULL ? server->nick :
|
||||
chat != NULL ? chat->nick : "??");
|
||||
|
|
@ -110,6 +110,7 @@ void dcc_destroy(DCC_REC *dcc)
|
|||
|
||||
if (dcc->fhandle != -1) close(dcc->fhandle);
|
||||
if (dcc->handle != -1) net_disconnect(dcc->handle);
|
||||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ typedef struct DCC_REC {
|
|||
|
||||
long size, transfd, skipped; /* file size / bytes transferred / skipped at start */
|
||||
int handle; /* socket handle */
|
||||
int tagread, tagwrite;
|
||||
int tagconn, tagread, tagwrite;
|
||||
int fhandle; /* file handle */
|
||||
time_t starttime; /* transfer start time */
|
||||
int trans_bytes;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue