ELinks 0.18.0
globhist.c File Reference
#include "elinks.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include "bfu/dialog.h"
#include "config/home.h"
#include "config/options.h"
#include "globhist/dialogs.h"
#include "globhist/globhist.h"
#include "intl/libintl.h"
#include "main/module.h"
#include "main/object.h"
#include "main/select.h"
#include "util/conv.h"
#include "util/file.h"
#include "util/hash.h"
#include "util/memory.h"
#include "util/secsave.h"
#include "util/string.h"
#include "util/lists.h"
Include dependency graph for globhist.c:

Macros

#define _GNU_SOURCE   /* XXX: we _WANT_ strcasestr() ! */
 
#define GLOBAL_HISTORY_FILENAME   "globhist"
 
#define get_opt_globhist(which)   global_history_options[(which)].option.value
 
#define get_globhist_enable()   get_opt_globhist(GLOBHIST_ENABLE).number
 
#define get_globhist_max_items()   get_opt_globhist(GLOBHIST_MAX_ITEMS).number
 
#define get_globhist_display_type()   get_opt_globhist(GLOBHIST_DISPLAY_TYPE).number
 

Enumerations

enum  global_history_options {
  GLOBHIST_TREE , GLOBHIST_ENABLE , GLOBHIST_MAX_ITEMS , GLOBHIST_DISPLAY_TYPE ,
  GLOBHIST_OPTIONS
}
 

Functions

 INIT_INPUT_HISTORY (global_history)
 
static void remove_item_from_global_history (struct global_history_item *history_item)
 
static void reap_deleted_globhist_items (void)
 
static void done_global_history_item (struct global_history_item *history_item)
 
void delete_global_history_item (struct global_history_item *history_item)
 
struct global_history_itemget_global_history_item (char *url)
 
static struct global_history_iteminit_global_history_item (char *url, char *title, time_t vtime)
 
static int cap_global_history (int max_globhist_items)
 
static void add_item_to_global_history (struct global_history_item *history_item, int max_globhist_items)
 
void add_global_history_item (char *url, char *title, time_t vtime)
 
int globhist_simple_search (char *search_url, char *search_title)
 
static void read_global_history (void)
 
static void write_global_history (void)
 
static void free_global_history (void)
 
static enum evhook_status global_history_write_hook (va_list ap, void *data)
 
static void init_global_history (struct module *module)
 
static void done_global_history (struct module *module)
 

Variables

struct global_history_item list global_history_reap_list = { D_LIST_HEAD_EL(global_history_reap_list) }
 
char * gh_last_searched_title = NULL
 
char * gh_last_searched_url = NULL
 
static union option_info global_history_options []
 
static struct hashglobhist_cache = NULL
 
static int globhist_cache_entries = 0
 
struct event_hook_info global_history_hooks []
 
struct module global_history_module
 

Macro Definition Documentation

◆ _GNU_SOURCE

#define _GNU_SOURCE   /* XXX: we _WANT_ strcasestr() ! */

◆ get_globhist_display_type

#define get_globhist_display_type ( )    get_opt_globhist(GLOBHIST_DISPLAY_TYPE).number

◆ get_globhist_enable

#define get_globhist_enable ( )    get_opt_globhist(GLOBHIST_ENABLE).number

◆ get_globhist_max_items

#define get_globhist_max_items ( )    get_opt_globhist(GLOBHIST_MAX_ITEMS).number

◆ get_opt_globhist

#define get_opt_globhist ( which)    global_history_options[(which)].option.value

◆ GLOBAL_HISTORY_FILENAME

#define GLOBAL_HISTORY_FILENAME   "globhist"

Enumeration Type Documentation

◆ global_history_options

Enumerator
GLOBHIST_TREE 
GLOBHIST_ENABLE 
GLOBHIST_MAX_ITEMS 
GLOBHIST_DISPLAY_TYPE 
GLOBHIST_OPTIONS 

Function Documentation

◆ add_global_history_item()

void add_global_history_item ( char * url,
char * title,
time_t vtime )

◆ add_item_to_global_history()

static void add_item_to_global_history ( struct global_history_item * history_item,
int max_globhist_items )
static

◆ cap_global_history()

static int cap_global_history ( int max_globhist_items)
static

◆ delete_global_history_item()

void delete_global_history_item ( struct global_history_item * history_item)

◆ done_global_history()

static void done_global_history ( struct module * module)
static

◆ done_global_history_item()

static void done_global_history_item ( struct global_history_item * history_item)
static

◆ free_global_history()

static void free_global_history ( void )
static

◆ get_global_history_item()

struct global_history_item * get_global_history_item ( char * url)

◆ global_history_write_hook()

static enum evhook_status global_history_write_hook ( va_list ap,
void * data )
static

◆ globhist_simple_search()

int globhist_simple_search ( char * search_url,
char * search_title )

◆ init_global_history()

static void init_global_history ( struct module * module)
static

◆ init_global_history_item()

static struct global_history_item * init_global_history_item ( char * url,
char * title,
time_t vtime )
static

◆ INIT_INPUT_HISTORY()

INIT_INPUT_HISTORY ( global_history )

◆ read_global_history()

static void read_global_history ( void )
static

◆ reap_deleted_globhist_items()

static void reap_deleted_globhist_items ( void )
static

◆ remove_item_from_global_history()

static void remove_item_from_global_history ( struct global_history_item * history_item)
static

◆ write_global_history()

static void write_global_history ( void )
static

Variable Documentation

◆ gh_last_searched_title

char* gh_last_searched_title = NULL

◆ gh_last_searched_url

char* gh_last_searched_url = NULL

◆ global_history_hooks

struct event_hook_info global_history_hooks[]
Initial value:
= {
{ "periodic-saving", 0, global_history_write_hook, {NULL} },
}
#define NULL
Definition explodename.c:35
static enum evhook_status global_history_write_hook(va_list ap, void *data)
Definition globhist.c:423
#define NULL_EVENT_HOOK_INFO
Definition event.h:88

◆ global_history_module

struct module global_history_module
Initial value:
N_("Global History"),
)
#define N_(msg)
Definition libintl.h:25
struct event_hook_info global_history_hooks[]
Definition globhist.c:429
static void init_global_history(struct module *module)
Definition globhist.c:436
global_history_options
Definition globhist.c:47
static void done_global_history(struct module *module)
Definition globhist.c:442
#define struct_module(name, options, hooks, submods, data, init, done, getname)
Definition module.h:47

◆ global_history_options

Initial value:
= {
INIT_OPT_TREE("document.history", N_("Global history"),
"global", OPT_ZERO,
N_("Global history options.")),
INIT_OPT_BOOL("document.history.global", N_("Enable"),
"enable", OPT_ZERO, 1,
N_("Enable global history (\"history of all pages "
"visited\").")),
INIT_OPT_INT("document.history.global", N_("Maximum number of entries"),
"max_items", OPT_ZERO, 1, INT_MAX, 1024,
N_("Maximum number of entries in the global history.")),
INIT_OPT_INT("document.history.global", N_("Display style"),
"display_type", OPT_ZERO, 0, 1, 0,
N_("What to display in global history dialog:\n"
"0 is URLs\n"
"1 is page titles")),
INIT_OPT_ALIAS("document.history.global", "write_interval", OPT_ZERO,
"infofiles.save_interval"),
NULL_OPTION_INFO,
}
@ OPT_ZERO
Definition options.h:23
#define INT_MAX
Definition types.h:34

◆ global_history_reap_list

struct global_history_item list global_history_reap_list = { D_LIST_HEAD_EL(global_history_reap_list) }

◆ globhist_cache

struct hash* globhist_cache = NULL
static

◆ globhist_cache_entries

int globhist_cache_entries = 0
static