/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
/*
 * Copyright (c) 2013 University of California, Los Angeles
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Alexander Afanasyev <alexander.afanasyev@ucla.edu>
 */

#include <QtCore>

#include "dispatcher.h"
#include "fs-watcher.h"
#include "logging.h"
#include "ccnx-wrapper.h"

#include <boost/make_shared.hpp>

using namespace boost;
using namespace std;
using namespace Ccnx;

int main(int argc, char *argv[])
{
  INIT_LOGGERS ();

  QCoreApplication app(argc, argv);

  if (argc != 4)
    {
      cerr << "Usage: ./csd <username> <shared-folder> <path>" << endl;
      return 1;
    }

  string username = argv[1];
  string sharedFolder = argv[2];
  string path = argv[3];

  cout << "Starting ChronoShare for [" << username << "] shared-folder [" << sharedFolder << "] at [" << path << "]" << endl;

  Dispatcher dispatcher (username, sharedFolder, path, make_shared<CcnxWrapper> ());

  FsWatcher watcher (path.c_str (),
                     bind (&Dispatcher::Did_LocalFile_AddOrModify, &dispatcher, _1),
                     bind (&Dispatcher::Did_LocalFile_Delete,      &dispatcher, _1));

  return app.exec ();
}
