From b933f62111cb088c9d5c8f9289cd6ebbdd409010 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 13 May 2002 18:25:21 +0000 Subject: fixes git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2791 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/perl/common/Core.xs | 2 +- src/perl/irc/Dcc.xs | 2 +- src/perl/irc/Modes.xs | 4 +-- src/perl/irc/Server.xs | 2 +- src/perl/ui/Formats.xs | 71 ++++++++++++++++++++++++++++++++++++------------- src/perl/ui/Themes.xs | 1 - 6 files changed, 58 insertions(+), 24 deletions(-) diff --git a/src/perl/common/Core.xs b/src/perl/common/Core.xs index da29b521..129b2081 100644 --- a/src/perl/common/Core.xs +++ b/src/perl/common/Core.xs @@ -452,7 +452,7 @@ PREINIT: char *ret; PPCODE: ret = bits2level(bits); - xPUSHs(sv_2mortal(new_pv(ret))); + XPUSHs(sv_2mortal(new_pv(ret))); g_free(ret); int diff --git a/src/perl/irc/Dcc.xs b/src/perl/irc/Dcc.xs index 8c906a19..eff4e982 100644 --- a/src/perl/irc/Dcc.xs +++ b/src/perl/irc/Dcc.xs @@ -65,7 +65,7 @@ PREINIT: char *ret; PPCODE: ret = dcc_get_download_path(fname); - xPUSHs(sv_2mortal(new_pv(ret))); + XPUSHs(sv_2mortal(new_pv(ret))); g_free(ret); #******************************* diff --git a/src/perl/irc/Modes.xs b/src/perl/irc/Modes.xs index 723930fb..411b07e8 100644 --- a/src/perl/irc/Modes.xs +++ b/src/perl/irc/Modes.xs @@ -12,7 +12,7 @@ PREINIT: char *ret; PPCODE: ret = modes_join(old, mode, channel); - xPUSHs(sv_2mortal(new_pv(ret))); + XPUSHs(sv_2mortal(new_pv(ret))); g_free(ret); #******************************* @@ -28,7 +28,7 @@ PREINIT: char *ret; PPCODE: ret = ban_get_mask(channel, nick, ban_type); - xPUSHs(sv_2mortal(new_pv(ret))); + XPUSHs(sv_2mortal(new_pv(ret))); g_free(ret); Irssi::Irc::Ban diff --git a/src/perl/irc/Server.xs b/src/perl/irc/Server.xs index dfe88f65..85b13f80 100644 --- a/src/perl/irc/Server.xs +++ b/src/perl/irc/Server.xs @@ -52,7 +52,7 @@ PREINIT: char *ret; PPCODE: ret = irc_server_get_channels(server); - xPUSHs(sv_2mortal(new_pv(ret))); + XPUSHs(sv_2mortal(new_pv(ret))); g_free(ret); void diff --git a/src/perl/ui/Formats.xs b/src/perl/ui/Formats.xs index f7a5414b..42376f8a 100644 --- a/src/perl/ui/Formats.xs +++ b/src/perl/ui/Formats.xs @@ -14,7 +14,28 @@ static MGVTBL vtbl_free_text_dest = NULL, NULL, NULL, NULL, magic_free_text_dest }; -MODULE = Irssi::UI::Formats PACKAGE = Irssi::UI::Window +static SV *perl_format_create_dest(SERVER_REC *server, char *target, + int level, WINDOW_REC *window) +{ + TEXT_DEST_REC *dest; + SV *sv, *ret_sv; + + dest = g_new0(TEXT_DEST_REC, 1); + format_create_dest(dest, server, g_strdup(target), level, window); + + ret_sv = plain_bless(dest, "Irssi::UI::TextDest"); + + sv = *hv_fetch(hvref(ret_sv), "_irssi", 6, 0); + sv_magic(sv, NULL, '~', NULL, 0); + + SvMAGIC(sv)->mg_private = 0x1551; /* HF */ + SvMAGIC(sv)->mg_virtual = &vtbl_free_text_dest; + SvMAGIC(sv)->mg_ptr = (char *) dest; + + return ret_sv; +} + +MODULE = Irssi::UI::Formats PACKAGE = Irssi PROTOTYPES: ENABLE int @@ -33,9 +54,22 @@ PREINIT: char *ret; PPCODE: ret = strip_codes(input); - xPUSHs(sv_2mortal(new_pv(ret))); + XPUSHs(sv_2mortal(new_pv(ret))); g_free(ret); + +void +format_create_dest(target, level=MSGLEVEL_CLIENTNOTICE, window=NULL) + char *target + int level + Irssi::UI::Window window +PPCODE: + XPUSHs(sv_2mortal(perl_format_create_dest(NULL, target, level, window))); + +#******************************* +MODULE = Irssi::UI::Formats PACKAGE = Irssi::UI::Window +#******************************* + void format_get_text(window, module, server, target, formatnum, ...) Irssi::UI::Window window @@ -64,7 +98,20 @@ PPCODE: XPUSHs(sv_2mortal(new_pv(ret))); g_free_not_null(ret); -MODULE = Irssi::UI::Formats PACKAGE = Irssi +#******************************* +MODULE = Irssi::UI::Formats PACKAGE = Irssi::Window +#******************************* + +void +format_create_dest(window=NULL, level=MSGLEVEL_CLIENTNOTICE) + Irssi::UI::Window window + int level +PPCODE: + XPUSHs(sv_2mortal(perl_format_create_dest(NULL, NULL, level, window))); + +#******************************* +MODULE = Irssi::UI::Formats PACKAGE = Irssi::Server +#******************************* void format_create_dest(server, target=NULL, level=MSGLEVEL_CLIENTNOTICE, window=NULL) @@ -72,24 +119,12 @@ format_create_dest(server, target=NULL, level=MSGLEVEL_CLIENTNOTICE, window=NULL char *target int level Irssi::UI::Window window -PREINIT: - TEXT_DEST_REC *dest; - SV *sv; PPCODE: - dest = g_new0(TEXT_DEST_REC, 1); - format_create_dest(dest, server, g_strdup(target), level, window); - - sv = plain_bless(dest, "Irssi::UI::TextDest"); - XPUSHs(sv_2mortal(sv)); - - sv = *hv_fetch(hvref(sv), "_irssi", 6, 0); - sv_magic(sv, NULL, '~', NULL, 0); - - SvMAGIC(sv)->mg_private = 0x1551; /* HF */ - SvMAGIC(sv)->mg_virtual = &vtbl_free_text_dest; - SvMAGIC(sv)->mg_ptr = (char *) dest; + XPUSHs(sv_2mortal(perl_format_create_dest(server, target, level, window))); +#******************************* MODULE = Irssi::UI::Formats PACKAGE = Irssi::UI::TextDest +#******************************* void print(dest, str) diff --git a/src/perl/ui/Themes.xs b/src/perl/ui/Themes.xs index f4528083..64a05676 100644 --- a/src/perl/ui/Themes.xs +++ b/src/perl/ui/Themes.xs @@ -232,7 +232,6 @@ theme_get_format(theme, module, tag) PREINIT: MODULE_THEME_REC *modtheme; FORMAT_REC *formats; - char *ret; int i; CODE: formats = g_hash_table_lookup(default_formats, module); -- cgit v1.2.3