/* input function: DCC SERVER received some data.. */ static void dcc_server_input(SERVER_DCC_REC *dcc) { char *str; int ret; g_return_if_fail(IS_DCC_SERVER(dcc)); do { ret = net_sendbuffer_receive_line(dcc->sendbuf, &str, 1); if (ret == -1) { /* connection lost */ dcc_close(DCC(dcc)); break; } if (ret > 0) { dcc->transfd += ret; signal_emit("dcc server message", 2, dcc, str); } if (dcc->connection_established) { /* We set handle to NULL first because the new (chat/get) is using the same */ /* handle and we don't want dcc_close to disconnect it.*/ dcc->handle = NULL; dcc_close(DCC(dcc)); break; } } while (ret > 0); }
static void sig_listen_client(CLIENT_REC *client) { char *str, *cmd, *args; int ret; g_return_if_fail(client != NULL); while (g_slist_find(proxy_clients, client) != NULL) { ret = net_sendbuffer_receive_line(client->handle, &str, 1); if (ret == -1) { /* connection lost */ remove_client(client); break; } if (ret == 0) break; cmd = g_strdup(str); args = strchr(cmd, ' '); if (args != NULL) *args++ = '\0'; else args = ""; if (*args == ':') args++; ascii_strup(cmd); handle_client_cmd(client, cmd, args, str); g_free(cmd); } }
/* input function: DCC CHAT received some data.. */ void dcc_chat_input(CHAT_DCC_REC *dcc) { char *str; int ret; g_return_if_fail(IS_DCC_CHAT(dcc)); do { ret = net_sendbuffer_receive_line(dcc->sendbuf, &str, 1); if (ret == -1) { /* connection lost */ dcc->connection_lost = TRUE; dcc_close(DCC(dcc)); break; } if (ret > 0) { char *recoded; dcc->transfd += ret; recoded = recode_in(SERVER(dcc->server), str, dcc->nick); signal_emit("dcc chat message", 2, dcc, recoded); g_free(recoded); } } while (ret > 0); }