CIRCDCCFileTransfer.request Member

Call to make this end offer DCC File to targeted user.

Syntax

object.request(localFile);

Arguments

ArgumentSummary
localFile

Returns

Remarks

See Also

Source Code

function dfile_request(localFile)
{
this.state.sendRequest();
this.localFile = new LocalFile(localFile, "<");
this.filename = localFile.leafName;
this.size = localFile.fileSize;
// Update view name.
this.viewName = "File: " + this.filename;
// Double-quote file names with spaces.
// FIXME: Do we need any better checking?
if (this.filename.match(/ /))
this.filename = '"' + this.filename + '"';
this.localIP = this.parent.localIP;
this.connection = new CBSConnection(true);
if (!this.connection.listen(this.port, this))
{
this.state.failed();
this.dispose();
return false;
}
this.port = this.connection.port;
// Send the CTCP DCC request via the net user (CIRCUser object).
var ipNumber;
var ipParts = this.localIP.match(/(\d+)\.(\d+)\.(\d+)\.(\d+)/);
if (ipParts)
ipNumber = Number(ipParts[1]) * 256 * 256 * 256 +
Number(ipParts[2]) * 256 * 256 +
Number(ipParts[3]) * 256 +
Number(ipParts[4]);
else
return false;
// What should we do here? Panic?
this.user.netUser.ctcp("DCC", "SEND " + this.filename + " " +
ipNumber + " " + this.port + " " + this.size);
return true;
}