mirror of
https://github.com/irssi/irssi.git
synced 2026-08-11 12:53:42 +02:00
Lots of changes again. Biggest ones:
- window's text buffer should work better - themes are almost working, you can change the text formats with /format - automatically try to rejoin the channel after 5 minutes if the join there failed because it was "temporarily unavailable" (netsplits) - generally cleaning code.. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@216 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
969cfe8abc
commit
cbdaf7d06d
63 changed files with 2471 additions and 1912 deletions
|
|
@ -436,8 +436,24 @@ static void cmd_cd(const char *data)
|
|||
g_free(str);
|
||||
}
|
||||
|
||||
static void cmd_rehash(const char *data)
|
||||
{
|
||||
char *fname;
|
||||
|
||||
fname = *data != '\0' ? g_strdup(data) :
|
||||
g_strdup_printf("%s/.irssi/config", g_get_home_dir());
|
||||
settings_reread(fname);
|
||||
g_free(fname);
|
||||
}
|
||||
|
||||
static void cmd_save(const char *data)
|
||||
{
|
||||
settings_save(*data != '\0' ? data : NULL);
|
||||
}
|
||||
|
||||
void commands_init(void)
|
||||
{
|
||||
commands = NULL;
|
||||
cmdget_funcs = NULL;
|
||||
current_command = NULL;
|
||||
|
||||
|
|
@ -448,6 +464,8 @@ void commands_init(void)
|
|||
|
||||
command_bind("eval", NULL, (SIGNAL_FUNC) cmd_eval);
|
||||
command_bind("cd", NULL, (SIGNAL_FUNC) cmd_cd);
|
||||
command_bind("rehash", NULL, (SIGNAL_FUNC) cmd_rehash);
|
||||
command_bind("save", NULL, (SIGNAL_FUNC) cmd_save);
|
||||
}
|
||||
|
||||
void commands_deinit(void)
|
||||
|
|
@ -459,4 +477,6 @@ void commands_deinit(void)
|
|||
|
||||
command_unbind("eval", (SIGNAL_FUNC) cmd_eval);
|
||||
command_unbind("cd", (SIGNAL_FUNC) cmd_cd);
|
||||
command_unbind("rehash", (SIGNAL_FUNC) cmd_rehash);
|
||||
command_unbind("save", (SIGNAL_FUNC) cmd_save);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,16 +10,11 @@ typedef struct {
|
|||
COMMAND_REC;
|
||||
|
||||
enum {
|
||||
CMDERR_PARAM, /* invalid parameter */
|
||||
CMDERR_ERRNO, /* get the error from errno */
|
||||
CMDERR_NOT_ENOUGH_PARAMS, /* not enough parameters given */
|
||||
CMDERR_NOT_CONNECTED, /* not connected to IRC server */
|
||||
CMDERR_NOT_JOINED, /* not joined to any channels in this window */
|
||||
CMDERR_GETSOCKNAME, /* getsockname() failed */
|
||||
CMDERR_LISTEN, /* listen() failed */
|
||||
CMDERR_MULTIPLE_MATCHES, /* multiple matches found, didn't do anything */
|
||||
CMDERR_NICK_NOT_FOUND, /* nick not found */
|
||||
CMDERR_CHAN_NOT_FOUND, /* channel not found */
|
||||
CMDERR_SERVER_NOT_FOUND, /* server not found */
|
||||
CMDERR_CHAN_NOT_SYNCED, /* channel not fully synchronized yet */
|
||||
CMDERR_NOT_GOOD_IDEA /* not good idea to do, -yes overrides this */
|
||||
};
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ void core_init(void)
|
|||
net_disconnect_init();
|
||||
signals_init();
|
||||
settings_init();
|
||||
commands_init();
|
||||
|
||||
servers_init();
|
||||
commands_init();
|
||||
log_init();
|
||||
rawlog_init();
|
||||
special_vars_init();
|
||||
|
|
@ -56,9 +56,9 @@ void core_deinit(void)
|
|||
special_vars_deinit();
|
||||
rawlog_deinit();
|
||||
log_deinit();
|
||||
commands_deinit();
|
||||
servers_deinit();
|
||||
|
||||
commands_deinit();
|
||||
settings_deinit();
|
||||
signals_deinit();
|
||||
net_disconnect_deinit();
|
||||
|
|
|
|||
|
|
@ -132,35 +132,26 @@ static void *data_remove(void *p, const char *file, int line)
|
|||
|
||||
void *ig_malloc(int size, const char *file, int line)
|
||||
{
|
||||
#if 1
|
||||
void *p;
|
||||
|
||||
size += BUFFER_CHECK_SIZE*2;
|
||||
p = g_malloc(size);
|
||||
data_add(p, size, file, line);
|
||||
return p+BUFFER_CHECK_SIZE;
|
||||
#else
|
||||
return g_malloc(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *ig_malloc0(int size, const char *file, int line)
|
||||
{
|
||||
#if 1
|
||||
void *p;
|
||||
|
||||
size += BUFFER_CHECK_SIZE*2;
|
||||
p = g_malloc0(size);
|
||||
data_add(p, size, file, line);
|
||||
return p+BUFFER_CHECK_SIZE;
|
||||
#else
|
||||
return g_malloc0(size);
|
||||
#endif
|
||||
}
|
||||
|
||||
void *ig_realloc(void *mem, unsigned long size, const char *file, int line)
|
||||
{
|
||||
#if 1
|
||||
void *p;
|
||||
|
||||
size += BUFFER_CHECK_SIZE*2;
|
||||
|
|
@ -169,9 +160,6 @@ void *ig_realloc(void *mem, unsigned long size, const char *file, int line)
|
|||
p = g_realloc(mem, size);
|
||||
data_add(p, size, file, line);
|
||||
return p+BUFFER_CHECK_SIZE;
|
||||
#else
|
||||
return g_realloc(mem, size);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *ig_strdup(const char *str, const char *file, int line)
|
||||
|
|
@ -264,12 +252,11 @@ char *ig_strdup_vprintf(const char *file, int line, const char *format, va_list
|
|||
|
||||
void ig_free(void *p)
|
||||
{
|
||||
#if 1
|
||||
if (p == NULL) g_error("ig_free() : trying to free NULL");
|
||||
|
||||
p -= BUFFER_CHECK_SIZE;
|
||||
p = data_remove(p, "??", 0);
|
||||
if (p != NULL)
|
||||
#endif
|
||||
g_free(p);
|
||||
if (p != NULL) g_free(p);
|
||||
}
|
||||
|
||||
GString *ig_string_new(const char *file, int line, const char *str)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#include "module.h"
|
||||
#include "signals.h"
|
||||
#include "commands.h"
|
||||
#include "misc.h"
|
||||
|
||||
#include "lib-config/iconfig.h"
|
||||
#include "settings.h"
|
||||
|
|
@ -278,15 +279,16 @@ static void init_configfile(void)
|
|||
signal(SIGTERM, sig_term);
|
||||
}
|
||||
|
||||
static void cmd_rehash(const char *data)
|
||||
void settings_reread(const char *fname)
|
||||
{
|
||||
CONFIG_REC *tempconfig;
|
||||
char *str, *fname;
|
||||
char *str;
|
||||
|
||||
fname = *data != '\0' ? g_strdup(data) :
|
||||
g_strdup_printf("%s/.irssi/config", g_get_home_dir());
|
||||
tempconfig = parse_configfile(fname);
|
||||
g_free(fname);
|
||||
if (fname == NULL) fname = "~/.irssi/config";
|
||||
|
||||
str = convert_home(fname);
|
||||
tempconfig = parse_configfile(str);
|
||||
g_free(str);
|
||||
|
||||
if (tempconfig == NULL) {
|
||||
signal_emit("gui dialog", 2, "error", g_strerror(errno));
|
||||
|
|
@ -310,11 +312,11 @@ static void cmd_rehash(const char *data)
|
|||
signal_emit("setup reread", 0);
|
||||
}
|
||||
|
||||
static void cmd_save(const char *data)
|
||||
void settings_save(const char *fname)
|
||||
{
|
||||
char *str;
|
||||
|
||||
if (config_write(mainconfig, *data == '\0' ? NULL : data, 0660) == 0)
|
||||
if (config_write(mainconfig, fname, 0660) == 0)
|
||||
return;
|
||||
|
||||
/* error */
|
||||
|
|
@ -329,8 +331,6 @@ void settings_init(void)
|
|||
settings = g_hash_table_new((GHashFunc) g_str_hash, (GCompareFunc) g_str_equal);
|
||||
|
||||
init_configfile();
|
||||
command_bind("rehash", NULL, (SIGNAL_FUNC) cmd_rehash);
|
||||
command_bind("save", NULL, (SIGNAL_FUNC) cmd_save);
|
||||
}
|
||||
|
||||
static void settings_hash_free(const char *key, SETTINGS_REC *rec)
|
||||
|
|
@ -340,9 +340,6 @@ static void settings_hash_free(const char *key, SETTINGS_REC *rec)
|
|||
|
||||
void settings_deinit(void)
|
||||
{
|
||||
command_unbind("rehash", (SIGNAL_FUNC) cmd_rehash);
|
||||
command_unbind("save", (SIGNAL_FUNC) cmd_save);
|
||||
|
||||
g_free_not_null(last_error_msg);
|
||||
g_hash_table_foreach(settings, (GHFunc) settings_hash_free, NULL);
|
||||
g_hash_table_destroy(settings);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,10 @@ GSList *settings_get_sorted(void);
|
|||
/* Get the record of the setting */
|
||||
SETTINGS_REC *settings_get_record(const char *key);
|
||||
|
||||
/* if `fname' is NULL, the default is used */
|
||||
void settings_reread(const char *fname);
|
||||
void settings_save(const char *fname);
|
||||
|
||||
void settings_init(void);
|
||||
void settings_deinit(void);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue