FiletransferInit

From TrillWiki

Jump to: navigation, search

The filetransferInit function will initiate either an incoming or outgoing file transfer. A medium plugin may use this to initiate an outgoing file transfer and may also use this to show an incoming file transfer window on incoming transfers.

Compatibility: 2.0 and higher

Contents

Syntax

plugin_send(MYGUID, "filetransferInit", struct filetransfer_init_t *);

Note that all Trillian functions and notifications begin with a lower-case letter, despite the Wiki requirement that all pages start with a capital letter.

Parameters

FiletransferInit utilitizes the filetransfer_init_t structure.

struct filetransfer_init_t {  
 	unsigned int				struct_size; 
 
 	char					*medium; 
 
 	int					connection_id; 
 	int					filetransfer_id; 
 
 	/* status of the transfer */ 
 	int					accepted; 
 	int					resume; 
 
 	/* preferences */ 
 	int					incoming; 
 	int					ask_resume; 
 	int					ask_location; 
 	int					ask_screen_name; 
 	int					ask_medium; 
 	int					ask_description; 
 	int					ask_confirmation; 
 							 
 	int					in_contact_list;  
 
 	unsigned int				file_size; 
 	unsigned int				start_size; /* for resuming */ 
 
 	char					*local_screen_name; 
 	char					*remote_screen_name; 
 							 
 	char					*filename; 
 	char					*description; 
 	 
 	ttkCallback				callback; 
 
 	void					*data; 
 };



medium
The medium for the file transfer.
connection_id
The connection id associated with the file transfer.
incoming
Set if the file transfer is incoming. Set this to 0 if it is an outgoing file transfer
ask_resume
If the medium supports file resuming, set this to 1.
ask_location
If the filename is not set yet, set this to 1 so the user can choose a location. Also, this may be set to 1 on outgoing transfers if the file is not set yet.
ask_screen_name
If its an outgoing file transfer and the destination user is not set yet, set this to 1. (Not available currently)
ask_medium
If the medium is not set yet, set this to 1. (Not available currently)
ask_description
If the medium allows descriptions along with the file transfer, set this to 1 to ask the user for the description.
ask_confirmation
If the medium may require a confirmation before sending the file, set this to 1. This will make Trillian call a filetransfer_request before initiating the transfer.
in_contact_list
If the user is within the contact list on this connection, set this to 1 so that preferences for file transfers may be used to auto-accept, etc.
start_size
The initial size of the file transfer. This is used for speed calculations for resumed file transfers.
local_screen_name
The local screen name of the file transfer.
remote_screen_name
The remote screen name of the file transfer.
filename
The file to receive or send.
callback
The callback to use with the file transfer events.
data
The data to send with the above callback.


Return Value

Negative value on error, file transfer id on success.

Remarks

fileTransferInit was designed for use by the owning medium. It will work improperly if called from other plugins. -eh?one


Personal tools