summaryrefslogtreecommitdiff
path: root/src/core/core-infolist.h
diff options
context:
space:
mode:
authorSébastien Helleu <flashcode@flashtux.org>2024-03-12 21:09:42 +0100
committerSébastien Helleu <flashcode@flashtux.org>2024-03-12 21:27:37 +0100
commit24c4029c96fa04b3cb4f90fbb36dc5248dd39810 (patch)
treeca51727f97207117f335f0309c063ffd2f168f2d /src/core/core-infolist.h
parentbb346f8c6c62655a6ef8fe4bc848d179258ce008 (diff)
downloadweechat-24c4029c96fa04b3cb4f90fbb36dc5248dd39810.zip
core: remove "wee-" prefix from source files in src/core and src/core/hook
Diffstat (limited to 'src/core/core-infolist.h')
-rw-r--r--src/core/core-infolist.h116
1 files changed, 116 insertions, 0 deletions
diff --git a/src/core/core-infolist.h b/src/core/core-infolist.h
new file mode 100644
index 000000000..b4d2589a6
--- /dev/null
+++ b/src/core/core-infolist.h
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2003-2024 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_INFOLIST_H
+#define WEECHAT_INFOLIST_H
+
+#include <time.h>
+
+struct t_weechat_plugin;
+
+/* list structures */
+
+enum t_infolist_type
+{
+ INFOLIST_INTEGER = 0,
+ INFOLIST_STRING,
+ INFOLIST_POINTER,
+ INFOLIST_BUFFER,
+ INFOLIST_TIME,
+ /* number of infolist types */
+ INFOLIST_NUM_TYPES,
+};
+
+struct t_infolist_var
+{
+ char *name; /* variable name */
+ enum t_infolist_type type; /* type: int, string, ... */
+ void *value; /* pointer to value */
+ int size; /* for type buffer */
+ struct t_infolist_var *prev_var; /* link to previous variable */
+ struct t_infolist_var *next_var; /* link to next variable */
+};
+
+struct t_infolist_item
+{
+ struct t_infolist_var *vars; /* item variables */
+ struct t_infolist_var *last_var; /* last variable */
+ char *fields; /* fields list (NULL if never asked) */
+ struct t_infolist_item *prev_item; /* link to previous item */
+ struct t_infolist_item *next_item; /* link to next item */
+};
+
+struct t_infolist
+{
+ struct t_weechat_plugin *plugin; /* plugin which created this infolist*/
+ /* (NULL if created by WeeChat) */
+ struct t_infolist_item *items; /* link to items */
+ struct t_infolist_item *last_item; /* last variable */
+ struct t_infolist_item *ptr_item; /* pointer to current item */
+ struct t_infolist *prev_infolist; /* link to previous list */
+ struct t_infolist *next_infolist; /* link to next list */
+};
+
+/* list variables */
+
+extern struct t_infolist *weechat_infolists;
+extern struct t_infolist *last_weechat_infolist;
+
+/* list functions */
+
+extern struct t_infolist *infolist_new (struct t_weechat_plugin *plugin);
+extern int infolist_valid (struct t_infolist *infolist);
+extern struct t_infolist_item *infolist_new_item (struct t_infolist *infolist);
+extern struct t_infolist_var *infolist_new_var_integer (struct t_infolist_item *item,
+ const char *name,
+ int value);
+extern struct t_infolist_var *infolist_new_var_string (struct t_infolist_item *item,
+ const char *name,
+ const char *value);
+extern struct t_infolist_var *infolist_new_var_pointer (struct t_infolist_item *item,
+ const char *name,
+ void *pointer);
+extern struct t_infolist_var *infolist_new_var_buffer (struct t_infolist_item *item,
+ const char *name,
+ void *pointer,
+ int size);
+extern struct t_infolist_var *infolist_new_var_time (struct t_infolist_item *item,
+ const char *name,
+ time_t time);
+extern struct t_infolist_var *infolist_search_var (struct t_infolist *infolist,
+ const char *name);
+extern struct t_infolist_item *infolist_next (struct t_infolist *infolist);
+extern struct t_infolist_item *infolist_prev (struct t_infolist *infolist);
+extern void infolist_reset_item_cursor (struct t_infolist *infolist);
+extern const char *infolist_fields (struct t_infolist *infolist);
+extern int infolist_integer (struct t_infolist *infolist,
+ const char *var);
+extern const char *infolist_string (struct t_infolist *infolist,
+ const char *var);
+extern void *infolist_pointer (struct t_infolist *infolist,
+ const char *var);
+extern void *infolist_buffer (struct t_infolist *infolist,
+ const char *var, int *size);
+extern time_t infolist_time (struct t_infolist *infolist,
+ const char *var);
+extern void infolist_free (struct t_infolist *infolist);
+extern void infolist_free_all_plugin (struct t_weechat_plugin *plugin);
+extern void infolist_print_log ();
+
+#endif /* WEECHAT_INFOLIST_H */