HEAD: an extra unit test for wvbase64 that I forgot to check in a while ago.
[wvapps.git] / evolution / deletefolder.cc
blob93a202391d2432f959b936ac143899f061c86781
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 "deletefolder.h"
26 #include "strutils.h"
28 DeleteFolder::DeleteFolder(WvStringParm _folder_name,
29 WvStringParm _folder_type) :
30 log("DeleteFolder", WvLog::Debug3),
31 folder_name(_folder_name),
32 folder_type(_folder_type)
36 void DeleteFolder::get_command(WvString &command,
37 WvStringList &params,
38 WvStringList &lines)
40 // When they're not used, it's still important to zap() these!
41 params.zap();
42 lines.zap();
44 command = "DELETEFOLDER";
45 params.append(url_encode(folder_name));
46 params.append(folder_type);
49 bool DeleteFolder::apply_response(WvStringList &parts,
50 WvStream &stream,
51 ExchangeItStorage *storage)
53 if (parts.count() < 1)
55 log("Malformed response: no response!!\n");
56 return false;
59 WvString response = parts.popstr();
61 if (response == "OK")
63 // all right
65 else if (response == "DENIED")
67 // the user is being naughty. not to worry, the
68 // folder should be recreated on the next sync
70 else if (response == "NOFOLDER")
72 // somebody else deleted the folder or we just
73 // lost our access to it. nothing to do
75 else
76 return false;
78 return true;