## [Unreleased]
### Added
-* `:cleardata [timeSpan] [listOfDataTypes]` command to clear various types of
+* `:cleardata [listOfDataTypes] [timeSpan]` command to clear various types of
stored website data modified in the last _timeSpan_.
### Changed
### Fixed
### Removed
* `:clearcache` was removed in favor of more advanced `:cleardata` command.
The previous behaviour of `:clearcache` could be replaces by
- `:cleardata - memory-cache,disk-cache`.
+ `:cleardata memory-cache,disk-cache`.
## [3.5.0] - 2019-07-29
### Added
.EE
.SS Misc
.TP
-.BI ":cl[eardata] [" timespan "] [" dataTypes "]"
-Asynchronously clears the website data of the given list of\fIdataTypes\fP
+.BI ":cl[eardata] [" dataTypes "] [" timespan "]"
+Asynchronously clears the website data of the given list of \fIdataTypes\fP
modified in the past \fItimespan\fP.
-If \fItimespan\fP is 0, all website data will be removed.
+Note that the \fIdataTypes\fP must not contain spaces.
+If \fItimespan\fP is not given, all website data will be removed.
Note that this effects all running instances of vimb.
.RS
.PP
.PD 0
-The \fItimespan\fP is given as sequence of '[multiplier]\fIunit\fP' tupels.
-with following units.
-.TP
-.B y
-year (365 days)
-.TP
-.B w
-week (7 days)
-.TP
-.B d
-day
-.TP
-.B h
-hour
-.TP
-.B m
-minute
-.TP
-.B s
-second
-.TP
-.B -
-can be used to clear data without timespan restriction
-.PD
-.RE
-.RS
-.PP
-.PD 0
The \fIdataTypes\fP is a comma separated list of following types.
.TP
.B memory-cache
.TP
.B hsts-cache
HTTP Strict Transport Security cache.
-.sp
+.TP
+.B -
+Can be used to clear all known data types in case a \fItimespan\fP is used.
+.PD
+.RE
+.RS
+.PP
+.PD 0
+The \fItimespan\fP is given as sequence of '[multiplier]\fIunit\fP' tupels
+with following units.
+.TP
+.B y
+year (365 days)
+.TP
+.B w
+week (7 days)
+.TP
+.B d
+day
+.TP
+.B h
+hour
+.TP
+.B m
+minute
+.TP
+.B s
+second
+.PD
.PP
.I Example:
.PD 0
.IP ":cleardata"
to clear all known website data types without any timespan restriction.
-.IP ":cleardata - local-storage,session-storage,cookies"
+.IP ":cleardata - 5m"
+to clear all known website data types modified in the last 5 minutes.
+.IP ":cleardata local-storage,session-storage,cookies"
to completely clear the cookies, local- and session-storage without time
restrictions.
-.IP ":cleardata 2d4h disk-cache"
+.IP ":cleardata disk-cache 2d4h"
to clear the disk cache that was modified in the past two days and four hours.
.PD
.RE
}
/**
- * Clear website data by ':cleardata {time} {dataTypeList}'.
+ * Clear website data by ':cleardata {dataTypeList} {timespan}'.
*/
static VbCmdResult ex_cleardata(Client *c, const ExArg *arg)
{
VbCmdResult result = CMD_SUCCESS;
GTimeSpan timespan = 0;
- if (arg->lhs->len) {
- timespan = util_string_to_timespan(arg->lhs->str);
- }
- if (!arg->rhs->len) {
- /* No special type given - clear all known types. */
- data_types = WEBKIT_WEBSITE_DATA_ALL;
- } else {
+ /* Parse the left hand side if this is available and not '-' */
+ if (arg->lhs->len && strcmp(arg->lhs->str, "-") != 0) {
GString *str;
char **types;
char *value;
}
g_string_free(str, TRUE);
g_strfreev(types);
+ } else {
+ /* No special type or '-' given - clear all known types. */
+ data_types = WEBKIT_WEBSITE_DATA_ALL;
+ }
+
+ if (arg->rhs->len) {
+ timespan = util_string_to_timespan(arg->rhs->str);
}
manager = webkit_web_context_get_website_data_manager(webkit_web_view_get_context(c->webview));
webkit_website_data_manager_clear(manager, data_types, timespan, NULL, NULL, NULL);