summaryrefslogtreecommitdiff
path: root/src/plugins/script/script-repo.h
blob: f67810f18c54f7e8e29f9e06c12c13ac67af99b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/*
 * Copyright (C) 2003-2019 Sébastien Helleu <flashcode@flashtux.org>
 *
 * This file is part of WeeChat, the extensible chat client.
 *
 * WeeChat is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * WeeChat is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with WeeChat.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef WEECHAT_PLUGIN_SCRIPT_REPO_H
#define WEECHAT_PLUGIN_SCRIPT_REPO_H

#include <time.h>

/* status for script */
#define SCRIPT_STATUS_INSTALLED   (1 << 0)
#define SCRIPT_STATUS_AUTOLOADED  (1 << 1)
#define SCRIPT_STATUS_HELD        (1 << 2)
#define SCRIPT_STATUS_RUNNING     (1 << 3)
#define SCRIPT_STATUS_NEW_VERSION (1 << 4)

struct t_script_repo
{
    char *name;                          /* script name                     */
    char *name_with_extension;           /* script name with extension      */
    int language;                        /* language index                  */
    char *author;                        /* author                          */
    char *mail;                          /* author's mail                   */
    char *version;                       /* plugin version                  */
    char *license;                       /* license                         */
    char *description;                   /* description                     */
    char *tags;                          /* comma-separated list of tags    */
    char *requirements;                  /* requirements                    */
    char *min_weechat;                   /* min WeeChat version             */
    char *max_weechat;                   /* max WeeChat version             */
    char *sha512sum;                     /* SHA-512 checksum of script      */
    char *url;                           /* URL to download script          */
    int popularity;                      /* >0 for popular scripts only     */
    time_t date_added;                   /* date added                      */
    time_t date_updated;                 /* date updated                    */
    int status;                          /* installed/running/new version   */
    char *version_loaded;                /* version of script loaded        */
    int displayed;                       /* script displayed?               */
    int install_order;                   /* order for install script (if >0)*/
    struct t_script_repo *prev_script;   /* link to previous script         */
    struct t_script_repo *next_script;   /* link to next script             */
};

extern struct t_script_repo *scripts_repo;
extern struct t_script_repo *last_script_repo;
extern int script_repo_count, script_repo_count_displayed;
extern struct t_hashtable *script_repo_max_length_field;
extern char *script_repo_filter;

extern int script_repo_script_valid (struct t_script_repo *script);
extern struct t_script_repo *script_repo_search_displayed_by_number (int number);
extern struct t_script_repo *script_repo_search_by_name (const char *name);
extern struct t_script_repo *script_repo_search_by_name_ext (const char *name_with_extension);
extern char *script_repo_get_filename_loaded (struct t_script_repo *script);
extern const char *script_repo_get_status_for_display (struct t_script_repo *script,
                                                       const char *list,
                                                       int collapse);
extern const char *script_repo_get_status_desc_for_display (struct t_script_repo *script,
                                                            const char *list);
extern void script_repo_remove_all ();
extern void script_repo_update_status (struct t_script_repo *script);
extern void script_repo_update_status_all ();
extern void script_repo_set_filter (const char *filter);
extern void script_repo_filter_scripts (const char *search);
extern int script_repo_file_exists ();
extern int script_repo_file_is_uptodate ();
extern int script_repo_file_read (int quiet);
extern void script_repo_file_update (int quiet);
extern struct t_hdata *script_repo_hdata_script_cb (const void *pointer,
                                                    void *data,
                                                    const char *hdata_name);
extern int script_repo_add_to_infolist (struct t_infolist *infolist,
                                        struct t_script_repo *script);
extern void script_repo_print_log ();

#endif /* WEECHAT_PLUGIN_SCRIPT_REPO_H */