Skip to content

Instantly share code, notes, and snippets.

@prof7bit
Created June 19, 2012 18:33
Show Gist options
  • Save prof7bit/2955776 to your computer and use it in GitHub Desktop.
Save prof7bit/2955776 to your computer and use it in GitHub Desktop.
{ This function is not what it seems to be. It will NOT simply be called
with the filename already known (as one might assume when looking
at its signature) instead it will be called with filename=nil when
the user clicks on the "Send File..." menu item. At this time there
has not yet been a file dialog to select the file, this will happen
when we call purple_xfer_request(). All the rest is then done from
within the callbacks that we are registering here. }
procedure torchat_send_file(gc: PPurpleConnection; who, filename: PChar); cdecl;
var
xfer: PPurpleXfer;
begin
Writeln(_F('send_file(%s, %s)', [who, filename]));
if not Assigned(filename) then begin
xfer := purple_xfer_new(gc^.account, PURPLE_XFER_SEND, who);
purple_xfer_set_init_fnc(xfer, @torchat_xfer_init);
purple_xfer_set_cancel_send_fnc(xfer, @torchat_xfer_cancel_send);
purple_xfer_set_end_fnc(xfer, @torchat_xfer_end);
purple_xfer_request(xfer);
end
else begin
// what else???
// I have no idea what it is supposed to mean when there
// is a file name already set. If you know: please tell me.
WriteLn('W send_file() has been called with a filename. Why? Does it even matter?');
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment