From 64df902cf71a8ee258fb85f6be26248f399aa01f Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Sun, 27 Jan 2013 01:05:15 -0600 Subject: Rename a number of libraries and executables to avoid conflicts with KDE4 --- tderesources/groupwise/CMakeLists.txt | 2 +- tderesources/groupwise/Makefile.am | 2 +- tderesources/groupwise/kabc_resourcegroupwise.cpp | 2 +- tderesources/groupwise/kabc_resourcegroupwise.h | 2 +- .../groupwise/kcal_groupwiseprefsbase.kcfgc | 2 +- tderesources/groupwise/kcal_resourcegroupwise.h | 4 +- tderesources/groupwise/kioslave/CMakeLists.txt | 39 -- tderesources/groupwise/kioslave/Makefile.am | 19 - tderesources/groupwise/kioslave/groupwise.cpp | 426 --------------------- tderesources/groupwise/kioslave/groupwise.h | 54 --- tderesources/groupwise/kioslave/groupwise.protocol | 7 - .../groupwise/kioslave/groupwises.protocol | 7 - tderesources/groupwise/soap/groupwiseserver.cpp | 6 +- tderesources/groupwise/soap/groupwiseserver.h | 4 +- tderesources/groupwise/soap/ksslsocket.cpp | 6 +- tderesources/groupwise/soap/ksslsocket.h | 2 +- tderesources/groupwise/soap/soapdebug.cpp | 2 +- tderesources/groupwise/tdeioslave/CMakeLists.txt | 39 ++ tderesources/groupwise/tdeioslave/Makefile.am | 19 + tderesources/groupwise/tdeioslave/groupwise.cpp | 426 +++++++++++++++++++++ tderesources/groupwise/tdeioslave/groupwise.h | 54 +++ .../groupwise/tdeioslave/groupwise.protocol | 7 + .../groupwise/tdeioslave/groupwises.protocol | 7 + 23 files changed, 569 insertions(+), 569 deletions(-) delete mode 100644 tderesources/groupwise/kioslave/CMakeLists.txt delete mode 100644 tderesources/groupwise/kioslave/Makefile.am delete mode 100644 tderesources/groupwise/kioslave/groupwise.cpp delete mode 100644 tderesources/groupwise/kioslave/groupwise.h delete mode 100644 tderesources/groupwise/kioslave/groupwise.protocol delete mode 100644 tderesources/groupwise/kioslave/groupwises.protocol create mode 100644 tderesources/groupwise/tdeioslave/CMakeLists.txt create mode 100644 tderesources/groupwise/tdeioslave/Makefile.am create mode 100644 tderesources/groupwise/tdeioslave/groupwise.cpp create mode 100644 tderesources/groupwise/tdeioslave/groupwise.h create mode 100644 tderesources/groupwise/tdeioslave/groupwise.protocol create mode 100644 tderesources/groupwise/tdeioslave/groupwises.protocol (limited to 'tderesources/groupwise') diff --git a/tderesources/groupwise/CMakeLists.txt b/tderesources/groupwise/CMakeLists.txt index 68c829a7b..a5617229a 100644 --- a/tderesources/groupwise/CMakeLists.txt +++ b/tderesources/groupwise/CMakeLists.txt @@ -10,7 +10,7 @@ ################################################# add_subdirectory( soap ) -add_subdirectory( kioslave ) +add_subdirectory( tdeioslave ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} diff --git a/tderesources/groupwise/Makefile.am b/tderesources/groupwise/Makefile.am index 4b7eb408e..486e89774 100644 --- a/tderesources/groupwise/Makefile.am +++ b/tderesources/groupwise/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = soap kioslave +SUBDIRS = soap tdeioslave INCLUDES = -I$(top_srcdir) $(all_includes) diff --git a/tderesources/groupwise/kabc_resourcegroupwise.cpp b/tderesources/groupwise/kabc_resourcegroupwise.cpp index b3930bfbe..cf5c4e95d 100644 --- a/tderesources/groupwise/kabc_resourcegroupwise.cpp +++ b/tderesources/groupwise/kabc_resourcegroupwise.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include diff --git a/tderesources/groupwise/kabc_resourcegroupwise.h b/tderesources/groupwise/kabc_resourcegroupwise.h index 658ddd76b..0c7533eef 100644 --- a/tderesources/groupwise/kabc_resourcegroupwise.h +++ b/tderesources/groupwise/kabc_resourcegroupwise.h @@ -27,7 +27,7 @@ #include -#include +#include class TDEConfig; diff --git a/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc b/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc index 3130cde1e..357cdc956 100644 --- a/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc +++ b/tderesources/groupwise/kcal_groupwiseprefsbase.kcfgc @@ -1,4 +1,4 @@ -# Code generation options for kconfig_compiler +# Code generation options for tdeconfig_compiler File=tderesources_kcal_groupwise.kcfg ClassName=GroupwisePrefsBase NameSpace=KCal diff --git a/tderesources/groupwise/kcal_resourcegroupwise.h b/tderesources/groupwise/kcal_resourcegroupwise.h index 088e624a6..f4417079c 100644 --- a/tderesources/groupwise/kcal_resourcegroupwise.h +++ b/tderesources/groupwise/kcal_resourcegroupwise.h @@ -28,8 +28,8 @@ #include #include -#include -#include +#include +#include #include class ngwt__Settings; diff --git a/tderesources/groupwise/kioslave/CMakeLists.txt b/tderesources/groupwise/kioslave/CMakeLists.txt deleted file mode 100644 index 23476fe0e..000000000 --- a/tderesources/groupwise/kioslave/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -################################################# -# -# (C) 2010-2011 Serghei Amelian -# serghei (DOT) amelian (AT) gmail.com -# -# Improvements and feedback are welcome -# -# This file is released under GPL >= 2 -# -################################################# - -include_directories( - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/../soap - ${CMAKE_SOURCE_DIR} - ${CMAKE_SOURCE_DIR}/libtdepim - ${TDE_INCLUDE_DIR} - ${TQT_INCLUDE_DIRS} -) - -link_directories( - ${TQT_LIBRARY_DIRS} -) - - -##### other data ################################ - -install( FILES - groupwise.protocol groupwises.protocol - DESTINATION ${SERVICES_INSTALL_DIR} ) - - -##### kio_groupwise (module) #################### - -tde_add_kpart( kio_groupwise AUTOMOC - SOURCES groupwise.cpp - LINK gwsoap-shared - DESTINATION ${PLUGIN_INSTALL_DIR} -) diff --git a/tderesources/groupwise/kioslave/Makefile.am b/tderesources/groupwise/kioslave/Makefile.am deleted file mode 100644 index 2b2eaa074..000000000 --- a/tderesources/groupwise/kioslave/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tderesources/groupwise/soap \ - -I$(top_builddir)/libtdepim $(all_includes) - -noinst_HEADERS = groupwise.h - -METASOURCES = AUTO - -kdelnkdir = $(kde_servicesdir) -kdelnk_DATA = groupwise.protocol groupwises.protocol - -kde_module_LTLIBRARIES = kio_groupwise.la - -kio_groupwise_la_SOURCES = groupwise.cpp -kio_groupwise_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ - ../soap/libgwsoap.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) -kio_groupwise_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) - -messages: rc.cpp - $(XGETTEXT) *.cpp -o $(podir)/kio_groupwise.pot diff --git a/tderesources/groupwise/kioslave/groupwise.cpp b/tderesources/groupwise/kioslave/groupwise.cpp deleted file mode 100644 index c3addd3b0..000000000 --- a/tderesources/groupwise/kioslave/groupwise.cpp +++ /dev/null @@ -1,426 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2004 Cornelius Schumacher - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ - - -#include "groupwiseserver.h" - -#include - -#include - -#include -#include -#include -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "groupwise.h" - -namespace KABC { - -class ResourceMemory : public ResourceCached -{ - public: - ResourceMemory() : ResourceCached( 0 ) {} - - Ticket *requestSaveTicket() { return 0; } - bool load() { return true; } - bool save( Ticket * ) { return true; } - void releaseSaveTicket( Ticket * ) {} -}; - -} - -extern "C" { -KDE_EXPORT int kdemain( int argc, char **argv ); -} - -int kdemain( int argc, char **argv ) -{ - TDEInstance instance( "kio_groupwise" ); - - kdDebug(7000) << "Starting kio_groupwise(pid: " << getpid() << ")" << endl; - - if (argc != 4) { - fprintf( stderr, "Usage: kio_groupwise protocol domain-socket1 domain-socket2\n"); - exit( -1 ); - } - - Groupwise slave( argv[1], argv[2], argv[3] ); - slave.dispatchLoop(); - - return 0; -} - -Groupwise::Groupwise( const TQCString &protocol, const TQCString &pool, - const TQCString &app ) - : SlaveBase( protocol, pool, app ) -{ -} - -void Groupwise::get( const KURL &url ) -{ - kdDebug(7000) << "Groupwise::get()" << endl; - kdDebug(7000) << " URL: " << url.url() << endl; - #if 1 - kdDebug(7000) << " Path: " << url.path() << endl; - kdDebug(7000) << " Query: " << url.query() << endl; - kdDebug(7000) << " Protocol: " << url.protocol() << endl; - kdDebug(7000) << " Filename: " << url.filename() << endl; - #endif - - mimeType( "text/plain" ); - - TQString path = url.path(); - debugMessage( "Path: " + path ); - - if ( path.contains( "/freebusy" ) ) { - getFreeBusy( url ); - } else if ( path.contains( "/calendar" ) ) { - getCalendar( url ); - } else if ( path.contains( "/addressbook" ) ) { - if ( url.query().contains( "update=true" ) ) - updateAddressbook( url ); - else - getAddressbook( url ); - } else { - TQString error = i18n("Unknown path. Known paths are '/freebusy/', " - "'/calendar/' and '/addressbook/'.") + TQString(" path was %1" ).arg( url.url() ); - errorMessage( error ); - } - - kdDebug(7000) << "Groupwise::get() done" << endl; -} - -TQString Groupwise::soapUrl( const KURL &url ) -{ - // FIXME: Get SSL from parameter - bool useSsl = url.protocol() == "groupwises"; - - TQString u; - if ( useSsl ) u = "https"; - else u = "http"; - - u += "://" + url.host() + ":"; - if ( url.port() ) - u += TQString::number( url.port() ); - else { - u += "7191"; - } - - // check for a soap path in the URL - // assume that if a path to soap is included in the URL, - // it will be at the start of the path, eg. - // groupwise://host:port/soap2/freebusy - if ( ! ( url.path().startsWith("/freebusy/") || - url.path().startsWith("/calendar/") || - url.path().startsWith("/addressbook/" ) ) ) - { - TQString soapPath = TQString("/") + TQStringList::split('/', url.path())[0]; - u += soapPath; - } - else - u += "/soap"; - - return u; -} - -void Groupwise::getFreeBusy( const KURL &url ) -{ - TQString file = url.filename(); - if ( file.right( 4 ) != ".ifb" ) { - TQString error = i18n("Illegal filename. File has to have '.ifb' suffix."); - errorMessage( error ); - } else { - TQString email = file.left( file.length() - 4 ); - debugMessage( "Email: " + email ); - - // Sanitise local Nuernberg email addresses - kdDebug() << "Email before sanitizing: " << email << endl; - email = email.replace(TQRegExp("\\.EMEA5-1\\.EMEA5" ), "" ); - email = email.replace(TQRegExp("\\.Suse.INTERNET" ), "" ); - kdDebug() << "Email after sanitizing: " << email << endl; - - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "URL: " + u ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - KCal::FreeBusy *fb = new KCal::FreeBusy; - - if ( user.isEmpty() || pass.isEmpty() ) { - errorMessage( i18n("Need username and password to read Free/Busy information.") ); - } else { - GroupwiseServer server( u, user, pass, 0 ); - - // FIXME: Read range from configuration or URL parameters. - TQDate start = TQDate::currentDate().addDays( -3 ); - TQDate end = TQDate::currentDate().addDays( 60 ); - - fb->setDtStart( start ); - fb->setDtEnd( end ); - - kdDebug() << "Login" << endl; - - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << "Read free/busy" << endl; - if ( !server.readFreeBusy( email, start, end, fb ) ) { - errorMessage( i18n("Unable to read free/busy data: ") + server.errorText() ); - } - kdDebug() << "Read free/busy" << endl; - server.logout(); - } - } - -#if 0 - TQDateTime s = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 10, 0 ) ); - TQDateTime e = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 11, 0 ) ); - - fb->addPeriod( s, e ); -#endif - - // FIXME: This does not take into account the time zone! - KCal::ICalFormat format; - - TQString ical = format.createScheduleMessage( fb, KCal::Scheduler::Publish ); - - data( ical.utf8() ); - - finished(); - } -} - -void Groupwise::getCalendar( const KURL &url ) -{ - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "URL: " + u ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - GroupwiseServer server( u, user, pass, 0 ); - - KCal::CalendarLocal calendar( TQString::fromLatin1("UTC")); - - kdDebug() << "Login" << endl; - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << "Read calendar" << endl; - if ( !server.readCalendarSynchronous( &calendar ) ) { - errorMessage( i18n("Unable to read calendar data: ") + server.errorText() ); - } - kdDebug() << "Logout" << endl; - server.logout(); - } - - KCal::ICalFormat format; - - TQString ical = format.toString( &calendar ); - - data( ical.utf8() ); - - finished(); -} - -void Groupwise::getAddressbook( const KURL &url ) -{ - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "URL: " + u ); - debugMessage( "User: " + user ); - debugMessage( "Password: " + pass ); - - TQString query = url.query(); - if ( query.isEmpty() || query == "?" ) { - errorMessage( i18n("No addressbook IDs given.") ); - } else { - TQStringList ids; - - query = query.mid( 1 ); - TQStringList queryItems = TQStringList::split( "&", query ); - TQStringList::ConstIterator it; - for( it = queryItems.begin(); it != queryItems.end(); ++it ) { - TQStringList item = TQStringList::split( "=", (*it) ); - if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { - ids.append( item[ 1 ] ); - } - } - - debugMessage( "IDs: " + ids.join( "," ) ); - - GroupwiseServer server( u, user, pass, 0 ); - - connect( &server, TQT_SIGNAL( readAddressBookTotalSize( int ) ), - TQT_SLOT( slotReadAddressBookTotalSize( int ) ) ); - connect( &server, TQT_SIGNAL( readAddressBookProcessedSize( int ) ), - TQT_SLOT( slotReadAddressBookProcessedSize( int ) ) ); - connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), - TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); - connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), - TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); - - kdDebug() << "Login" << endl; - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << "Read Addressbook" << endl; - if ( !server.readAddressBooksSynchronous( ids ) ) { - errorMessage( i18n("Unable to read addressbook data: ") + server.errorText() ); - } - kdDebug() << "Logout" << endl; - server.logout(); - finished(); - } - } -} - -void Groupwise::slotReadReceiveAddressees( const KABC::Addressee::List addressees ) -{ - kdDebug() << "Groupwise::slotReadReceiveAddressees() - passing " << addressees.count() << " contacts back to application" << endl; - KABC::VCardConverter conv; - - TQString vcard = conv.createVCards( addressees ); - - data( vcard.utf8() ); -} - -void Groupwise::updateAddressbook( const KURL &url ) -{ - kdDebug() << "Groupwise::updateAddressbook() " << url << endl; - TQString u = soapUrl( url ); - - TQString user = url.user(); - TQString pass = url.pass(); - - debugMessage( "update AB URL: " + u ); - debugMessage( "update AB User: " + user ); - debugMessage( "update AB Password: " + pass ); - - TQString query = url.query(); - - unsigned long lastSequenceNumber = 0; - unsigned long lastPORebuildTime = 0; - - if ( query.isEmpty() || query == "?" ) { - errorMessage( i18n("No addressbook IDs given.") ); - return; - } else { - TQStringList ids; - - query = query.mid( 1 ); - TQStringList queryItems = TQStringList::split( "&", query ); - TQStringList::ConstIterator it; - for( it = queryItems.begin(); it != queryItems.end(); ++it ) { - TQStringList item = TQStringList::split( "=", (*it) ); - if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { - ids.append( item[ 1 ] ); - } - if ( item.count() == 2 && item[ 0 ] == "lastSeqNo" ) - lastSequenceNumber = item[ 1 ].toULong(); - if ( item.count() == 2 && item[ 0 ] == "PORebuildTime" ) - lastPORebuildTime = item[ 1 ].toULong(); - } - - debugMessage( "update IDs: " + ids.join( "," ) ); - - GroupwiseServer server( u, user, pass, 0 ); - connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), - TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); - connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), - TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); - - kdDebug() << " Login" << endl; - if ( !server.login() ) { - errorMessage( i18n("Unable to login: ") + server.errorText() ); - } else { - kdDebug() << " Updating Addressbook" << endl; - if ( !server.updateAddressBooks( ids, lastSequenceNumber + 1, lastPORebuildTime ) ) - { - error( TDEIO::ERR_NO_CONTENT, server.errorText() ); - //errorMessage( i18n("Unable to update addressbook data: ") + server.errorText() ); - } - kdDebug() << " Logout" << endl; - server.logout(); - finished(); - } - } -} - -void Groupwise::errorMessage( const TQString &msg ) -{ - error( TDEIO::ERR_SLAVE_DEFINED, msg ); -} - -void Groupwise::debugMessage( const TQString &msg ) -{ -#if 0 - data( ( msg + "\n" ).utf8() ); -#else - Q_UNUSED( msg ); -#endif -} - -void Groupwise::slotReadAddressBookTotalSize( int size ) -{ - totalSize( size ); -} - -void Groupwise::slotReadAddressBookProcessedSize( int size ) -{ - kdDebug() << "Groupwise::processedSize(): " << size << endl; - processedSize( size ); -} - -void Groupwise::slotServerErrorMessage( const TQString & serverErrorMessage, bool fatal ) -{ - kdDebug() << "Groupwise::slotJobErrorMessage()" << serverErrorMessage << ( fatal ? ", FATAL!" : ", proceeding" ) << endl; - errorMessage( i18n( "An error occurred while communicating with the GroupWise server:\n%1" ).arg( serverErrorMessage ) ); -} - -#include "groupwise.moc" - diff --git a/tderesources/groupwise/kioslave/groupwise.h b/tderesources/groupwise/kioslave/groupwise.h deleted file mode 100644 index c5f109d30..000000000 --- a/tderesources/groupwise/kioslave/groupwise.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - This file is part of KDE. - - Copyright (c) 2004 Cornelius Schumacher - - 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -#ifndef GROUPWISE_H -#define GROUPWISE_H - -#include - -#include - -class Groupwise : public TQObject, public TDEIO::SlaveBase -{ - Q_OBJECT - - public: - void get( const KURL &url ); - Groupwise( const TQCString &protocol, const TQCString &pool, - const TQCString &app ); - - protected: - void debugMessage( const TQString & ); - void errorMessage( const TQString & ); - - void getFreeBusy( const KURL &url ); - void getCalendar( const KURL &url ); - void getAddressbook( const KURL &url ); - void updateAddressbook( const KURL &url ); - - TQString soapUrl( const KURL &url ); - - protected slots: - void slotReadAddressBookTotalSize( int ); - void slotReadAddressBookProcessedSize( int ); - void slotServerErrorMessage( const TQString &, bool ); - void slotReadReceiveAddressees( const KABC::Addressee::List ); -}; - -#endif diff --git a/tderesources/groupwise/kioslave/groupwise.protocol b/tderesources/groupwise/kioslave/groupwise.protocol deleted file mode 100644 index ec22851aa..000000000 --- a/tderesources/groupwise/kioslave/groupwise.protocol +++ /dev/null @@ -1,7 +0,0 @@ -[Protocol] -DocPath=kioslave/groupwise.html -exec=kio_groupwise -input=none -output=filesystem -protocol=groupwise -reading=true diff --git a/tderesources/groupwise/kioslave/groupwises.protocol b/tderesources/groupwise/kioslave/groupwises.protocol deleted file mode 100644 index b2b2c7b9b..000000000 --- a/tderesources/groupwise/kioslave/groupwises.protocol +++ /dev/null @@ -1,7 +0,0 @@ -[Protocol] -DocPath=kioslave/groupwise.html -exec=kio_groupwise -input=none -output=filesystem -protocol=groupwises -reading=true diff --git a/tderesources/groupwise/soap/groupwiseserver.cpp b/tderesources/groupwise/soap/groupwiseserver.cpp index 9112fdeab..cedcde6aa 100644 --- a/tderesources/groupwise/soap/groupwiseserver.cpp +++ b/tderesources/groupwise/soap/groupwiseserver.cpp @@ -30,9 +30,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/tderesources/groupwise/soap/groupwiseserver.h b/tderesources/groupwise/soap/groupwiseserver.h index 95218be06..e1c25c0f3 100644 --- a/tderesources/groupwise/soap/groupwiseserver.h +++ b/tderesources/groupwise/soap/groupwiseserver.h @@ -21,8 +21,8 @@ #ifndef GROUPWISESERVER_H #define GROUPWISESERVER_H -#include -#include +#include +#include #include #include #include diff --git a/tderesources/groupwise/soap/ksslsocket.cpp b/tderesources/groupwise/soap/ksslsocket.cpp index 90ccf83d6..809c29b8b 100644 --- a/tderesources/groupwise/soap/ksslsocket.cpp +++ b/tderesources/groupwise/soap/ksslsocket.cpp @@ -181,12 +181,12 @@ int KSSLSocket::messageBox( TDEIO::SlaveBase::MessageBoxType type, const TQStrin d->dcc = new DCOPClient(); d->dcc->attach(); } - if (!d->dcc->isApplicationRegistered("kio_uiserver")) + if (!d->dcc->isApplicationRegistered("tdeio_uiserver")) { - TDEApplication::startServiceByDesktopPath("kio_uiserver.desktop",TQStringList()); + TDEApplication::startServiceByDesktopPath("tdeio_uiserver.desktop",TQStringList()); } - d->dcc->call("kio_uiserver", "UIServer", + d->dcc->call("tdeio_uiserver", "UIServer", "messageBox(int,int,TQString,TQString,TQString,TQString)", data, returnType, result); if( returnType == "int" ) diff --git a/tderesources/groupwise/soap/ksslsocket.h b/tderesources/groupwise/soap/ksslsocket.h index c19b440a1..425459483 100644 --- a/tderesources/groupwise/soap/ksslsocket.h +++ b/tderesources/groupwise/soap/ksslsocket.h @@ -21,7 +21,7 @@ #include #include -#include +#include class KSSLSocketPrivate; diff --git a/tderesources/groupwise/soap/soapdebug.cpp b/tderesources/groupwise/soap/soapdebug.cpp index 415021a78..e68da9ee1 100644 --- a/tderesources/groupwise/soap/soapdebug.cpp +++ b/tderesources/groupwise/soap/soapdebug.cpp @@ -3,7 +3,7 @@ #include #include #include -#include +#include #include #include diff --git a/tderesources/groupwise/tdeioslave/CMakeLists.txt b/tderesources/groupwise/tdeioslave/CMakeLists.txt new file mode 100644 index 000000000..23476fe0e --- /dev/null +++ b/tderesources/groupwise/tdeioslave/CMakeLists.txt @@ -0,0 +1,39 @@ +################################################# +# +# (C) 2010-2011 Serghei Amelian +# serghei (DOT) amelian (AT) gmail.com +# +# Improvements and feedback are welcome +# +# This file is released under GPL >= 2 +# +################################################# + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/../soap + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/libtdepim + ${TDE_INCLUDE_DIR} + ${TQT_INCLUDE_DIRS} +) + +link_directories( + ${TQT_LIBRARY_DIRS} +) + + +##### other data ################################ + +install( FILES + groupwise.protocol groupwises.protocol + DESTINATION ${SERVICES_INSTALL_DIR} ) + + +##### kio_groupwise (module) #################### + +tde_add_kpart( kio_groupwise AUTOMOC + SOURCES groupwise.cpp + LINK gwsoap-shared + DESTINATION ${PLUGIN_INSTALL_DIR} +) diff --git a/tderesources/groupwise/tdeioslave/Makefile.am b/tderesources/groupwise/tdeioslave/Makefile.am new file mode 100644 index 000000000..e6da52837 --- /dev/null +++ b/tderesources/groupwise/tdeioslave/Makefile.am @@ -0,0 +1,19 @@ +INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tderesources/groupwise/soap \ + -I$(top_builddir)/libtdepim $(all_includes) + +noinst_HEADERS = groupwise.h + +METASOURCES = AUTO + +kdelnkdir = $(kde_servicesdir) +kdelnk_DATA = groupwise.protocol groupwises.protocol + +kde_module_LTLIBRARIES = kio_groupwise.la + +kio_groupwise_la_SOURCES = groupwise.cpp +kio_groupwise_la_LIBADD = $(top_builddir)/libkcal/libkcal.la \ + ../soap/libgwsoap.la $(top_builddir)/libtdepim/libtdepim.la $(LIB_KIO) +kio_groupwise_la_LDFLAGS = $(all_libraries) -module $(KDE_PLUGIN) + +messages: rc.cpp + $(XGETTEXT) *.cpp -o $(podir)/tdeio_groupwise.pot diff --git a/tderesources/groupwise/tdeioslave/groupwise.cpp b/tderesources/groupwise/tdeioslave/groupwise.cpp new file mode 100644 index 000000000..bfa02156a --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwise.cpp @@ -0,0 +1,426 @@ +/* + This file is part of KDE. + + Copyright (c) 2004 Cornelius Schumacher + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ + + +#include "groupwiseserver.h" + +#include + +#include + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "groupwise.h" + +namespace KABC { + +class ResourceMemory : public ResourceCached +{ + public: + ResourceMemory() : ResourceCached( 0 ) {} + + Ticket *requestSaveTicket() { return 0; } + bool load() { return true; } + bool save( Ticket * ) { return true; } + void releaseSaveTicket( Ticket * ) {} +}; + +} + +extern "C" { +KDE_EXPORT int kdemain( int argc, char **argv ); +} + +int kdemain( int argc, char **argv ) +{ + TDEInstance instance( "kio_groupwise" ); + + kdDebug(7000) << "Starting kio_groupwise(pid: " << getpid() << ")" << endl; + + if (argc != 4) { + fprintf( stderr, "Usage: kio_groupwise protocol domain-socket1 domain-socket2\n"); + exit( -1 ); + } + + Groupwise slave( argv[1], argv[2], argv[3] ); + slave.dispatchLoop(); + + return 0; +} + +Groupwise::Groupwise( const TQCString &protocol, const TQCString &pool, + const TQCString &app ) + : SlaveBase( protocol, pool, app ) +{ +} + +void Groupwise::get( const KURL &url ) +{ + kdDebug(7000) << "Groupwise::get()" << endl; + kdDebug(7000) << " URL: " << url.url() << endl; + #if 1 + kdDebug(7000) << " Path: " << url.path() << endl; + kdDebug(7000) << " Query: " << url.query() << endl; + kdDebug(7000) << " Protocol: " << url.protocol() << endl; + kdDebug(7000) << " Filename: " << url.filename() << endl; + #endif + + mimeType( "text/plain" ); + + TQString path = url.path(); + debugMessage( "Path: " + path ); + + if ( path.contains( "/freebusy" ) ) { + getFreeBusy( url ); + } else if ( path.contains( "/calendar" ) ) { + getCalendar( url ); + } else if ( path.contains( "/addressbook" ) ) { + if ( url.query().contains( "update=true" ) ) + updateAddressbook( url ); + else + getAddressbook( url ); + } else { + TQString error = i18n("Unknown path. Known paths are '/freebusy/', " + "'/calendar/' and '/addressbook/'.") + TQString(" path was %1" ).arg( url.url() ); + errorMessage( error ); + } + + kdDebug(7000) << "Groupwise::get() done" << endl; +} + +TQString Groupwise::soapUrl( const KURL &url ) +{ + // FIXME: Get SSL from parameter + bool useSsl = url.protocol() == "groupwises"; + + TQString u; + if ( useSsl ) u = "https"; + else u = "http"; + + u += "://" + url.host() + ":"; + if ( url.port() ) + u += TQString::number( url.port() ); + else { + u += "7191"; + } + + // check for a soap path in the URL + // assume that if a path to soap is included in the URL, + // it will be at the start of the path, eg. + // groupwise://host:port/soap2/freebusy + if ( ! ( url.path().startsWith("/freebusy/") || + url.path().startsWith("/calendar/") || + url.path().startsWith("/addressbook/" ) ) ) + { + TQString soapPath = TQString("/") + TQStringList::split('/', url.path())[0]; + u += soapPath; + } + else + u += "/soap"; + + return u; +} + +void Groupwise::getFreeBusy( const KURL &url ) +{ + TQString file = url.filename(); + if ( file.right( 4 ) != ".ifb" ) { + TQString error = i18n("Illegal filename. File has to have '.ifb' suffix."); + errorMessage( error ); + } else { + TQString email = file.left( file.length() - 4 ); + debugMessage( "Email: " + email ); + + // Sanitise local Nuernberg email addresses + kdDebug() << "Email before sanitizing: " << email << endl; + email = email.replace(TQRegExp("\\.EMEA5-1\\.EMEA5" ), "" ); + email = email.replace(TQRegExp("\\.Suse.INTERNET" ), "" ); + kdDebug() << "Email after sanitizing: " << email << endl; + + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "URL: " + u ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + KCal::FreeBusy *fb = new KCal::FreeBusy; + + if ( user.isEmpty() || pass.isEmpty() ) { + errorMessage( i18n("Need username and password to read Free/Busy information.") ); + } else { + GroupwiseServer server( u, user, pass, 0 ); + + // FIXME: Read range from configuration or URL parameters. + TQDate start = TQDate::currentDate().addDays( -3 ); + TQDate end = TQDate::currentDate().addDays( 60 ); + + fb->setDtStart( start ); + fb->setDtEnd( end ); + + kdDebug() << "Login" << endl; + + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << "Read free/busy" << endl; + if ( !server.readFreeBusy( email, start, end, fb ) ) { + errorMessage( i18n("Unable to read free/busy data: ") + server.errorText() ); + } + kdDebug() << "Read free/busy" << endl; + server.logout(); + } + } + +#if 0 + TQDateTime s = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 10, 0 ) ); + TQDateTime e = TQDateTime( TQDate( 2004, 9, 27 ), TQTime( 11, 0 ) ); + + fb->addPeriod( s, e ); +#endif + + // FIXME: This does not take into account the time zone! + KCal::ICalFormat format; + + TQString ical = format.createScheduleMessage( fb, KCal::Scheduler::Publish ); + + data( ical.utf8() ); + + finished(); + } +} + +void Groupwise::getCalendar( const KURL &url ) +{ + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "URL: " + u ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + GroupwiseServer server( u, user, pass, 0 ); + + KCal::CalendarLocal calendar( TQString::fromLatin1("UTC")); + + kdDebug() << "Login" << endl; + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << "Read calendar" << endl; + if ( !server.readCalendarSynchronous( &calendar ) ) { + errorMessage( i18n("Unable to read calendar data: ") + server.errorText() ); + } + kdDebug() << "Logout" << endl; + server.logout(); + } + + KCal::ICalFormat format; + + TQString ical = format.toString( &calendar ); + + data( ical.utf8() ); + + finished(); +} + +void Groupwise::getAddressbook( const KURL &url ) +{ + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "URL: " + u ); + debugMessage( "User: " + user ); + debugMessage( "Password: " + pass ); + + TQString query = url.query(); + if ( query.isEmpty() || query == "?" ) { + errorMessage( i18n("No addressbook IDs given.") ); + } else { + TQStringList ids; + + query = query.mid( 1 ); + TQStringList queryItems = TQStringList::split( "&", query ); + TQStringList::ConstIterator it; + for( it = queryItems.begin(); it != queryItems.end(); ++it ) { + TQStringList item = TQStringList::split( "=", (*it) ); + if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { + ids.append( item[ 1 ] ); + } + } + + debugMessage( "IDs: " + ids.join( "," ) ); + + GroupwiseServer server( u, user, pass, 0 ); + + connect( &server, TQT_SIGNAL( readAddressBookTotalSize( int ) ), + TQT_SLOT( slotReadAddressBookTotalSize( int ) ) ); + connect( &server, TQT_SIGNAL( readAddressBookProcessedSize( int ) ), + TQT_SLOT( slotReadAddressBookProcessedSize( int ) ) ); + connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), + TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); + connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), + TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); + + kdDebug() << "Login" << endl; + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << "Read Addressbook" << endl; + if ( !server.readAddressBooksSynchronous( ids ) ) { + errorMessage( i18n("Unable to read addressbook data: ") + server.errorText() ); + } + kdDebug() << "Logout" << endl; + server.logout(); + finished(); + } + } +} + +void Groupwise::slotReadReceiveAddressees( const KABC::Addressee::List addressees ) +{ + kdDebug() << "Groupwise::slotReadReceiveAddressees() - passing " << addressees.count() << " contacts back to application" << endl; + KABC::VCardConverter conv; + + TQString vcard = conv.createVCards( addressees ); + + data( vcard.utf8() ); +} + +void Groupwise::updateAddressbook( const KURL &url ) +{ + kdDebug() << "Groupwise::updateAddressbook() " << url << endl; + TQString u = soapUrl( url ); + + TQString user = url.user(); + TQString pass = url.pass(); + + debugMessage( "update AB URL: " + u ); + debugMessage( "update AB User: " + user ); + debugMessage( "update AB Password: " + pass ); + + TQString query = url.query(); + + unsigned long lastSequenceNumber = 0; + unsigned long lastPORebuildTime = 0; + + if ( query.isEmpty() || query == "?" ) { + errorMessage( i18n("No addressbook IDs given.") ); + return; + } else { + TQStringList ids; + + query = query.mid( 1 ); + TQStringList queryItems = TQStringList::split( "&", query ); + TQStringList::ConstIterator it; + for( it = queryItems.begin(); it != queryItems.end(); ++it ) { + TQStringList item = TQStringList::split( "=", (*it) ); + if ( item.count() == 2 && item[ 0 ] == "addressbookid" ) { + ids.append( item[ 1 ] ); + } + if ( item.count() == 2 && item[ 0 ] == "lastSeqNo" ) + lastSequenceNumber = item[ 1 ].toULong(); + if ( item.count() == 2 && item[ 0 ] == "PORebuildTime" ) + lastPORebuildTime = item[ 1 ].toULong(); + } + + debugMessage( "update IDs: " + ids.join( "," ) ); + + GroupwiseServer server( u, user, pass, 0 ); + connect( &server, TQT_SIGNAL( errorMessage( const TQString &, bool ) ), + TQT_SLOT( slotServerErrorMessage( const TQString &, bool ) ) ); + connect( &server, TQT_SIGNAL( gotAddressees( const KABC::Addressee::List ) ), + TQT_SLOT( slotReadReceiveAddressees( const KABC::Addressee::List ) ) ); + + kdDebug() << " Login" << endl; + if ( !server.login() ) { + errorMessage( i18n("Unable to login: ") + server.errorText() ); + } else { + kdDebug() << " Updating Addressbook" << endl; + if ( !server.updateAddressBooks( ids, lastSequenceNumber + 1, lastPORebuildTime ) ) + { + error( TDEIO::ERR_NO_CONTENT, server.errorText() ); + //errorMessage( i18n("Unable to update addressbook data: ") + server.errorText() ); + } + kdDebug() << " Logout" << endl; + server.logout(); + finished(); + } + } +} + +void Groupwise::errorMessage( const TQString &msg ) +{ + error( TDEIO::ERR_SLAVE_DEFINED, msg ); +} + +void Groupwise::debugMessage( const TQString &msg ) +{ +#if 0 + data( ( msg + "\n" ).utf8() ); +#else + Q_UNUSED( msg ); +#endif +} + +void Groupwise::slotReadAddressBookTotalSize( int size ) +{ + totalSize( size ); +} + +void Groupwise::slotReadAddressBookProcessedSize( int size ) +{ + kdDebug() << "Groupwise::processedSize(): " << size << endl; + processedSize( size ); +} + +void Groupwise::slotServerErrorMessage( const TQString & serverErrorMessage, bool fatal ) +{ + kdDebug() << "Groupwise::slotJobErrorMessage()" << serverErrorMessage << ( fatal ? ", FATAL!" : ", proceeding" ) << endl; + errorMessage( i18n( "An error occurred while communicating with the GroupWise server:\n%1" ).arg( serverErrorMessage ) ); +} + +#include "groupwise.moc" + diff --git a/tderesources/groupwise/tdeioslave/groupwise.h b/tderesources/groupwise/tdeioslave/groupwise.h new file mode 100644 index 000000000..e95ed260a --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwise.h @@ -0,0 +1,54 @@ +/* + This file is part of KDE. + + Copyright (c) 2004 Cornelius Schumacher + + 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +*/ +#ifndef GROUPWISE_H +#define GROUPWISE_H + +#include + +#include + +class Groupwise : public TQObject, public TDEIO::SlaveBase +{ + Q_OBJECT + + public: + void get( const KURL &url ); + Groupwise( const TQCString &protocol, const TQCString &pool, + const TQCString &app ); + + protected: + void debugMessage( const TQString & ); + void errorMessage( const TQString & ); + + void getFreeBusy( const KURL &url ); + void getCalendar( const KURL &url ); + void getAddressbook( const KURL &url ); + void updateAddressbook( const KURL &url ); + + TQString soapUrl( const KURL &url ); + + protected slots: + void slotReadAddressBookTotalSize( int ); + void slotReadAddressBookProcessedSize( int ); + void slotServerErrorMessage( const TQString &, bool ); + void slotReadReceiveAddressees( const KABC::Addressee::List ); +}; + +#endif diff --git a/tderesources/groupwise/tdeioslave/groupwise.protocol b/tderesources/groupwise/tdeioslave/groupwise.protocol new file mode 100644 index 000000000..a7c26b6e3 --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwise.protocol @@ -0,0 +1,7 @@ +[Protocol] +DocPath=tdeioslave/groupwise.html +exec=kio_groupwise +input=none +output=filesystem +protocol=groupwise +reading=true diff --git a/tderesources/groupwise/tdeioslave/groupwises.protocol b/tderesources/groupwise/tdeioslave/groupwises.protocol new file mode 100644 index 000000000..2666f1fd7 --- /dev/null +++ b/tderesources/groupwise/tdeioslave/groupwises.protocol @@ -0,0 +1,7 @@ +[Protocol] +DocPath=tdeioslave/groupwise.html +exec=kio_groupwise +input=none +output=filesystem +protocol=groupwises +reading=true -- cgit v1.2.1