1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Added Irssi::redirect_get_signal() and Irssi::redirect_peek_signal().

Changed syntax of Irssi::redirect_register() and Irssi::redirect_event().


git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1989 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2001-11-12 09:13:12 +00:00 committed by cras
parent 65f92c5e9d
commit 1b2f3a6d4c

View File

@ -1,5 +1,48 @@
#include "module.h"
static GSList *register_hash2list(HV *hv)
{
HE *he;
GSList *list;
if (hv == NULL)
return NULL;
list = NULL;
hv_iterinit(hv);
while ((he = hv_iternext(hv)) != NULL) {
I32 len;
char *key = hv_iterkey(he, &len);
int value = (int)SvIV(HeVAL(he));
list = g_slist_append(list, g_strdup(key));
list = g_slist_append(list, GINT_TO_POINTER(value));
}
return list;
}
static GSList *event_hash2list(HV *hv)
{
HE *he;
GSList *list;
STRLEN n_a;
if (hv == NULL)
return NULL;
list = NULL;
hv_iterinit(hv);
while ((he = hv_iternext(hv)) != NULL) {
I32 len;
char *key = hv_iterkey(he, &len);
char *value = SvPV(HeVAL(he), n_a);
list = g_slist_append(list, g_strdup(key));
list = g_slist_append(list, g_strdup(value));
}
return list;
}
MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Server PREFIX = irc_server_
PROTOTYPES: ENABLE
@ -38,40 +81,49 @@ ctcp_send_reply(server, data)
MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Server PREFIX = server_
void
server_redirect_register(command, remote, timeout, ...)
server_redirect_register(command, remote, timeout, start, stop)
char *command
int remote
int timeout
PREINIT:
STRLEN n_a;
GSList *start, *stop, **list;
int n;
void *start
void *stop
CODE:
start = stop = NULL; list = &start;
for (n = 3; n < items; n++) {
if (ST(n) == &PL_sv_undef) list = &stop;
if (SvPOK(ST(n)))
*list = g_slist_append(*list, SvPV(ST(n), n_a));
}
server_redirect_register_list(command, remote, timeout, start, stop);
server_redirect_register_list(command, remote, timeout,
register_hash2list(hvref(ST(3))),
register_hash2list(hvref(ST(4))));
void
server_redirect_event(server, command, arg, remote, failure_signal, ...)
server_redirect_event(server, command, arg, remote, failure_signal, signals)
Irssi::Irc::Server server
char *command
char *arg
int remote
char *failure_signal
PREINIT:
STRLEN n_a;
GSList *list;
int n;
void *signals
CODE:
list = NULL;
for (n = 5; n < items; n++) {
list = g_slist_append(list, SvPV(ST(n), n_a));
}
server_redirect_event_list(server, command, arg, remote, failure_signal, list);
server_redirect_event_list(server, command, arg, remote,
failure_signal,
event_hash2list(hvref(ST(5))));
char *
server_redirect_get_signal(server, event, args)
Irssi::Irc::Server server
char *event
char *args
CODE:
RETVAL = (char *) server_redirect_get_signal(server, event, args);
OUTPUT:
RETVAL
char *
server_redirect_peek_signal(server, event, args)
Irssi::Irc::Server server
char *event
char *args
CODE:
RETVAL = (char *) server_redirect_peek_signal(server, event, args);
OUTPUT:
RETVAL
MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Connect PREFIX = irc_server_