Beispiel #1
0
/**
 * Gaim calls this function when the user selects Send File from the
 * buddy menu
 * It sets up the GaimXfer struct and tells Gaim to go ahead
 */
void irc_dccsend_send_file(GaimConnection *gc, const char *who, const char *file) {
	GaimXfer *xfer = irc_dccsend_new_xfer(gc, who);

	/* Perform the request */
	if (file)
		gaim_xfer_request_accepted(xfer, file);
	else
		gaim_xfer_request(xfer);
}
Beispiel #2
0
static void
file_recv_request_cb(GaimXfer *xfer, gpointer handle)
{
	GaimAccount *account;
	GaimBlistNode *node;
	const char *pref;
	char *filename;
	char *dirname;

	account = xfer->account;
	node = (GaimBlistNode *)gaim_find_buddy(account, xfer->who);

	if (!node)
	{
		if (gaim_prefs_get_bool(PREF_STRANGER))
			xfer->status = GAIM_XFER_STATUS_CANCEL_LOCAL;
		return;
	}

	node = node->parent;
	g_return_if_fail(GAIM_BLIST_NODE_IS_CONTACT(node));

	pref = gaim_prefs_get_string(PREF_PATH);
	switch (gaim_blist_node_get_int(node, "autoaccept"))
	{
		case FT_ASK:
			break;
		case FT_ACCEPT:
			if (ensure_path_exists(pref))
			{
				dirname = g_build_filename(pref, xfer->who, NULL);

				if (!ensure_path_exists(dirname))
				{
					g_free(dirname);
					break;
				}
				
				filename = g_build_filename(dirname, xfer->filename, NULL);

				gaim_xfer_request_accepted(xfer, filename);

				g_free(dirname);
				g_free(filename);
			}
			
			gaim_signal_connect(gaim_xfers_get_handle(), "file-recv-complete", handle,
								GAIM_CALLBACK(auto_accept_complete_cb), xfer);
			break;
		case FT_REJECT:
			xfer->status = GAIM_XFER_STATUS_CANCEL_LOCAL;
			break;
	}
}
Beispiel #3
0
Datei: si.c Projekt: VoxOx/VoxOx
void jabber_si_xfer_send(GaimConnection *gc, const char *who, const char *file)
{
	JabberStream *js;

	GaimXfer *xfer;

	js = gc->proto_data;

	if(!gaim_find_buddy(gc->account, who) || !jabber_buddy_find(js, who, FALSE))
		return;

	xfer = jabber_si_new_xfer(gc, who);

	if (file)
		gaim_xfer_request_accepted(xfer, file);
	else
		gaim_xfer_request(xfer);
}
Beispiel #4
0
/**
 * Gaim calls this function when the user selects Send File from the
 * buddy menu
 * It sets up the GaimXfer struct and tells Gaim to go ahead
 */
void gaym_dccsend_send_file(GaimConnection *gc, const char *who, const char *file) {
	GaimXfer *xfer;
	struct gaym_xfer_send_data *xd;

	/* Build the file transfer handle */
	xfer = gaim_xfer_new(gaim_connection_get_account(gc), GAIM_XFER_SEND, who);


	xd = g_new0(struct gaym_xfer_send_data, 1);
	xd->fd = -1;
	xfer->data = xd;

	 /* Setup our I/O op functions */
	gaim_xfer_set_init_fnc(xfer, gaym_dccsend_send_init);
	gaim_xfer_set_write_fnc(xfer, gaym_dccsend_send_write);
	gaim_xfer_set_end_fnc(xfer, gaym_dccsend_send_destroy);
	gaim_xfer_set_request_denied_fnc(xfer, gaym_dccsend_send_destroy);
	gaim_xfer_set_cancel_send_fnc(xfer, gaym_dccsend_send_destroy);
	/* Now perform the request */
	if (file)
		gaim_xfer_request_accepted(xfer, file);
	else
		gaim_xfer_request(xfer);
}