CIRCDCC Prototype

Syntax

var object = new CIRCDCC(parent);

Arguments

ArgumentSummary
parent

Remarks

Members

MemberSummary
addChat
addFileTransfer
addHost
addIP
addUser
findByID
getMatches
getNextID
getNextPort

See Also

Source Code

function CIRCDCC(parent)
{
this.parent = parent;
this.users = new Object();
this.chats = new Array();
this.files = new Array();
this.last = null;
this.lastTime = null;
this.sendChunk = 4096;
this.maxUnAcked = 32; // 4096 * 32 == 128KiB 'in transit'.
this.requestTimeout = 3 * 60 * 1000; // 3 minutes.
// Can't do anything 'til this is set!
this.localIPlist = new Array();
this.localIP = null;
this._lastPort = null;
try {
var dnsComp = Components.classes["@mozilla.org/network/dns-service;1"];
this._dnsSvc = dnsComp.getService(Components.interfaces.nsIDNSService);
// Get local hostname.
if ("myHostName" in this._dnsSvc) {
// Using newer (1.7a+) version with DNS re-write.
this.addHost(this._dnsSvc.myHostName);
}
if ("myIPAddress" in this._dnsSvc) {
// Older Mozilla, have to use this method.
this.addIP(this._dnsSvc.myIPAddress);
}
this.addHost("localhost");
} catch(ex) {
// what to do?
dd("Error getting local IPs: " + ex);
}
this._lastID = Math.round(Math.random() * DCC_ID_MAX);
return this;
}