Ejemplo n.º 1
0
static int dcc_ctcp_resume_parse(int type, const char *data, const char *nick,
				 FILE_DCC_REC **dcc, uoff_t *size, int *pasv_id)
{
	char **params;
	int paramcount, fileparams;
	int port;

	/* RESUME|ACCEPT <file name> <port> <size> */
	/* RESUME|ACCEPT <file name> 0 <size> <id> (passive protocol) */
	params = g_strsplit(data, " ", -1);
	paramcount = strarray_length(params);

	if (paramcount < 3)
		return 0;

	fileparams = get_file_params_count_resume(params, paramcount);

	if (paramcount >= fileparams + 2) {
		port = atoi(params[fileparams]);
		*size = str_to_uofft(params[fileparams+1]);
		*pasv_id = ((port == 0) && (paramcount == fileparams + 3)) ? atoi(params[fileparams+2]) : -1;
		*dcc = dcc_resume_find(type, nick, port);
		g_strfreev(params);

		/* If the ID is different then the DCC cannot be resumed */
		return ((*dcc != NULL) && ((*dcc)->pasv_id == *pasv_id));
	}
	g_strfreev(params);
	return FALSE;
}
Ejemplo n.º 2
0
static int dcc_ctcp_resume_parse(int type, const char *data, const char *nick,
				 FILE_DCC_REC **dcc, long *size)
{
	char **params;
	int paramcount;
        int port;

	/* RESUME|ACCEPT <file name> <port> <size> */
	params = g_strsplit(data, " ", -1);
	paramcount = strarray_length(params);

	if (paramcount >= 3) {
		port = atoi(params[paramcount-2]);
		*size = atol(params[paramcount-1]);

		*dcc = dcc_resume_find(type, nick, port);
	}
	g_strfreev(params);
	return paramcount >= 3;
}