/usr/lib/nodejs/node-xmpp/idle_timeout.js is in node-node-xmpp 0.3.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | /**
 * Emulates stream.setTimeout() behaviour, but respects outgoing data
 * too.
 *
 * @param {Number} timeout Milliseconds
 */
exports.attach = function(stream, timeout) {
    var timer;
    var emitTimeout = function() {
        timer = undefined;
        stream.emit('timeout');
    };
    var updateTimer = function() {
        if (timer)
            clearTimeout(timer);
        timer = setTimeout(emitTimeout, timeout);
    };
    var oldWrite = stream.write;
    stream.write = function() {
        updateTimer();
        oldWrite.apply(this, arguments);
    };
    var clear = function() {
    	if (timer)
    		clearTimeout(timer);
    	if (stream.write !== oldWrite)
        	stream.write = oldWrite;
	delete stream.clearTimer;
    };
    stream.clearTimer = clear;
    stream.addListener('data', updateTimer);
    stream.addListener('error', clear);
    stream.addListener('close', clear);
    stream.addListener('end', clear);
};
 |