2014-06-24 20:20:27 +01:00
|
|
|
#define PERL_NO_GET_CONTEXT
|
2001-10-20 19:52:07 +00:00
|
|
|
#include "module.h"
|
2019-08-08 21:54:30 +02:00
|
|
|
#include "wrapper_buffer_line.h"
|
|
|
|
|
#include <irssi/src/fe-text/textbuffer-formats.h>
|
2001-10-20 19:52:07 +00:00
|
|
|
|
|
|
|
|
MODULE = Irssi::TextUI::TextBuffer PACKAGE = Irssi
|
|
|
|
|
PROTOTYPES: ENABLE
|
2001-08-09 01:59:36 +00:00
|
|
|
|
|
|
|
|
#*******************************
|
2001-10-20 19:52:07 +00:00
|
|
|
MODULE = Irssi::TextUI::TextBuffer PACKAGE = Irssi::TextUI::Line PREFIX = textbuffer_line_
|
2001-08-09 01:59:36 +00:00
|
|
|
#*******************************
|
|
|
|
|
|
|
|
|
|
Irssi::TextUI::Line
|
|
|
|
|
textbuffer_line_prev(line)
|
|
|
|
|
Irssi::TextUI::Line line
|
|
|
|
|
CODE:
|
2019-08-08 21:54:30 +02:00
|
|
|
RETVAL = perl_wrap_buffer_line(line->buffer, line->line->prev);
|
2001-08-09 01:59:36 +00:00
|
|
|
OUTPUT:
|
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
|
|
Irssi::TextUI::Line
|
|
|
|
|
textbuffer_line_next(line)
|
|
|
|
|
Irssi::TextUI::Line line
|
|
|
|
|
CODE:
|
2019-08-08 21:54:30 +02:00
|
|
|
RETVAL = perl_wrap_buffer_line(line->buffer, line->line->next);
|
2001-08-09 01:59:36 +00:00
|
|
|
OUTPUT:
|
|
|
|
|
RETVAL
|
|
|
|
|
|
|
|
|
|
void
|
2019-08-08 21:54:30 +02:00
|
|
|
textbuffer_line_get_text(line, coloring)
|
2001-08-09 01:59:36 +00:00
|
|
|
Irssi::TextUI::Line line
|
|
|
|
|
int coloring
|
|
|
|
|
PREINIT:
|
|
|
|
|
GString *str;
|
2006-09-20 23:29:41 +00:00
|
|
|
SV *result;
|
2001-08-09 01:59:36 +00:00
|
|
|
PPCODE:
|
|
|
|
|
str = g_string_new(NULL);
|
2019-08-08 21:54:30 +02:00
|
|
|
textbuffer_line2text(line->buffer, line->line, coloring, str);
|
2006-09-20 23:29:41 +00:00
|
|
|
result = new_pv(str->str);
|
|
|
|
|
XPUSHs(sv_2mortal(result));
|
2001-08-09 01:59:36 +00:00
|
|
|
g_string_free(str, TRUE);
|
|
|
|
|
|
2019-08-08 21:54:30 +02:00
|
|
|
void
|
|
|
|
|
textbuffer_line_get_format(line)
|
|
|
|
|
Irssi::TextUI::Line line
|
|
|
|
|
PREINIT:
|
|
|
|
|
HV *hv;
|
|
|
|
|
AV *av;
|
|
|
|
|
LINE_REC *l;
|
|
|
|
|
TEXT_BUFFER_FORMAT_REC *f;
|
|
|
|
|
int i;
|
|
|
|
|
PPCODE:
|
|
|
|
|
hv = newHV();
|
|
|
|
|
l = line->line;
|
|
|
|
|
if (l->info.format != NULL) {
|
|
|
|
|
f = l->info.format;
|
|
|
|
|
(void) hv_store(hv, "module", 6, new_pv(f->module), 0);
|
|
|
|
|
(void) hv_store(hv, "format", 6, new_pv(f->format), 0);
|
|
|
|
|
(void) hv_store(hv, "server_tag", 10, new_pv(f->server_tag), 0);
|
|
|
|
|
(void) hv_store(hv, "target", 6, new_pv(f->target), 0);
|
|
|
|
|
(void) hv_store(hv, "nick", 4, new_pv(f->nick), 0);
|
|
|
|
|
av = newAV();
|
|
|
|
|
for (i = 0; i < f->nargs; i++) {
|
|
|
|
|
av_push(av, new_pv(f->args[i]));
|
|
|
|
|
}
|
|
|
|
|
(void) hv_store(hv, "args", 4, newRV_noinc((SV *) av), 0);
|
|
|
|
|
} else {
|
|
|
|
|
(void) hv_store(hv, "text", 4, new_pv(l->info.text), 0);
|
|
|
|
|
}
|
|
|
|
|
XPUSHs(sv_2mortal(newRV_noinc((SV *) hv)));
|