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