140 const char *title,
size_t title_len,
225 data->
value_len = (value != NULL) ? strlen(value) : 0;
251 if ((ftime = localtime(value)) != NULL) {
252 const size_t vsize = 256;
253 char *value = malloc(vsize);
255 fdata->
value = value;
256 fdata->
value_len = strftime(value, vsize,
257 "%a %b %e %H:%M:%S %Y", ftime);
277 assert(data != NULL);
306 }
else if (data->
secure) {
352 if (cookie == NULL) {
447 strlen(
data->domain) : 0;
473 assert(
data != NULL);
494 strlen(
data->name), &cookie);
498 if (cookie == NULL) {
517 assert(
data != NULL);
531 strlen(
data->name), &cookie);
569 label =
"TreeviewLabelName";
571 if (lwc_intern_string(label, strlen(label),
578 label =
"TreeviewLabelContent";
580 if (lwc_intern_string(label, strlen(label),
589 label =
"TreeviewLabelDomain";
591 if (lwc_intern_string(label, strlen(label),
598 label =
"TreeviewLabelPath";
600 if (lwc_intern_string(label, strlen(label),
607 label =
"TreeviewLabelExpires";
609 if (lwc_intern_string(label, strlen(label),
616 label =
"TreeviewLabelLastUsed";
618 if (lwc_intern_string(label, strlen(label),
625 label =
"TreeviewLabelRestrictions";
627 if (lwc_intern_string(label, strlen(label),
634 label =
"TreeviewLabelVersion";
636 if (lwc_intern_string(label, strlen(label),
643 label =
"TreeviewLabelDomainFolder";
645 if (lwc_intern_string(label, strlen(label),
726 if ((domain != NULL) && (
path != NULL) && (name != NULL)) {
731 "Delete cookie fail: ""need domain, path, and name.");
800 NSLOG(netsurf, INFO,
"Generating cookie manager data");
839 NSLOG(netsurf, INFO,
"Generated cookie manager data");
851 NSLOG(netsurf, INFO,
"Finalising cookie manager");
874 NSLOG(netsurf, INFO,
"Finalised cookie manager");
void urldb_iterate_cookies(bool(*callback)(const struct cookie_data *cookie))
Iterate over all cookies in database.
void urldb_delete_cookie(const char *domain, const char *path, const char *name)
Delete a cookie.
static nserror cookie_manager_field_builder(enum cookie_manager_field field, struct treeview_field_data *data, const char *value)
Build a cookie manager treeview field from given text.
nserror cookie_manager_contract(bool all)
Contract the treeview's nodes.
static nserror cookie_manager_tree_node_folder_cb(struct treeview_node_msg msg, void *data)
nserror cookie_manager_expand(bool only_folders)
Expand the treeview's nodes.
static nserror cookie_manager_create_cookie_node(struct cookie_manager_folder *parent, const struct cookie_data *data)
Creates an empty tree entry for a cookie, and links it into the tree.
struct cookie_manager_ctx cm_ctx
static nserror cookie_manager_init_entry_fields(void)
Initialise the treeview entry feilds.
void cookie_manager_redraw(int x, int y, struct rect *clip, const struct redraw_context *ctx)
Redraw the cookies manager.
bool cookie_manager_add(const struct cookie_data *data)
Add/update a cookie to the viewer.
bool cookie_manager_has_selection(void)
Determine whether there is a selection.
void cookie_manager_remove(const struct cookie_data *data)
Remove a cookie from viewer.
static nserror cookie_manager_update_cookie_node(struct cookie_manager_entry *e, const struct cookie_data *data)
Updates a cookie manager entry for updated cookie_data.
static nserror cookie_manager_create_domain_folder(struct cookie_manager_folder **folder, const struct cookie_data *data)
Creates an empty tree folder for a cookie domain, and links it into the tree.
static nserror cookie_manager_walk_cb(void *ctx, void *node_data, enum treeview_node_type type, bool *abort)
Callback for treeview_walk.
static nserror cookie_manager_find_folder(treeview_node *root, const char *title, size_t title_len, struct cookie_manager_folder **found)
Find a cookie domain folder in the cookie manager's treeview.
void cookie_manager_mouse_action(enum browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
static nserror cookie_manager_tree_node_entry_cb(struct treeview_node_msg msg, void *data)
static nserror cookie_manager_set_treeview_field_data(struct cookie_manager_entry *e, const struct cookie_data *data)
Set a cookie manager entry's data from the cookie_data.
static nserror cookie_manager_field_builder_time(enum cookie_manager_field field, struct treeview_field_data *fdata, const time_t *value)
Build a cookie manager treeview field from given time.
nserror cookie_manager_init(void *core_window_handle)
Initialise the cookie manager.
nserror cookie_manager_fini(void)
Finalise the cookie manager.
static nserror cookie_manager_init_common_values(void)
Initialise the common entry values.
static void cookie_manager_delete_entry(struct cookie_manager_entry *e)
Delete cookie manager entries (and optionally delete from urldb)
struct treeview_callback_table cm_tree_cb_t
nserror cookie_manager_set_search_string(const char *string)
Set the cookie manager search string.
bool cookie_manager_keypress(uint32_t key)
Key press handling.
static void cookie_manager_free_treeview_field_data(struct cookie_manager_entry *e)
Free a cookie manager entry's treeview field data.
static nserror cookie_manager_find_entry(treeview_node *root, const char *title, size_t title_len, struct cookie_manager_entry **found)
Find a cookie entry in the cookie manager's treeview.
Cookie Manager (interface).
nserror treeview_create(treeview **treeout, const struct treeview_callback_table *callbacks, int n_fields, struct treeview_field_desc fields[], struct core_window *cw, treeview_flags flags)
Create a treeview.
void treeview_mouse_action(treeview *tree, browser_mouse_state mouse, int x, int y)
Handles all kinds of mouse action.
nserror treeview_contract(treeview *tree, bool all)
Contract a treeview's nodes.
nserror treeview_delete_node(treeview *tree, treeview_node *n, treeview_node_options_flags flags)
Delete a treeview node.
nserror treeview_fini(void)
Finalise the treeview module (all treeviews must have been destroyed first)
bool treeview_has_selection(treeview *tree)
Determine whether treeview has a selection.
bool treeview_keypress(treeview *tree, uint32_t key)
Key press handling for treeviews.
nserror treeview_update_node_entry(treeview *tree, treeview_node *entry, const struct treeview_field_data fields[], void *data)
Update an entry node in given treeview.
nserror treeview_create_node_folder(treeview *tree, treeview_node **folder, treeview_node *relation, enum treeview_relationship rel, const struct treeview_field_data *field, void *data, treeview_node_options_flags flags)
Create a folder node in given treeview.
nserror treeview_destroy(treeview *tree)
Destroy a treeview object.
nserror treeview_walk(treeview *tree, treeview_node *root, treeview_walk_cb enter_cb, treeview_walk_cb leave_cb, void *ctx, enum treeview_node_type type)
Walk (depth first) a treeview subtree, calling a callback at each node of required type.
int treeview_get_height(treeview *tree)
Find current height of a treeview.
void treeview_redraw(treeview *tree, const int x, const int y, struct rect *clip, const struct redraw_context *ctx)
Redraw a treeview object.
nserror treeview_init(void)
Prepare treeview module for treeview usage.
nserror treeview_create_node_entry(treeview *tree, treeview_node **entry, treeview_node *relation, enum treeview_relationship rel, const struct treeview_field_data fields[], void *data, treeview_node_options_flags flags)
Create an entry node in given treeview.
nserror treeview_expand(treeview *tree, bool only_folders)
Expand a treeview's nodes.
nserror treeview_set_search_string(treeview *tree, const char *string)
Set the search string for a treeview with TREEVIEW_SEARCHABLE.
Treeview handling interface.
@ TREE_MSG_NODE_EDIT
Node to be edited.
@ TREE_MSG_NODE_LAUNCH
Node to be launched.
@ TREE_MSG_NODE_DELETE
Node to be deleted.
treeview_node_type
treeview node type
@ TREE_NODE_ENTRY
Node is an entry.
@ TREE_NODE_FOLDER
Node is folder.
@ TREE_OPTION_SUPPRESS_RESIZE
@ TREE_OPTION_SUPPRESS_REDRAW
@ TREE_FLAG_SEARCHABLE
Whether field is searchable.
@ TREE_FLAG_SHOW_NAME
Whether field name shown.
@ TREE_FLAG_DEFAULT
Whether field is default.
@ TREEVIEW_DEL_EMPTY_DIRS
Delete dirs on empty.
@ TREEVIEW_SEARCHABLE
Treeview has search bar.
@ TREEVIEW_NO_MOVES
No node drags.
nserror
Enumeration of error codes.
@ NSERROR_NOT_FOUND
Requested item not found.
@ NSERROR_UNKNOWN
Unknown error - DO NOT USE.
@ NSERROR_NOMEM
Memory exhaustion.
static struct directory * root
browser_mouse_state
Mouse state: 1 is primary mouse button.
#define NSLOG(catname, level, logmsg, args...)
const char * messages_get(const char *key)
Fast lookup of a message by key from the standard Messages hash.
Localised message support (interface).
Interface to utility string handling.
const char * name
Cookie name.
const bool http_only
Only expose to HTTP(S) requests.
const time_t last_used
Last used time.
const char * domain
Domain.
enum cookie_version version
Specification compliance.
const bool secure
Only send for HTTPS requests.
const char * value
Cookie value.
const time_t expires
Expiry timestamp, or 1 for session.
struct treeview_field_desc fields[COOKIE_M_N_FIELDS]
struct treeview_field_data values[COOKIE_M_N_VALUES]
struct treeview_field_data data[COOKIE_M_N_FIELDS - 1]
struct treeview_field_data data
Client callbacks for events concerning nodes.
nserror(* folder)(struct treeview_node_msg msg, void *data)
const char * value
Field value.
lwc_string * field
Field name.
size_t value_len
Field value length (bytes)
Treeview field description.
lwc_string * field
A treeview field name.
enum treeview_field_flags flags
Flags for field.
bool user
True iff delete by user interaction.
union treeview_node_msg::@94 data
The message data.
struct treeview_node_msg::@94::@95 delete
enum treeview_msg msg
The message type.
Treewalk iterator context.
struct cookie_manager_folder * folder
struct cookie_manager_entry * entry
Unified URL information database internal interface.
Interface to a number of general purpose functionality.
static nserror path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.