1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
#include "groupwiseserver.h"
#include <tdeaboutdata.h>
#include <tdeapplication.h>
#include <tdecmdlineargs.h>
#include <tdeconfig.h>
#include <kdebug.h>
#include <tdetempfile.h>
#include <tdeabcresourcecached.h>
#include <libkcal/icalformat.h>
#include <libkcal/resourcelocal.h>
#include <libkcal/calendarresources.h>
#include <iostream>
namespace TDEABC {
class ResourceMemory : public ResourceCached
{
public:
ResourceMemory() : ResourceCached( 0 ) {}
Ticket *requestSaveTicket() { return 0; }
bool load() { return true; }
bool save( Ticket * ) { return true; }
void releaseSaveTicket( Ticket * ) {}
};
}
static const TDECmdLineOptions options[] =
{
{ "s", 0, 0 },
{ "server <hostname>", I18N_NOOP("Server"), 0 },
{ "u", 0, 0 },
{ "user <string>", I18N_NOOP("User"), 0 },
{ "p", 0, 0 },
{ "password <string>", I18N_NOOP("Password"), 0 },
{ "f", 0, 0 },
{ "freebusy-user <string>", I18N_NOOP("Free/Busy user name"), 0 },
{ "addressbook-id <string>", I18N_NOOP("Addressbook identifier"), 0 },
TDECmdLineLastOption
};
int main( int argc, char **argv )
{
TDEAboutData aboutData( "soapdebug", I18N_NOOP("Groupwise Soap Debug"), "0.1" );
aboutData.addAuthor( "Cornelius Schumacher", 0, "[email protected]" );
TDECmdLineArgs::init( argc, argv, &aboutData );
TDECmdLineArgs::addCmdLineOptions( options );
TDEApplication app;
TDECmdLineArgs *args = TDECmdLineArgs::parsedArgs();
TQString user = args->getOption( "user" );
TQString pass = args->getOption( "password" );
TQString url = args->getOption( "server" );
#if 1
if ( user.isEmpty() ) {
kdError() << "Need user." << endl;
return 1;
}
if ( pass.isEmpty() ) {
kdError() << "Need password." << endl;
return 1;
}
if ( url.isEmpty() ) {
kdError() << "Need server." << endl;
return 1;
}
#endif
GroupwiseServer server( url, user, pass, 0 );
#if 1
if ( !server.login() ) {
kdError() << "Unable to login to server " << url << endl;
return 1;
}
#endif
#if 0
server.dumpData();
#endif
#if 0
server.getCategoryList();
#endif
#if 0
server.dumpFolderList();
#endif
#if 0
TQString fbUser = args->getOption( "freebusy-user" );
if ( fbUser.isEmpty() ) {
kdError() << "Need user for which the freebusy data should be retrieved."
<< endl;
} else {
KCal::FreeBusy *fb = new KCal::FreeBusy;
server.readFreeBusy( "user1",
TQDate( 2004, 9, 1 ), TQDate( 2004, 10, 31 ), fb );
}
#endif
#if 0
KTempFile temp;
KCal::ResourceLocal resource( temp.name() );
resource.setActive( true );
KCal::CalendarResources calendar;
calendar.resourceManager()->add( &resource );
kdDebug() << "Login" << endl;
if ( !server.login() ) {
kdDebug() << "Unable to login." << endl;
} else {
kdDebug() << "Read calendar" << endl;
if ( !server.readCalendarSynchronous( &resource ) ) {
kdDebug() << "Unable to read calendar data." << endl;
}
kdDebug() << "Logout" << endl;
server.logout();
}
KCal::ICalFormat format;
TQString ical = format.toString( &calendar );
kdDebug() << "ICALENDAR: " << ical << endl;
#endif
#if 0
TQString id = args->getOption( "addressbook-id" );
kdDebug() << "ADDRESSBOOK ID: " << id << endl;
TQStringList ids;
ids.append( id );
TDEABC::ResourceMemory resource;
kdDebug() << "Login" << endl;
if ( !server.login() ) {
kdError() << "Unable to login." << endl;
} else {
kdDebug() << "Read Addressbook" << endl;
if ( !server.readAddressBooksSynchronous( ids, &resource ) ) {
kdError() << "Unable to read addressbook data." << endl;
}
kdDebug() << "Logout" << endl;
server.logout();
}
TDEABC::Addressee::List addressees;
TDEABC::Resource::Iterator it2;
for( it2 = resource.begin(); it2 != resource.end(); ++it2 ) {
kdDebug() << "ADDRESSEE: " << (*it2).fullEmail() << endl;
addressees.append( *it2 );
}
#endif
#if 0
server.getDelta();
#endif
server.logout();
return 0;
}
|