1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-04 21:25:41 +02:00

api: allow update for some variables of hdata, add new functions hdata_update and hdata_set

This commit is contained in:
Sebastien Helleu
2012-08-27 09:47:46 +02:00
parent e767346a19
commit df80aa5fc9
54 changed files with 2953 additions and 1713 deletions
+3 -1
View File
@@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
Sébastien Helleu <flashcode@flashtux.org>
v0.3.9-dev, 2012-08-25
v0.3.9-dev, 2012-08-27
Version 0.3.9 (under dev!)
@@ -49,6 +49,8 @@ Version 0.3.9 (under dev!)
* core: escape special chars (`#[\`) in configuration files for name of options
(bug #36584)
* doc: add japanese user's guide (patch #7827)
* api: allow update for some variables of hdata, add new functions hdata_update
and hdata_set
* api: add info "locale" for info_get (locale used to translate messages)
* api: add new function util_version_number
* aspell: add option aspell.check.enabled, add options enable/disable/toggle for
File diff suppressed because it is too large Load Diff
+30 -18
View File
@@ -201,6 +201,7 @@ def get_hdata():
plugin = weechat.infolist_string(infolist, 'plugin_name') or 'weechat'
hdata[plugin][hdata_name]['description'] = weechat.infolist_string(infolist, 'description')
variables = ''
variables_update = ''
lists = ''
ptr_hdata = weechat.hdata_get(hdata_name)
if ptr_hdata:
@@ -208,26 +209,34 @@ def get_hdata():
string = weechat.hdata_get_string(ptr_hdata, 'var_keys_values')
if string:
for item in string.split(','):
(key, value) = item.split(':')
var_type = int(value) >> 16
var_offset = int(value) & 0xFFFF
key = item.split(':')[0]
var_offset = weechat.hdata_get_var_offset(ptr_hdata, key)
var_array_size = weechat.hdata_get_var_array_size_string(ptr_hdata, '', key)
if var_array_size:
var_array_size = ', array_size: \'%s\'' % var_array_size
var_array_size = ', array_size: "%s"' % var_array_size
var_hdata = weechat.hdata_get_var_hdata(ptr_hdata, key)
if var_hdata:
var_hdata = ', hdata: \'%s\'' % var_hdata
var_hdata = ', hdata: "%s"' % var_hdata
type_string = weechat.hdata_get_var_type_string(ptr_hdata, key)
hdata2.append({'offset': var_offset,
'text': '\'%s\' (%s%s%s)' % (key,
weechat.hdata_get_var_type_string(ptr_hdata, key),
var_array_size,
var_hdata)})
'text': '\'%s\' (%s)' % (key, type_string),
'textlong': '\'%s\' (%s%s%s)' % (key, type_string, var_array_size, var_hdata),
'update': weechat.hdata_update(ptr_hdata, '', { '__update_allowed': key })})
hdata2 = sorted(hdata2, key=itemgetter('offset'))
for item in hdata2:
if variables:
variables += ' +\n'
variables += ' %s' % item['text']
variables += ' %s' % item['textlong']
if item['update']:
if variables_update:
variables_update += ' +\n'
variables_update += ' %s' % item['text']
if weechat.hdata_update(ptr_hdata, '', { '__delete_allowed' : '' }):
if variables_update:
variables_update += ' +\n'
variables_update += ' \'__delete\''
hdata[plugin][hdata_name]['vars'] = '\n%s' % variables
hdata[plugin][hdata_name]['vars_update'] = '\n%s' % variables_update
string = weechat.hdata_get_string(ptr_hdata, 'list_keys')
if string:
@@ -480,20 +489,23 @@ def docgen_cmd_cb(data, buffer, args):
filename = '%s/plugin_api/hdata.txt' % directory
tmpfilename = '%s.tmp' % filename
f = open(tmpfilename, 'w')
f.write('[width="100%",cols="^1,^2,5,5,5",options="header"]\n')
f.write('[width="100%",cols="^1,^2,5,5,5,5",options="header"]\n')
f.write('|========================================\n')
f.write('| %s | %s | %s | %s | %s\n\n' % (_('Plugin'), _('Name'), _('Description'),
_('Variables'), _('Lists')))
f.write('| %s | %s | %s | %s | %s | %s\n\n' % (_('Plugin'), _('Name'), _('Description'),
_('Variables'), _('Update allowed'),
_('Lists')))
for plugin in sorted(hdata):
for hdata_name in sorted(hdata[plugin]):
description = translate(hdata[plugin][hdata_name]['description'])
variables = hdata[plugin][hdata_name]['vars']
variables_update = hdata[plugin][hdata_name]['vars_update']
lists = hdata[plugin][hdata_name]['lists']
f.write('| %s | %s | %s |%s |%s\n\n' % (escape(plugin),
escape(hdata_name),
escape(description),
escape(variables),
escape(lists)))
f.write('| %s | %s | %s |%s |%s |%s\n\n' % (escape(plugin),
escape(hdata_name),
escape(description),
escape(variables),
escape(variables_update),
escape(lists)))
f.write('|========================================\n')
f.close()
update_file(filename, tmpfilename, num_files, num_files_updated, 'hdata')
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8993,6 +8993,9 @@ msgstr "Ukazatel"
msgid "Variables"
msgstr ""
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr ""
+4 -1
View File
@@ -23,7 +23,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.7-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <weechatter@arcor.de>\n"
@@ -9575,6 +9575,9 @@ msgstr "Pointer"
msgid "Variables"
msgstr "Variablen"
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr "Listen"
+4 -1
View File
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9277,6 +9277,9 @@ msgstr "Puntero"
msgid "Variables"
msgstr "Variables"
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr "Listas"
+5 -2
View File
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"PO-Revision-Date: 2012-08-23 22:02+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-25 16:14+0200\n"
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: French\n"
@@ -9432,6 +9432,9 @@ msgstr "Pointeur"
msgid "Variables"
msgstr "Variables"
msgid "Update allowed"
msgstr "Mise à jour autorisée"
msgid "Lists"
msgstr "Listes"
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8488,6 +8488,9 @@ msgstr "perc"
msgid "Variables"
msgstr ""
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr ""
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9254,6 +9254,9 @@ msgstr "Puntatore"
msgid "Variables"
msgstr "Variabili"
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr "Liste"
+4 -1
View File
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/WeeChat>\n"
@@ -9047,6 +9047,9 @@ msgstr "ポインタ"
msgid "Variables"
msgstr "変数"
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr "リスト"
+4 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Krzysztof Korościk <soltys@szluug.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -9186,6 +9186,9 @@ msgstr "Wskaźnik"
msgid "Variables"
msgstr "Zmienne"
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr "Listy"
+4 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Sergio Durigan Junior <sergiosdj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8630,6 +8630,9 @@ msgstr "Ponteiro"
msgid "Variables"
msgstr "Variáveis"
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr "Listas"
+4 -1
View File
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.9-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: 2012-08-20 15:20+0200\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -8507,6 +8507,9 @@ msgstr "минута"
msgid "Variables"
msgstr ""
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr ""
+4 -1
View File
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2012-08-23 22:01+0200\n"
"POT-Creation-Date: 2012-08-25 19:27+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -7479,6 +7479,9 @@ msgstr ""
msgid "Variables"
msgstr ""
msgid "Update allowed"
msgstr ""
msgid "Lists"
msgstr ""
File diff suppressed because it is too large Load Diff
+14 -8
View File
@@ -310,15 +310,16 @@ debug_hdata_hash_var_map_cb (void *data,
const void *key, const void *value)
{
struct t_weelist *list;
struct t_hdata_var *var;
char str_offset[16];
/* make C compiler happy */
(void) hashtable;
list = (struct t_weelist *)data;
var = (struct t_hdata_var *)value;
snprintf (str_offset, sizeof (str_offset),
"%12d", (*((int *)value)) & 0xFFFF);
snprintf (str_offset, sizeof (str_offset), "%12d", var->offset);
weelist_add (list, str_offset, WEECHAT_LIST_POS_SORT, (void *)key);
}
@@ -350,9 +351,9 @@ debug_hdata_map_cb (void *data, struct t_hashtable *hashtable,
const void *key, const void *value)
{
struct t_hdata *ptr_hdata;
struct t_hdata_var *ptr_var;
struct t_weelist *list;
struct t_weelist_item *ptr_item;
void *ptr_value;
/* make C compiler happy */
(void) data;
@@ -379,14 +380,19 @@ debug_hdata_map_cb (void *data, struct t_hashtable *hashtable,
for (ptr_item = list->items; ptr_item;
ptr_item = ptr_item->next_item)
{
ptr_value = hashtable_get (ptr_hdata->hash_var, ptr_item->user_data);
if (ptr_value)
ptr_var = hashtable_get (ptr_hdata->hash_var, ptr_item->user_data);
if (ptr_var)
{
gui_chat_printf (NULL,
" %04d -> %s (%s)",
(*((int *)ptr_value)) & 0xFFFF,
" %04d -> %s (%s%s%s%s%s%s)",
ptr_var->offset,
(char *)ptr_item->user_data,
hdata_type_string[(*((int *)ptr_value)) >> 16]);
hdata_type_string[(int)ptr_var->type],
(ptr_var->update_allowed) ? ", R/W" : "",
(ptr_var->array_size) ? ", array size: " : "",
(ptr_var->array_size) ? ptr_var->array_size : "",
(ptr_var->hdata_name) ? ", hdata: " : "",
(ptr_var->hdata_name) ? ptr_var->hdata_name : "");
}
}
weelist_free (list);
+473 -276
View File
File diff suppressed because it is too large Load Diff
+36 -6
View File
@@ -20,11 +20,22 @@
#ifndef __WEECHAT_HDATA_H
#define __WEECHAT_HDATA_H 1
#define HDATA_VAR(__struct, __name, __type, __array_size, __hdata_name) \
#define HDATA_VAR(__struct, __name, __type, __update_allowed, \
__array_size, __hdata_name) \
hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
WEECHAT_HDATA_##__type, __array_size, __hdata_name)
WEECHAT_HDATA_##__type, __update_allowed, \
__array_size, __hdata_name)
#define HDATA_LIST(__name) hdata_new_list (hdata, #__name, &(__name));
struct t_hdata_var
{
int offset; /* offset */
char type; /* type */
char update_allowed; /* update allowed? */
char *array_size; /* array size */
char *hdata_name; /* hdata name */
};
struct t_hdata
{
struct t_weechat_plugin *plugin; /* plugin which created this hdata */
@@ -34,10 +45,19 @@ struct t_hdata
char *var_next; /* name of var with pointer to */
/* next element in list */
struct t_hashtable *hash_var; /* hash with type & offset of vars */
struct t_hashtable *hash_var_array_size; /* array size */
struct t_hashtable *hash_var_hdata; /* hashtable with hdata names */
struct t_hashtable *hash_list; /* hashtable with pointers on lists */
/* (used to search objects) */
char delete_allowed; /* delete allowed? */
int (*callback_update) /* update callback */
(void *data,
struct t_hdata *hdata,
void *pointer,
struct t_hashtable *hashtable);
void *callback_update_data; /* data sent to update callback */
/* internal vars */
char update_pending; /* update pending: hdata_set allowed */
};
extern struct t_hashtable *weechat_hdata;
@@ -46,9 +66,15 @@ extern char *hdata_type_string[];
extern struct t_hdata *hdata_new (struct t_weechat_plugin *plugin,
const char *hdata_name, const char *var_prev,
const char *var_next);
const char *var_next,
int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,
struct t_hashtable *hashtable),
void *callback_update_data);
extern void hdata_new_var (struct t_hdata *hdata, const char *name, int offset,
int type, const char *array_size,
int type, int update_allowed, const char *array_size,
const char *hdata_name);
extern void hdata_new_list (struct t_hdata *hdata, const char *name,
void *pointer);
@@ -85,6 +111,10 @@ extern time_t hdata_time (struct t_hdata *hdata, void *pointer,
const char *name);
extern struct t_hashtable *hdata_hashtable (struct t_hdata *hdata,
void *pointer, const char *name);
extern int hdata_set (struct t_hdata *hdata, void *pointer, const char *name,
const char *value);
extern int hdata_update (struct t_hdata *hdata, void *pointer,
struct t_hashtable *hashtable);
extern const char *hdata_get_string (struct t_hdata *hdata,
const char *property);
extern void hdata_free_all_plugin (struct t_weechat_plugin *plugin);
+8 -7
View File
@@ -1852,15 +1852,16 @@ gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item");
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, NULL, "plugin");
HDATA_VAR(struct t_gui_bar_item, name, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar_item, next_item, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar_item, plugin, POINTER, 0, NULL, "plugin");
HDATA_VAR(struct t_gui_bar_item, name, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar_item, next_item, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_bar_items);
HDATA_LIST(last_gui_bar_item);
}
+23 -22
View File
@@ -1404,30 +1404,31 @@ gui_bar_window_hdata_bar_window_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window");
hdata = hdata_new (NULL, hdata_name, "prev_bar_window", "next_bar_window",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_bar_window, bar, POINTER, NULL, "bar");
HDATA_VAR(struct t_gui_bar_window, x, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, y, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, width, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, height, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, cursor_x, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, cursor_y, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, current_size, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_count, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_subcount, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_content, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_num_lines, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_refresh_needed, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, screen_col_size, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, coords_count, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, coords, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, gui_objects, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, prev_bar_window, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar_window, next_bar_window, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar_window, bar, POINTER, 0, NULL, "bar");
HDATA_VAR(struct t_gui_bar_window, x, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, y, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, width, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, height, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, scroll_x, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, scroll_y, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, cursor_x, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, cursor_y, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, current_size, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_subcount, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_content, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_num_lines, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, items_refresh_needed, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, screen_col_size, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, coords_count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, coords, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, gui_objects, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar_window, prev_bar_window, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar_window, next_bar_window, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
+16 -15
View File
@@ -2243,23 +2243,24 @@ gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar");
hdata = hdata_new (NULL, hdata_name, "prev_bar", "next_bar",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_bar, name, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_bar, options, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, conditions_array, STRING, "conditions_count", NULL);
HDATA_VAR(struct t_gui_bar, items_count, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_array, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_prefix, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_name, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_suffix, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, bar_window, POINTER, NULL, "bar_window");
HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar, next_bar, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar, name, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, options, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, conditions_array, STRING, 0, "conditions_count", NULL);
HDATA_VAR(struct t_gui_bar, items_count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_subcount, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_array, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_prefix, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_name, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, items_suffix, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, bar_window, POINTER, 0, NULL, "bar_window");
HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_bar, prev_bar, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_bar, next_bar, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_bars);
HDATA_LIST(last_gui_bar);
}
+79 -76
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -339,6 +339,9 @@ gui_chat_get_time_string (time_t date)
int i, time_first_digit, time_last_digit, last_color;
struct tm *local_time;
if (date == 0)
return NULL;
if (!CONFIG_STRING(config_look_buffer_time_format)
|| !CONFIG_STRING(config_look_buffer_time_format)[0])
return NULL;
+27 -25
View File
@@ -1214,28 +1214,29 @@ gui_completion_hdata_completion_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, NULL, NULL);
hdata = hdata_new (NULL, hdata_name, NULL, NULL,
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_completion, buffer, POINTER, NULL, "buffer");
HDATA_VAR(struct t_gui_completion, context, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_command, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_word, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, position, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, args, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_completion, direction, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, add_space, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, completion_list, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, word_found, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, position_replace, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, diff_size, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, diff_length, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER, NULL, "completion_partial");
HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER, NULL, "completion_partial");
HDATA_VAR(struct t_gui_completion, buffer, POINTER, 0, NULL, "buffer");
HDATA_VAR(struct t_gui_completion, context, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_command, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_word, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, position, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, args, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, direction, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, add_space, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, completion_list, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, word_found, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, position_replace, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, diff_size, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, diff_length, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER, 0, NULL, "completion_partial");
HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER, 0, NULL, "completion_partial");
}
return hdata;
}
@@ -1253,13 +1254,14 @@ gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item");
hdata = hdata_new (NULL, hdata_name, "prev_item", "next_item",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_completion_partial, word, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_completion_partial, count, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_completion_partial, word, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion_partial, count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
+15 -14
View File
@@ -449,22 +449,23 @@ gui_filter_hdata_filter_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter");
hdata = hdata_new (NULL, hdata_name, "prev_filter", "next_filter",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_filter, enabled, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_filter, name, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_filter, buffer_name, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_filter, buffers, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_filter, tags, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_filter, tags_count, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_filter, tags_array, STRING, "tags_count", NULL);
HDATA_VAR(struct t_gui_filter, regex, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_filter, regex_message, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_filter, prev_filter, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_filter, next_filter, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_filter, enabled, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, name, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, buffer_name, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, buffers, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, tags, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, tags_count, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, tags_array, STRING, 0, "tags_count", NULL);
HDATA_VAR(struct t_gui_filter, regex, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, regex_message, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_filter, prev_filter, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_filter, next_filter, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_filters);
HDATA_LIST(last_gui_filter);
}
+5 -4
View File
@@ -227,12 +227,13 @@ gui_history_hdata_history_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history");
hdata = hdata_new (NULL, hdata_name, "prev_history", "next_history",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_history, text, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_history, prev_history, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_history, next_history, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_history, text, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_history, prev_history, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_history, next_history, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
+9 -8
View File
@@ -474,16 +474,17 @@ gui_hotlist_hdata_hotlist_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_hotlist", "next_hotlist");
hdata = hdata_new (NULL, hdata_name, "prev_hotlist", "next_hotlist",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_hotlist, priority, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, creation_time.tv_sec, TIME, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, creation_time.tv_usec, LONG, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, buffer, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, count, INTEGER, GUI_HOTLIST_NUM_PRIORITIES_STR, NULL);
HDATA_VAR(struct t_gui_hotlist, prev_hotlist, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_hotlist, next_hotlist, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_hotlist, priority, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, creation_time.tv_sec, TIME, 0, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, creation_time.tv_usec, LONG, 0, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, buffer, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_hotlist, count, INTEGER, 0, GUI_HOTLIST_NUM_PRIORITIES_STR, NULL);
HDATA_VAR(struct t_gui_hotlist, prev_hotlist, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_hotlist, next_hotlist, POINTER, 0, NULL, hdata_name);
HDATA_LIST(gui_hotlist);
HDATA_LIST(last_gui_hotlist);
}
+10 -9
View File
@@ -1715,17 +1715,18 @@ gui_key_hdata_key_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key");
hdata = hdata_new (NULL, hdata_name, "prev_key", "next_key",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_key, key, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_key, area_type, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_key, area_name, POINTER, NULL, NULL);
HDATA_VAR(struct t_gui_key, area_key, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_key, command, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_key, score, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_key, prev_key, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_key, next_key, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_key, key, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_key, area_type, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_key, area_name, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_key, area_key, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_key, command, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_key, score, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_key, prev_key, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_key, next_key, POINTER, 0, NULL, hdata_name);
for (i = 0; i < GUI_KEY_NUM_CONTEXTS; i++)
{
snprintf (str_list, sizeof (str_list),
+114 -29
View File
File diff suppressed because it is too large Load Diff
+23 -21
View File
@@ -971,20 +971,21 @@ gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group");
hdata = hdata_new (NULL, hdata_name, "prev_group", "next_group",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_nick_group, name, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, color, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, visible, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, level, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, parent, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, children, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, last_child, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, nicks, POINTER, NULL, "nick");
HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER, NULL, "nick");
HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, next_group, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, name, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, color, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, visible, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, level, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick_group, parent, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, children, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, last_child, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, nicks, POINTER, 0, NULL, "nick");
HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER, 0, NULL, "nick");
HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick_group, next_group, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
@@ -1001,17 +1002,18 @@ gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick");
hdata = hdata_new (NULL, hdata_name, "prev_nick", "next_nick",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_gui_nick, group, POINTER, NULL, "nick_group");
HDATA_VAR(struct t_gui_nick, name, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_nick, color, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_nick, prefix, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_nick, prefix_color, STRING, NULL, NULL);
HDATA_VAR(struct t_gui_nick, visible, INTEGER, NULL, NULL);
HDATA_VAR(struct t_gui_nick, prev_nick, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick, next_nick, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick, group, POINTER, 0, NULL, "nick_group");
HDATA_VAR(struct t_gui_nick, name, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick, color, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick, prefix, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick, prefix_color, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick, visible, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_gui_nick, prev_nick, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_gui_nick, next_nick, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
+45 -43
View File
File diff suppressed because it is too large Load Diff
+29 -4
View File
@@ -5102,7 +5102,6 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
{
char timebuffer[64], *result;
time_t time;
struct tm *date_tmp;
SCM return_value;
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
@@ -5113,9 +5112,7 @@ weechat_guile_api_hdata_time (SCM hdata, SCM pointer, SCM name)
time = weechat_hdata_time (API_STR2PTR(scm_i_string_chars (hdata)),
API_STR2PTR(scm_i_string_chars (pointer)),
scm_i_string_chars (name));
date_tmp = localtime (&time);
if (date_tmp)
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -5144,6 +5141,33 @@ weechat_guile_api_hdata_hashtable (SCM hdata, SCM pointer, SCM name)
return result_alist;
}
/*
* weechat_guile_api_hdata_update: update data in a hdata
*/
SCM
weechat_guile_api_hdata_update (SCM hdata, SCM pointer, SCM hashtable)
{
struct t_hashtable *c_hashtable;
int value;
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
if (!scm_is_string (hdata) || !scm_is_string (pointer) || !scm_list_p (hashtable))
API_WRONG_ARGS(API_RETURN_INT(0));
c_hashtable = weechat_guile_alist_to_hashtable (hashtable,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
value = weechat_hdata_update (API_STR2PTR(scm_i_string_chars (hdata)),
API_STR2PTR(scm_i_string_chars (pointer)),
c_hashtable);
if (c_hashtable)
weechat_hashtable_free (c_hashtable);
API_RETURN_INT(value);
}
/*
* weechat_guile_api_hdata_get_string: get hdata property as string
*/
@@ -5494,6 +5518,7 @@ weechat_guile_api_module_init (void *data)
API_DEF_FUNC(hdata_pointer, 3);
API_DEF_FUNC(hdata_time, 3);
API_DEF_FUNC(hdata_hashtable, 3);
API_DEF_FUNC(hdata_update, 3);
API_DEF_FUNC(hdata_get_string, 2);
API_DEF_FUNC(upgrade_new, 2);
API_DEF_FUNC(upgrade_write_object, 3);
+33 -31
View File
@@ -876,34 +876,35 @@ irc_channel_hdata_channel_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel");
hdata = weechat_hdata_new (hdata_name, "prev_channel", "next_channel",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, NULL, "irc_nick");
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, NULL, "irc_nick");
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, NULL, "irc_channel_speaking");
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, NULL, "irc_channel_speaking");
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, NULL, "buffer");
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_channel, type, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, name, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, topic, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, modes, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, limit, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, key, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, names_received, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, checking_away, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, away_message, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, has_quit_server, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, cycle, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, part, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nick_completion_reset, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, pv_remote_nick_color, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, hook_autorejoin, POINTER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_count, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks, POINTER, 0, NULL, "irc_nick");
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick, POINTER, 0, NULL, "irc_nick");
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking, POINTER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, nicks_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
WEECHAT_HDATA_VAR(struct t_irc_channel, last_nick_speaking_time, POINTER, 0, NULL, "irc_channel_speaking");
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer, POINTER, 0, NULL, "buffer");
WEECHAT_HDATA_VAR(struct t_irc_channel, buffer_as_string, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel, prev_channel, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_channel, next_channel, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
@@ -920,13 +921,14 @@ irc_channel_hdata_channel_speaking_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, nick, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, time_last_message, TIME, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, prev_nick, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_channel_speaking, next_nick, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
+9 -8
View File
@@ -318,16 +318,17 @@ irc_ignore_hdata_ignore_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore");
hdata = weechat_hdata_new (hdata_name, "prev_ignore", "next_ignore",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_ignore, number, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, mask, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, regex_mask, POINTER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, server, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, channel, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_ignore, prev_ignore, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_ignore, next_ignore, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_LIST(irc_ignore_list);
WEECHAT_HDATA_LIST(last_irc_ignore);
}
+10 -9
View File
@@ -1031,17 +1031,18 @@ irc_nick_hdata_nick_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick");
hdata = weechat_hdata_new (hdata_name, "prev_nick", "next_nick",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_nick, name, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, host, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, prefixes, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, prefix, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, away, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, color, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_nick, prev_nick, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_nick, next_nick, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
+10 -9
View File
@@ -963,17 +963,18 @@ irc_notify_hdata_notify_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify");
hdata = weechat_hdata_new (hdata_name, "prev_notify", "next_notify",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, NULL, "irc_server");
WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_notify, server, POINTER, 0, NULL, "irc_server");
WEECHAT_HDATA_VAR(struct t_irc_notify, nick, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, check_away, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, is_on_server, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, away_message, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, ison_received, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_notify, prev_notify, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_notify, next_notify, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
+32 -30
View File
@@ -975,17 +975,18 @@ irc_redirect_hdata_redirect_pattern_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, name, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, temp_pattern, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, timeout, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_start, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_stop, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, cmd_extra, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, prev_redirect, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_redirect_pattern, next_redirect, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_LIST(irc_redirect_patterns);
WEECHAT_HDATA_LIST(last_irc_redirect_pattern);
}
@@ -1004,29 +1005,30 @@ irc_redirect_hdata_redirect_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect");
hdata = weechat_hdata_new (hdata_name, "prev_redirect", "next_redirect",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, NULL, "irc_server");
WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, assigned_to_command, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_redirect, server, POINTER, 0, NULL, "irc_server");
WEECHAT_HDATA_VAR(struct t_irc_redirect, pattern, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, signal, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, count, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, current_count, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, string, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, timeout, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, command, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, assigned_to_command, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, start_time, TIME, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start, HASHTABLE, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop, HASHTABLE, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_extra, HASHTABLE, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_start_received, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_stop_received, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, cmd_filter, HASHTABLE, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, output, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, output_size, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_irc_redirect, prev_redirect, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_irc_redirect, next_redirect, POINTER, 0, NULL, hdata_name);
}
return hdata;
}
File diff suppressed because it is too large Load Diff
+32 -4
View File
@@ -5627,7 +5627,6 @@ weechat_lua_api_hdata_time (lua_State *L)
{
const char *hdata, *pointer, *name;
time_t time;
struct tm *date_tmp;
char timebuffer[64], *result;
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
@@ -5642,9 +5641,7 @@ weechat_lua_api_hdata_time (lua_State *L)
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
date_tmp = localtime (&time);
if (date_tmp)
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -5676,6 +5673,36 @@ weechat_lua_api_hdata_hashtable (lua_State *L)
return 1;
}
/*
* weechat_lua_api_hdata_update: update data in a hdata
*/
static int
weechat_lua_api_hdata_update (lua_State *L)
{
const char *hdata, *pointer;
struct t_hashtable *hashtable;
int value;
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
if (lua_gettop (lua_current_interpreter) < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
hdata = lua_tostring (lua_current_interpreter, -3);
pointer = lua_tostring (lua_current_interpreter, -2);
hashtable = weechat_lua_tohashtable (lua_current_interpreter, -1,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
value = weechat_hdata_update (API_STR2PTR(hdata),
API_STR2PTR(pointer),
hashtable);
if (hashtable)
weechat_hashtable_free (hashtable);
API_RETURN_INT(value);
}
/*
* weechat_lua_api_hdata_get_string: get hdata property as string
*/
@@ -6419,6 +6446,7 @@ const struct luaL_Reg weechat_lua_api_funcs[] = {
API_DEF_FUNC(hdata_pointer),
API_DEF_FUNC(hdata_time),
API_DEF_FUNC(hdata_hashtable),
API_DEF_FUNC(hdata_update),
API_DEF_FUNC(hdata_get_string),
API_DEF_FUNC(upgrade_new),
API_DEF_FUNC(upgrade_write_object),
+32 -4
View File
@@ -5358,7 +5358,6 @@ XS (XS_weechat_api_hdata_pointer)
XS (XS_weechat_api_hdata_time)
{
time_t time;
struct tm *date_tmp;
char timebuffer[64], *result, *hdata, *pointer, *name;
dXSARGS;
@@ -5374,9 +5373,7 @@ XS (XS_weechat_api_hdata_time)
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
date_tmp = localtime (&time);
if (date_tmp)
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -5409,6 +5406,36 @@ XS (XS_weechat_api_hdata_hashtable)
API_RETURN_OBJ(result_hash);
}
/*
* weechat::hdata_update: update data in a hdata
*/
XS (XS_weechat_api_hdata_update)
{
char *hdata, *pointer;
struct t_hashtable *hashtable;
int value;
dXSARGS;
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
if (items < 3)
API_WRONG_ARGS(API_RETURN_INT(0));
hdata = SvPV_nolen (ST (0));
pointer = SvPV_nolen (ST (1));
hashtable = weechat_perl_hash_to_hashtable (ST (2),
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
value = weechat_hdata_update (API_STR2PTR(hdata),
API_STR2PTR(pointer),
hashtable);
if (hashtable)
weechat_hashtable_free (hashtable);
API_RETURN_INT(value);
}
/*
* weechat::hdata_get_string: get hdata property as string
*/
@@ -5763,6 +5790,7 @@ weechat_perl_api_init (pTHX)
API_DEF_FUNC(hdata_pointer);
API_DEF_FUNC(hdata_time);
API_DEF_FUNC(hdata_hashtable);
API_DEF_FUNC(hdata_update);
API_DEF_FUNC(hdata_get_string);
API_DEF_FUNC(upgrade_new);
API_DEF_FUNC(upgrade_write_object);
+15 -14
View File
@@ -1202,22 +1202,23 @@ plugin_script_hdata_script (struct t_weechat_plugin *weechat_plugin,
{
struct t_hdata *hdata;
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script");
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, interpreter, POINTER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, name, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, author, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, version, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, license, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, description, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, shutdown_func, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, charset, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, callbacks, POINTER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, unloading, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, prev_script, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_plugin_script, next_script, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_plugin_script, filename, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, interpreter, POINTER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, name, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, author, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, version, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, license, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, description, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, shutdown_func, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, charset, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, callbacks, POINTER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, unloading, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_plugin_script, prev_script, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_plugin_script, next_script, POINTER, 0, NULL, hdata_name);
weechat_hdata_new_list (hdata, "scripts", scripts);
weechat_hdata_new_list (hdata, "last_script", last_script);
}
+15 -12
View File
@@ -756,6 +756,8 @@ plugin_load (const char *filename, int argc, char **argv)
new_plugin->hdata_pointer = &hdata_pointer;
new_plugin->hdata_time = &hdata_time;
new_plugin->hdata_hashtable = &hdata_hashtable;
new_plugin->hdata_set = &hdata_set;
new_plugin->hdata_update = &hdata_update;
new_plugin->hdata_get_string = &hdata_get_string;
new_plugin->upgrade_new = &upgrade_file_new;
@@ -1211,20 +1213,21 @@ plugin_hdata_plugin_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin");
hdata = hdata_new (NULL, hdata_name, "prev_plugin", "next_plugin",
0, NULL, NULL);
if (hdata)
{
HDATA_VAR(struct t_weechat_plugin, filename, STRING, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, handle, POINTER, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, name, STRING, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, description, STRING, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, author, STRING, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, version, STRING, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, license, STRING, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, charset, STRING, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, NULL, hdata_name);
HDATA_VAR(struct t_weechat_plugin, filename, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, handle, POINTER, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, name, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, description, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, author, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, version, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, license, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, charset, STRING, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, debug, INTEGER, 0, NULL, NULL);
HDATA_VAR(struct t_weechat_plugin, prev_plugin, POINTER, 0, NULL, hdata_name);
HDATA_VAR(struct t_weechat_plugin, next_plugin, POINTER, 0, NULL, hdata_name);
HDATA_LIST(weechat_plugins);
HDATA_LIST(last_weechat_plugin);
}
File diff suppressed because it is too large Load Diff
+37 -4
View File
@@ -6382,7 +6382,6 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
{
char *c_hdata, *c_pointer, *c_name, timebuffer[64], *result;
time_t time;
struct tm *date_tmp;
VALUE return_value;
API_FUNC(1, "hdata_time", API_RETURN_EMPTY);
@@ -6401,9 +6400,7 @@ weechat_ruby_api_hdata_time (VALUE class, VALUE hdata, VALUE pointer,
time = weechat_hdata_time (API_STR2PTR(c_hdata),
API_STR2PTR(c_pointer),
c_name);
date_tmp = localtime (&time);
if (date_tmp)
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -6441,6 +6438,41 @@ weechat_ruby_api_hdata_hashtable (VALUE class, VALUE hdata, VALUE pointer,
return result_hash;
}
/*
* weechat_ruby_api_hdata_update: update data in a hdata
*/
static VALUE
weechat_ruby_api_hdata_update (VALUE class, VALUE hdata, VALUE pointer,
VALUE hashtable)
{
char *c_hdata, *c_pointer;
struct t_hashtable *c_hashtable;
int value;
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
if (NIL_P (hdata) || NIL_P (pointer) || NIL_P (hashtable))
API_WRONG_ARGS(API_RETURN_INT(0));
Check_Type (hdata, T_STRING);
Check_Type (pointer, T_STRING);
Check_Type (hashtable, T_HASH);
c_hdata = StringValuePtr (hdata);
c_pointer = StringValuePtr (pointer);
c_hashtable = weechat_ruby_hash_to_hashtable (hashtable,
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
value = weechat_hdata_update (API_STR2PTR(c_hdata),
API_STR2PTR(c_pointer),
c_hashtable);
if (c_hashtable)
weechat_hashtable_free (c_hashtable);
API_RETURN_INT(value);
}
/*
* weechat_ruby_api_hdata_get_string: get hdata property as string
*/
@@ -6859,6 +6891,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
API_DEF_FUNC(hdata_pointer, 3);
API_DEF_FUNC(hdata_time, 3);
API_DEF_FUNC(hdata_hashtable, 3);
API_DEF_FUNC(hdata_update, 3);
API_DEF_FUNC(hdata_get_string, 2);
API_DEF_FUNC(upgrade_new, 2);
API_DEF_FUNC(upgrade_write_object, 3);
+25 -24
View File
@@ -1318,32 +1318,33 @@ script_repo_hdata_script_cb (void *data, const char *hdata_name)
/* make C compiler happy */
(void) data;
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script");
hdata = weechat_hdata_new (hdata_name, "prev_script", "next_script",
0, NULL, NULL);
if (hdata)
{
WEECHAT_HDATA_VAR(struct t_repo_script, name, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, name_with_extension, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, language, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, author, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, mail, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, version, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, license, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, description, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, tags, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, requirements, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, min_weechat, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, max_weechat, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, md5sum, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, url, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, popularity, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, date_added, TIME, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, date_updated, TIME, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, status, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, version_loaded, STRING, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, displayed, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, install_order, INTEGER, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, prev_script, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_repo_script, next_script, POINTER, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_repo_script, name, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, name_with_extension, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, language, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, author, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, mail, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, version, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, license, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, description, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, tags, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, requirements, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, min_weechat, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, max_weechat, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, md5sum, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, url, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, popularity, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, date_added, TIME, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, date_updated, TIME, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, status, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, version_loaded, STRING, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, displayed, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, install_order, INTEGER, 0, NULL, NULL);
WEECHAT_HDATA_VAR(struct t_repo_script, prev_script, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_VAR(struct t_repo_script, next_script, POINTER, 0, NULL, hdata_name);
WEECHAT_HDATA_LIST(repo_scripts);
WEECHAT_HDATA_LIST(last_repo_script);
}
+34 -4
View File
@@ -6103,7 +6103,6 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
{
Tcl_Obj *objp;
time_t time;
struct tm *date_tmp;
char timebuffer[64], *result, *hdata, *pointer, *name;
int i;
@@ -6119,9 +6118,7 @@ weechat_tcl_api_hdata_time (ClientData clientData, Tcl_Interp *interp,
time = weechat_hdata_time (API_STR2PTR(hdata),
API_STR2PTR(pointer),
name);
date_tmp = localtime (&time);
if (date_tmp)
strftime (timebuffer, sizeof (timebuffer), "%F %T", date_tmp);
snprintf (timebuffer, sizeof (timebuffer), "%ld", (long int)time);
result = strdup (timebuffer);
API_RETURN_STRING_FREE(result);
@@ -6157,6 +6154,38 @@ weechat_tcl_api_hdata_hashtable (ClientData clientData, Tcl_Interp *interp,
API_RETURN_OBJ(result_dict);
}
/*
* weechat_tcl_api_hdata_update: update data in a hdata
*/
static int
weechat_tcl_api_hdata_update (ClientData clientData, Tcl_Interp *interp,
int objc, Tcl_Obj *CONST objv[])
{
Tcl_Obj *objp;
char *hdata, *pointer;
struct t_hashtable *hashtable;
int i, value;
API_FUNC(1, "hdata_update", API_RETURN_INT(0));
if (objc < 4)
API_WRONG_ARGS(API_RETURN_INT(0));
hdata = Tcl_GetStringFromObj (objv[1], &i);
pointer = Tcl_GetStringFromObj (objv[2], &i);
hashtable = weechat_tcl_dict_to_hashtable (interp, objv[3],
WEECHAT_SCRIPT_HASHTABLE_DEFAULT_SIZE);
value = weechat_hdata_update (API_STR2PTR(hdata),
API_STR2PTR(pointer),
hashtable);
if (hashtable)
weechat_hashtable_free (hashtable);
API_RETURN_INT(value);
}
/*
* weechat_tcl_api_hdata_get_string: get hdata property as string
*/
@@ -6624,6 +6653,7 @@ void weechat_tcl_api_init (Tcl_Interp *interp)
API_DEF_FUNC(hdata_pointer);
API_DEF_FUNC(hdata_time);
API_DEF_FUNC(hdata_hashtable);
API_DEF_FUNC(hdata_update);
API_DEF_FUNC(hdata_get_string);
API_DEF_FUNC(upgrade_new);
API_DEF_FUNC(upgrade_write_object);
+31 -11
View File
@@ -46,7 +46,7 @@ struct timeval;
*/
/* API version (used to check that plugin has same API and can be loaded) */
#define WEECHAT_PLUGIN_API_VERSION "20120804-01"
#define WEECHAT_PLUGIN_API_VERSION "20120827-01"
/* macros for defining plugin infos */
#define WEECHAT_PLUGIN_NAME(__name) \
@@ -833,9 +833,15 @@ struct t_weechat_plugin
/* hdata */
struct t_hdata *(*hdata_new) (struct t_weechat_plugin *plugin,
const char *hdata_name, const char *var_prev,
const char *var_next);
const char *var_next,
int delete_allowed,
int (*callback_update)(void *data,
struct t_hdata *hdata,
void *pointer,
struct t_hashtable *hashtable),
void *callback_update_data);
void (*hdata_new_var) (struct t_hdata *hdata, const char *name, int offset,
int type, const char *array_size,
int type, int update_allowed, const char *array_size,
const char *hdata_name);
void (*hdata_new_list) (struct t_hdata *hdata, const char *name,
void *pointer);
@@ -874,6 +880,10 @@ struct t_weechat_plugin
const char *name);
struct t_hashtable *(*hdata_hashtable) (struct t_hdata *hdata,
void *pointer, const char *name);
int (*hdata_set) (struct t_hdata *hdata, void *pointer, const char *name,
const char *value);
int (*hdata_update) (struct t_hdata *hdata, void *pointer,
struct t_hashtable *hashtable);
const char *(*hdata_get_string) (struct t_hdata *hdata,
const char *property);
@@ -1598,18 +1608,24 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->infolist_free(__list)
/* hdata */
#define weechat_hdata_new(__hdata_name, __var_prev, __var_next) \
#define weechat_hdata_new(__hdata_name, __var_prev, __var_next, \
__delete_allowed, __callback_update, \
__callback_update_data) \
weechat_plugin->hdata_new(weechat_plugin, __hdata_name, __var_prev, \
__var_next)
__var_next, __delete_allowed, \
__callback_update, \
__callback_update_data)
#define weechat_hdata_new_var(__hdata, __name, __offset, __type, \
__array_size, __hdata_name) \
__update_allowed, __array_size, \
__hdata_name) \
weechat_plugin->hdata_new_var(__hdata, __name, __offset, __type, \
__array_size, __hdata_name)
#define WEECHAT_HDATA_VAR(__struct, __name, __type, __array_size, \
__hdata_name) \
__update_allowed, __array_size, \
__hdata_name)
#define WEECHAT_HDATA_VAR(__struct, __name, __type, __update_allowed, \
__array_size, __hdata_name) \
weechat_hdata_new_var (hdata, #__name, offsetof (__struct, __name), \
WEECHAT_HDATA_##__type, __array_size, \
__hdata_name)
WEECHAT_HDATA_##__type, __update_allowed, \
__array_size, __hdata_name)
#define weechat_hdata_new_list(__hdata, __name, __pointer) \
weechat_plugin->hdata_new_list(__hdata, __name, __pointer)
#define WEECHAT_HDATA_LIST(__name) \
@@ -1656,6 +1672,10 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
weechat_plugin->hdata_time(__hdata, __pointer, __name)
#define weechat_hdata_hashtable(__hdata, __pointer, __name) \
weechat_plugin->hdata_hashtable(__hdata, __pointer, __name)
#define weechat_hdata_set(__hdata, __pointer, __name, __value) \
weechat_plugin->hdata_set(__hdata, __pointer, __name, __value)
#define weechat_hdata_update(__hdata, __pointer, __hashtable) \
weechat_plugin->hdata_update(__hdata, __pointer, __hashtable)
#define weechat_hdata_get_string(__hdata, __property) \
weechat_plugin->hdata_get_string(__hdata, __property)