mirror of
https://github.com/irssi/irssi.git
synced 2025-01-03 14:56:47 -05:00
Unbinding commands didn't work properly
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1058 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
69f3b3f159
commit
fe8710ac41
@ -323,21 +323,12 @@ command_bind(cmd, category, func)
|
||||
char *category
|
||||
char *func
|
||||
CODE:
|
||||
char *signal;
|
||||
|
||||
if (*category == '\0') category = "Perl scripts' commands";
|
||||
command_bind(cmd, category, NULL);
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_add(signal, func);
|
||||
g_free(signal);
|
||||
perl_command_bind(cmd, category, func);
|
||||
|
||||
void
|
||||
command_unbind(cmd, func)
|
||||
char *cmd
|
||||
char *func
|
||||
CODE:
|
||||
char *signal;
|
||||
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_remove(signal, func);
|
||||
g_free(signal);
|
||||
perl_command_unbind(cmd, func);
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "servers.h"
|
||||
|
||||
#include "perl-common.h"
|
||||
#include "perl-signals.h"
|
||||
|
||||
typedef struct {
|
||||
int signal_id;
|
||||
@ -201,7 +202,7 @@ void perl_signal_add_to(const char *signal, const char *func, int priority)
|
||||
static void perl_signal_destroy(PERL_SIGNAL_REC *rec)
|
||||
{
|
||||
if (strncmp(rec->signal, "command ", 8) == 0)
|
||||
command_unbind(rec->signal+8, NULL);
|
||||
command_unbind(rec->signal+8, sig_func_default);
|
||||
|
||||
g_free(rec->signal);
|
||||
g_free(rec->func);
|
||||
@ -260,6 +261,27 @@ void perl_signal_remove(const char *signal, const char *func)
|
||||
g_free(fullfunc);
|
||||
}
|
||||
|
||||
void perl_command_bind(const char *cmd, const char *category, const char *func)
|
||||
{
|
||||
char *signal;
|
||||
|
||||
command_bind(cmd, category, sig_func_default);
|
||||
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_add(signal, func);
|
||||
g_free(signal);
|
||||
}
|
||||
|
||||
void perl_command_unbind(const char *cmd, const char *func)
|
||||
{
|
||||
char *signal;
|
||||
|
||||
/* perl_signal_remove() calls command_unbind() */
|
||||
signal = g_strconcat("command ", cmd, NULL);
|
||||
perl_signal_remove(signal, func);
|
||||
g_free(signal);
|
||||
}
|
||||
|
||||
static int signal_destroy_hash(void *key, GSList **list, const char *package)
|
||||
{
|
||||
GSList *tmp, *next;
|
||||
|
@ -11,6 +11,10 @@ void perl_signal_add_to(const char *signal, const char *func, int priority);
|
||||
|
||||
void perl_signal_remove(const char *signal, const char *func);
|
||||
|
||||
void perl_command_bind(const char *cmd, const char *category,
|
||||
const char *func);
|
||||
void perl_command_unbind(const char *cmd, const char *func);
|
||||
|
||||
/* destroy all signals used by package */
|
||||
void perl_signals_package_destroy(const char *package);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user