summaryrefslogtreecommitdiff
path: root/src/perl/common/Channel.xs
blob: 0692a7ccc5642f78af2c33ae6c1a8f095bd9b7bf (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
#include "module.h"

MODULE = Irssi::Channel  PACKAGE = Irssi
PROTOTYPES: ENABLE

void
channels()
PREINIT:
	GSList *tmp;
PPCODE:
	for (tmp = channels; tmp != NULL; tmp = tmp->next) {
		XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data)));
	}

Irssi::Channel
channel_find(channel)
	char *channel
CODE:
	RETVAL = channel_find(NULL, channel);
OUTPUT:
	RETVAL

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

void
channels(server)
	Irssi::Server server
PREINIT:
	GSList *tmp;
PPCODE:
	for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
		XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data)));
	}

void
channels_join(server, channels, automatic)
	Irssi::Server server
	char *channels
	int automatic
CODE:
	server->channels_join(server, channels, automatic);

Irssi::Channel
channel_find(server, name)
	Irssi::Server server
	char *name

void
nicks_get_same(server, nick)
	Irssi::Server server
        char *nick
PREINIT:
	GSList *list, *tmp;
PPCODE:
	list = nicklist_get_same(server, nick);

	for (tmp = list; tmp != NULL; tmp = tmp->next->next) {
		XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data)));
		XPUSHs(sv_2mortal(iobject_bless((NICK_REC *) tmp->next->data)));
	}
	g_slist_free(list);

#*******************************
MODULE = Irssi::Channel  PACKAGE = Irssi::Channel  PREFIX = channel_
#*******************************

void
channel_destroy(channel)
	Irssi::Channel channel

void
nick_insert(channel, nick)
	Irssi::Channel channel
	Irssi::Nick nick
CODE:
	nicklist_insert(channel, nick);

void
nick_remove(channel, nick)
	Irssi::Channel channel
	Irssi::Nick nick
CODE:
	nicklist_remove(channel, nick);

Irssi::Nick
nick_find(channel, nick)
	Irssi::Channel channel
	char *nick
CODE:
	RETVAL = nicklist_find(channel, nick);
OUTPUT:
	RETVAL

Irssi::Nick
nick_find_mask(channel, mask)
	Irssi::Channel channel
	char *mask
CODE:
	RETVAL = nicklist_find_mask(channel, mask);
OUTPUT:
	RETVAL

void
nicks(channel)
	Irssi::Channel channel
PREINIT:
	GSList *list, *tmp;
PPCODE:
	list = nicklist_getnicks(channel);

	for (tmp = list; tmp != NULL; tmp = tmp->next) {
		XPUSHs(sv_2mortal(iobject_bless((NICK_REC *) tmp->data)));
	}
	g_slist_free(list);