summaryrefslogtreecommitdiff
path: root/src/perl/common/Ignore.xs
blob: aab0db8bd5be8a0a8f9518dd3f2419f16af7d5dc (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
MODULE = Irssi  PACKAGE = Irssi

void
ignores()
PREINIT:
	GSList *tmp;
	HV *stash;
PPCODE:
	stash = gv_stashpv("Irssi::Ignore", 0);
	for (tmp = servers; tmp != NULL; tmp = tmp->next) {
		push_bless(tmp->data, stash);
	}

int
ignore_check(nick, host, channel, text, level)
	char *nick
	char *host
	char *channel
	char *text
	int level
CODE:
	RETVAL = ignore_check(NULL, nick, host, channel, text, level);
OUTPUT:
	RETVAL

#*******************************
MODULE = Irssi  PACKAGE = Irssi::Server
#*******************************

int
ignore_check(server, nick, host, channel, text, level)
	Irssi::Server server
	char *nick
	char *host
	char *channel
	char *text
	int level

#*******************************
MODULE = Irssi  PACKAGE = Irssi::Ignore  PREFIX = ignore_
#*******************************

void
init(ignore)
	Irssi::Ignore ignore
PREINIT:
        HV *hv;
	AV *av;
	char **tmp;
CODE:
	hv = hvref(ST(0));
	if (hv != NULL) {
		hv_store(hv, "mask", 4, new_pv(ignore->mask), 0);
		hv_store(hv, "servertag", 9, new_pv(ignore->servertag), 0);
		av = newAV();
		for (tmp = ignore->channels; *tmp != NULL; tmp++) {
			av_push(av, new_pv(*tmp));
		}
		hv_store(hv, "channels", 8, newRV_noinc((SV*)av), 0);
		hv_store(hv, "pattern", 7, new_pv(ignore->pattern), 0);

		hv_store(hv, "level", 5, newSViv(ignore->level), 0);
		hv_store(hv, "except_level", 12, newSViv(ignore->except_level), 0);

		hv_store(hv, "regexp", 6, newSViv(ignore->regexp), 0);
		hv_store(hv, "fullword", 8, newSViv(ignore->fullword), 0);
		XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
	}

void
ignore_add_rec(rec)
	Irssi::Ignore rec

void
ignore_update_rec(rec)
	Irssi::Ignore rec