2005-11-05 23:04:33 +01:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2005 Patrick Ohly
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
2005-10-08 14:03:24 +02:00
|
|
|
|
2005-11-05 23:04:33 +01:00
|
|
|
#include <base/Log.h>
|
2005-11-25 21:53:04 +01:00
|
|
|
#include <posix/base/posixlog.h>
|
2005-11-05 23:04:33 +01:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
#include "EvolutionContactSource.h"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* list all known data sources of a certain type
|
|
|
|
*/
|
|
|
|
static void listSources( EvolutionSyncSource &syncSource, const string &header )
|
|
|
|
{
|
|
|
|
cout << header << ":\n";
|
|
|
|
EvolutionSyncSource::sources sources = syncSource.getSyncBackends();
|
|
|
|
|
|
|
|
for( EvolutionSyncSource::sources::const_iterator it = sources.begin();
|
|
|
|
it != sources.end();
|
|
|
|
it++ ) {
|
|
|
|
cout << it->m_name << ": " << it->m_uri << "\n";
|
|
|
|
}
|
|
|
|
}
|
2005-10-08 14:03:24 +02:00
|
|
|
|
|
|
|
int main( int argc, char **argv )
|
|
|
|
{
|
2005-11-05 23:04:33 +01:00
|
|
|
setLogFile("-");
|
|
|
|
LOG.reset();
|
|
|
|
LOG.setLevel(LOG_LEVEL_DEBUG);
|
|
|
|
resetError();
|
|
|
|
|
|
|
|
try {
|
|
|
|
if ( argc != 2 ) {
|
|
|
|
EvolutionContactSource contactSource( string( "list" ) );
|
|
|
|
|
|
|
|
listSources( contactSource, "address books" );
|
|
|
|
|
|
|
|
fprintf( stderr, "usage: %s <server>\n", argv[0] );
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
} catch ( int sync4jerror ) {
|
|
|
|
LOG.error( lastErrorMsg );
|
|
|
|
} catch ( string *errmsg ) {
|
|
|
|
LOG.error( errmsg->c_str() );
|
|
|
|
delete errmsg;
|
|
|
|
} catch ( const char *errmsg ) {
|
|
|
|
LOG.error( errmsg );
|
|
|
|
} catch (...) {
|
|
|
|
LOG.error( "unknown error" );
|
|
|
|
}
|
|
|
|
|
2005-10-08 14:03:24 +02:00
|
|
|
return 0;
|
|
|
|
}
|