summaryrefslogtreecommitdiff
path: root/src/perl/ui/Formats.xs
blob: 84368d78303b280ef0c97bc16c46f6be70d7a044 (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
#include "module.h"

MODULE = Irssi::UI::Formats  PACKAGE = Irssi::UI::Window
PROTOTYPES: ENABLE

void
format_get_text(window, module, server, target, formatnum, ...)
	Irssi::UI::Window window
	char *module
	Irssi::Server server
	char *target
	int formatnum
PREINIT:
	char **charargs;
	char *ret;
	int n;
	STRLEN n_a;
PPCODE:
	charargs = g_new0(char *, items-5+1);
	charargs[items-5] = NULL;
        for (n = 5; n < items; n++) {
		charargs[n-5] = (char *)SvPV(ST(n), n_a);
	}
	ret = format_get_text(module, window, server, target, formatnum, charargs);
	g_free(charargs);

	XPUSHs(sv_2mortal(new_pv(ret)));
	g_free_not_null(ret);