// index.js
//
// main module for Webfinger
// 
// Copyright 2012, StatusNet Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

var async = require("async"),
    http = require("http"),
    https = require("https"),
    xml2js = require("xml2js");

var xrd2jrd = function(str) {
    return null;
};

var webfinger = function(address, callback) {
};

var hostmeta = function(address, callback) {
};

var discover = function(address, callback) {
    if (address.indexOf("@") !== -1) {
        webfinger(address, callback);
    } else {
        hostmeta(address, callback);
    }
};

exports.xrd2jrd = xrd2jrd;
exports.webfinger = webfinger;
exports.hostmeta = hostmeta;
exports.discover = discover;

@@ -638,21 +638,20 @@
 e.%0A%0Avar 
-async
+Step
  = requi
@@ -658,13 +658,12 @@
 re(%22
-async
+step
 %22),%0A
@@ -791,19 +791,46 @@
     
-return null
+throw new Error(%22Not yet implemented%22)
 ;%0A%7D;
@@ -881,56 +881,164 @@
 ) %7B%0A
-%7D;%0A%0Avar hostmeta = function(address, callback) %7B
+    callback(new Error(%22Not yet implemented%22), null);%0A%7D;%0A%0Avar hostmeta = function(address, callback) %7B%0A    callback(new Error(%22Not yet implemented%22), null);
 %0A%7D;%0A

throw a not-yet-implemented error