Example #1
0
static void dcc_request_send(DCC_REC *dcc)
{
    g_return_if_fail(dcc != NULL);

    printformat(dcc->server, NULL, MSGLEVEL_DCC, IRCTXT_DCC_REQUEST_SEND,
                dcc_type2str(dcc->type), dcc->nick, dcc->arg);
}
Example #2
0
static void dcc_rejected(DCC_REC *dcc)
{
    g_return_if_fail(dcc != NULL);

    printformat(dcc->server, NULL, MSGLEVEL_DCC, IRCTXT_DCC_CLOSE,
                dcc_type2str(dcc->type), dcc->nick, dcc->arg);
}
Example #3
0
void dcc_list_print_file(FILE_DCC_REC *dcc)
{
    time_t going;

    going = time(NULL) - dcc->starttime;
    if (going == 0) going = 1; /* no division by zeros :) */

    printformat(NULL, NULL, MSGLEVEL_DCC,
                IRCTXT_DCC_LIST_LINE_FILE,
                dcc->nick, dcc_type2str(dcc->type),
                (dcc->transfd+1023)/1024, (dcc->size+1023)/1024,
                dcc->size == 0 ? 0 : (int)((double)dcc->transfd/(double)dcc->size*100.0),
                (double) (dcc->transfd-dcc->skipped)/going/1024, dcc->arg);
}
Example #4
0
static void cmd_dcc_list(const char *data)
{
	GSList *tmp;
	time_t going;

	g_return_if_fail(data != NULL);

	printformat(NULL, NULL, MSGLEVEL_DCC, IRCTXT_DCC_LIST_HEADER);
	for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) {
		DCC_REC *dcc = tmp->data;

		going = time(NULL) - dcc->starttime;
		if (going == 0) going = 1; /* no division by zeros :) */

		if (dcc->type == DCC_TYPE_CHAT)
			printformat(NULL, NULL, MSGLEVEL_DCC, IRCTXT_DCC_LIST_LINE_CHAT, dcc->nick, dcc_type2str(dcc->type));
		else
			printformat(NULL, NULL, MSGLEVEL_DCC, IRCTXT_DCC_LIST_LINE_FILE,
				  dcc->nick, dcc_type2str(dcc->type), dcc->transfd/1024, dcc->size/1024,
				  dcc->size == 0 ? 0 : (100*dcc->transfd/dcc->size),
				  (double) (dcc->transfd-dcc->skipped)/going/1024, dcc->arg);
	}
	printformat(NULL, NULL, MSGLEVEL_DCC, IRCTXT_DCC_LIST_FOOTER);
}
Example #5
0
/* Reject a DCC request */
void dcc_reject(DCC_REC *dcc, IRC_SERVER_REC *server)
{
	g_return_if_fail(dcc != NULL);

	signal_emit("dcc rejected", 1, dcc);

	if (dcc->server != NULL)
		server = dcc->server;

	if (server != NULL && !dcc_is_connected(dcc)) {
		irc_send_cmdv(server, "NOTICE %s :\001DCC REJECT %s %s\001",
			      dcc->nick, dcc_type2str(dcc->orig_type),
			      dcc->arg);
	}

	dcc_close(dcc);
}
Example #6
0
static void dcc_reject(DCC_REC *dcc, IRC_SERVER_REC *server)
{
    char *str;

    g_return_if_fail(dcc != NULL);

    if (dcc->server != NULL) server = dcc->server;
    if (server != NULL && (dcc->type != DCC_TYPE_CHAT || dcc->starttime == 0))
    {
        signal_emit("dcc rejected", 1, dcc);
        str = g_strdup_printf("NOTICE %s :\001DCC REJECT %s %s\001",
                              dcc->nick, dcc_type2str(SWAP_SENDGET(dcc->type)), dcc->arg);

        irc_send_cmd(server, str);
        g_free(str);
    }

    signal_emit("dcc closed", 1, dcc);
    dcc_destroy(dcc);
}