mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04: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 *category
|
||||||
char *func
|
char *func
|
||||||
CODE:
|
CODE:
|
||||||
char *signal;
|
|
||||||
|
|
||||||
if (*category == '\0') category = "Perl scripts' commands";
|
if (*category == '\0') category = "Perl scripts' commands";
|
||||||
command_bind(cmd, category, NULL);
|
perl_command_bind(cmd, category, func);
|
||||||
signal = g_strconcat("command ", cmd, NULL);
|
|
||||||
perl_signal_add(signal, func);
|
|
||||||
g_free(signal);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
command_unbind(cmd, func)
|
command_unbind(cmd, func)
|
||||||
char *cmd
|
char *cmd
|
||||||
char *func
|
char *func
|
||||||
CODE:
|
CODE:
|
||||||
char *signal;
|
perl_command_unbind(cmd, func);
|
||||||
|
|
||||||
signal = g_strconcat("command ", cmd, NULL);
|
|
||||||
perl_signal_remove(signal, func);
|
|
||||||
g_free(signal);
|
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "servers.h"
|
#include "servers.h"
|
||||||
|
|
||||||
#include "perl-common.h"
|
#include "perl-common.h"
|
||||||
|
#include "perl-signals.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int signal_id;
|
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)
|
static void perl_signal_destroy(PERL_SIGNAL_REC *rec)
|
||||||
{
|
{
|
||||||
if (strncmp(rec->signal, "command ", 8) == 0)
|
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->signal);
|
||||||
g_free(rec->func);
|
g_free(rec->func);
|
||||||
@ -260,6 +261,27 @@ void perl_signal_remove(const char *signal, const char *func)
|
|||||||
g_free(fullfunc);
|
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)
|
static int signal_destroy_hash(void *key, GSList **list, const char *package)
|
||||||
{
|
{
|
||||||
GSList *tmp, *next;
|
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_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 */
|
/* destroy all signals used by package */
|
||||||
void perl_signals_package_destroy(const char *package);
|
void perl_signals_package_destroy(const char *package);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user