function removeClient(mail, key, callback) {
    var id;
    console.log("Removing mail " + mail + ", key " + key);
    if (!key) {
        // Delete all subscriptions of this mail address
        var i = registry.length;
        var found = false;
        while (i--) {
            if(registry[i].mail === mail) {
                id = hash(mail + registry[i].key);
                delete(registryMap[id]);
                registry.splice(i, 1);
                found = true;
            }
        }
        if (found === false) {
            callback(new errors.FieldError('mail', 'This mail address doesn\'t exist in storage.'));
            return;
        }
    } else {
        id = hash(mail + key);
        if (registryMap.hasOwnProperty(id)) {
            registry.splice(registryMap[id], 1);
            delete(registryMap[id]);
        } else {
            callback(new errors.FieldError('key', 'This combination of key and mail doesn\'t exist in storage.'));
            return;
        }
    }
    save(function(error) {
        if (typeof callback != 'function') {
            return;
        }
        if (error) {
            callback(error);
        } else {
            callback(null);
        }
    });
}
/**
 * Removes a client from the registry.
 *
 * @param mail
 * @param key
 * @param callback {function}
 */
Removes a client from the registry.
Removes a client from the registry .
function removeClient(mail, key, callback) {
    var id;
    console.log("Removing mail " + mail + ", key " + key);
    if (!key) {
        var i = registry.length;
        var found = false;
        while (i--) {
            if(registry[i].mail === mail) {
                id = hash(mail + registry[i].key);
                delete(registryMap[id]);
                registry.splice(i, 1);
                found = true;
            }
        }
        if (found === false) {
            callback(new errors.FieldError('mail', 'This mail address doesn\'t exist in storage.'));
            return;
        }
    } else {
        id = hash(mail + key);
        if (registryMap.hasOwnProperty(id)) {
            registry.splice(registryMap[id], 1);
            delete(registryMap[id]);
        } else {
            callback(new errors.FieldError('key', 'This combination of key and mail doesn\'t exist in storage.'));
            return;
        }
    }
    save(function(error) {
        if (typeof callback != 'function') {
            return;
        }
        if (error) {
            callback(error);
        } else {
            callback(null);
        }
    });
}
function removeClient ( mail , key , callback ) { var id ; console . log ( "Removing mail " + mail + ", key " + key ) ; if ( ! key ) { var i = registry . length ; var found = false ; while ( i -- ) { if ( registry [ i ] . mail === mail ) { id = hash ( mail + registry [ i ] . key ) ; delete ( registryMap [ id ] ) ; registry . splice ( i , 1 ) ; found = true ; } } if ( found === false ) { callback ( new errors . FieldError ( 'mail' , 'This mail address doesn\'t exist in storage.' ) ) ; return ; } } else { id = hash ( mail + key ) ; if ( registryMap . hasOwnProperty ( id ) ) { registry . splice ( registryMap [ id ] , 1 ) ; delete ( registryMap [ id ] ) ; } else { callback ( new errors . FieldError ( 'key' , 'This combination of key and mail doesn\'t exist in storage.' ) ) ; return ; } } save ( function ( error ) { if ( typeof callback != 'function' ) { return ; } if ( error ) { callback ( error ) ; } else { callback ( null ) ; } } ) ; }
Removes a client from the registry.
Removes a client from the registry .
// Delete all subscriptions of this mail address