Exported expando interface to perl. Fix for statusbar deinit.

git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2975 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
Timo Sirainen 2002-10-27 22:30:41 +00:00 committed by cras
commit d58e119a98
8 changed files with 192 additions and 3 deletions

View file

@ -46,6 +46,8 @@ typedef struct {
int signal_args[MAX_EXPANDO_SIGNALS];
} EXPANDO_REC;
const char *current_expando = NULL;
static int timer_tag;
static EXPANDO_REC *char_expandos[255];

View file

@ -16,6 +16,8 @@ typedef enum {
typedef char* (*EXPANDO_FUNC)
(SERVER_REC *server, void *item, int *free_ret);
extern const char *current_expando;
/* Create expando - overrides any existing ones.
... = signal, type, ..., NULL - list of signals that might change the
value of this expando */

View file

@ -113,8 +113,10 @@ static char *get_long_variable_value(const char *key, SERVER_REC *server,
/* expando? */
func = expando_find_long(key);
if (func != NULL)
if (func != NULL) {
current_expando = key;
return func(server, item, free_ret);
}
/* internal setting? */
type = settings_get_type(key);
@ -176,7 +178,15 @@ static char *get_variable(char **cmd, SERVER_REC *server, void *item,
}
*free_ret = FALSE;
func = expando_find_char(**cmd);
return func == NULL ? NULL : func(server, item, free_ret);
if (func == NULL)
return NULL;
else {
char str[2];
str[0] = **cmd; str[1] = '\0';
current_expando = str;
return func(server, item, free_ret);
}
}
static char *get_history(char **cmd, void *item, int *free_ret)