<commit_before>/*
 * @package jsDAV
 * @subpackage DAV
 * @copyright Copyright(c) 2011 Ajax.org B.V. <info AT ajax DOT org>
 * @author <NAME> <mail AT luismerino DOT name>
 * @license http://github.com/mikedeboer/jsDAV/blob/master/LICENSE MIT License
 */
 
var jsDAV_ServerPlugin = require("./../plugin").jsDAV_ServerPlugin;
var Exc = require("../exceptions");

/**
 * Ftp Plugin
 *
 * The purpose of this plugin is to rebase the uri calculation for
 * 'trees' which happen to lack a root node in their listing command(s)
 * this is specially intended for FTP implementations and alike.
 *
 * Also takes care of initializing the FTP server connection, followed by
 * determining the FTP server's time zone with a different between LIST and MDTM
 * FTP commands to reckon the hour difference value.
 */
function jsDAV_Ftp_Plugin(handler) {
    this.handler = handler;
    this.initialize();
}

(function() {
    /** Redefines handler::invoke to delay request handling. This allows any middleware functionality like user authentication and whatnot
      * to be dealt with before the request gets dispatched, giving time to login and prepare the FTP server for ready state.
      * 
      * @throws jsDAV_Exception_Forbidden
      * @return void 
     */
    this.initialize = function() {
        var tree = this.tree = this.handler.server.tree;
        var conn = tree.ftp;
        
        if (typeof conn == 'undefined')
            return;
        // Fix node root path for FTP clients
        fixRootNodeUri(this.handler);
        
        if (tree.$ready) {
            // Use event to dispatch methods as stateful.
            return this.handler.addEventListener("beforeMethod", this.handleState.bind(this));
        }
        // Once the Ftp server is ready, all instances of handler can be run after being halted
        var oldInvoke = this.handler.invoke,
            _self = this,
            args;
        
        this.handler.invoke = function(){
            args = Array.prototype.slice.call(arguments);
        };
        
        this.handler.server.tree.ftp.on("ftp.ready", function(oldInvoke, args) {
            if (!tree.$ready)
                console.info('Ftp connection ready on: '+ conn.options.host);<commit_msg>update last commit<commit_after>/*
 * @package jsDAV
 * @subpackage DAV
 * @copyright Copyright(c) 2011 Ajax.org B.V. <info AT ajax DOT org>
 * @author <NAME> <mail AT luismerino DOT name>
 * @license http://github.com/mikedeboer/jsDAV/blob/master/LICENSE MIT License
 */
 
var jsDAV_ServerPlugin = require("./../plugin").jsDAV_ServerPlugin;
var Exc = require("../exceptions");
 
/**
 * Ftp Plugin
 *
 * The purpose of this plugin is to rebase the uri calculation for
 * 'trees' which happen to lack a root node in their listing command(s)
 * this is specially intended for FTP implementations and alike.
 *
 * Also takes care of initializing the FTP server connection, followed by
 * determining the FTP server's time zone with a different between LIST and MDTM
 * FTP commands to reckon the hour difference value.
 */
function jsDAV_Ftp_Plugin(handler) {
    this.handler = handler;
    this.initialize();
}

(function() {
    /** Redefines handler::invoke to delay request handling. This allows any middleware functionality like user authentication and whatnot
      * to be dealt with before the request gets dispatched, giving time to login and prepare the FTP server for ready state.
      * 
      * @throws jsDAV_Exception_Forbidden
      * @return void 
     */
    this.initialize = function() {
        var tree = this.tree = this.handler.server.tree;
        var conn = tree.ftp;
        
        if (typeof conn == 'undefined')
            return;

        fixRootNodeUri(this.handler);

        if (tree.$ready) {
            // Use event to dispatch methods as stateful.
            return this.handler.addEventListener("beforeMethod", this.handleState.bind(this));
        }
        // Once the Ftp server is ready, all instances of handler can be run after being halted
        var oldInvoke = this.handler.invoke,
            _self = this,
            args;
        
        this.handler.invoke = function(){
            args = Array.prototype.slice.call(arguments);
        };
        
        this.handler.server.tree.ftp.on("ftp.ready", function(oldInvoke, args) {
            if (!tree.$ready)
                console.info('Ftp connection ready on: '+ conn.options.host);
{'fraction_non_alphanumeric': 0.09609745093616061, 'fraction_numerical': 0.0018046469659372885, 'mean_word_length': 2.58447857720291, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3271727', 'n_tokens_mistral': 1239, 'n_tokens_neox': 1181, 'n_words': 426}