schedulator: added a "result" plugin that records the finished schedule in a database...
[wvapps.git] / evolution / delete.cc
blob4e2bb3e606841fa931295933210e9ac6a6a28c27
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: s; c-basic-offset: 4 -*- */
2 /*
3 * Authors : Patrick Patterson <ppatters@nit.ca>
4 * Peter Colijn <pcolijn@nit.ca>
5 * Scott MacLean <scott@nit.ca>
6 * William Lachance <wlach@nit.ca>
8 * Copyright 2003-2004, Net Integration Technologies, Inc.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of version 2 of the GNU General Public
12 * License as published by the Free Software Foundation.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 * USA
25 #include "delete.h"
26 #include "updateitem.h"
28 Delete::Delete(ExchangeItAdaptor *_adaptor,
29 WvStringParm _uid) :
30 adaptor(_adaptor),
31 log("Delete", WvLog::Debug1),
32 uid(_uid)
34 assert(adaptor);
37 bool Delete::apply_response(WvStringList &parts,
38 WvStream &stream,
39 ExchangeItStorage *storage)
41 if (parts.count() < 1)
43 log("Malformed response: no response!!\n");
44 return false;
47 WvString line;
48 WvString response = parts.popstr();
50 if (response == "DELETED" ||
51 response == "NOTFOUND" ||
52 response == "NOFOLDER" ||
53 response == "ERROR")
55 // I'm assuming ERROR in 4.0 means the item wasn't found (pcolijn)
56 // success, nothing to do
58 else if (response == "DENIED")
60 // Server sends us back the item, we suck it down in our
61 // usual unscaleable way, and update it
63 UpdateItem update(stream, adaptor, uid);
64 return update.update();
66 else
68 log("Unknown response to DELETE: %s\n", response);
69 return false;
72 adaptor->remove_uid_from_list(uid, "todelete");
73 return true;
77 void Delete::get_command(WvString &command, WvStringList &params, WvStringList &lines)
79 command = "DELETE";
81 params.zap();
82 lines.zap();
84 params.append(new WvString(adaptor->key), true);
85 params.append(new WvString(adaptor->get_type()), true);
86 params.append(new WvString(uid), true);