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:
parent
65f92c5e9d
commit
1b2f3a6d4c
@ -1,5 +1,48 @@
|
|||||||
#include "module.h"
|
#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_
|
MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Server PREFIX = irc_server_
|
||||||
PROTOTYPES: ENABLE
|
PROTOTYPES: ENABLE
|
||||||
|
|
||||||
@ -38,40 +81,49 @@ ctcp_send_reply(server, data)
|
|||||||
MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Server PREFIX = server_
|
MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Server PREFIX = server_
|
||||||
|
|
||||||
void
|
void
|
||||||
server_redirect_register(command, remote, timeout, ...)
|
server_redirect_register(command, remote, timeout, start, stop)
|
||||||
char *command
|
char *command
|
||||||
int remote
|
int remote
|
||||||
int timeout
|
int timeout
|
||||||
PREINIT:
|
void *start
|
||||||
STRLEN n_a;
|
void *stop
|
||||||
GSList *start, *stop, **list;
|
|
||||||
int n;
|
|
||||||
CODE:
|
CODE:
|
||||||
start = stop = NULL; list = &start;
|
server_redirect_register_list(command, remote, timeout,
|
||||||
for (n = 3; n < items; n++) {
|
register_hash2list(hvref(ST(3))),
|
||||||
if (ST(n) == &PL_sv_undef) list = &stop;
|
register_hash2list(hvref(ST(4))));
|
||||||
if (SvPOK(ST(n)))
|
|
||||||
*list = g_slist_append(*list, SvPV(ST(n), n_a));
|
|
||||||
}
|
|
||||||
server_redirect_register_list(command, remote, timeout, start, stop);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
server_redirect_event(server, command, arg, remote, failure_signal, ...)
|
server_redirect_event(server, command, arg, remote, failure_signal, signals)
|
||||||
Irssi::Irc::Server server
|
Irssi::Irc::Server server
|
||||||
char *command
|
char *command
|
||||||
char *arg
|
char *arg
|
||||||
int remote
|
int remote
|
||||||
char *failure_signal
|
char *failure_signal
|
||||||
PREINIT:
|
void *signals
|
||||||
STRLEN n_a;
|
|
||||||
GSList *list;
|
|
||||||
int n;
|
|
||||||
CODE:
|
CODE:
|
||||||
list = NULL;
|
server_redirect_event_list(server, command, arg, remote,
|
||||||
for (n = 5; n < items; n++) {
|
failure_signal,
|
||||||
list = g_slist_append(list, SvPV(ST(n), n_a));
|
event_hash2list(hvref(ST(5))));
|
||||||
}
|
|
||||||
server_redirect_event_list(server, command, arg, remote, failure_signal, list);
|
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_
|
MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Connect PREFIX = irc_server_
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user