1 #define PERL_NO_GET_CONTEXT
2 #include "module.h"
3 
4 MODULE = Irssi::Channel  PACKAGE = Irssi
5 PROTOTYPES: ENABLE
6 
7 void
8 channels()
9 PREINIT:
10 	GSList *tmp;
11 PPCODE:
12 	for (tmp = channels; tmp != NULL; tmp = tmp->next) {
13 		XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data)));
14 	}
15 
16 Irssi::Channel
17 channel_find(channel)
18 	char *channel
19 CODE:
20 	RETVAL = channel_find(NULL, channel);
21 OUTPUT:
22 	RETVAL
23 
24 #*******************************
25 MODULE = Irssi::Channel  PACKAGE = Irssi::Server
26 #*******************************
27 
28 void
29 channels(server)
30 	Irssi::Server server
31 PREINIT:
32 	GSList *tmp;
33 PPCODE:
34 	for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
35 		XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data)));
36 	}
37 
38 void
39 channels_join(server, channels, automatic)
40 	Irssi::Server server
41 	char *channels
42 	int automatic
43 CODE:
44 	server->channels_join(server, channels, automatic);
45 
46 Irssi::Channel
47 channel_find(server, name)
48 	Irssi::Server server
49 	char *name
50 
51 void
52 nicks_get_same(server, nick)
53 	Irssi::Server server
54         char *nick
55 PREINIT:
56 	GSList *list, *tmp;
57 PPCODE:
58 	list = nicklist_get_same(server, nick);
59 
60 	for (tmp = list; tmp != NULL; tmp = tmp->next->next) {
61 		XPUSHs(sv_2mortal(iobject_bless((CHANNEL_REC *) tmp->data)));
62 		XPUSHs(sv_2mortal(iobject_bless((NICK_REC *) tmp->next->data)));
63 	}
64 	g_slist_free(list);
65 
66 #*******************************
67 MODULE = Irssi::Channel  PACKAGE = Irssi::Channel  PREFIX = channel_
68 #*******************************
69 
70 void
71 channel_destroy(channel)
72 	Irssi::Channel channel
73 
74 void
75 nick_insert(channel, nick)
76 	Irssi::Channel channel
77 	Irssi::Nick nick
78 CODE:
79 	nicklist_insert(channel, nick);
80 
81 void
82 nick_remove(channel, nick)
83 	Irssi::Channel channel
84 	Irssi::Nick nick
85 CODE:
86 	nicklist_remove(channel, nick);
87 
88 Irssi::Nick
89 nick_find(channel, nick)
90 	Irssi::Channel channel
91 	char *nick
92 CODE:
93 	RETVAL = nicklist_find(channel, nick);
94 OUTPUT:
95 	RETVAL
96 
97 Irssi::Nick
98 nick_find_mask(channel, mask)
99 	Irssi::Channel channel
100 	char *mask
101 CODE:
102 	RETVAL = nicklist_find_mask(channel, mask);
103 OUTPUT:
104 	RETVAL
105 
106 void
107 nicks(channel)
108 	Irssi::Channel channel
109 PREINIT:
110 	GSList *list, *tmp;
111 PPCODE:
112 	list = nicklist_getnicks(channel);
113 
114 	for (tmp = list; tmp != NULL; tmp = tmp->next) {
115 		XPUSHs(sv_2mortal(iobject_bless((NICK_REC *) tmp->data)));
116 	}
117 	g_slist_free(list);
118