mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
add LINE_INFO_META_REC to Perl
This commit is contained in:
parent
6a52b5ac07
commit
1602b506a6
@ -52,12 +52,13 @@ while (<>) {
|
||||
CLIENT_REC => 'Irssi::Irc::Client',
|
||||
|
||||
# fe-common
|
||||
THEME_REC => 'Irssi::UI::Theme',
|
||||
KEYINFO_REC => 'Irssi::UI::Keyinfo',
|
||||
PROCESS_REC => 'Irssi::UI::Process',
|
||||
TEXT_DEST_REC => 'Irssi::UI::TextDest',
|
||||
WINDOW_REC => 'Irssi::UI::Window',
|
||||
WI_ITEM_REC => 'iobject',
|
||||
THEME_REC => 'Irssi::UI::Theme',
|
||||
KEYINFO_REC => 'Irssi::UI::Keyinfo',
|
||||
PROCESS_REC => 'Irssi::UI::Process',
|
||||
TEXT_DEST_REC => 'Irssi::UI::TextDest',
|
||||
LINE_INFO_META_REC => 'Irssi::UI::LineInfoMeta',
|
||||
WINDOW_REC => 'Irssi::UI::Window',
|
||||
WI_ITEM_REC => 'iobject',
|
||||
|
||||
# fe-text
|
||||
TEXTBUFFER_VIEW_REC => 'Irssi::TextUI::TextBufferView',
|
||||
|
@ -101,30 +101,10 @@ PPCODE:
|
||||
}
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV *) hv)));
|
||||
|
||||
void
|
||||
Irssi::UI::LineInfoMeta
|
||||
textbuffer_line_get_meta(line)
|
||||
Irssi::TextUI::Line line
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
LINE_REC *l;
|
||||
LINE_INFO_META_REC *m;
|
||||
GHashTableIter iter;
|
||||
char *key;
|
||||
char *val;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
l = line->line;
|
||||
if (l->info.meta != NULL) {
|
||||
m = l->info.meta;
|
||||
if (m->hash != NULL) {
|
||||
g_hash_table_iter_init(&iter, m->hash);
|
||||
while (
|
||||
g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) {
|
||||
(void) hv_store(hv, key, strlen(key), new_pv(val), 0);
|
||||
}
|
||||
}
|
||||
if (m->server_time) {
|
||||
(void) hv_store(hv, "server_time", 11, newSViv(m->server_time), 0);
|
||||
}
|
||||
}
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV *) hv)));
|
||||
CODE:
|
||||
RETVAL = line->line->info.meta;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
@ -64,6 +64,26 @@ static void perl_text_dest_fill_hash(HV *hv, TEXT_DEST_REC *dest)
|
||||
(void) hv_store(hv, "hilight_color", 13, new_pv(dest->hilight_color), 0);
|
||||
}
|
||||
|
||||
static void perl_line_info_meta_fill_hash(HV *hv, LINE_INFO_META_REC *meta)
|
||||
{
|
||||
GHashTableIter iter;
|
||||
char *key;
|
||||
char *val;
|
||||
|
||||
if (meta != NULL) {
|
||||
if (meta->hash != NULL) {
|
||||
g_hash_table_iter_init(&iter, meta->hash);
|
||||
while (
|
||||
g_hash_table_iter_next(&iter, (gpointer *) &key, (gpointer *) &val)) {
|
||||
(void) hv_store(hv, key, strlen(key), new_pv(val), 0);
|
||||
}
|
||||
}
|
||||
if (meta->server_time) {
|
||||
(void) hv_store(hv, "server_time", 11, newSViv(meta->server_time), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void perl_exec_fill_hash(HV *hv, EXEC_WI_REC *item)
|
||||
{
|
||||
g_return_if_fail(hv != NULL);
|
||||
@ -81,6 +101,7 @@ static PLAIN_OBJECT_INIT_REC fe_plains[] = {
|
||||
{ "Irssi::UI::Process", (PERL_OBJECT_FUNC) perl_process_fill_hash },
|
||||
{ "Irssi::UI::Window", (PERL_OBJECT_FUNC) perl_window_fill_hash },
|
||||
{ "Irssi::UI::TextDest", (PERL_OBJECT_FUNC) perl_text_dest_fill_hash },
|
||||
{ "Irssi::UI::LineInfoMeta", (PERL_OBJECT_FUNC) perl_line_info_meta_fill_hash },
|
||||
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
@ -12,3 +12,4 @@ typedef WINDOW_REC *Irssi__UI__Window;
|
||||
typedef TEXT_DEST_REC *Irssi__UI__TextDest;
|
||||
typedef THEME_REC *Irssi__UI__Theme;
|
||||
typedef KEYINFO_REC *Irssi__UI__Keyinfo;
|
||||
typedef LINE_INFO_META_REC *Irssi__UI__LineInfoMeta;
|
||||
|
@ -3,6 +3,7 @@ Irssi::UI::Theme T_PlainObj
|
||||
Irssi::UI::Window T_PlainObj
|
||||
Irssi::UI::Keyinfo T_PlainObj
|
||||
Irssi::UI::TextDest T_PlainObj
|
||||
Irssi::UI::LineInfoMeta T_PlainObj
|
||||
|
||||
INPUT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user