summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-10-20 19:52:07 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-10-20 19:52:07 +0000
commit76c6e9ab831b53e0189d00a81d00e0e956fa7b90 (patch)
treea12001904bf473f2c9b5ca8607d69fe62e06c32a
parent17f4d6b5de3a2a753091fcea39f63151183b5a30 (diff)
downloadirssi-76c6e9ab831b53e0189d00a81d00e0e956fa7b90.zip
Dependencies finally work correctly in perl libraries (they're each compiled
separately now). Added statusbar code to available to perl, it's now possible to create new statusbar items with perl scripts. statusbar_items_redraw(char *name) can now be used to easily redraw all named statusbar items in screen. Probably several other changes I've already forgotten :) git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1861 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/fe-text/statusbar-items.c37
-rw-r--r--src/fe-text/statusbar.c53
-rw-r--r--src/fe-text/statusbar.h6
-rw-r--r--src/perl/Makefile.am7
-rw-r--r--src/perl/common/.cvsignore2
-rw-r--r--src/perl/common/Channel.xs9
-rw-r--r--src/perl/common/Core.xs9
-rw-r--r--src/perl/common/Ignore.xs9
-rw-r--r--src/perl/common/Irssi.pm2
-rw-r--r--src/perl/common/Irssi.xs23
-rw-r--r--src/perl/common/Log.xs7
-rw-r--r--src/perl/common/Makefile.PL.in1
-rw-r--r--src/perl/common/Masks.xs7
-rw-r--r--src/perl/common/Query.xs9
-rw-r--r--src/perl/common/Rawlog.xs7
-rw-r--r--src/perl/common/Server.xs7
-rw-r--r--src/perl/common/Settings.xs5
-rw-r--r--src/perl/irc/.cvsignore2
-rw-r--r--src/perl/irc/Channel.xs (renamed from src/perl/irc/IrcChannel.xs)7
-rw-r--r--src/perl/irc/Dcc.xs9
-rw-r--r--src/perl/irc/Irc.pm2
-rw-r--r--src/perl/irc/Irc.xs20
-rw-r--r--src/perl/irc/IrcQuery.xs7
-rw-r--r--src/perl/irc/Makefile.PL.in1
-rw-r--r--src/perl/irc/Modes.xs7
-rw-r--r--src/perl/irc/Netsplit.xs5
-rw-r--r--src/perl/irc/Notifylist.xs9
-rw-r--r--src/perl/irc/Query.xs10
-rw-r--r--src/perl/irc/Server.xs (renamed from src/perl/irc/IrcServer.xs)7
-rw-r--r--src/perl/module.h2
-rw-r--r--src/perl/perl-common.c10
-rw-r--r--src/perl/perl-common.h6
-rw-r--r--src/perl/perl-core.c3
-rw-r--r--src/perl/textui/.cvsignore2
-rw-r--r--src/perl/textui/Makefile.PL.in1
-rw-r--r--src/perl/textui/Statusbar.xs159
-rw-r--r--src/perl/textui/TextBuffer.xs9
-rw-r--r--src/perl/textui/TextBufferView.xs9
-rw-r--r--src/perl/textui/TextUI.pm2
-rw-r--r--src/perl/textui/TextUI.xs21
-rw-r--r--src/perl/textui/module.h2
-rw-r--r--src/perl/textui/typemap1
-rw-r--r--src/perl/ui/.cvsignore2
-rw-r--r--src/perl/ui/Makefile.PL.in1
-rw-r--r--src/perl/ui/Themes.xs10
-rw-r--r--src/perl/ui/UI.pm3
-rw-r--r--src/perl/ui/UI.xs16
-rw-r--r--src/perl/ui/Window.xs11
48 files changed, 430 insertions, 126 deletions
diff --git a/src/fe-text/statusbar-items.c b/src/fe-text/statusbar-items.c
index 3cb496c9..7969c5ea 100644
--- a/src/fe-text/statusbar-items.c
+++ b/src/fe-text/statusbar-items.c
@@ -33,7 +33,6 @@
#define MAX_LAG_UNKNOWN_TIME 30
/* activity */
-static GSList *activity_items;
static GList *activity_list;
static GHashTable *input_entries;
@@ -195,7 +194,7 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
activity_list = g_list_remove(activity_list, window);
if (window->data_level != 0)
activity_list = g_list_prepend(activity_list, window);
- statusbar_items_redraw(activity_items);
+ statusbar_items_redraw("act");
return;
}
@@ -204,12 +203,12 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
if (window->data_level == 0) {
/* remove from activity list */
activity_list = g_list_remove(activity_list, window);
- statusbar_items_redraw(activity_items);
+ statusbar_items_redraw("act");
} else if (window->data_level != GPOINTER_TO_INT(oldlevel) ||
window->hilight_color != 0) {
/* different level as last time (or maybe different
hilight color?), just redraw it. */
- statusbar_items_redraw(activity_items);
+ statusbar_items_redraw("act");
}
return;
}
@@ -231,7 +230,7 @@ static void sig_statusbar_activity_hilight(WINDOW_REC *window, gpointer oldlevel
if (tmp == NULL)
activity_list = g_list_append(activity_list, window);
- statusbar_items_redraw(activity_items);
+ statusbar_items_redraw("act");
}
static void sig_statusbar_activity_window_destroyed(WINDOW_REC *window)
@@ -240,12 +239,12 @@ static void sig_statusbar_activity_window_destroyed(WINDOW_REC *window)
if (g_list_find(activity_list, window) != NULL)
activity_list = g_list_remove(activity_list, window);
- statusbar_items_redraw(activity_items);
+ statusbar_items_redraw("act");
}
static void sig_statusbar_activity_updated(void)
{
- statusbar_items_redraw(activity_items);
+ statusbar_items_redraw("act");
}
static void item_more(SBAR_ITEM_REC *item, int get_size_only)
@@ -276,24 +275,14 @@ static void item_input(SBAR_ITEM_REC *item, int get_size_only)
}
}
-static void sig_statusbar_item_created(SBAR_ITEM_REC *item)
-{
- if (item->func == item_act)
- activity_items = g_slist_prepend(activity_items, item);
-}
-
static void sig_statusbar_item_destroyed(SBAR_ITEM_REC *item)
{
- if (item->func == item_act)
- activity_items = g_slist_remove(activity_items, item);
- else {
- GUI_ENTRY_REC *rec;
-
- rec = g_hash_table_lookup(input_entries, item);
- if (rec != NULL) {
- gui_entry_destroy(rec);
- g_hash_table_remove(input_entries, item);
- }
+ GUI_ENTRY_REC *rec;
+
+ rec = g_hash_table_lookup(input_entries, item);
+ if (rec != NULL) {
+ gui_entry_destroy(rec);
+ g_hash_table_remove(input_entries, item);
}
}
@@ -319,7 +308,6 @@ void statusbar_items_init(void)
signal_add("window destroyed", (SIGNAL_FUNC) sig_statusbar_activity_window_destroyed);
signal_add("window refnum changed", (SIGNAL_FUNC) sig_statusbar_activity_updated);
- signal_add("statusbar item created", (SIGNAL_FUNC) sig_statusbar_item_created);
signal_add("statusbar item destroyed", (SIGNAL_FUNC) sig_statusbar_item_destroyed);
}
@@ -334,6 +322,5 @@ void statusbar_items_deinit(void)
g_list_free(activity_list);
activity_list = NULL;
- signal_remove("statusbar item created", (SIGNAL_FUNC) sig_statusbar_item_created);
signal_remove("statusbar item destroyed", (SIGNAL_FUNC) sig_statusbar_item_destroyed);
}
diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c
index f8f42b0d..ed9a8ea1 100644
--- a/src/fe-text/statusbar.c
+++ b/src/fe-text/statusbar.c
@@ -39,10 +39,11 @@ STATUSBAR_GROUP_REC *active_statusbar_group;
sbar_item_funcs: char *name => STATUSBAR_FUNC func
sbar_signal_items: int signal_id => GSList *(SBAR_ITEM_REC *items)
sbar_item_signals: SBAR_ITEM_REC *item => GSList *(int *signal_ids)
-
+ named_sbar_items: const char *name => GSList *(SBAR_ITEM_REC *items)
*/
static GHashTable *sbar_item_defs, *sbar_item_funcs;
static GHashTable *sbar_signal_items, *sbar_item_signals;
+static GHashTable *named_sbar_items;
void statusbar_item_register(const char *name, const char *value,
STATUSBAR_FUNC func)
@@ -322,6 +323,12 @@ void statusbar_item_redraw(SBAR_ITEM_REC *item)
active_win = old_active_win;
}
+void statusbar_items_redraw(const char *name)
+{
+ g_slist_foreach(g_hash_table_lookup(named_sbar_items, name),
+ (GFunc) statusbar_item_redraw, NULL);
+}
+
static void statusbars_recalc_ypos(STATUSBAR_REC *bar)
{
GSList *tmp, *bar_group;
@@ -532,6 +539,32 @@ void statusbar_destroy(STATUSBAR_REC *bar)
g_free(bar);
}
+void statusbar_recreate_items(STATUSBAR_REC *bar)
+{
+ GSList *tmp;
+
+ /* destroy */
+ while (bar->items != NULL)
+ statusbar_item_destroy(bar->items->data);
+
+ /* create */
+ for (tmp = bar->config->items; tmp != NULL; tmp = tmp->next) {
+ SBAR_ITEM_CONFIG_REC *rec = tmp->data;
+
+ statusbar_item_create(bar, rec);
+ }
+
+ statusbar_redraw(bar);
+}
+
+void statusbars_recreate_items(void)
+{
+ if (active_statusbar_group != NULL) {
+ g_slist_foreach(active_statusbar_group->bars,
+ (GFunc) statusbar_recreate_items, NULL);
+ }
+}
+
STATUSBAR_REC *statusbar_find(STATUSBAR_GROUP_REC *group, const char *name,
MAIN_WINDOW_REC *window)
{
@@ -782,6 +815,7 @@ SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar,
SBAR_ITEM_CONFIG_REC *config)
{
SBAR_ITEM_REC *rec;
+ GSList *items;
g_return_val_if_fail(bar != NULL, NULL);
g_return_val_if_fail(config != NULL, NULL);
@@ -797,6 +831,10 @@ SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar,
rec->func = statusbar_item_default_func;
statusbar_item_default_signals(rec);
+ items = g_hash_table_lookup(named_sbar_items, config->name);
+ items = g_slist_append(items, rec);
+ g_hash_table_insert(named_sbar_items, config->name, items);
+
signal_emit("statusbar item created", 1, rec);
return rec;
}
@@ -834,6 +872,14 @@ void statusbar_item_destroy(SBAR_ITEM_REC *item)
g_return_if_fail(item != NULL);
item->bar->items = g_slist_remove(item->bar->items, item);
+
+ list = g_hash_table_lookup(named_sbar_items, item->config->name);
+ list = g_slist_remove(list, item);
+ if (list == NULL)
+ g_hash_table_remove(named_sbar_items, item->config->name);
+ else
+ g_hash_table_insert(named_sbar_items, item->config->name, list);
+
signal_emit("statusbar item destroyed", 1, item);
list = g_hash_table_lookup(sbar_item_signals, item);
@@ -943,13 +989,15 @@ void statusbar_init(void)
statusbar_groups = NULL;
active_statusbar_group = NULL;
sbar_item_defs = g_hash_table_new((GHashFunc) g_str_hash,
- (GCompareFunc) g_str_equal);
+ (GCompareFunc) g_str_equal);
sbar_item_funcs = g_hash_table_new((GHashFunc) g_str_hash,
(GCompareFunc) g_str_equal);
sbar_signal_items = g_hash_table_new((GHashFunc) g_direct_hash,
(GCompareFunc) g_direct_equal);
sbar_item_signals = g_hash_table_new((GHashFunc) g_direct_hash,
(GCompareFunc) g_direct_equal);
+ named_sbar_items = g_hash_table_new((GHashFunc) g_str_hash,
+ (GCompareFunc) g_str_equal);
signal_add("terminal resized", (SIGNAL_FUNC) sig_terminal_resized);
signal_add("mainwindow resized", (SIGNAL_FUNC) sig_mainwindow_resized);
@@ -980,6 +1028,7 @@ void statusbar_deinit(void)
g_hash_table_foreach(sbar_item_signals,
(GHFunc) statusbar_item_signal_destroy, NULL);
g_hash_table_destroy(sbar_item_signals);
+ g_hash_table_destroy(named_sbar_items);
signal_remove("terminal resized", (SIGNAL_FUNC) sig_terminal_resized);
signal_remove("mainwindow resized", (SIGNAL_FUNC) sig_mainwindow_resized);
diff --git a/src/fe-text/statusbar.h b/src/fe-text/statusbar.h
index 4a1865db..08e9ba80 100644
--- a/src/fe-text/statusbar.h
+++ b/src/fe-text/statusbar.h
@@ -100,8 +100,10 @@ void statusbar_item_default_handler(SBAR_ITEM_REC *item, int get_size_only,
/* redraw statusbar, NULL = all */
void statusbar_redraw(STATUSBAR_REC *bar);
void statusbar_item_redraw(SBAR_ITEM_REC *item);
-#define statusbar_items_redraw(list) \
- g_slist_foreach(list, (GFunc) statusbar_item_redraw, NULL);
+void statusbar_items_redraw(const char *name);
+
+void statusbar_recreate_items(STATUSBAR_REC *bar);
+void statusbars_recreate_items(void);
void statusbar_init(void);
void statusbar_deinit(void);
diff --git a/src/perl/Makefile.am b/src/perl/Makefile.am
index 6e345126..8bfef386 100644
--- a/src/perl/Makefile.am
+++ b/src/perl/Makefile.am
@@ -90,9 +90,9 @@ IRC_SOURCES = \
irc/Irc.xs \
irc/Irc.pm \
irc/Dcc.xs \
- irc/IrcChannel.xs \
- irc/IrcQuery.xs \
- irc/IrcServer.xs \
+ irc/Channel.xs \
+ irc/Query.xs \
+ irc/Server.xs \
irc/Modes.xs \
irc/Netsplit.xs \
irc/Notifylist.xs \
@@ -114,6 +114,7 @@ TEXTUI_SOURCES = \
textui/TextUI.pm \
textui/TextBuffer.xs \
textui/TextBufferView.xs \
+ textui/Statusbar.xs \
textui/Makefile.PL.in \
textui/typemap \
textui/module.h
diff --git a/src/perl/common/.cvsignore b/src/perl/common/.cvsignore
index d424b077..e9658495 100644
--- a/src/perl/common/.cvsignore
+++ b/src/perl/common/.cvsignore
@@ -1,7 +1,7 @@
Makefile
Makefile.PL
-Irssi.c
Irssi.bs
+*.c
*.o
pm_to_blib
blib
diff --git a/src/perl/common/Channel.xs b/src/perl/common/Channel.xs
index cfcf72a2..4763e708 100644
--- a/src/perl/common/Channel.xs
+++ b/src/perl/common/Channel.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Channel PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
channels()
@@ -18,7 +21,7 @@ OUTPUT:
RETVAL
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Server
+MODULE = Irssi::Channel PACKAGE = Irssi::Server
#*******************************
void
@@ -68,7 +71,7 @@ PPCODE:
g_slist_free(list);
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Channel PREFIX = channel_
+MODULE = Irssi::Channel PACKAGE = Irssi::Channel PREFIX = channel_
#*******************************
void
diff --git a/src/perl/common/Core.xs b/src/perl/common/Core.xs
index 4378c5c6..5439efbf 100644
--- a/src/perl/common/Core.xs
+++ b/src/perl/common/Core.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Core PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
signal_emit(signal, ...)
@@ -374,7 +377,7 @@ OUTPUT:
RETVAL
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Server
+MODULE = Irssi::Core PACKAGE = Irssi::Server
#*******************************
char *
@@ -389,7 +392,7 @@ OUTPUT:
RETVAL
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Windowitem
+MODULE = Irssi::Core PACKAGE = Irssi::Windowitem
#*******************************
char *
diff --git a/src/perl/common/Ignore.xs b/src/perl/common/Ignore.xs
index 30b8590c..2a053b16 100644
--- a/src/perl/common/Ignore.xs
+++ b/src/perl/common/Ignore.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Ignore PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
ignores()
@@ -22,7 +25,7 @@ OUTPUT:
RETVAL
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Server
+MODULE = Irssi::Ignore PACKAGE = Irssi::Server
#*******************************
int
@@ -35,7 +38,7 @@ ignore_check(server, nick, host, channel, text, level)
int level
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Ignore PREFIX = ignore_
+MODULE = Irssi::Ignore PACKAGE = Irssi::Ignore PREFIX = ignore_
#*******************************
void
diff --git a/src/perl/common/Irssi.pm b/src/perl/common/Irssi.pm
index 17d463c4..c082c0c0 100644
--- a/src/perl/common/Irssi.pm
+++ b/src/perl/common/Irssi.pm
@@ -7,7 +7,7 @@ package Irssi;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION = "0.8";
+$VERSION = "0.9";
require Exporter;
require DynaLoader;
diff --git a/src/perl/common/Irssi.xs b/src/perl/common/Irssi.xs
index 59e4ebe6..5e28bed8 100644
--- a/src/perl/common/Irssi.xs
+++ b/src/perl/common/Irssi.xs
@@ -9,12 +9,17 @@ init()
CODE:
perl_api_version_check("Irssi");
-INCLUDE: Channel.xs
-INCLUDE: Core.xs
-INCLUDE: Ignore.xs
-INCLUDE: Log.xs
-INCLUDE: Masks.xs
-INCLUDE: Query.xs
-INCLUDE: Rawlog.xs
-INCLUDE: Server.xs
-INCLUDE: Settings.xs
+void
+deinit()
+CODE:
+
+BOOT:
+ irssi_boot(Channel);
+ irssi_boot(Core);
+ irssi_boot(Ignore);
+ irssi_boot(Log);
+ irssi_boot(Masks);
+ irssi_boot(Query);
+ irssi_boot(Rawlog);
+ irssi_boot(Server);
+ irssi_boot(Settings);
diff --git a/src/perl/common/Log.xs b/src/perl/common/Log.xs
index 4879aef9..c87ee45b 100644
--- a/src/perl/common/Log.xs
+++ b/src/perl/common/Log.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Log PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
logs()
@@ -19,7 +22,7 @@ log_find(fname)
char *fname
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Log PREFIX = log_
+MODULE = Irssi::Log PACKAGE = Irssi::Log PREFIX = log_
#*******************************
void
diff --git a/src/perl/common/Makefile.PL.in b/src/perl/common/Makefile.PL.in
index 76887f64..4e545e7c 100644
--- a/src/perl/common/Makefile.PL.in
+++ b/src/perl/common/Makefile.PL.in
@@ -2,5 +2,6 @@ use ExtUtils::MakeMaker;
WriteMakefile('NAME' => 'Irssi',
'LIBS' => '',
+ 'OBJECT' => '$(O_FILES)',
'INC' => '-I../../.. -I@top_srcdir@ -I@top_srcdir@/src -I@top_srcdir@/src/core @GLIB_CFLAGS@',
'VERSION_FROM' => '@srcdir@/Irssi.pm');
diff --git a/src/perl/common/Masks.xs b/src/perl/common/Masks.xs
index d27e32f3..1ea13969 100644
--- a/src/perl/common/Masks.xs
+++ b/src/perl/common/Masks.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Masks PACKAGE = Irssi
+PROTOTYPES: ENABLE
int
mask_match(mask, nick, user, host)
@@ -32,7 +35,7 @@ OUTPUT:
RETVAL
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Server
+MODULE = Irssi::Masks PACKAGE = Irssi::Server
#*******************************
int
diff --git a/src/perl/common/Query.xs b/src/perl/common/Query.xs
index 191b334a..b0766b91 100644
--- a/src/perl/common/Query.xs
+++ b/src/perl/common/Query.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Query PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
queries()
@@ -20,7 +23,7 @@ OUTPUT:
RETVAL
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Server
+MODULE = Irssi::Query PACKAGE = Irssi::Server
#*******************************
void
@@ -41,7 +44,7 @@ query_find(server, nick)
char *nick
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Query PREFIX = query_
+MODULE = Irssi::Query PACKAGE = Irssi::Query PREFIX = query_
#*******************************
void
diff --git a/src/perl/common/Rawlog.xs b/src/perl/common/Rawlog.xs
index 115b08cb..dd95ce50 100644
--- a/src/perl/common/Rawlog.xs
+++ b/src/perl/common/Rawlog.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Rawlog PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
rawlog_set_size(lines)
@@ -8,7 +11,7 @@ Irssi::Rawlog
rawlog_create()
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Rawlog PREFIX = rawlog_
+MODULE = Irssi::Rawlog PACKAGE = Irssi::Rawlog PREFIX = rawlog_
#*******************************
void
diff --git a/src/perl/common/Server.xs b/src/perl/common/Server.xs
index dd44fe08..1580e235 100644
--- a/src/perl/common/Server.xs
+++ b/src/perl/common/Server.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Server PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
servers()
@@ -36,7 +39,7 @@ server_find_chatnet(chatnet)
char *chatnet
#*******************************
-MODULE = Irssi PACKAGE = Irssi::Server PREFIX = server_
+MODULE = Irssi::Server PACKAGE = Irssi::Server PREFIX = server_
#*******************************
void
diff --git a/src/perl/common/Settings.xs b/src/perl/common/Settings.xs
index 6f5c0915..eeb30c39 100644
--- a/src/perl/common/Settings.xs
+++ b/src/perl/common/Settings.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::Settings PACKAGE = Irssi
+PROTOTYPES: ENABLE
char *
settings_get_str(key)
diff --git a/src/perl/irc/.cvsignore b/src/perl/irc/.cvsignore
index 092c3980..b99999fd 100644
--- a/src/perl/irc/.cvsignore
+++ b/src/perl/irc/.cvsignore
@@ -1,7 +1,7 @@
Makefile
Makefile.PL
-Irc.c
Irc.bs
+*.c
*.o
pm_to_blib
blib
diff --git a/src/perl/irc/IrcChannel.xs b/src/perl/irc/Channel.xs
index fb8ff3fc..bd88be79 100644
--- a/src/perl/irc/IrcChannel.xs
+++ b/src/perl/irc/Channel.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Channel PREFIX = irc_
+#include "module.h"
+
+MODULE = Irssi::Irc::Channel PACKAGE = Irssi::Irc::Channel PREFIX = irc_
+PROTOTYPES: ENABLE
void
bans(channel)
@@ -42,7 +45,7 @@ CODE:
OUTPUT:
RETVAL
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_
+MODULE = Irssi::Irc::Channel PACKAGE = Irssi::Irc::Server PREFIX = irc_
Irssi::Irc::Channel
irc_channel_create(server, name, automatic)
diff --git a/src/perl/irc/Dcc.xs b/src/perl/irc/Dcc.xs
index 8b6d7155..a46f171f 100644
--- a/src/perl/irc/Dcc.xs
+++ b/src/perl/irc/Dcc.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc
+#include "module.h"
+
+MODULE = Irssi::Irc::Dcc PACKAGE = Irssi::Irc
+PROTOTYPES: ENABLE
void
dccs()
@@ -60,7 +63,7 @@ dcc_get_download_path(fname)
char *fname
#*******************************
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Dcc PREFIX = dcc_
+MODULE = Irssi::Irc::Dcc PACKAGE = Irssi::Irc::Dcc PREFIX = dcc_
#*******************************
void
@@ -85,7 +88,7 @@ dcc_reject(dcc, server)
Irssi::Irc::Server server
#*******************************
-MODULE = Irssi::Irc PACKAGE = Irssi::Windowitem PREFIX = item_
+MODULE = Irssi::Irc::Dcc PACKAGE = Irssi::Windowitem PREFIX = item_
#*******************************
Irssi::Irc::Dcc::Chat
diff --git a/src/perl/irc/Irc.pm b/src/perl/irc/Irc.pm
index 48260a27..5baeba7e 100644
--- a/src/perl/irc/Irc.pm
+++ b/src/perl/irc/Irc.pm
@@ -7,7 +7,7 @@ package Irssi::Irc;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION = "0.8";
+$VERSION = "0.9";
require Exporter;
require DynaLoader;
diff --git a/src/perl/irc/Irc.xs b/src/perl/irc/Irc.xs
index 306e3a4f..3ab20ac4 100644
--- a/src/perl/irc/Irc.xs
+++ b/src/perl/irc/Irc.xs
@@ -178,11 +178,15 @@ CODE:
"@Irssi::Irc::Dcc::Send::ISA = qw(Irssi::Irc::Dcc);\n",
TRUE);
-INCLUDE: IrcServer.xs
-INCLUDE: IrcChannel.xs
-INCLUDE: IrcQuery.xs
-INCLUDE: Modes.xs
-INCLUDE: Netsplit.xs
-
-INCLUDE: Dcc.xs
-INCLUDE: Notifylist.xs
+void
+deinit()
+CODE:
+
+BOOT:
+ irssi_boot(Irc__Channel);
+ irssi_boot(Irc__Dcc);
+ irssi_boot(Irc__Modes);
+ irssi_boot(Irc__Netsplit);
+ irssi_boot(Irc__Notifylist);
+ irssi_boot(Irc__Query);
+ irssi_boot(Irc__Server);
diff --git a/src/perl/irc/IrcQuery.xs b/src/perl/irc/IrcQuery.xs
deleted file mode 100644
index db292852..00000000
--- a/src/perl/irc/IrcQuery.xs
+++ /dev/null
@@ -1,7 +0,0 @@
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_
-
-Irssi::Irc::Query
-irc_query_create(server_tag, nick, automatic)
- char *server_tag
- char *nick
- int automatic
diff --git a/src/perl/irc/Makefile.PL.in b/src/perl/irc/Makefile.PL.in
index de7bbbff..8f1e94d5 100644
--- a/src/perl/irc/Makefile.PL.in
+++ b/src/perl/irc/Makefile.PL.in
@@ -2,6 +2,7 @@ use ExtUtils::MakeMaker;
WriteMakefile('NAME' => 'Irssi::Irc',
'LIBS' => '',
+ 'OBJECT' => '$(O_FILES)',
'TYPEMAPS' => ['../common/typemap'],
'INC' => '-I../../.. -I@top_srcdir@/src -I@top_srcdir@/src/core -I@top_srcdir@/src/irc/core -I@top_srcdir@/src/irc @GLIB_CFLAGS@',
'VERSION_FROM' => '@srcdir@/Irc.pm');
diff --git a/src/perl/irc/Modes.xs b/src/perl/irc/Modes.xs
index f3c2991f..e25c887f 100644
--- a/src/perl/irc/Modes.xs
+++ b/src/perl/irc/Modes.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc
+#include "module.h"
+
+MODULE = Irssi::Irc::Modes PACKAGE = Irssi::Irc
+PROTOTYPES: ENABLE
char *
modes_join(old, mode, channel)
@@ -7,7 +10,7 @@ modes_join(old, mode, channel)
int channel
#*******************************
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Channel PREFIX = channel_
+MODULE = Irssi::Irc::Modes PACKAGE = Irssi::Irc::Channel PREFIX = channel_
#*******************************
char *
diff --git a/src/perl/irc/Netsplit.xs b/src/perl/irc/Netsplit.xs
index c6d7c6e8..e4ef85e4 100644
--- a/src/perl/irc/Netsplit.xs
+++ b/src/perl/irc/Netsplit.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
+#include "module.h"
+
+MODULE = Irssi::Irc::Netsplit PACKAGE = Irssi::Irc::Server
+PROTOTYPES: ENABLE
Irssi::Irc::Netsplit
netsplit_find(server, nick, address)
diff --git a/src/perl/irc/Notifylist.xs b/src/perl/irc/Notifylist.xs
index 1951c125..33f8a9ac 100644
--- a/src/perl/irc/Notifylist.xs
+++ b/src/perl/irc/Notifylist.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc
+#include "module.h"
+
+MODULE = Irssi::Irc::Notifylist PACKAGE = Irssi::Irc
+PROTOTYPES: ENABLE
void
notifies()
@@ -31,7 +34,7 @@ notifylist_find(mask, ircnet)
char *ircnet
#*******************************
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server
+MODULE = Irssi::Irc::Notifylist PACKAGE = Irssi::Irc::Server
#*******************************
int
@@ -40,7 +43,7 @@ notifylist_ison_server(server, nick)
char *nick
#*******************************
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Notifylist PREFIX = notifylist_
+MODULE = Irssi::Irc::Notifylist PACKAGE = Irssi::Irc::Notifylist PREFIX = notifylist_
#*******************************
int
diff --git a/src/perl/irc/Query.xs b/src/perl/irc/Query.xs
new file mode 100644
index 00000000..a4f6bd03
--- /dev/null
+++ b/src/perl/irc/Query.xs
@@ -0,0 +1,10 @@
+#include "module.h"
+
+MODULE = Irssi::Irc::Query PACKAGE = Irssi::Irc::Server PREFIX = irc_
+PROTOTYPES: ENABLE
+
+Irssi::Irc::Query
+irc_query_create(server_tag, nick, automatic)
+ char *server_tag
+ char *nick
+ int automatic
diff --git a/src/perl/irc/IrcServer.xs b/src/perl/irc/Server.xs
index 1ceff0c2..44813fe6 100644
--- a/src/perl/irc/IrcServer.xs
+++ b/src/perl/irc/Server.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Server PREFIX = irc_server_
+#include "module.h"
+
+MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Server PREFIX = irc_server_
+PROTOTYPES: ENABLE
char *
irc_server_get_channels(server)
@@ -32,7 +35,7 @@ ctcp_send_reply(server, data)
Irssi::Irc::Server server
char *data
-MODULE = Irssi::Irc PACKAGE = Irssi::Irc::Connect PREFIX = irc_server_
+MODULE = Irssi::Irc::Server PACKAGE = Irssi::Irc::Connect PREFIX = irc_server_
Irssi::Irc::Server
irc_server_connect(conn)
diff --git a/src/perl/module.h b/src/perl/module.h
index 831ded91..f936fb37 100644
--- a/src/perl/module.h
+++ b/src/perl/module.h
@@ -22,4 +22,4 @@ extern PerlInterpreter *my_perl; /* must be called my_perl or some perl implemen
/* Change this every time when some API changes between irssi's perl module
and irssi's perl libraries. */
-#define IRSSI_PERL_API_VERSION 20011020
+#define IRSSI_PERL_API_VERSION 20011021
diff --git a/src/perl/perl-common.c b/src/perl/perl-common.c
index 1109dee6..276ae14e 100644
--- a/src/perl/perl-common.c
+++ b/src/perl/perl-common.c
@@ -190,6 +190,16 @@ char *perl_get_use_list(void)
return ret;
}
+void irssi_callXS(void (*subaddr)(CV* cv), CV *cv, SV **mark)
+{
+ dSP;
+
+ PUSHMARK(mark);
+ (*subaddr)(cv);
+
+ PUTBACK;
+}
+
void perl_connect_fill_hash(HV *hv, SERVER_CONNECT_REC *conn)
{
char *type, *chat_type;
diff --git a/src/perl/perl-common.h b/src/perl/perl-common.h
index 232d7510..da099062 100644
--- a/src/perl/perl-common.h
+++ b/src/perl/perl-common.h
@@ -48,6 +48,12 @@ void irssi_add_plains(PLAIN_OBJECT_INIT_REC *objects);
char *perl_get_use_list(void);
+#define irssi_boot(x) { \
+ extern void boot_Irssi__##x(CV *cv); \
+ irssi_callXS(boot_Irssi__##x, cv, mark); \
+ }
+void irssi_callXS(void (*subaddr)(CV* cv), CV *cv, SV **mark);
+
void perl_common_start(void);
void perl_common_stop(void);
diff --git a/src/perl/perl-core.c b/src/perl/perl-core.c
index d319be04..1a970604 100644
--- a/src/perl/perl-core.c
+++ b/src/perl/perl-core.c
@@ -120,7 +120,8 @@ void perl_scripts_deinit(void)
perl_sources_stop();
perl_common_stop();
- /* Unload all perl libraries loaded with dynaloader */
+ /* Unload all perl libraries loaded with dynaloader */
+ perl_eval_pv("foreach my $lib (@DynaLoader::dl_modules) { if ($lib =~ /^Irssi\\b/) { $lib .= '::deinit();'; eval $lib; } }", TRUE);
perl_eval_pv("foreach my $lib (@DynaLoader::dl_librefs) { DynaLoader::dl_unload_file($lib); }", TRUE);
/* perl interpreter */
diff --git a/src/perl/textui/.cvsignore b/src/perl/textui/.cvsignore
index e6c0f856..517db94b 100644
--- a/src/perl/textui/.cvsignore
+++ b/src/perl/textui/.cvsignore
@@ -1,7 +1,7 @@
Makefile
Makefile.PL
-TextUI.c
TextUI.bs
+*.c
*.o
pm_to_blib
blib
diff --git a/src/perl/textui/Makefile.PL.in b/src/perl/textui/Makefile.PL.in
index 8b5a2b6c..9e80274b 100644
--- a/src/perl/textui/Makefile.PL.in
+++ b/src/perl/textui/Makefile.PL.in
@@ -2,6 +2,7 @@ use ExtUtils::MakeMaker;
WriteMakefile('NAME' => 'Irssi::TextUI',
'LIBS' => '',
+ 'OBJECT' => '$(O_FILES)',
'TYPEMAPS' => ['../common/typemap', '../ui/typemap'],
'INC' => '-I../../.. -I@top_srcdir@/src -I@top_srcdir@/src/core -I@top_srcdir@/src/fe-common/core -I@top_srcdir@/src/fe-text @GLIB_CFLAGS@',
'VERSION_FROM' => '@srcdir@/TextUI.pm');
diff --git a/src/perl/textui/Statusbar.xs b/src/perl/textui/Statusbar.xs
new file mode 100644
index 00000000..d512a3ab
--- /dev/null
+++ b/src/perl/textui/Statusbar.xs
@@ -0,0 +1,159 @@
+#include "module.h"
+
+static GHashTable *perl_sbar_defs;
+
+static int check_sbar_destroy(char *key, char *value, char *script)
+{
+ if (strncmp(key, script, strlen(script)) == 0 &&
+ key[strlen(script)] == ':') {
+ g_free(key);
+ g_free(value);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void sig_script_destroy(PERL_SCRIPT_REC *script)
+{
+ g_hash_table_foreach_remove(perl_sbar_defs,
+ (GHRFunc) check_sbar_destroy,
+ script->name);
+}
+
+void perl_statusbar_init(void)
+{
+ perl_sbar_defs = g_hash_table_new((GHashFunc) g_str_hash,
+ (GCompareFunc) g_str_equal);
+ signal_add("script destroy", (SIGNAL_FUNC) sig_script_destroy);
+}
+
+static void statusbar_item_def_destroy(void *key, void *value)
+{
+ g_free(key);
+ g_free(value);
+}
+
+void perl_statusbar_deinit(void)
+{
+ signal_remove("script destroy", (SIGNAL_FUNC) sig_script_destroy);
+
+ g_hash_table_foreach(perl_sbar_defs,
+ (GHFunc) statusbar_item_def_destroy, NULL);
+ g_hash_table_destroy(perl_sbar_defs);
+}
+
+static void perl_statusbar_event(char *function, SBAR_ITEM_REC *item,
+ int get_size_only)
+{
+ dSP;
+ int retcount;
+ SV *item_sv, **sv;
+ HV *hv;
+
+ ENTER;
+ SAVETMPS;
+
+ PUSHMARK(SP);
+ item_sv = plain_bless(item, "Irssi::TextUI::StatusbarItem");
+ XPUSHs(sv_2mortal(item_sv));
+ XPUSHs(sv_2mortal(newSViv(get_size_only)));
+ PUTBACK;
+
+ retcount = perl_call_pv(function, G_EVAL|G_DISCARD);
+ SPAGAIN;
+
+ if (SvTRUE(ERRSV)) {
+ STRLEN n_a;
+ char *package;
+
+ package = perl_function_get_package(function);
+ signal_emit("script error", 2,
+ perl_script_find_package(package),
+ SvPV(ERRSV, n_a));
+ g_free(package);
+ }
+
+ /* min_size and max_size can be changed, move them to SBAR_ITEM_REC */
+ hv = hvref(item_sv);
+ if (hv != NULL) {
+ sv = hv_fetch(hv, "min_size", 8, 0);
+ if (sv != NULL) item->min_size = SvIV(*sv);
+ sv = hv_fetch(hv, "max_size", 8, 0);
+ if (sv != NULL) item->max_size = SvIV(*sv);
+ }
+
+ PUTBACK;
+ FREETMPS;
+ LEAVE;
+}
+
+
+static void sig_perl_statusbar(SBAR_ITEM_REC *item, int get_size_only)
+{
+ char *function;
+
+ function = g_hash_table_lookup(perl_sbar_defs, item->config->name);
+ if (function != NULL)
+ perl_statusbar_event(function, item, get_size_only);
+ else {
+ /* use default function - this shouldn't actually happen.. */
+ statusbar_item_default_handler(item, get_size_only, NULL, "", TRUE);
+ }
+}
+
+MODULE = Irssi::TextUI::Statusbar PACKAGE = Irssi
+PROTOTYPES: ENABLE
+
+void
+statusbar_item_register(name, value, func = NULL)
+ char *name
+ char *value
+ char *func
+CODE:
+ statusbar_item_register(name, value, func == NULL || *func == '\0' ? NULL : sig_perl_statusbar);
+ if (func != NULL) {
+ g_hash_table_insert(perl_sbar_defs, g_strdup(name),
+ g_strdup_printf("%s::%s", perl_get_package(), func));
+ }
+
+void
+statusbar_item_unregister(name)
+ char *name
+PREINIT:
+ gpointer key, value;
+CODE:
+ if (g_hash_table_lookup_extended(perl_sbar_defs, name, &key, &value)) {
+ g_hash_table_remove(perl_sbar_defs, name);
+ g_free(key);
+ g_free(value);
+ }
+ statusbar_item_unregister(name);
+
+void
+statusbar_items_redraw(name)
+ char *name
+
+void
+statusbars_recreate_items()
+
+#*******************************
+MODULE = Irssi::TextUI::Statusbar PACKAGE = Irssi::TextUI::StatusbarItem PREFIX = statusbar_item_
+#*******************************
+
+void
+statusbar_item_default_handler(item, get_size_only, str, data, escape_vars = TRUE)
+ Irssi::TextUI::StatusbarItem item
+ int get_size_only
+ char *str
+ char *data
+ int escape_vars
+PREINIT:
+ HV *hv;
+CODE:
+ statusbar_item_default_handler(item, get_size_only,
+ *str == '\0' ? NULL : str,
+ data, escape_vars);
+ hv = hvref(ST(0));
+ hv_store(hv, "min_size", 8, newSViv(item->min_size), 0);
+ hv_store(hv, "max_size", 8, newSViv(item->max_size), 0);
diff --git a/src/perl/textui/TextBuffer.xs b/src/perl/textui/TextBuffer.xs
index 83b1582c..4fb92f11 100644
--- a/src/perl/textui/TextBuffer.xs
+++ b/src/perl/textui/TextBuffer.xs
@@ -1,10 +1,13 @@
-MODULE = Irssi::TextUI PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::TextUI::TextBuffer PACKAGE = Irssi
+PROTOTYPES: ENABLE
Irssi::TextUI::TextBuffer
textbuffer_create()
#*******************************
-MODULE = Irssi::TextUI PACKAGE = Irssi::TextUI::TextBuffer PREFIX = textbuffer_
+MODULE = Irssi::TextUI::TextBuffer PACKAGE = Irssi::TextUI::TextBuffer PREFIX = textbuffer_
#*******************************
void
@@ -36,7 +39,7 @@ textbuffer_remove_all_lines(buffer)
Irssi::TextUI::TextBuffer buffer
#*******************************
-MODULE = Irssi::TextUI PACKAGE = Irssi::TextUI::Line PREFIX = textbuffer_line_
+MODULE = Irssi::TextUI::TextBuffer PACKAGE = Irssi::TextUI::Line PREFIX = textbuffer_line_
#*******************************
Irssi::TextUI::Line
diff --git a/src/perl/textui/TextBufferView.xs b/src/perl/textui/TextBufferView.xs
index e38bf483..dfb1d036 100644
--- a/src/perl/textui/TextBufferView.xs
+++ b/src/perl/textui/TextBufferView.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::TextUI PACKAGE = Irssi::TextUI::TextBuffer PREFIX = textbuffer_
+#include "module.h"
+
+MODULE = Irssi::TextUI::TextBufferView PACKAGE = Irssi::TextUI::TextBuffer PREFIX = textbuffer_
+PROTOTYPES: ENABLE
Irssi::TextUI::TextBufferView
textbuffer_view_create(buffer, width, height, default_indent, longword_noindent, scroll)
@@ -10,7 +13,7 @@ textbuffer_view_create(buffer, width, height, default_indent, longword_noindent,
int scroll
#*******************************
-MODULE = Irssi::TextUI PACKAGE = Irssi::TextUI::TextBufferView PREFIX = textbuffer_view_
+MODULE = Irssi::TextUI::TextBufferView PACKAGE = Irssi::TextUI::TextBufferView PREFIX = textbuffer_view_
#*******************************
void
@@ -92,7 +95,7 @@ textbuffer_view_redraw(view)
Irssi::TextUI::TextBufferView view
#*******************************
-MODULE = Irssi::TextUI PACKAGE = Irssi::UI::Window
+MODULE = Irssi::TextUI::TextBufferView PACKAGE = Irssi::UI::Window
#*******************************
Irssi::TextUI::TextBufferView
diff --git a/src/perl/textui/TextUI.pm b/src/perl/textui/TextUI.pm
index 21f6d03b..2bcd17ff 100644
--- a/src/perl/textui/TextUI.pm
+++ b/src/perl/textui/TextUI.pm
@@ -7,7 +7,7 @@ package Irssi::TextUI;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION = "0.8";
+$VERSION = "0.9";
require Exporter;
require DynaLoader;
diff --git a/src/perl/textui/TextUI.xs b/src/perl/textui/TextUI.xs
index f3978212..c92da84a 100644
--- a/src/perl/textui/TextUI.xs
+++ b/src/perl/textui/TextUI.xs
@@ -61,6 +61,14 @@ static void perl_line_info_fill_hash(HV *hv, LINE_INFO_REC *info)
hv_store(hv, "time", 4, newSViv(info->time), 0);
}
+static void perl_statusbar_item_fill_hash(HV *hv, SBAR_ITEM_REC *item)
+{
+ hv_store(hv, "min_size", 8, newSViv(item->min_size), 0);
+ hv_store(hv, "max_size", 8, newSViv(item->max_size), 0);
+ hv_store(hv, "xpos", 4, newSViv(item->xpos), 0);
+ hv_store(hv, "size", 4, newSViv(item->size), 0);
+}
+
static PLAIN_OBJECT_INIT_REC textui_plains[] = {
{ "Irssi::TextUI::MainWindow", (PERL_OBJECT_FUNC) perl_main_window_fill_hash },
{ "Irssi::TextUI::TextBuffer", (PERL_OBJECT_FUNC) perl_text_buffer_fill_hash },
@@ -68,6 +76,7 @@ static PLAIN_OBJECT_INIT_REC textui_plains[] = {
{ "Irssi::TextUI::Line", (PERL_OBJECT_FUNC) perl_line_fill_hash },
{ "Irssi::TextUI::LineCache", (PERL_OBJECT_FUNC) perl_line_cache_fill_hash },
{ "Irssi::TextUI::LineInfo", (PERL_OBJECT_FUNC) perl_line_info_fill_hash },
+ { "Irssi::TextUI::StatusbarItem", (PERL_OBJECT_FUNC) perl_statusbar_item_fill_hash },
{ NULL, NULL }
};
@@ -86,6 +95,12 @@ CODE:
initialized = TRUE;
irssi_add_plains(textui_plains);
+ perl_statusbar_init();
+
+void
+deinit()
+CODE:
+ perl_statusbar_deinit();
MODULE = Irssi::TextUI PACKAGE = Irssi
@@ -95,5 +110,7 @@ gui_printtext(xpos, ypos, str)
int ypos
char *str
-INCLUDE: TextBuffer.xs
-INCLUDE: TextBufferView.xs
+BOOT:
+ irssi_boot(TextUI__Statusbar);
+ irssi_boot(TextUI__TextBuffer);
+ irssi_boot(TextUI__TextBufferView);
diff --git a/src/perl/textui/module.h b/src/perl/textui/module.h
index 239b0b02..9123afb2 100644
--- a/src/perl/textui/module.h
+++ b/src/perl/textui/module.h
@@ -3,6 +3,7 @@
#include "mainwindows.h"
#include "gui-windows.h"
#include "gui-printtext.h"
+#include "statusbar.h"
#include "textbuffer.h"
#include "textbuffer-view.h"
@@ -12,3 +13,4 @@ typedef TEXT_BUFFER_VIEW_REC *Irssi__TextUI__TextBufferView;
typedef LINE_REC *Irssi__TextUI__Line;
typedef LINE_CACHE_REC *Irssi__TextUI__LineCache;
typedef LINE_INFO_REC *Irssi__TextUI__LineInfo;
+typedef SBAR_ITEM_REC *Irssi__TextUI__StatusbarItem;
diff --git a/src/perl/textui/typemap b/src/perl/textui/typemap
index a31b6478..364cdf32 100644
--- a/src/perl/textui/typemap
+++ b/src/perl/textui/typemap
@@ -5,6 +5,7 @@ Irssi::TextUI::TextBufferView T_PlainObj
Irssi::TextUI::Line T_PlainObj
Irssi::TextUI::LineCache T_PlainObj
Irssi::TextUI::LineInfo T_PlainObj
+Irssi::TextUI::StatusbarItem T_PlainObj
INPUT
diff --git a/src/perl/ui/.cvsignore b/src/perl/ui/.cvsignore
index 239deafc..335ef887 100644
--- a/src/perl/ui/.cvsignore
+++ b/src/perl/ui/.cvsignore
@@ -1,7 +1,7 @@
Makefile
Makefile.PL
-UI.c
UI.bs
+*.c
*.o
pm_to_blib
blib
diff --git a/src/perl/ui/Makefile.PL.in b/src/perl/ui/Makefile.PL.in
index 601c3b9d..a349918e 100644
--- a/src/perl/ui/Makefile.PL.in
+++ b/src/perl/ui/Makefile.PL.in
@@ -2,6 +2,7 @@ use ExtUtils::MakeMaker;
WriteMakefile('NAME' => 'Irssi::UI',
'LIBS' => '',
+ 'OBJECT' => '$(O_FILES)',
'TYPEMAPS' => ['../common/typemap'],
'INC' => '-I../../.. -I@top_srcdir@/src -I@top_srcdir@/src/core -I@top_srcdir@/src/fe-common/core @GLIB_CFLAGS@',
'VERSION_FROM' => '@srcdir@/UI.pm');
diff --git a/src/perl/ui/Themes.xs b/src/perl/ui/Themes.xs
index 427952ff..c2a0f1bc 100644
--- a/src/perl/ui/Themes.xs
+++ b/src/perl/ui/Themes.xs
@@ -1,5 +1,7 @@
+#include "module.h"
-MODULE = Irssi::UI PACKAGE = Irssi
+MODULE = Irssi::UI::Themes PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
theme_register(formats)
@@ -53,7 +55,7 @@ CODE:
printformat_perl(&dest, format, arglist);
#*******************************
-MODULE = Irssi::UI PACKAGE = Irssi::Server
+MODULE = Irssi::UI::Themes PACKAGE = Irssi::Server
#*******************************
void
@@ -77,7 +79,7 @@ CODE:
printformat_perl(&dest, format, arglist);
#*******************************
-MODULE = Irssi::UI PACKAGE = Irssi::UI::Window
+MODULE = Irssi::UI::Themes PACKAGE = Irssi::UI::Window
#*******************************
void
@@ -100,7 +102,7 @@ CODE:
printformat_perl(&dest, format, arglist);
#*******************************
-MODULE = Irssi::UI PACKAGE = Irssi::Windowitem
+MODULE = Irssi::UI::Themes PACKAGE = Irssi::Windowitem
#*******************************
void
diff --git a/src/perl/ui/UI.pm b/src/perl/ui/UI.pm
index 7701d178..0ef9c711 100644
--- a/src/perl/ui/UI.pm
+++ b/src/perl/ui/UI.pm
@@ -7,7 +7,7 @@ package Irssi::UI;
use strict;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
-$VERSION = "0.8";
+$VERSION = "0.9";
require Exporter;
require DynaLoader;
@@ -21,4 +21,3 @@ bootstrap Irssi::UI $VERSION;
Irssi::UI::init();
1;
-
diff --git a/src/perl/ui/UI.xs b/src/perl/ui/UI.xs
index 2e9dbeac..8ad60bd7 100644
--- a/src/perl/ui/UI.xs
+++ b/src/perl/ui/UI.xs
@@ -104,12 +104,6 @@ static PLAIN_OBJECT_INIT_REC fe_plains[] = {
{ NULL, NULL }
};
-static void sig_deinit(void)
-{
- signal_remove("script destroy", (SIGNAL_FUNC) sig_script_destroy);
- signal_remove("perl scripts deinit", (SIGNAL_FUNC) sig_deinit);
-}
-
MODULE = Irssi::UI PACKAGE = Irssi::UI
PROTOTYPES: ENABLE
@@ -126,8 +120,12 @@ CODE:
irssi_add_plains(fe_plains);
signal_add("script destroy", (SIGNAL_FUNC) sig_script_destroy);
- signal_add("perl scripts deinit", (SIGNAL_FUNC) sig_deinit);
+void
+deinit()
+CODE:
+ signal_remove("script destroy", (SIGNAL_FUNC) sig_script_destroy);
-INCLUDE: Themes.xs
-INCLUDE: Window.xs
+BOOT:
+ irssi_boot(UI__Themes);
+ irssi_boot(UI__Window);
diff --git a/src/perl/ui/Window.xs b/src/perl/ui/Window.xs
index 520c5bb8..322be79c 100644
--- a/src/perl/ui/Window.xs
+++ b/src/perl/ui/Window.xs
@@ -1,4 +1,7 @@
-MODULE = Irssi::UI PACKAGE = Irssi
+#include "module.h"
+
+MODULE = Irssi::UI::Window PACKAGE = Irssi
+PROTOTYPES: ENABLE
void
windows()
@@ -93,7 +96,7 @@ OUTPUT:
#*******************************
-MODULE = Irssi::UI PACKAGE = Irssi::Server
+MODULE = Irssi::UI::Window PACKAGE = Irssi::Server
#*******************************
void
@@ -135,7 +138,7 @@ window_find_closest(server, name, level)
#*******************************
-MODULE = Irssi::UI PACKAGE = Irssi::UI::Window PREFIX=window_
+MODULE = Irssi::UI::Window PACKAGE = Irssi::UI::Window PREFIX=window_
#*******************************
void
@@ -230,7 +233,7 @@ OUTPUT:
RETVAL
#*******************************
-MODULE = Irssi::UI PACKAGE = Irssi::Windowitem PREFIX = window_item_
+MODULE = Irssi::UI::Window PACKAGE = Irssi::Windowitem PREFIX = window_item_
#*******************************
void