mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Perl working again, better than ever (unless there's bugs :)
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@191 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
9cbf26d519
commit
a5a66264de
@ -404,13 +404,14 @@ dnl **
|
||||
CORE_LIBS="../core/libcore.la ../lib-config/libirssi_config.la"
|
||||
IRC_LIBS="../irc/libirc.la ../irc/core/libirc_core.la ../irc/dcc/libirc_dcc.la ../irc/flood/libirc_flood.la ../irc/notifylist/libirc_notifylist.la"
|
||||
FE_COMMON_LIBS="../fe-common/core/libfe_common_core.la ../fe-common/irc/libfe_common_irc.la ../fe-common/irc/notifylist/libfe_common_irc_notifylist.la ../fe-common/irc/dcc/libfe_common_irc_dcc.la ../fe-common/irc/flood/libfe_common_irc_flood.la"
|
||||
PERL_LIBS="../perl/libperl.la"
|
||||
|
||||
AC_SUBST(CORE_LIBS)
|
||||
AC_SUBST(IRC_LIBS)
|
||||
AC_SUBST(FE_COMMON_LIBS)
|
||||
|
||||
dnl ** common libraries needed by frontends
|
||||
COMMON_LIBS="$FE_COMMON_LIBS $IRC_LIBS $CORE_LIBS"
|
||||
COMMON_LIBS="$PERL_LIBS $FE_COMMON_LIBS $IRC_LIBS $CORE_LIBS"
|
||||
AC_SUBST(COMMON_LIBS)
|
||||
|
||||
dnl **
|
||||
|
@ -4,16 +4,15 @@ IRC base
|
||||
* Requires to work properly:
|
||||
|
||||
"gui exit"
|
||||
"gui channel open", CHANNEL_REC
|
||||
"send command", char *command, SERVER_REC, CHANNEL_REC
|
||||
"send command", char *command, SERVER_REC, WI_ITEM_REC
|
||||
|
||||
* Provides signals:
|
||||
|
||||
irc.c:
|
||||
|
||||
"send command", char *args, SERVER_REC
|
||||
"command "<cmd>, char *args, SERVER_REC, CHANNEL_REC
|
||||
"default command", char *args, SERVER_REC, CHANNEL_REC
|
||||
"command "<cmd>, char *args, SERVER_REC, WI_ITEM_REC
|
||||
"default command", char *args, SERVER_REC, WI_ITEM_REC
|
||||
|
||||
"server event", char *data, SERVER_REC, char *sender_nick, char *sender_address
|
||||
"event "<cmd>, char *args, SERVER_REC, char *sender_nick, char *sender_address
|
||||
@ -115,7 +114,6 @@ IRC extra
|
||||
* Requires to work properly:
|
||||
|
||||
"print text stripped", SERVER_REC, char *channel, int level, char *text
|
||||
"plugin add menu", char *menuitem, void (*func) (gpointer, PLUGIN_REC), PLUGIN_REC
|
||||
|
||||
* Provides signals:
|
||||
|
||||
@ -175,18 +173,6 @@ notifylist.c:
|
||||
"notifylist unidle", SERVER_REC, char *nick, char *user, char *host, char *realname, char *awaymsg
|
||||
"notifylist left", SERVER_REC, char *nick, char *user, char *host, char *realname, char *awaymsg
|
||||
|
||||
plugins.c:
|
||||
|
||||
"plugin created", PLUGIN_REC
|
||||
"plugin loaded", PLUGIN_REC
|
||||
"plugin destroyed", PLUGIN_REC
|
||||
|
||||
"plugin error already loaded", char *plugin
|
||||
"plugin error invalid", char *plugin
|
||||
"plugin error load", char *plugin, char *error
|
||||
"plugin error not loaded", char *plugin
|
||||
"plugin error version", char *plugin
|
||||
|
||||
UI common
|
||||
---------
|
||||
|
||||
|
@ -3,18 +3,21 @@ TEXTUI=fe-text
|
||||
endif
|
||||
|
||||
if BUILD_GNOMEUI
|
||||
GNOMEUI=fe-gnome
|
||||
#GNOMEUI=fe-gnome
|
||||
GNOMEUI=
|
||||
endif
|
||||
|
||||
if BUILD_IRSSIBOT
|
||||
BOTUI=fe-none
|
||||
endif
|
||||
|
||||
if HAVE_PERL
|
||||
PERLDIR=perl
|
||||
endif
|
||||
|
||||
noinst_HEADERS = \
|
||||
nls.h \
|
||||
common.h \
|
||||
common-setup.h \
|
||||
irssi-plugin.h \
|
||||
irssi-plugin-gui.h
|
||||
common-setup.h
|
||||
|
||||
SUBDIRS = lib-popt lib-config core irc fe-common perl $(GNOMEUI) $(TEXTUI) $(BOTUI)
|
||||
SUBDIRS = lib-popt lib-config core irc fe-common $(PERLDIR) $(GNOMEUI) $(TEXTUI) $(BOTUI)
|
||||
|
@ -45,7 +45,7 @@ void rawlog_destroy(RAWLOG_REC *rawlog)
|
||||
g_slist_foreach(rawlog->lines, (GFunc) g_free, NULL);
|
||||
g_slist_free(rawlog->lines);
|
||||
|
||||
if (rawlog->logging) close(rawlog->file);
|
||||
if (rawlog->logging) close(rawlog->handle);
|
||||
g_free(rawlog);
|
||||
}
|
||||
|
||||
@ -60,8 +60,8 @@ static void rawlog_add(RAWLOG_REC *rawlog, char *str)
|
||||
}
|
||||
|
||||
if (rawlog->logging) {
|
||||
write(rawlog->file, str, strlen(str));
|
||||
write(rawlog->file, "\n", 1);
|
||||
write(rawlog->handle, str, strlen(str));
|
||||
write(rawlog->handle, "\n", 1);
|
||||
}
|
||||
|
||||
rawlog->lines = g_slist_append(rawlog->lines, str);
|
||||
@ -113,17 +113,17 @@ void rawlog_open(RAWLOG_REC *rawlog, const char *fname)
|
||||
return;
|
||||
|
||||
path = convert_home(fname);
|
||||
rawlog->file = open(path, O_WRONLY | O_APPEND | O_CREAT, LOG_FILE_CREATE_MODE);
|
||||
rawlog->handle = open(path, O_WRONLY | O_APPEND | O_CREAT, LOG_FILE_CREATE_MODE);
|
||||
g_free(path);
|
||||
|
||||
rawlog_dump(rawlog, rawlog->file);
|
||||
rawlog->logging = rawlog->file != -1;
|
||||
rawlog_dump(rawlog, rawlog->handle);
|
||||
rawlog->logging = rawlog->handle != -1;
|
||||
}
|
||||
|
||||
void rawlog_close(RAWLOG_REC *rawlog)
|
||||
{
|
||||
if (rawlog->logging) {
|
||||
close(rawlog->file);
|
||||
close(rawlog->handle);
|
||||
rawlog->logging = 0;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
typedef struct {
|
||||
int logging;
|
||||
int file;
|
||||
int handle;
|
||||
|
||||
int nlines;
|
||||
GSList *lines;
|
||||
|
@ -38,6 +38,9 @@ void autorun_deinit(void);
|
||||
void fe_core_log_init(void);
|
||||
void fe_core_log_deinit(void);
|
||||
|
||||
void fe_log_init(void);
|
||||
void fe_log_deinit(void);
|
||||
|
||||
void fe_server_init(void);
|
||||
void fe_server_deinit(void);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
fe-log.c : irssi
|
||||
|
||||
Copyright (C) 1999 Timo Sirainen
|
||||
Copyright (C) 1999-2000 Timo Sirainen
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -83,5 +83,6 @@ FORMAT_REC fecommon_core_formats[] =
|
||||
/* ---- */
|
||||
{ NULL, N_("Misc"), 0 },
|
||||
|
||||
{ "not_toggle", N_("Value must be either ON, OFF or TOGGLE"), 0 }
|
||||
{ "not_toggle", N_("Value must be either ON, OFF or TOGGLE"), 0 },
|
||||
{ "perl_error", N_("Perl error: $0"), 1, { 0 } }
|
||||
};
|
||||
|
@ -55,7 +55,8 @@ enum {
|
||||
|
||||
IRCTXT_FILL_6,
|
||||
|
||||
IRCTXT_NOT_TOGGLE
|
||||
IRCTXT_NOT_TOGGLE,
|
||||
IRCTXT_PERL_ERROR
|
||||
};
|
||||
|
||||
extern FORMAT_REC fecommon_core_formats[];
|
||||
|
@ -807,23 +807,30 @@ static int sig_check_daychange(void)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void sig_gui_dialog(const char *type, const char *text)
|
||||
void printtext_multiline(void *server, const char *channel, int level, const char *format, const char *text)
|
||||
{
|
||||
char **lines, **tmp;
|
||||
|
||||
if (g_strcasecmp(type, "warning") == 0)
|
||||
type = _("%_Warning:%_ %s");
|
||||
else if (g_strcasecmp(type, "error") == 0)
|
||||
type = _("%_Error:%_ %s");
|
||||
else
|
||||
type = "%s";
|
||||
|
||||
lines = g_strsplit(text, "\n", -1);
|
||||
for (tmp = lines; *tmp != NULL; tmp++)
|
||||
printtext(NULL, NULL, MSGLEVEL_NEVER, type, *tmp);
|
||||
printtext(NULL, NULL, MSGLEVEL_NEVER, format, *tmp);
|
||||
g_strfreev(lines);
|
||||
}
|
||||
|
||||
static void sig_gui_dialog(const char *type, const char *text)
|
||||
{
|
||||
char *format;
|
||||
|
||||
if (g_strcasecmp(type, "warning") == 0)
|
||||
format = _("%_Warning:%_ %s");
|
||||
else if (g_strcasecmp(type, "error") == 0)
|
||||
format = _("%_Error:%_ %s");
|
||||
else
|
||||
format = "%s";
|
||||
|
||||
printtext_multiline(NULL, NULL, MSGLEVEL_NEVER, format, text);
|
||||
}
|
||||
|
||||
static void read_settings(void)
|
||||
{
|
||||
toggle_show_timestamps = settings_get_bool("toggle_show_timestamps");
|
||||
|
@ -53,6 +53,7 @@ void printformat(void *server, const char *channel, int level, int formatnum, ..
|
||||
void printformat_format(FORMAT_REC *formats, void *server, const char *channel, int level, int formatnum, ...);
|
||||
|
||||
void printtext(void *server, const char *channel, int level, const char *str, ...);
|
||||
void printtext_multiline(void *server, const char *channel, int level, const char *format, const char *text);
|
||||
void printbeep(void);
|
||||
|
||||
void printtext_init(void);
|
||||
|
@ -556,12 +556,6 @@ static void event_ban_type_changed(gchar *bantype)
|
||||
}
|
||||
}
|
||||
|
||||
/*FIXME: move to core
|
||||
static void event_perl_error(gchar *text)
|
||||
{
|
||||
printformat(NULL, NULL, MSGLEVEL_CLIENTERROR, IRCTXT_PERL_ERROR, text);
|
||||
}*/
|
||||
|
||||
static void sig_server_lag_disconnected(IRC_SERVER_REC *server)
|
||||
{
|
||||
g_return_if_fail(server != NULL);
|
||||
@ -643,7 +637,6 @@ void fe_events_init(void)
|
||||
signal_add("event connected", (SIGNAL_FUNC) event_connected);
|
||||
signal_add("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois);
|
||||
signal_add("ban type changed", (SIGNAL_FUNC) event_ban_type_changed);
|
||||
//signal_add("perl error", (SIGNAL_FUNC) event_perl_error);
|
||||
|
||||
signal_add("server lag disconnect", (SIGNAL_FUNC) sig_server_lag_disconnected);
|
||||
signal_add("server reconnect remove", (SIGNAL_FUNC) sig_server_reconnect_removed);
|
||||
@ -676,7 +669,6 @@ void fe_events_deinit(void)
|
||||
signal_remove("event connected", (SIGNAL_FUNC) event_connected);
|
||||
signal_remove("nickfind event whois", (SIGNAL_FUNC) event_nickfind_whois);
|
||||
signal_remove("ban type changed", (SIGNAL_FUNC) event_ban_type_changed);
|
||||
//signal_remove("perl error", (SIGNAL_FUNC) event_perl_error);
|
||||
|
||||
signal_remove("server lag disconnect", (SIGNAL_FUNC) sig_server_lag_disconnected);
|
||||
signal_remove("server reconnect remove", (SIGNAL_FUNC) sig_server_reconnect_removed);
|
||||
|
@ -82,7 +82,7 @@ int main(int argc, char **argv)
|
||||
|
||||
do {
|
||||
reload = FALSE;
|
||||
module_load(autoload_module, "");
|
||||
/*FIXME:module_load(autoload_module, "");*/
|
||||
main_loop = g_main_new(TRUE);
|
||||
g_main_run(main_loop);
|
||||
g_main_destroy(main_loop);
|
||||
|
@ -43,6 +43,11 @@
|
||||
void irc_init(void);
|
||||
void irc_deinit(void);
|
||||
|
||||
#ifdef HAVE_PERL
|
||||
void irssi_perl_init(void);
|
||||
void irssi_perl_deinit(void);
|
||||
#endif
|
||||
|
||||
static GMainLoop *main_loop;
|
||||
int quitting;
|
||||
|
||||
@ -101,6 +106,9 @@ static void textui_finish_init(void)
|
||||
gui_statusbar_items_init();
|
||||
|
||||
signal_emit("irssi init finished", 0);
|
||||
#ifdef HAVE_PERL
|
||||
irssi_perl_init();
|
||||
#endif
|
||||
screen_refresh_thaw();
|
||||
}
|
||||
|
||||
@ -110,6 +118,9 @@ static void textui_deinit(void)
|
||||
signal(SIGINT, SIG_DFL);
|
||||
|
||||
signal_remove("gui exit", (SIGNAL_FUNC) sig_exit);
|
||||
#ifdef HAVE_PERL
|
||||
irssi_perl_deinit();
|
||||
#endif
|
||||
gui_textwidget_deinit();
|
||||
gui_special_vars_deinit();
|
||||
gui_statusbar_items_deinit();
|
||||
|
@ -127,7 +127,7 @@ static void notifylist_timeout_server(IRC_SERVER_REC *server)
|
||||
for (tmp = notifies; tmp != NULL; tmp = tmp->next) {
|
||||
NOTIFYLIST_REC *rec = tmp->data;
|
||||
|
||||
if (!notify_ircnets_match(rec, server->connrec->ircnet))
|
||||
if (!notifylist_ircnets_match(rec, server->connrec->ircnet))
|
||||
continue;
|
||||
|
||||
nick = g_strdup(rec->mask);
|
||||
|
@ -85,7 +85,7 @@ void notifylist_remove(const char *mask)
|
||||
notify_destroy(rec);
|
||||
}
|
||||
|
||||
int notify_ircnets_match(NOTIFYLIST_REC *rec, const char *ircnet)
|
||||
int notifylist_ircnets_match(NOTIFYLIST_REC *rec, const char *ircnet)
|
||||
{
|
||||
char **tmp;
|
||||
|
||||
@ -122,7 +122,7 @@ NOTIFYLIST_REC *notifylist_find(const char *mask, const char *ircnet)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (notify_ircnets_match(rec, ircnet))
|
||||
if (notifylist_ircnets_match(rec, ircnet))
|
||||
return rec;
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,6 @@ int notifylist_ison_server(IRC_SERVER_REC *server, const char *nick);
|
||||
/* If `ircnet' is "*", it doesn't matter at all. */
|
||||
NOTIFYLIST_REC *notifylist_find(const char *mask, const char *ircnet);
|
||||
|
||||
int notify_ircnets_match(NOTIFYLIST_REC *rec, const char *ircnet);
|
||||
int notifylist_ircnets_match(NOTIFYLIST_REC *rec, const char *ircnet);
|
||||
|
||||
#endif
|
||||
|
9
src/perl/.cvsignore
Normal file
9
src/perl/.cvsignore
Normal file
@ -0,0 +1,9 @@
|
||||
*.la
|
||||
*.lo
|
||||
*.o
|
||||
.deps
|
||||
.libs
|
||||
Makefile
|
||||
Makefile.in
|
||||
so_locations
|
||||
perl-signals.h
|
@ -1,6 +1,6 @@
|
||||
noinst_LTLIBRARIES = libperl.la
|
||||
|
||||
libperl_la_DEPENDENCIES = perl-signals.h
|
||||
irssi-perl.c: perl-signals.h
|
||||
|
||||
INCLUDES = $(GLIB_CFLAGS) \
|
||||
-DPLUGINSDIR=\""$(libdir)/irssi/plugins"\" \
|
||||
@ -18,11 +18,31 @@ perl-signals.h: $(top_srcdir)/docs/signals.txt $(srcdir)/get-signals.pl
|
||||
|
||||
EXTRA_DIST = \
|
||||
get-signals.pl \
|
||||
xs/Irssi-bans.xs \
|
||||
xs/Irssi-channel.xs \
|
||||
xs/Irssi-core.xs \
|
||||
xs/Irssi-dcc.xs \
|
||||
xs/Irssi-flood.xs \
|
||||
xs/Irssi-ignore.xs \
|
||||
xs/Irssi-log.xs \
|
||||
xs/Irssi-masks.xs \
|
||||
xs/Irssi-modes.xs \
|
||||
xs/Irssi-netsplit.xs \
|
||||
xs/Irssi-notifylist.xs \
|
||||
xs/Irssi-query.xs \
|
||||
xs/Irssi-rawlog.xs \
|
||||
xs/Irssi-server.xs \
|
||||
xs/Irssi-settings.xs \
|
||||
xs/Irssi-window.xs \
|
||||
xs/Irssi.xs \
|
||||
xs/Irssi.pm \
|
||||
xs/Makefile.PL.in \
|
||||
xs/typemap
|
||||
|
||||
noinst_HEADERS = \
|
||||
module.h \
|
||||
xs/module.h
|
||||
|
||||
all-local:
|
||||
cd xs && if [ ! -f Makefile ]; then $(perlpath) Makefile.PL; fi && $(MAKE) && cd ..
|
||||
|
||||
|
@ -18,18 +18,23 @@ while (<STDIN>) {
|
||||
s/int[^,]*/int/g;
|
||||
s/GSList of (\w+)s/gslist_\1/g;
|
||||
|
||||
s/SERVER_REC \*[^,]*/Irssi::Server/g;
|
||||
s/RECONNECT_REC \*[^,]*/Irssi::Reconnect/g;
|
||||
s/CHANNEL_REC \*[^,]*/Irssi::Channel/g;
|
||||
s/COMMAND_REC \*[^,]*/Irssi::Command/g;
|
||||
s/NICK_REC \*[^,]*/Irssi::Nick/g;
|
||||
s/BAN_REC \*[^,]*/Irssi::Ban/g;
|
||||
s/NETSPLIT_REC \*[^,]*/Irssi::Netsplit/g;
|
||||
s/DCC_REC \*[^,]*/Irssi::Dcc/g;
|
||||
s/LOG_REC \*[^,]*/Irssi::Log/g;
|
||||
s/LOG_ITEM_REC \*[^,]*/Irssi::Logitem/g;
|
||||
s/PLUGIN_REC \*[^,]*/Irssi::Plugin/g;
|
||||
s/AUTOIGNORE_REC \*[^,]*/Irssi::Autoignore/g;
|
||||
s/SERVER_REC[^,]*/Irssi::Server/g;
|
||||
s/IRC_SERVER_REC[^,]*/Irssi::Server/g;
|
||||
s/RECONNECT_REC[^,]*/Irssi::Reconnect/g;
|
||||
s/CHANNEL_REC[^,]*/Irssi::Channel/g;
|
||||
s/QUERY_REC[^,]*/Irssi::Query/g;
|
||||
s/COMMAND_REC[^,]*/Irssi::Command/g;
|
||||
s/NICK_REC[^,]*/Irssi::Nick/g;
|
||||
s/BAN_REC[^,]*/Irssi::Ban/g;
|
||||
s/DCC_REC[^,]*/Irssi::Dcc/g;
|
||||
s/NETSPLIT_REC[^,]*/Irssi::Netsplit/g;
|
||||
s/AUTOIGNORE_REC[^,]*/Irssi::Autoignore/g;
|
||||
s/LOG_REC[^,]*/Irssi::Log/g;
|
||||
s/RAWLOG_REC[^,]*/Irssi::Rawlog/g;
|
||||
s/NOTIFYLIST_REC[^,]*/Irssi::Notifylist/g;
|
||||
s/IGNORE_REC[^,]*/Irssi::Ignore/g;
|
||||
s/WINDOW_REC[^,]*/Irssi::Window/g;
|
||||
s/WI_ITEM_REC[^,]*/Irssi::Windowitem/g;
|
||||
|
||||
s/([\w:]+)(,|$)/"\1"\2/g;
|
||||
print " { -1, \"$signal\", { $_, NULL } },\n";
|
||||
|
@ -116,14 +116,13 @@ static void irssi_perl_start(void)
|
||||
"sub load_file()\n"
|
||||
"{\n"
|
||||
" (my $file_name) = @_;\n"
|
||||
" open FH, $file_name or return 2;\n"
|
||||
" open FH, $file_name or return \"File not found: $file_name\";\n"
|
||||
" local($/) = undef;\n"
|
||||
" $file = <FH>;\n"
|
||||
" close FH;\n"
|
||||
" eval $file;\n"
|
||||
" eval $file if $@;\n"
|
||||
" return 1 if $@;\n"
|
||||
" return 0;\n"
|
||||
" return $@ if $@;\n"
|
||||
"}";
|
||||
|
||||
first_signals = g_hash_table_new((GHashFunc) g_direct_hash, (GCompareFunc) g_direct_equal);
|
||||
@ -137,9 +136,16 @@ static void irssi_perl_start(void)
|
||||
perl_eval_pv(load_file, TRUE);
|
||||
}
|
||||
|
||||
static void signal_destroy_hash(void *key, PERL_SIGNAL_REC *rec)
|
||||
static void signal_destroy_hash(void *key, GSList *list)
|
||||
{
|
||||
perl_signal_destroy(rec);
|
||||
GSList *next;
|
||||
|
||||
while (list != NULL) {
|
||||
next = list->next;
|
||||
|
||||
perl_signal_destroy(list->data);
|
||||
list = next;
|
||||
}
|
||||
}
|
||||
|
||||
static void irssi_perl_stop(void)
|
||||
@ -195,10 +201,15 @@ static void cmd_run(char *data)
|
||||
if (SvTRUE(ERRSV)) {
|
||||
STRLEN n_a;
|
||||
|
||||
signal_emit("perl error", 1, SvPV(ERRSV, n_a));
|
||||
signal_emit("gui dialog", 2, "error", SvPV(ERRSV, n_a));
|
||||
(void) POPs;
|
||||
}
|
||||
else while (retcount--) (void) POPi;
|
||||
else if (retcount > 0) {
|
||||
char *str = POPp;
|
||||
|
||||
if (str != NULL && *str != '\0')
|
||||
signal_emit("gui dialog", 2, "error", str);
|
||||
}
|
||||
|
||||
PUTBACK;
|
||||
FREETMPS;
|
||||
@ -406,8 +417,12 @@ static int call_perl(const char *func, int signal, va_list va)
|
||||
}
|
||||
else
|
||||
{
|
||||
stash = gv_stashpv(rec->args[n], 0);
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(arg))), stash)));
|
||||
if (arg == NULL)
|
||||
XPUSHs(sv_2mortal(newSViv(0)));
|
||||
else {
|
||||
stash = gv_stashpv(rec->args[n], 0);
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(arg))), stash)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -421,7 +436,7 @@ static int call_perl(const char *func, int signal, va_list va)
|
||||
{
|
||||
STRLEN n_a;
|
||||
|
||||
signal_emit("perl error", 1, SvPV(ERRSV, n_a));
|
||||
signal_emit("gui dialog", 2, "error", SvPV(ERRSV, n_a));
|
||||
(void)POPs;
|
||||
}
|
||||
else
|
||||
@ -490,6 +505,7 @@ static void irssi_perl_autorun(void)
|
||||
{
|
||||
DIR *dirp;
|
||||
struct dirent *dp;
|
||||
struct stat statbuf;
|
||||
char *path, *fname;
|
||||
|
||||
path = g_strdup_printf("%s/.irssi/scripts/autorun", g_get_home_dir());
|
||||
@ -501,7 +517,8 @@ static void irssi_perl_autorun(void)
|
||||
|
||||
while ((dp = readdir(dirp)) != NULL) {
|
||||
fname = g_strdup_printf("%s/%s", path, dp->d_name);
|
||||
cmd_run(fname);
|
||||
if (stat(fname, &statbuf) == 0 && !S_ISDIR(statbuf.st_mode))
|
||||
cmd_run(fname);
|
||||
g_free(fname);
|
||||
}
|
||||
closedir(dirp);
|
||||
@ -522,8 +539,8 @@ void irssi_perl_deinit(void)
|
||||
{
|
||||
irssi_perl_stop();
|
||||
|
||||
command_unbind("run", (SIGNAL_FUNC) cmd_run);
|
||||
command_unbind("perlflush", (SIGNAL_FUNC) cmd_flush);
|
||||
if (signal_grabbed) signal_remove("signal", (SIGNAL_FUNC) sig_signal);
|
||||
if (siglast_grabbed) signal_remove("last signal", (SIGNAL_FUNC) sig_lastsignal);
|
||||
command_unbind("run", (SIGNAL_FUNC) cmd_run);
|
||||
command_unbind("perlflush", (SIGNAL_FUNC) cmd_flush);
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
#ifndef __IRSSI_PERL_H
|
||||
#define __IRSSI_PERL_H
|
||||
|
||||
void irssi_perl_init(void);
|
||||
void irssi_perl_deinit(void);
|
||||
|
||||
#endif
|
7
src/perl/xs/.cvsignore
Normal file
7
src/perl/xs/.cvsignore
Normal file
@ -0,0 +1,7 @@
|
||||
Makefile
|
||||
Makefile.PL
|
||||
Irssi.c
|
||||
Irssi.bs
|
||||
*.o
|
||||
pm_to_blib
|
||||
blib
|
40
src/perl/xs/Irssi-bans.xs
Normal file
40
src/perl/xs/Irssi-bans.xs
Normal file
@ -0,0 +1,40 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
ban_set_type(type)
|
||||
char *type
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Channel
|
||||
#*******************************
|
||||
|
||||
char *
|
||||
ban_get_mask(channel, nick)
|
||||
Irssi::Channel channel
|
||||
char *nick
|
||||
|
||||
void
|
||||
ban_set(channel, bans)
|
||||
Irssi::Channel channel
|
||||
char *bans
|
||||
|
||||
void
|
||||
ban_remove(channel, ban)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Ban
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(ban)
|
||||
Irssi::Ban ban
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "ban", 3, new_pv(ban->ban), 0);
|
||||
hv_store(hv, "setby", 5, new_pv(ban->setby), 0);
|
||||
hv_store(hv, "time", 4, newSViv(ban->time), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
193
src/perl/xs/Irssi-channel.xs
Normal file
193
src/perl/xs/Irssi-channel.xs
Normal file
@ -0,0 +1,193 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
channels()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Channel", 0);
|
||||
for (tmp = channels; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
int
|
||||
is_channel(text)
|
||||
char *text
|
||||
CODE:
|
||||
RETVAL = ischannel(*text);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
#*******************************
|
||||
|
||||
void
|
||||
channels(server)
|
||||
Irssi::Server server
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Channel", 0);
|
||||
for (tmp = server->channels; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
Irssi::Channel
|
||||
channel_create(server, channel, automatic)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
int automatic
|
||||
|
||||
Irssi::Channel
|
||||
channel_find(server, channel)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
|
||||
void
|
||||
channels_join(server, data, automatic)
|
||||
Irssi::Server server
|
||||
char *data
|
||||
int automatic
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Channel PREFIX = channel_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(channel)
|
||||
Irssi::Channel channel
|
||||
PREINIT:
|
||||
HV *hv, *stash;
|
||||
char *type;
|
||||
PPCODE:
|
||||
type = "channel";
|
||||
|
||||
hv = newHV();
|
||||
hv_store(hv, "type", 4, new_pv(type), 0);
|
||||
|
||||
stash = gv_stashpv("Irssi::Server", 0);
|
||||
hv_store(hv, "server", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(channel->server))), stash), 0);
|
||||
hv_store(hv, "name", 4, new_pv(channel->name), 0);
|
||||
|
||||
hv_store(hv, "new_data", 8, newSViv(channel->new_data), 0);
|
||||
hv_store(hv, "createtime", 10, newSViv(channel->createtime), 0);
|
||||
|
||||
hv_store(hv, "topic", 5, new_pv(channel->topic), 0);
|
||||
hv_store(hv, "limit", 5, newSViv(channel->limit), 0);
|
||||
hv_store(hv, "key", 3, new_pv(channel->key), 0);
|
||||
|
||||
hv_store(hv, "chanop", 6, newSViv(channel->chanop), 0);
|
||||
|
||||
hv_store(hv, "names_got", 9, newSViv(channel->names_got), 0);
|
||||
hv_store(hv, "wholist", 7, newSViv(channel->wholist), 0);
|
||||
hv_store(hv, "synced", 6, newSViv(channel->synced), 0);
|
||||
|
||||
hv_store(hv, "left", 4, newSViv(channel->left), 0);
|
||||
hv_store(hv, "kicked", 6, newSViv(channel->kicked), 0);
|
||||
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
void
|
||||
channel_destroy(channel)
|
||||
Irssi::Channel channel
|
||||
|
||||
Irssi::Channel
|
||||
channel_find(channel)
|
||||
char *channel
|
||||
CODE:
|
||||
RETVAL = channel_find(NULL, channel);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
command(channel, cmd)
|
||||
Irssi::Channel channel
|
||||
char *cmd
|
||||
CODE:
|
||||
signal_emit("send command", 3, cmd, channel->server, channel);
|
||||
|
||||
char *
|
||||
channel_get_mode(channel)
|
||||
Irssi::Channel channel
|
||||
|
||||
Irssi::Nick
|
||||
nicklist_insert(channel, nick, op, voice, send_massjoin)
|
||||
Irssi::Channel channel
|
||||
char *nick
|
||||
int op
|
||||
int voice
|
||||
int send_massjoin
|
||||
|
||||
void
|
||||
nicklist_remove(channel, nick)
|
||||
Irssi::Channel channel
|
||||
Irssi::Nick nick
|
||||
|
||||
Irssi::Nick
|
||||
nicklist_find(channel, mask)
|
||||
Irssi::Channel channel
|
||||
char *mask
|
||||
|
||||
void
|
||||
nicklist_getnicks(channel)
|
||||
Irssi::Channel channel
|
||||
PREINIT:
|
||||
GSList *list, *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
list = nicklist_getnicks(channel);
|
||||
|
||||
stash = gv_stashpv("Irssi::Nick", 0);
|
||||
for (tmp = list; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
g_slist_free(list);
|
||||
|
||||
void
|
||||
nicklist_get_same(server, nick)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
PREINIT:
|
||||
GSList *list, *tmp;
|
||||
HV *chanstash, *nickstash;
|
||||
PPCODE:
|
||||
list = nicklist_get_same(server, nick);
|
||||
|
||||
chanstash = gv_stashpv("Irssi::Channel", 0);
|
||||
nickstash = gv_stashpv("Irssi::Nick", 0);
|
||||
|
||||
for (tmp = list; tmp != NULL; tmp = tmp->next->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), chanstash)));
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->next->data))), nickstash)));
|
||||
}
|
||||
g_slist_free(list);
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Nick
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(nick)
|
||||
Irssi::Nick nick
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "last_check", 10, newSViv(nick->last_check), 0);
|
||||
hv_store(hv, "send_massjoin", 13, newSViv(nick->send_massjoin), 0);
|
||||
|
||||
hv_store(hv, "nick", 4, new_pv(nick->nick), 0);
|
||||
hv_store(hv, "host", 4, new_pv(nick->host), 0);
|
||||
hv_store(hv, "realname", 8, new_pv(nick->realname), 0);
|
||||
|
||||
hv_store(hv, "hops", 4, newSViv(nick->hops), 0);
|
||||
|
||||
hv_store(hv, "op", 2, newSViv(nick->op), 0);
|
||||
hv_store(hv, "voice", 5, newSViv(nick->voice), 0);
|
||||
hv_store(hv, "gone", 4, newSViv(nick->gone), 0);
|
||||
hv_store(hv, "ircop", 5, newSViv(nick->ircop), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
122
src/perl/xs/Irssi-core.xs
Normal file
122
src/perl/xs/Irssi-core.xs
Normal file
@ -0,0 +1,122 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
signal_emit(signal, ...)
|
||||
char *signal
|
||||
CODE:
|
||||
void *p[6];
|
||||
int n;
|
||||
|
||||
memset(p, 0, sizeof(p));
|
||||
for (n = 1; n < items && n < 6; n++) {
|
||||
p[n-1] = SvPOKp(ST(n)) ? SvPV(ST(n), PL_na) : (void *) SvIV((SV*)SvRV(ST(n)));
|
||||
}
|
||||
signal_emit(signal, items-1, p[0], p[1], p[2], p[3], p[4], p[5]);
|
||||
|
||||
void
|
||||
signal_add(signal, func)
|
||||
char *signal
|
||||
char *func
|
||||
CODE:
|
||||
perl_signal_add(signal, func);
|
||||
|
||||
void
|
||||
signal_add_last(signal, func)
|
||||
char *signal
|
||||
char *func
|
||||
CODE:
|
||||
perl_signal_add_last(signal, func);
|
||||
|
||||
void
|
||||
signal_remove(signal, func)
|
||||
char *signal
|
||||
char *func
|
||||
CODE:
|
||||
perl_signal_remove(signal, func);
|
||||
|
||||
void
|
||||
signal_stop()
|
||||
|
||||
void
|
||||
signal_stop_by_name(signal)
|
||||
char *signal
|
||||
|
||||
int
|
||||
timeout_add(msecs, func, data)
|
||||
int msecs
|
||||
char *func
|
||||
char *data
|
||||
CODE:
|
||||
RETVAL = perl_timeout_add(msecs, func, data);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
timeout_remove(tag)
|
||||
int tag
|
||||
CODE:
|
||||
perl_timeout_remove(tag);
|
||||
|
||||
int
|
||||
level2bits(str)
|
||||
char *str
|
||||
|
||||
char *
|
||||
bits2level(bits)
|
||||
int bits
|
||||
|
||||
int
|
||||
combine_level(level, str)
|
||||
int level
|
||||
char *str
|
||||
|
||||
void
|
||||
commands()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Command", 0);
|
||||
for (tmp = commands; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
void
|
||||
command_bind(cmd, category, func)
|
||||
char *cmd
|
||||
char *category
|
||||
char *func
|
||||
CODE:
|
||||
char *signal;
|
||||
|
||||
command_bind(cmd, *category ? category : "Perl scripts' commands", NULL);
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_add(signal, func);
|
||||
g_free(signal);
|
||||
|
||||
void
|
||||
command_unbind(cmd, func)
|
||||
char *cmd
|
||||
char *func
|
||||
CODE:
|
||||
char *signal;
|
||||
|
||||
command_unbind(cmd, NULL);
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_remove(signal, func);
|
||||
g_free(signal);
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Command PREFIX = command_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(cmd)
|
||||
Irssi::Command cmd
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "category", 8, new_pv(cmd->category), 0);
|
||||
hv_store(hv, "cmd", 3, new_pv(cmd->cmd), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
39
src/perl/xs/Irssi-dcc.xs
Normal file
39
src/perl/xs/Irssi-dcc.xs
Normal file
@ -0,0 +1,39 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
dccs()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Dcc", 0);
|
||||
for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
Irssi::Dcc
|
||||
dcc_find_item(type, nick, arg)
|
||||
int type
|
||||
char *nick
|
||||
char *arg
|
||||
|
||||
Irssi::Dcc
|
||||
dcc_find_by_port(nick, port)
|
||||
char *nick
|
||||
int port
|
||||
|
||||
char *
|
||||
dcc_type2str(type)
|
||||
int type
|
||||
|
||||
int
|
||||
dcc_str2type(type)
|
||||
char *type
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Dcc PREFIX = dcc_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
dcc_destroy(dcc)
|
||||
Irssi::Dcc dcc
|
29
src/perl/xs/Irssi-flood.xs
Normal file
29
src/perl/xs/Irssi-flood.xs
Normal file
@ -0,0 +1,29 @@
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
|
||||
void
|
||||
autoignore_add(server, nick, level)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
int level
|
||||
|
||||
int
|
||||
autoignore_remove(server, mask, level)
|
||||
Irssi::Server server
|
||||
char *mask
|
||||
int level
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Autoignore
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(ai)
|
||||
Irssi::Autoignore ai
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "nick", 4, new_pv(ai->nick), 0);
|
||||
hv_store(hv, "timeleft", 8, newSViv(ai->timeleft), 0);
|
||||
hv_store(hv, "level", 5, newSViv(ai->level), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
74
src/perl/xs/Irssi-ignore.xs
Normal file
74
src/perl/xs/Irssi-ignore.xs
Normal file
@ -0,0 +1,74 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
ignores()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Ignore", 0);
|
||||
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
int
|
||||
ignore_check(nick, host, channel, text, level)
|
||||
char *nick
|
||||
char *host
|
||||
char *channel
|
||||
char *text
|
||||
int level
|
||||
CODE:
|
||||
RETVAL = ignore_check(NULL, nick, host, channel, text, level);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
#*******************************
|
||||
|
||||
int
|
||||
ignore_check(server, nick, host, channel, text, level)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
char *host
|
||||
char *channel
|
||||
char *text
|
||||
int level
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Ignore PREFIX = ignore_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(ignore)
|
||||
Irssi::Ignore ignore
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
AV *av;
|
||||
char **tmp;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "mask", 4, new_pv(ignore->mask), 0);
|
||||
hv_store(hv, "servertag", 9, new_pv(ignore->servertag), 0);
|
||||
av = newAV();
|
||||
for (tmp = ignore->channels; *tmp != NULL; tmp++) {
|
||||
av_push(av, new_pv(*tmp));
|
||||
}
|
||||
hv_store(hv, "channels", 8, newRV_noinc((SV*)av), 0);
|
||||
hv_store(hv, "pattern", 7, new_pv(ignore->pattern), 0);
|
||||
|
||||
hv_store(hv, "level", 5, newSViv(ignore->level), 0);
|
||||
hv_store(hv, "except_level", 12, newSViv(ignore->except_level), 0);
|
||||
|
||||
hv_store(hv, "regexp", 6, newSViv(ignore->regexp), 0);
|
||||
hv_store(hv, "fullword", 8, newSViv(ignore->fullword), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
void
|
||||
ignore_add_rec(rec)
|
||||
Irssi::Ignore rec
|
||||
|
||||
void
|
||||
ignore_update_rec(rec)
|
||||
Irssi::Ignore rec
|
89
src/perl/xs/Irssi-log.xs
Normal file
89
src/perl/xs/Irssi-log.xs
Normal file
@ -0,0 +1,89 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
logs()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Log", 0);
|
||||
for (tmp = logs; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
Irssi::Log
|
||||
log_create_rec(fname, level, items)
|
||||
char *fname
|
||||
int level
|
||||
char *items
|
||||
|
||||
Irssi::Log
|
||||
log_find(fname)
|
||||
char *fname
|
||||
|
||||
void
|
||||
log_write(item, level, str)
|
||||
char *item
|
||||
int level
|
||||
char *str
|
||||
|
||||
char *
|
||||
log_rotate2str(rotate)
|
||||
int rotate
|
||||
CODE:
|
||||
RETVAL = (char *) log_rotate2str(rotate);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
int
|
||||
log_str2rotate(str)
|
||||
char *str
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Log PREFIX = log_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(log)
|
||||
Irssi::Log log
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
AV *av;
|
||||
char **tmp;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "fname", 5, new_pv(log->fname), 0);
|
||||
hv_store(hv, "opened", 6, newSViv(log->opened), 0);
|
||||
hv_store(hv, "level", 5, newSViv(log->level), 0);
|
||||
hv_store(hv, "last", 4, newSViv(log->last), 0);
|
||||
hv_store(hv, "rotate", 6, new_pv((char *) log_rotate2str(log->rotate)), 0);
|
||||
hv_store(hv, "autoopen", 8, newSViv(log->autoopen), 0);
|
||||
hv_store(hv, "temp", 4, newSViv(log->temp), 0);
|
||||
|
||||
av = newAV();
|
||||
for (tmp = log->items; *tmp != NULL; tmp++) {
|
||||
av_push(av, new_pv(*tmp));
|
||||
}
|
||||
hv_store(hv, "items", 4, newRV_noinc((SV*)av), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
void
|
||||
log_update(log)
|
||||
Irssi::Log log
|
||||
|
||||
void
|
||||
log_close(log)
|
||||
Irssi::Log log
|
||||
|
||||
void
|
||||
log_write_rec(log, str)
|
||||
Irssi::Log log
|
||||
char *str
|
||||
|
||||
void
|
||||
log_start_logging(log)
|
||||
Irssi::Log log
|
||||
|
||||
void
|
||||
log_stop_logging(log)
|
||||
Irssi::Log log
|
26
src/perl/xs/Irssi-masks.xs
Normal file
26
src/perl/xs/Irssi-masks.xs
Normal file
@ -0,0 +1,26 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
int
|
||||
irc_mask_match(mask, nick, user, host)
|
||||
char *mask
|
||||
char *nick
|
||||
char *user
|
||||
char *host
|
||||
|
||||
int
|
||||
irc_mask_match_address(mask, nick, address)
|
||||
char *mask
|
||||
char *nick
|
||||
char *address
|
||||
|
||||
int
|
||||
irc_masks_match(masks, nick, address)
|
||||
char *masks
|
||||
char *nick
|
||||
char *address
|
||||
|
||||
char *
|
||||
irc_get_mask(nick, host, flags)
|
||||
char *nick
|
||||
char *host
|
||||
int flags
|
67
src/perl/xs/Irssi-modes.xs
Normal file
67
src/perl/xs/Irssi-modes.xs
Normal file
@ -0,0 +1,67 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
char *
|
||||
modes_join(old, mode)
|
||||
char *old
|
||||
char *mode
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
#*******************************
|
||||
|
||||
void
|
||||
channel_set_singlemode(server, channel, nicks, mode)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
char *nicks
|
||||
char *mode
|
||||
|
||||
void
|
||||
channel_set_mode(server, channel, mode)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
char *mode
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Channel PREFIX = channel_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
parse_channel_modes(channel, setby, modestr)
|
||||
Irssi::Channel channel
|
||||
char *setby
|
||||
char *modestr
|
||||
|
||||
Irssi::Ban
|
||||
banlist_add(channel, ban, nick, time)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
char *nick
|
||||
time_t time
|
||||
|
||||
void
|
||||
banlist_remove(channel, ban)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
|
||||
Irssi::Ban
|
||||
banlist_exception_add(channel, ban, nick, time)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
char *nick
|
||||
time_t time
|
||||
|
||||
void
|
||||
banlist_exception_remove(channel, ban)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
|
||||
void
|
||||
invitelist_add(channel, mask)
|
||||
Irssi::Channel channel
|
||||
char *mask
|
||||
|
||||
void
|
||||
invitelist_remove(channel, mask)
|
||||
Irssi::Channel channel
|
||||
char *mask
|
34
src/perl/xs/Irssi-netsplit.xs
Normal file
34
src/perl/xs/Irssi-netsplit.xs
Normal file
@ -0,0 +1,34 @@
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
|
||||
Irssi::Netsplit
|
||||
netsplit_find(server, nick, address)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
char *address
|
||||
|
||||
Irssi::Nick
|
||||
netsplit_find_channel(server, nick, address, channel)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
char *address
|
||||
char *channel
|
||||
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Netsplit
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(netsplit)
|
||||
Irssi::Netsplit netsplit
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "nick", 4, new_pv(netsplit->nick), 0);
|
||||
hv_store(hv, "address", 7, new_pv(netsplit->address), 0);
|
||||
hv_store(hv, "server", 6, new_pv(netsplit->server), 0);
|
||||
hv_store(hv, "destserver", 10, new_pv(netsplit->destserver), 0);
|
||||
hv_store(hv, "destroy", 7, newSViv(netsplit->destroy), 0);
|
||||
/*FIXME: add GSList *channels;*/
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
71
src/perl/xs/Irssi-notifylist.xs
Normal file
71
src/perl/xs/Irssi-notifylist.xs
Normal file
@ -0,0 +1,71 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
notifies()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Notifylist", 0);
|
||||
for (tmp = notifies; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
Irssi::Notifylist
|
||||
notifylist_add(mask, ircnets, away_check, idle_check_time)
|
||||
char *mask
|
||||
char *ircnets
|
||||
int away_check
|
||||
int idle_check_time
|
||||
|
||||
void
|
||||
notifylist_remove(mask)
|
||||
char *mask
|
||||
|
||||
Irssi::Server
|
||||
notifylist_ison(nick, serverlist)
|
||||
char *nick
|
||||
char *serverlist
|
||||
|
||||
Irssi::Notifylist
|
||||
notifylist_find(mask, ircnet)
|
||||
char *mask
|
||||
char *ircnet
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
#*******************************
|
||||
|
||||
int
|
||||
notifylist_ison_server(server, nick)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Notifylist PREFIX = notifylist_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(notify)
|
||||
Irssi::Notifylist notify
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
AV *av;
|
||||
char **tmp;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "mask", 4, new_pv(notify->mask), 0);
|
||||
hv_store(hv, "away_check", 10, newSViv(notify->away_check), 0);
|
||||
hv_store(hv, "idle_check_time", 15, newSViv(notify->idle_check_time), 0);
|
||||
|
||||
av = newAV();
|
||||
for (tmp = notify->ircnets; *tmp != NULL; tmp++) {
|
||||
av_push(av, new_pv(*tmp));
|
||||
}
|
||||
hv_store(hv, "ircnets", 7, newRV_noinc((SV*)av), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
int
|
||||
notifylist_ircnets_match(rec, ircnet)
|
||||
Irssi::Notifylist rec
|
||||
char *ircnet
|
74
src/perl/xs/Irssi-query.xs
Normal file
74
src/perl/xs/Irssi-query.xs
Normal file
@ -0,0 +1,74 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
queries()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Query", 0);
|
||||
for (tmp = queries; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
#*******************************
|
||||
|
||||
void
|
||||
queries(server)
|
||||
Irssi::Server server
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Query", 0);
|
||||
for (tmp = server->queries; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
Irssi::Query
|
||||
query_create(server, nick, automatic)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
int automatic
|
||||
|
||||
Irssi::Query
|
||||
query_find(server, nick)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Query PREFIX = query_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(query)
|
||||
Irssi::Query query
|
||||
PREINIT:
|
||||
HV *hv, *stash;
|
||||
char *type;
|
||||
PPCODE:
|
||||
type = "query";
|
||||
|
||||
hv = newHV();
|
||||
hv_store(hv, "type", 4, new_pv(type), 0);
|
||||
|
||||
stash = gv_stashpv("Irssi::Server", 0);
|
||||
hv_store(hv, "server", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(query->server))), stash), 0);
|
||||
hv_store(hv, "nick", 4, new_pv(query->nick), 0);
|
||||
hv_store(hv, "new_data", 8, newSViv(query->new_data), 0);
|
||||
|
||||
hv_store(hv, "address", 7, new_pv(query->address), 0);
|
||||
hv_store(hv, "server_tag", 10, new_pv(query->server_tag), 0);
|
||||
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
void
|
||||
query_destroy(query)
|
||||
Irssi::Query query
|
||||
|
||||
void
|
||||
query_change_server(query, server)
|
||||
Irssi::Query query
|
||||
Irssi::Server server
|
84
src/perl/xs/Irssi-rawlog.xs
Normal file
84
src/perl/xs/Irssi-rawlog.xs
Normal file
@ -0,0 +1,84 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
rawlog_set_size(lines)
|
||||
int lines
|
||||
|
||||
Irssi::Rawlog
|
||||
rawlog_create()
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
#*******************************
|
||||
|
||||
void
|
||||
rawlog_input(rawlog, str)
|
||||
Irssi::Rawlog rawlog
|
||||
char *str
|
||||
|
||||
void
|
||||
rawlog_output(rawlog, str)
|
||||
Irssi::Rawlog rawlog
|
||||
char *str
|
||||
|
||||
void
|
||||
rawlog_redirect(rawlog, str)
|
||||
Irssi::Rawlog rawlog
|
||||
char *str
|
||||
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Rawlog PREFIX = rawlog_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(rawlog)
|
||||
Irssi::Rawlog rawlog
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
AV *av;
|
||||
GSList *tmp;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "logging", 7, newSViv(rawlog->logging), 0);
|
||||
hv_store(hv, "nlines", 6, newSViv(rawlog->nlines), 0);
|
||||
|
||||
av = newAV();
|
||||
for (tmp = rawlog->lines; tmp != NULL; tmp = tmp->next) {
|
||||
av_push(av, new_pv(tmp->data));
|
||||
}
|
||||
hv_store(hv, "lines", 5, newRV_noinc((SV*)av), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
void
|
||||
rawlog_destroy(rawlog)
|
||||
Irssi::Rawlog rawlog
|
||||
|
||||
void
|
||||
rawlog_input(rawlog, str)
|
||||
Irssi::Rawlog rawlog
|
||||
char *str
|
||||
|
||||
void
|
||||
rawlog_output(rawlog, str)
|
||||
Irssi::Rawlog rawlog
|
||||
char *str
|
||||
|
||||
void
|
||||
rawlog_redirect(rawlog, str)
|
||||
Irssi::Rawlog rawlog
|
||||
char *str
|
||||
|
||||
void
|
||||
rawlog_open(rawlog, fname)
|
||||
Irssi::Rawlog rawlog
|
||||
char *fname
|
||||
|
||||
void
|
||||
rawlog_close(rawlog)
|
||||
Irssi::Rawlog rawlog
|
||||
|
||||
void
|
||||
rawlog_save(rawlog, fname)
|
||||
Irssi::Rawlog rawlog
|
||||
char *fname
|
184
src/perl/xs/Irssi-server.xs
Normal file
184
src/perl/xs/Irssi-server.xs
Normal file
@ -0,0 +1,184 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
servers()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Server", 0);
|
||||
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
void
|
||||
reconnects()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Reconnect", 0);
|
||||
for (tmp = reconnects; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
Irssi::Connect
|
||||
irc_server_create_conn(dest, port=6667, password=NULL, nick=NULL)
|
||||
char *dest
|
||||
int port
|
||||
char *password
|
||||
char *nick
|
||||
|
||||
Irssi::Server
|
||||
server_find_tag(tag)
|
||||
char *tag
|
||||
CODE:
|
||||
RETVAL = (IRC_SERVER_REC *) server_find_tag(tag);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Irssi::Server
|
||||
server_find_ircnet(ircnet)
|
||||
char *ircnet
|
||||
CODE:
|
||||
RETVAL = (IRC_SERVER_REC *) server_find_ircnet(ircnet);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server PREFIX = server_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(server)
|
||||
Irssi::Server server
|
||||
PREINIT:
|
||||
HV *hv, *stash;
|
||||
char *type;
|
||||
PPCODE:
|
||||
type = "IRC";
|
||||
|
||||
hv = newHV();
|
||||
hv_store(hv, "type", 4, new_pv(type), 0);
|
||||
server_fill_hash(hv, server);
|
||||
|
||||
hv_store(hv, "real_address", 12, new_pv(server->real_address), 0);
|
||||
hv_store(hv, "version", 7, new_pv(server->version), 0);
|
||||
hv_store(hv, "usermode", 8, new_pv(server->usermode), 0);
|
||||
hv_store(hv, "userhost", 8, new_pv(server->userhost), 0);
|
||||
hv_store(hv, "last_invite", 11, new_pv(server->last_invite), 0);
|
||||
hv_store(hv, "away_reason", 11, new_pv(server->away_reason), 0);
|
||||
hv_store(hv, "usermode_away", 13, newSViv(server->usermode_away), 0);
|
||||
hv_store(hv, "server_operator", 15, newSViv(server->server_operator), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
int
|
||||
server_connect(server)
|
||||
Irssi::Server server
|
||||
CODE:
|
||||
RETVAL = server_connect((SERVER_REC *) server);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
server_disconnect(server)
|
||||
Irssi::Server server
|
||||
CODE:
|
||||
server_disconnect((SERVER_REC *) server);
|
||||
|
||||
char *
|
||||
irc_server_get_channels(server)
|
||||
Irssi::Server server
|
||||
|
||||
void
|
||||
send_raw(server, cmd)
|
||||
Irssi::Server server
|
||||
char *cmd
|
||||
CODE:
|
||||
irc_send_cmd(server, cmd);
|
||||
|
||||
void
|
||||
irc_send_cmd_split(server, cmd, arg, max_nicks)
|
||||
Irssi::Server server
|
||||
char *cmd
|
||||
int arg
|
||||
int max_nicks
|
||||
|
||||
void
|
||||
ctcp_send_reply(server, data)
|
||||
Irssi::Server server
|
||||
char *data
|
||||
|
||||
void
|
||||
server_redirect_init(server, command, last, ...)
|
||||
Irssi::Server server
|
||||
char *command
|
||||
int last
|
||||
PREINIT:
|
||||
GSList *list;
|
||||
int n;
|
||||
CODE:
|
||||
list = NULL;
|
||||
for (n = 3; n < items; n++) {
|
||||
list = g_slist_append(list, SvPV(ST(n), PL_na));
|
||||
}
|
||||
server_redirect_initv(server, command, last, list);
|
||||
|
||||
int
|
||||
server_redirect_single_event(server, arg, last, group, event, signal, argpos)
|
||||
Irssi::Server server
|
||||
char *arg
|
||||
int last
|
||||
int group
|
||||
char *event
|
||||
char *signal
|
||||
int argpos
|
||||
|
||||
void
|
||||
server_redirect_event(server, arg, last, ...)
|
||||
Irssi::Server server
|
||||
char *arg
|
||||
int last
|
||||
PREINIT:
|
||||
int n, group;
|
||||
CODE:
|
||||
group = 0;
|
||||
for (n = 3; n+3 <= items; n += 3, last--) {
|
||||
group = server_redirect_single_event(server, arg, last > 0, group,
|
||||
(char *) SvPV(ST(n), PL_na), (char *) SvPV(ST(n+1), PL_na), (int) SvIV(ST(n+2)));
|
||||
}
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Connect PREFIX = irc_server_
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(conn)
|
||||
Irssi::Connect conn
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
connect_fill_hash(hv, conn);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
Irssi::Server
|
||||
irc_server_connect(conn)
|
||||
Irssi::Connect conn
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Reconnect
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(reconnect)
|
||||
Irssi::Reconnect reconnect
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
add_connect_hash(hv, reconnect->conn);
|
||||
hv_store(hv, "tag", 3, newSViv(reconnect->tag), 0);
|
||||
hv_store(hv, "next_connect", 12, newSViv(reconnect->next_connect), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
39
src/perl/xs/Irssi-settings.xs
Normal file
39
src/perl/xs/Irssi-settings.xs
Normal file
@ -0,0 +1,39 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
char *
|
||||
settings_get_str(key)
|
||||
char *key
|
||||
CODE:
|
||||
RETVAL = (char *) settings_get_str(key);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
int
|
||||
settings_get_int(key)
|
||||
char *key
|
||||
|
||||
int
|
||||
settings_get_bool(key)
|
||||
char *key
|
||||
|
||||
void
|
||||
settings_add_str(section, key, def)
|
||||
char *section
|
||||
char *key
|
||||
char *def
|
||||
|
||||
void
|
||||
settings_add_int(section, key, def)
|
||||
char *section
|
||||
char *key
|
||||
int def
|
||||
|
||||
void
|
||||
settings_add_bool(section, key, def)
|
||||
char *section
|
||||
char *key
|
||||
int def
|
||||
|
||||
void
|
||||
settings_remove(key)
|
||||
char *key
|
106
src/perl/xs/Irssi-window.xs
Normal file
106
src/perl/xs/Irssi-window.xs
Normal file
@ -0,0 +1,106 @@
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
void
|
||||
command(cmd, server=active_win->active_server, item=active_win->active)
|
||||
char *cmd
|
||||
Irssi::Server server
|
||||
Irssi::Windowitem item
|
||||
CODE:
|
||||
signal_emit("send command", 3, cmd, server, item);
|
||||
|
||||
Irssi::Window
|
||||
active_win()
|
||||
CODE:
|
||||
RETVAL = active_win;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Irssi::Server
|
||||
active_server()
|
||||
CODE:
|
||||
RETVAL = active_win->active_server;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
print(str)
|
||||
char *str
|
||||
CODE:
|
||||
printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE, str);
|
||||
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server
|
||||
#*******************************
|
||||
|
||||
void
|
||||
command(server, cmd, item=active_win->active)
|
||||
char *cmd
|
||||
Irssi::Server server
|
||||
Irssi::Windowitem item
|
||||
CODE:
|
||||
if (item != NULL && item->server != server)
|
||||
item = NULL;
|
||||
signal_emit("send command", 3, cmd, server, item);
|
||||
|
||||
void
|
||||
printtext(server, channel, level, str)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
int level
|
||||
char *str
|
||||
CODE:
|
||||
printtext(server, channel, level, str);
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Window
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(window)
|
||||
Irssi::Window window
|
||||
PREINIT:
|
||||
HV *hv, *stash;
|
||||
AV *av;
|
||||
GSList *tmp;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "refnum", 6, newSViv(window->refnum), 0);
|
||||
hv_store(hv, "name", 4, new_pv(window->name), 0);
|
||||
|
||||
av = newAV();
|
||||
for (tmp = window->items; tmp != NULL; tmp = tmp->next) {
|
||||
av_push(av, new_pv(tmp->data));
|
||||
}
|
||||
hv_store(hv, "items", 8, newRV_noinc((SV*)av), 0);
|
||||
|
||||
stash = gv_stashpv("Irssi::Windowitem", 0);
|
||||
hv_store(hv, "active", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(window->active))), stash), 0);
|
||||
stash = gv_stashpv("Irssi::Server", 0);
|
||||
hv_store(hv, "active_server", 13, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(window->active_server))), stash), 0);
|
||||
|
||||
hv_store(hv, "lines", 5, newSViv(window->lines), 0);
|
||||
|
||||
hv_store(hv, "level", 5, newSViv(window->level), 0);
|
||||
hv_store(hv, "new_data", 8, newSViv(window->new_data), 0);
|
||||
hv_store(hv, "last_timestamp", 14, newSViv(window->last_timestamp), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Windowitem
|
||||
#*******************************
|
||||
|
||||
void
|
||||
values(item)
|
||||
Irssi::Windowitem item
|
||||
PREINIT:
|
||||
HV *hv, *stash;
|
||||
AV *av;
|
||||
GSList *tmp;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
stash = gv_stashpv("Irssi::Server", 0);
|
||||
hv_store(hv, "server", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(item->server))), stash), 0);
|
||||
hv_store(hv, "name", 4, new_pv(item->name), 0);
|
||||
hv_store(hv, "new_data", 8, newSViv(item->new_data), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
@ -1,933 +1,53 @@
|
||||
/* This could be split to different files / modules ..? */
|
||||
#include "EXTERN.h"
|
||||
#include "perl.h"
|
||||
#include "XSUB.h"
|
||||
#include "module.h"
|
||||
#include "levels.h"
|
||||
|
||||
#undef _
|
||||
#include <irssi-plugin.h>
|
||||
#include <irc-base/server-setup.h>
|
||||
#include <irc-base/server-reconnect.h>
|
||||
#include <irc-base/server-redirect.h>
|
||||
|
||||
typedef SERVER_REC *Irssi__Server;
|
||||
typedef SERVER_CONNECT_REC *Irssi__Connect;
|
||||
typedef RECONNECT_REC *Irssi__Reconnect;
|
||||
typedef CHANNEL_REC *Irssi__Channel;
|
||||
typedef COMMAND_REC *Irssi__Command;
|
||||
typedef NICK_REC *Irssi__Nick;
|
||||
typedef BAN_REC *Irssi__Ban;
|
||||
typedef DCC_REC *Irssi__Dcc;
|
||||
typedef NETSPLIT_REC *Irssi__Netsplit;
|
||||
typedef AUTOIGNORE_REC *Irssi__Autoignore;
|
||||
typedef LOG_REC *Irssi__Log;
|
||||
typedef LOG_ITEM_REC *Irssi__Logitem;
|
||||
typedef PLUGIN_REC *Irssi__Plugin;
|
||||
|
||||
#define new_pv(a) (newSVpv((a) == NULL ? "" : (a), (a) == NULL ? 0 : strlen(a)))
|
||||
|
||||
void add_connect_hash(HV *hv, SERVER_CONNECT_REC *conn)
|
||||
void connect_fill_hash(HV *hv, IRC_SERVER_CONNECT_REC *conn)
|
||||
{
|
||||
hv_store(hv, "address", 7, new_pv(conn->address), 0);
|
||||
hv_store(hv, "port", 4, newSViv(conn->port), 0);
|
||||
hv_store(hv, "password", 8, new_pv(conn->password), 0);
|
||||
|
||||
hv_store(hv, "ircnet", 6, new_pv(conn->ircnet), 0);
|
||||
|
||||
hv_store(hv, "password", 8, new_pv(conn->password), 0);
|
||||
hv_store(hv, "wanted_nick", 11, new_pv(conn->nick), 0);
|
||||
hv_store(hv, "alternate_nick", 14, new_pv(conn->alternate_nick), 0);
|
||||
hv_store(hv, "username", 8, new_pv(conn->username), 0);
|
||||
hv_store(hv, "realname", 8, new_pv(conn->realname), 0);
|
||||
hv_store(hv, "autojoin_channels", 17, new_pv(conn->autojoin_channels), 0);
|
||||
}
|
||||
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
void server_fill_hash(HV *hv, IRC_SERVER_REC *server)
|
||||
{
|
||||
HV *stash;
|
||||
|
||||
connect_fill_hash(hv, server->connrec);
|
||||
hv_store(hv, "connect_time", 12, newSViv(server->connect_time), 0);
|
||||
|
||||
hv_store(hv, "tag", 3, new_pv(server->tag), 0);
|
||||
hv_store(hv, "nick", 4, new_pv(server->nick), 0);
|
||||
|
||||
hv_store(hv, "connected", 9, newSViv(server->connected), 0);
|
||||
hv_store(hv, "connection_lost", 15, newSViv(server->connection_lost), 0);
|
||||
|
||||
stash = gv_stashpv("Irssi::Rawlog", 0);
|
||||
hv_store(hv, "rawlog", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(server->rawlog))), stash), 0);
|
||||
}
|
||||
|
||||
MODULE = Irssi PACKAGE = Irssi
|
||||
|
||||
PROTOTYPES: ENABLE
|
||||
|
||||
Irssi::Channel
|
||||
cur_channel()
|
||||
CODE:
|
||||
RETVAL = cur_channel;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Irssi::Server
|
||||
cur_server()
|
||||
CODE:
|
||||
RETVAL = cur_channel->server;
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
channels()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Channel", 0);
|
||||
for (tmp = channels; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
void
|
||||
servers()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Server", 0);
|
||||
for (tmp = servers; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
void
|
||||
commands()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Command", 0);
|
||||
for (tmp = commands; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
void
|
||||
dccs()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Dcc", 0);
|
||||
for (tmp = dcc_conns; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
void
|
||||
logs()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Log", 0);
|
||||
for (tmp = logs; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
void
|
||||
plugins()
|
||||
PREINIT:
|
||||
GSList *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
stash = gv_stashpv("Irssi::Plugin", 0);
|
||||
for (tmp = plugins; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
|
||||
Irssi::Connect
|
||||
server_create_conn(dest, port=6667, password=NULL, nick=NULL, channels=NULL)
|
||||
char *dest
|
||||
int port
|
||||
char *password
|
||||
char *nick
|
||||
char *channels
|
||||
|
||||
Irssi::Server
|
||||
server_find_tag(tag)
|
||||
char *tag
|
||||
|
||||
Irssi::Server
|
||||
server_find_ircnet(ircnet)
|
||||
char *ircnet
|
||||
|
||||
Irssi::Channel
|
||||
channel_find(channel)
|
||||
char *channel
|
||||
CODE:
|
||||
RETVAL = channel_find(NULL, channel);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
print(str)
|
||||
char *str
|
||||
CODE:
|
||||
printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE, str);
|
||||
|
||||
void
|
||||
signal_emit(signal, ...)
|
||||
char *signal
|
||||
CODE:
|
||||
void *p[6];
|
||||
int n;
|
||||
|
||||
memset(p, 0, sizeof(p));
|
||||
for (n = 1; n < items && n < 6; n++) {
|
||||
p[n-1] = SvPOKp(ST(n)) ? SvPV(ST(n), PL_na) : (void *) SvIV((SV*)SvRV(ST(n)));
|
||||
}
|
||||
signal_emit(signal, items-1, p[0], p[1], p[2], p[3], p[4], p[5]);
|
||||
|
||||
void
|
||||
signal_add(signal, func)
|
||||
char *signal
|
||||
char *func
|
||||
CODE:
|
||||
perl_signal_add(signal, func);
|
||||
|
||||
void
|
||||
signal_add_last(signal, func)
|
||||
char *signal
|
||||
char *func
|
||||
CODE:
|
||||
perl_signal_add_last(signal, func);
|
||||
|
||||
void
|
||||
signal_remove(signal, func)
|
||||
char *signal
|
||||
char *func
|
||||
CODE:
|
||||
perl_signal_remove(signal, func);
|
||||
|
||||
int
|
||||
timeout_add(msecs, func, data)
|
||||
int msecs
|
||||
char *func
|
||||
char *data
|
||||
CODE:
|
||||
RETVAL = perl_timeout_add(msecs, func, data);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
void
|
||||
timeout_remove(tag)
|
||||
int tag
|
||||
CODE:
|
||||
perl_timeout_remove(tag);
|
||||
|
||||
void
|
||||
command_bind(cmd, category, func)
|
||||
char *cmd
|
||||
char *category
|
||||
char *func
|
||||
CODE:
|
||||
char *signal;
|
||||
|
||||
command_bind(cmd, *category ? category : "Perl scripts' commands", NULL);
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_add(signal, func);
|
||||
g_free(signal);
|
||||
|
||||
void
|
||||
command_unbind(cmd, func)
|
||||
char *cmd
|
||||
char *func
|
||||
CODE:
|
||||
char *signal;
|
||||
|
||||
command_unbind(cmd, NULL);
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_remove(signal, func);
|
||||
g_free(signal);
|
||||
|
||||
void
|
||||
command(cmd, server=cur_channel->server, channel=cur_channel)
|
||||
char *cmd
|
||||
Irssi::Server server
|
||||
Irssi::Channel channel
|
||||
CODE:
|
||||
signal_emit("send command", 3, cmd, server, channel);
|
||||
|
||||
int
|
||||
is_channel(text)
|
||||
char *text
|
||||
CODE:
|
||||
RETVAL = ischannel(*text);
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
int
|
||||
irc_mask_match(mask, nick, user, host)
|
||||
char *mask
|
||||
char *nick
|
||||
char *user
|
||||
char *host
|
||||
|
||||
int
|
||||
irc_mask_match_address(mask, nick, address)
|
||||
char *mask
|
||||
char *nick
|
||||
char *address
|
||||
|
||||
int
|
||||
irc_masks_match(masks, nick, address)
|
||||
char *masks
|
||||
char *nick
|
||||
char *address
|
||||
|
||||
char *
|
||||
irc_get_mask(nick, host, flags)
|
||||
char *nick
|
||||
char *host
|
||||
int flags
|
||||
|
||||
int
|
||||
level2bits(str)
|
||||
char *str
|
||||
|
||||
char *
|
||||
bits2level(bits)
|
||||
int bits
|
||||
|
||||
int
|
||||
combine_level(level, str)
|
||||
int level
|
||||
char *str
|
||||
|
||||
Irssi::Dcc
|
||||
dcc_find_item(type, nick, arg)
|
||||
int type
|
||||
char *nick
|
||||
char *arg
|
||||
|
||||
Irssi::Dcc
|
||||
dcc_find_by_port(nick, port)
|
||||
char *nick
|
||||
int port
|
||||
|
||||
char *
|
||||
dcc_type2str(type)
|
||||
int type
|
||||
|
||||
int
|
||||
dcc_str2type(type)
|
||||
char *type
|
||||
|
||||
void
|
||||
ignore_add(mask, level)
|
||||
char *mask
|
||||
char *level
|
||||
|
||||
void
|
||||
ignore_remove(mask, level)
|
||||
char *mask
|
||||
char *level
|
||||
|
||||
Irssi::Log
|
||||
log_create(fname, data)
|
||||
char *fname
|
||||
char *data
|
||||
|
||||
Irssi::Log
|
||||
log_create_with_level(fname, level)
|
||||
char *fname
|
||||
int level
|
||||
|
||||
Irssi::Log
|
||||
log_file_find(fname)
|
||||
char *fname
|
||||
|
||||
void
|
||||
notifylist_add(nick, ircnet)
|
||||
char *nick
|
||||
char *ircnet
|
||||
|
||||
Irssi::Server
|
||||
notifylist_ison(nick, serverlist)
|
||||
char *nick
|
||||
char *serverlist
|
||||
|
||||
int
|
||||
plugin_load(name, args)
|
||||
char *name
|
||||
char *args
|
||||
|
||||
char *
|
||||
plugin_get_description(name)
|
||||
char *name
|
||||
|
||||
Irssi::Plugin
|
||||
plugin_find(name)
|
||||
char *name
|
||||
|
||||
void
|
||||
setup_get(option)
|
||||
char *option
|
||||
PREINIT:
|
||||
char *ret;
|
||||
PPCODE:
|
||||
switch(setup_option_type(option)) {
|
||||
case SETUP_TYPE_TOGGLEBUTTON:
|
||||
XPUSHs(sv_2mortal(newSViv(setup_get_bool(option))));
|
||||
break;
|
||||
case SETUP_TYPE_SPIN:
|
||||
case SETUP_TYPE_INT_OBJECT:
|
||||
XPUSHs(sv_2mortal(newSViv(setup_get_int(option))));
|
||||
break;
|
||||
case SETUP_TYPE_ENTRY:
|
||||
ret = setup_get_str(option);
|
||||
XPUSHs(sv_2mortal(newSVpv(ret, strlen(ret))));
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Server PREFIX = server_
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
send_raw(server, cmd)
|
||||
Irssi::Server server
|
||||
char *cmd
|
||||
CODE:
|
||||
irc_send_cmd(server, cmd);
|
||||
|
||||
void
|
||||
command(server, cmd, channel=cur_channel)
|
||||
char *cmd
|
||||
Irssi::Server server
|
||||
Irssi::Channel channel
|
||||
CODE:
|
||||
if (channel->server != server) {
|
||||
GSList *tmp;
|
||||
|
||||
for (tmp = channels; tmp != NULL; tmp = tmp->next) {
|
||||
CHANNEL_REC *rec = tmp->data;
|
||||
|
||||
if (rec->server == server) {
|
||||
channel = rec;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
signal_emit("send command", 3, cmd, server, channel);
|
||||
|
||||
void
|
||||
server_disconnect(server)
|
||||
Irssi::Server server
|
||||
|
||||
Irssi::Channel
|
||||
channel_create(server, channel, type, automatic)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
int type
|
||||
int automatic
|
||||
|
||||
Irssi::Channel
|
||||
channel_find(server, channel)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
|
||||
Irssi::Channel
|
||||
channel_find_closest(server, channel, level)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
int level
|
||||
|
||||
Irssi::Channel
|
||||
channel_find_level(server, level)
|
||||
Irssi::Server server
|
||||
int level
|
||||
|
||||
void
|
||||
printtext(server, channel, level, str)
|
||||
Irssi::Server server
|
||||
char *channel
|
||||
int level
|
||||
char *str
|
||||
CODE:
|
||||
printtext(server, channel, level, str);
|
||||
|
||||
void
|
||||
irc_send_cmd_split(server, cmd, arg, max_nicks)
|
||||
Irssi::Server server
|
||||
char *cmd
|
||||
int arg
|
||||
int max_nicks
|
||||
|
||||
void
|
||||
ctcp_send_reply(server, data)
|
||||
Irssi::Server server
|
||||
char *data
|
||||
|
||||
Irssi::Netsplit
|
||||
netsplit_find(server, nick, address)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
char *address
|
||||
|
||||
Irssi::Nick
|
||||
netsplit_find_channel(server, nick, address, channel)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
char *address
|
||||
char *channel
|
||||
|
||||
void
|
||||
rawlog_input(server, str)
|
||||
Irssi::Server server
|
||||
char *str
|
||||
|
||||
void
|
||||
rawlog_output(server, str)
|
||||
Irssi::Server server
|
||||
char *str
|
||||
|
||||
void
|
||||
rawlog_redirect(server, str)
|
||||
Irssi::Server server
|
||||
char *str
|
||||
|
||||
void
|
||||
server_redirect_init(server, command, last, ...)
|
||||
Irssi::Server server
|
||||
char *command
|
||||
int last
|
||||
PREINIT:
|
||||
GSList *list;
|
||||
int n;
|
||||
CODE:
|
||||
list = NULL;
|
||||
for (n = 3; n < items; n++) {
|
||||
list = g_slist_append(list, SvPV(ST(n), PL_na));
|
||||
}
|
||||
server_redirect_initv(server, command, last, list);
|
||||
|
||||
int
|
||||
server_redirect_single_event(server, arg, last, group, event, signal, argpos)
|
||||
Irssi::Server server
|
||||
char *arg
|
||||
int last
|
||||
int group
|
||||
char *event
|
||||
char *signal
|
||||
int argpos
|
||||
|
||||
void
|
||||
server_redirect_event(server, arg, last, ...)
|
||||
Irssi::Server server
|
||||
char *arg
|
||||
int last
|
||||
PREINIT:
|
||||
int n, group;
|
||||
CODE:
|
||||
group = 0;
|
||||
for (n = 3; n+3 <= items; n += 3, last--) {
|
||||
group = server_redirect_single_event(server, arg, last > 0, group,
|
||||
(char *) SvPV(ST(n), PL_na), (char *) SvPV(ST(n+1), PL_na), (int) SvIV(ST(n+2)));
|
||||
}
|
||||
|
||||
void
|
||||
autoignore_add(server, type, nick)
|
||||
Irssi::Server server
|
||||
int type
|
||||
char *nick
|
||||
|
||||
int
|
||||
autoignore_remove(server, mask, level)
|
||||
Irssi::Server server
|
||||
char *mask
|
||||
char *level
|
||||
|
||||
int
|
||||
ignore_check(server, nick, host, type)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
char *host
|
||||
int type
|
||||
|
||||
int
|
||||
notifylist_ison_server(server, nick)
|
||||
Irssi::Server server
|
||||
char *nick
|
||||
|
||||
void
|
||||
values(server)
|
||||
Irssi::Server server
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
add_connect_hash(hv, server->connrec);
|
||||
hv_store(hv, "real_address", 12, new_pv(server->real_address), 0);
|
||||
hv_store(hv, "tag", 3, new_pv(server->tag), 0);
|
||||
hv_store(hv, "nick", 4, new_pv(server->nick), 0);
|
||||
hv_store(hv, "usermode", 8, new_pv(server->usermode), 0);
|
||||
hv_store(hv, "usermode_away", 13, newSViv(server->usermode_away), 0);
|
||||
hv_store(hv, "away_reason", 11, new_pv(server->away_reason), 0);
|
||||
hv_store(hv, "connected", 9, newSViv(server->connected), 0);
|
||||
hv_store(hv, "connection_lost", 15, newSViv(server->connection_lost), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Connect PREFIX = server_
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(conn)
|
||||
Irssi::Connect conn
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
add_connect_hash(hv, conn);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
Irssi::Server
|
||||
server_connect(conn)
|
||||
Irssi::Connect conn
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Reconnect
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(reconnect)
|
||||
Irssi::Reconnect reconnect
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
add_connect_hash(hv, reconnect->conn);
|
||||
hv_store(hv, "tag", 3, newSViv(reconnect->tag), 0);
|
||||
hv_store(hv, "next_connect", 12, newSViv(reconnect->next_connect), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Channel PREFIX = channel_
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
command(channel, cmd)
|
||||
Irssi::Channel channel
|
||||
char *cmd
|
||||
CODE:
|
||||
signal_emit("send command", 3, cmd, channel->server, channel);
|
||||
|
||||
void
|
||||
channel_destroy(channel)
|
||||
Irssi::Channel channel
|
||||
|
||||
void
|
||||
channel_change_name(channel, name)
|
||||
Irssi::Channel channel
|
||||
char *name
|
||||
|
||||
char *
|
||||
channel_get_mode(channel)
|
||||
Irssi::Channel channel
|
||||
|
||||
Irssi::Nick
|
||||
nicklist_insert(channel, nick, op, voice, send_massjoin)
|
||||
Irssi::Channel channel
|
||||
char *nick
|
||||
int op
|
||||
int voice
|
||||
int send_massjoin
|
||||
|
||||
void
|
||||
nicklist_remove(channel, nick)
|
||||
Irssi::Channel channel
|
||||
Irssi::Nick nick
|
||||
|
||||
Irssi::Nick
|
||||
nicklist_find(channel, mask)
|
||||
Irssi::Channel channel
|
||||
char *mask
|
||||
|
||||
void
|
||||
nicklist_getnicks(channel)
|
||||
Irssi::Channel channel
|
||||
PREINIT:
|
||||
GSList *list, *tmp;
|
||||
HV *stash;
|
||||
PPCODE:
|
||||
list = nicklist_getnicks(channel);
|
||||
|
||||
stash = gv_stashpv("Irssi::Nick", 0);
|
||||
for (tmp = list; tmp != NULL; tmp = tmp->next) {
|
||||
XPUSHs(sv_2mortal(sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(tmp->data))), stash)));
|
||||
}
|
||||
g_slist_free(list);
|
||||
|
||||
Irssi::Ban
|
||||
ban_add(channel, ban, nick, time)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
char *nick
|
||||
time_t time
|
||||
|
||||
void
|
||||
ban_remove(channel, ban)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
|
||||
Irssi::Ban
|
||||
ban_exception_add(channel, ban, nick, time)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
char *nick
|
||||
time_t time
|
||||
|
||||
void
|
||||
ban_exception_remove(channel, ban)
|
||||
Irssi::Channel channel
|
||||
char *ban
|
||||
|
||||
char *
|
||||
ban_get_mask(channel, nick)
|
||||
Irssi::Channel channel
|
||||
char *nick
|
||||
|
||||
void
|
||||
modes_set(channel, data, mode)
|
||||
Irssi::Channel channel
|
||||
char *data
|
||||
char *mode
|
||||
CODE:
|
||||
modes_set(data, mode, channel->server, channel);
|
||||
|
||||
void
|
||||
modes_parse_channel(channel, setby, modestr)
|
||||
Irssi::Channel channel
|
||||
char *setby
|
||||
char *modestr
|
||||
|
||||
void
|
||||
invitelist_add(channel, mask)
|
||||
Irssi::Channel channel
|
||||
char *mask
|
||||
|
||||
void
|
||||
invitelist_remove(channel, mask)
|
||||
Irssi::Channel channel
|
||||
char *mask
|
||||
|
||||
void
|
||||
values(channel)
|
||||
Irssi::Channel channel
|
||||
PREINIT:
|
||||
HV *hv, *stash;
|
||||
char *type;
|
||||
PPCODE:
|
||||
switch (channel->type)
|
||||
{
|
||||
case CHANNEL_TYPE_CHANNEL:
|
||||
type = "channel";
|
||||
break;
|
||||
case CHANNEL_TYPE_QUERY:
|
||||
type = "query";
|
||||
break;
|
||||
case CHANNEL_TYPE_DCC_CHAT:
|
||||
type = "dcc chat";
|
||||
break;
|
||||
default:
|
||||
type = "empty";
|
||||
break;
|
||||
}
|
||||
hv = newHV();
|
||||
stash = gv_stashpv("Irssi::Server", 0);
|
||||
hv_store(hv, "server", 6, sv_bless(newRV_noinc(newSViv(GPOINTER_TO_INT(channel->server))), stash), 0);
|
||||
|
||||
hv_store(hv, "name", 4, new_pv(channel->name), 0);
|
||||
hv_store(hv, "type", 4, new_pv(type), 0);
|
||||
|
||||
hv_store(hv, "topic", 5, new_pv(channel->topic), 0);
|
||||
hv_store(hv, "key", 3, new_pv(channel->key), 0);
|
||||
hv_store(hv, "limit", 5, newSViv(channel->limit), 0);
|
||||
|
||||
hv_store(hv, "level", 5, newSViv(channel->level), 0);
|
||||
hv_store(hv, "new_data", 8, newSViv(channel->new_data), 0);
|
||||
|
||||
hv_store(hv, "synced", 6, newSViv(channel->synced), 0);
|
||||
hv_store(hv, "wholist", 7, newSViv(channel->wholist), 0);
|
||||
hv_store(hv, "names_got", 9, newSViv(channel->names_got), 0);
|
||||
hv_store(hv, "chanop", 6, newSViv(channel->chanop), 0);
|
||||
hv_store(hv, "left", 4, newSViv(channel->left), 0);
|
||||
hv_store(hv, "kicked", 6, newSViv(channel->kicked), 0);
|
||||
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Command
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(cmd)
|
||||
Irssi::Command cmd
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "cmd", 3, new_pv(cmd->cmd), 0);
|
||||
hv_store(hv, "category", 8, new_pv(cmd->category), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Nick
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(nick)
|
||||
Irssi::Nick nick
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "nick", 4, new_pv(nick->nick), 0);
|
||||
hv_store(hv, "host", 4, new_pv(nick->host), 0);
|
||||
hv_store(hv, "name", 4, new_pv(nick->realname), 0);
|
||||
hv_store(hv, "hops", 4, newSViv(nick->hops), 0);
|
||||
hv_store(hv, "op", 2, newSViv(nick->op), 0);
|
||||
hv_store(hv, "voice", 5, newSViv(nick->voice), 0);
|
||||
hv_store(hv, "gone", 4, newSViv(nick->gone), 0);
|
||||
hv_store(hv, "ircop", 5, newSViv(nick->ircop), 0);
|
||||
hv_store(hv, "last_check", 10, newSViv(nick->last_check), 0);
|
||||
hv_store(hv, "send_massjoin", 13, newSViv(nick->send_massjoin), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Ban
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(ban)
|
||||
Irssi::Ban ban
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "ban", 3, new_pv(ban->ban), 0);
|
||||
hv_store(hv, "setby", 5, new_pv(ban->setby), 0);
|
||||
hv_store(hv, "time", 4, newSViv(ban->time), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Dcc PREFIX = dcc_
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
dcc_destroy(dcc)
|
||||
Irssi::Dcc dcc
|
||||
|
||||
void
|
||||
values(ban)
|
||||
Irssi::Ban ban
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "ban", 3, new_pv(ban->ban), 0);
|
||||
hv_store(hv, "setby", 5, new_pv(ban->setby), 0);
|
||||
hv_store(hv, "time", 4, newSViv(ban->time), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Netsplit
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(netsplit)
|
||||
Irssi::Netsplit netsplit
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "nick", 4, new_pv(netsplit->nick), 0);
|
||||
hv_store(hv, "address", 7, new_pv(netsplit->address), 0);
|
||||
hv_store(hv, "server", 6, new_pv(netsplit->server), 0);
|
||||
hv_store(hv, "destserver", 10, new_pv(netsplit->destserver), 0);
|
||||
hv_store(hv, "destroy", 7, newSViv(netsplit->destroy), 0);
|
||||
/*FIXME: add GSList *channels;*/
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Autoignore
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(ai)
|
||||
Irssi::Autoignore ai
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "nick", 4, new_pv(ai->nick), 0);
|
||||
hv_store(hv, "timeleft", 8, newSViv(ai->timeleft), 0);
|
||||
hv_store(hv, "level", 5, newSViv(ai->level), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Log PREFIX = log_
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(log)
|
||||
Irssi::Log log
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "fname", 5, new_pv(log->fname), 0);
|
||||
hv_store(hv, "autoopen_log", 12, newSViv(log->autoopen_log), 0);
|
||||
hv_store(hv, "last", 4, newSViv(log->last), 0);
|
||||
hv_store(hv, "level", 5, newSViv(log->level), 0);
|
||||
/*FIXME: add GSList *items;*/
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
void
|
||||
destroy(log)
|
||||
Irssi::Log log
|
||||
CODE:
|
||||
log_file_destroy(log);
|
||||
|
||||
int
|
||||
open(log)
|
||||
Irssi::Log log
|
||||
CODE:
|
||||
log_file_open(log);
|
||||
|
||||
void
|
||||
close(log)
|
||||
Irssi::Log log
|
||||
CODE:
|
||||
log_file_close(log);
|
||||
|
||||
void
|
||||
log_append_item(log, name, level)
|
||||
Irssi::Log log
|
||||
char *name
|
||||
int level
|
||||
|
||||
void
|
||||
log_remove_item(log, name)
|
||||
Irssi::Log log
|
||||
char *name
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Logitem
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(item)
|
||||
Irssi::Logitem item
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "name", 4, new_pv(item->name), 0);
|
||||
hv_store(hv, "level", 5, newSViv(item->level), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
|
||||
#*******************************************************
|
||||
MODULE = Irssi PACKAGE = Irssi::Plugin PREFIX = plugin_
|
||||
#*******************************************************
|
||||
|
||||
void
|
||||
values(plugin)
|
||||
Irssi::Plugin plugin
|
||||
PREINIT:
|
||||
HV *hv;
|
||||
PPCODE:
|
||||
hv = newHV();
|
||||
hv_store(hv, "name", 4, new_pv(plugin->name), 0);
|
||||
hv_store(hv, "description", 11, new_pv(plugin->description), 0);
|
||||
XPUSHs(sv_2mortal(newRV_noinc((SV*)hv)));
|
||||
INCLUDE: Irssi-bans.xs
|
||||
INCLUDE: Irssi-channel.xs
|
||||
INCLUDE: Irssi-core.xs
|
||||
INCLUDE: Irssi-dcc.xs
|
||||
INCLUDE: Irssi-flood.xs
|
||||
INCLUDE: Irssi-ignore.xs
|
||||
INCLUDE: Irssi-log.xs
|
||||
INCLUDE: Irssi-masks.xs
|
||||
INCLUDE: Irssi-modes.xs
|
||||
INCLUDE: Irssi-netsplit.xs
|
||||
INCLUDE: Irssi-notifylist.xs
|
||||
INCLUDE: Irssi-query.xs
|
||||
INCLUDE: Irssi-rawlog.xs
|
||||
INCLUDE: Irssi-server.xs
|
||||
INCLUDE: Irssi-settings.xs
|
||||
INCLUDE: Irssi-window.xs
|
||||
|
@ -2,5 +2,5 @@ use ExtUtils::MakeMaker;
|
||||
|
||||
WriteMakefile('NAME' => 'Irssi',
|
||||
'LIBS' => '',
|
||||
'INC' => '-I@top_srcdir@/src @GLIB_CFLAGS@',
|
||||
'INC' => '-I@top_srcdir@/src -I@top_srcdir@/src/core @GLIB_CFLAGS@',
|
||||
'VERSION_FROM' => '@srcdir@/Irssi.pm');
|
||||
|
54
src/perl/xs/module.h
Normal file
54
src/perl/xs/module.h
Normal file
@ -0,0 +1,54 @@
|
||||
#include <EXTERN.h>
|
||||
#include <perl.h>
|
||||
#include <XSUB.h>
|
||||
|
||||
#undef _
|
||||
#include "common.h"
|
||||
#include "network.h"
|
||||
#include "commands.h"
|
||||
#include "server.h"
|
||||
#include "log.h"
|
||||
#include "rawlog.h"
|
||||
#include "settings.h"
|
||||
|
||||
#include "irc/core/bans.h"
|
||||
#include "irc/core/channels.h"
|
||||
#include "irc/core/query.h"
|
||||
#include "irc/core/irc-server.h"
|
||||
#include "irc/core/server-reconnect.h"
|
||||
#include "irc/core/server-setup.h"
|
||||
#include "irc/core/nicklist.h"
|
||||
#include "irc/core/masks.h"
|
||||
#include "irc/core/modes.h"
|
||||
#include "irc/core/mode-lists.h"
|
||||
#include "irc/core/netsplit.h"
|
||||
#include "irc/core/ignore.h"
|
||||
|
||||
#include "irc/dcc/dcc.h"
|
||||
#include "irc/flood/autoignore.h"
|
||||
#include "irc/notifylist/notifylist.h"
|
||||
|
||||
#include "fe-common/core/windows.h"
|
||||
|
||||
#define new_pv(a) (newSVpv((a) == NULL ? "" : (a), (a) == NULL ? 0 : strlen(a)))
|
||||
|
||||
typedef COMMAND_REC *Irssi__Command;
|
||||
typedef LOG_REC *Irssi__Log;
|
||||
typedef RAWLOG_REC *Irssi__Rawlog;
|
||||
|
||||
typedef CHANNEL_REC *Irssi__Channel;
|
||||
typedef QUERY_REC *Irssi__Query;
|
||||
typedef IRC_SERVER_REC *Irssi__Server;
|
||||
typedef IRC_SERVER_CONNECT_REC *Irssi__Connect;
|
||||
typedef RECONNECT_REC *Irssi__Reconnect;
|
||||
typedef NICK_REC *Irssi__Nick;
|
||||
typedef BAN_REC *Irssi__Ban;
|
||||
typedef NETSPLIT_REC *Irssi__Netsplit;
|
||||
typedef IGNORE_REC *Irssi__Ignore;
|
||||
|
||||
typedef DCC_REC *Irssi__Dcc;
|
||||
typedef AUTOIGNORE_REC *Irssi__Autoignore;
|
||||
typedef NOTIFYLIST_REC *Irssi__Notifylist;
|
||||
|
||||
typedef WINDOW_REC *Irssi__Window;
|
||||
typedef WI_ITEM_REC *Irssi__Windowitem;
|
@ -1,8 +1,9 @@
|
||||
TYPEMAP
|
||||
Irssi::Server T_PTROBJ
|
||||
Irssi::Connect T_PTROBJ
|
||||
Irssi::Reconnect T_PTROBJ
|
||||
Irssi::Connect T_PTROBJ
|
||||
Irssi::Reconnect T_PTROBJ
|
||||
Irssi::Channel T_PTROBJ
|
||||
Irssi::Query T_PTROBJ
|
||||
Irssi::Command T_PTROBJ
|
||||
Irssi::Nick T_PTROBJ
|
||||
Irssi::Ban T_PTROBJ
|
||||
@ -10,5 +11,8 @@ Irssi::Dcc T_PTROBJ
|
||||
Irssi::Netsplit T_PTROBJ
|
||||
Irssi::Autoignore T_PTROBJ
|
||||
Irssi::Log T_PTROBJ
|
||||
Irssi::Logitem T_PTROBJ
|
||||
Irssi::Plugin T_PTROBJ
|
||||
Irssi::Rawlog T_PTROBJ
|
||||
Irssi::Notifylist T_PTROBJ
|
||||
Irssi::Ignore T_PTROBJ
|
||||
Irssi::Window T_PTROBJ
|
||||
Irssi::Windowitem T_PTROBJ
|
||||
|
Loading…
Reference in New Issue
Block a user