diff options
author | Timo Sirainen <cras@irssi.org> | 2001-11-29 22:12:28 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2001-11-29 22:12:28 +0000 |
commit | 6976bec3d9533fada929675e57930363942710e0 (patch) | |
tree | 9879a65d9ad06e7d2a51982d7799f6c364130f4a /src | |
parent | 4ebe07e0d17281726097ffff255de6a985252046 (diff) | |
download | irssi-6976bec3d9533fada929675e57930363942710e0.zip |
Allow using Irssi::signal_add('command ...', ..) so irssi won't crash when
the script is unloaded.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2167 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src')
-rw-r--r-- | src/perl/perl-signals.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/perl/perl-signals.c b/src/perl/perl-signals.c index 2d7940df..f81be8cd 100644 --- a/src/perl/perl-signals.c +++ b/src/perl/perl-signals.c @@ -252,8 +252,8 @@ SIG_FUNC_DECL(2, last); #define perl_signal_get_func(rec) \ (priority_get_func((rec)->priority)) -void perl_signal_add_to_int(const char *signal, const char *func, - int priority, int add_signal) +static void perl_signal_add_to_int(const char *signal, const char *func, + int priority, int command) { PERL_SIGNAL_REC *rec; GHashTable *table; @@ -264,6 +264,13 @@ void perl_signal_add_to_int(const char *signal, const char *func, g_return_if_fail(func != NULL); g_return_if_fail(priority >= 0 && priority <= 2); + if (!command && strncmp(signal, "command ", 8) == 0) { + /* we used Irssi::signal_add() instead of + Irssi::command_bind() - oh well, allow this.. */ + command_bind(signal+8, NULL, priority_get_func(priority)); + command = TRUE; + } + rec = g_new(PERL_SIGNAL_REC, 1); rec->signal_id = signal_get_uniq_id(signal); rec->signal = g_strdup(signal); @@ -278,7 +285,7 @@ void perl_signal_add_to_int(const char *signal, const char *func, siglist = g_new0(GSList *, 1); g_hash_table_insert(table, signal_idp, siglist); - if (add_signal) { + if (!command) { signal_add_to_id(MODULE_NAME, priority, rec->signal_id, perl_signal_get_func(rec)); } @@ -289,7 +296,7 @@ void perl_signal_add_to_int(const char *signal, const char *func, void perl_signal_add_to(const char *signal, const char *func, int priority) { - perl_signal_add_to_int(signal, func, priority, TRUE); + perl_signal_add_to_int(signal, func, priority, FALSE); } static void perl_signal_destroy(PERL_SIGNAL_REC *rec) @@ -362,7 +369,7 @@ void perl_command_bind_to(const char *cmd, const char *category, command_bind(cmd, category, priority_get_func(priority)); signal = g_strconcat("command ", cmd, NULL); - perl_signal_add_to_int(signal, func, priority, FALSE); + perl_signal_add_to_int(signal, func, priority, TRUE); g_free(signal); } |