summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/common.h30
-rw-r--r--src/core/core.c51
-rw-r--r--src/core/core.h2
-rw-r--r--src/core/modules.c2
-rw-r--r--src/core/settings.c33
-rw-r--r--src/fe-common/core/autorun.c2
-rw-r--r--src/fe-common/core/fe-settings.c5
-rw-r--r--src/fe-common/core/themes.c7
-rw-r--r--src/fe-none/irssi.c2
-rw-r--r--src/fe-text/Makefile.am1
-rw-r--r--src/fe-text/gui-printtext.c61
-rw-r--r--src/fe-text/irssi.c14
-rw-r--r--src/fe-text/textbuffer-commands.c13
-rw-r--r--src/fe-text/textbuffer.c168
-rw-r--r--src/irc/bot/bot-users.c2
-rw-r--r--src/irc/bot/botnet-connection.c2
-rw-r--r--src/irc/bot/botnet.c4
-rw-r--r--src/irc/core/irc-log.c2
-rw-r--r--src/perl/perl.c4
19 files changed, 129 insertions, 276 deletions
diff --git a/src/common.h b/src/common.h
index c79c5d9b..89d4da94 100644
--- a/src/common.h
+++ b/src/common.h
@@ -4,6 +4,9 @@
#define IRSSI_AUTHOR "Timo Sirainen <tss@iki.fi>"
#define IRSSI_WEBSITE "http://irssi.org/"
+#define IRSSI_DIR_SHORT "~/.irssi"
+#define IRSSI_DIR_FULL "%s/.irssi" /* %s == g_get_home_dir() */
+
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
@@ -45,16 +48,7 @@
#include "core/memdebug.h"
-#define g_free_not_null(a) \
- G_STMT_START { \
- if (a) g_free(a); \
- } G_STMT_END
-
-#define g_free_and_null(a) \
- G_STMT_START { \
- if (a) { g_free(a); (a) = NULL; } \
- } G_STMT_END
-
+/* input functions */
#define G_INPUT_READ (1 << 0)
#define G_INPUT_WRITE (1 << 1)
@@ -65,8 +59,24 @@ int g_input_add(GIOChannel *source, int condition,
int g_input_add_full(GIOChannel *source, int priority, int condition,
GInputFunction function, void *data);
+/* return full path for ~/.irssi */
+const char *get_irssi_dir(void);
+/* return full path for ~/.irssi/config */
+const char *get_irssi_config(void);
+
+/* max. size for %d */
#define MAX_INT_STRLEN ((sizeof(int) * CHAR_BIT + 2) / 3 + 1)
+#define g_free_not_null(a) \
+ G_STMT_START { \
+ if (a) g_free(a); \
+ } G_STMT_END
+
+#define g_free_and_null(a) \
+ G_STMT_START { \
+ if (a) { g_free(a); (a) = NULL; } \
+ } G_STMT_END
+
typedef struct _IPADDR IPADDR;
typedef struct _CONFIG_REC CONFIG_REC;
typedef struct _CONFIG_NODE CONFIG_NODE;
diff --git a/src/core/core.c b/src/core/core.c
index f023552d..87816316 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -21,6 +21,7 @@
#include "module.h"
#include <signal.h>
+#include "args.h"
#include "pidwait.h"
#include "misc.h"
@@ -49,8 +50,20 @@ void chat_commands_deinit(void);
int irssi_gui;
+static char *irssi_dir, *irssi_config_file;
static GSList *dialog_type_queue, *dialog_text_queue;
+const char *get_irssi_dir(void)
+{
+ return irssi_dir;
+}
+
+/* return full path for ~/.irssi/config */
+const char *get_irssi_config(void)
+{
+ return irssi_config_file;
+}
+
static void read_signals(void)
{
#ifndef WIN32
@@ -106,7 +119,40 @@ static void sig_init_finished(void)
g_slist_free(dialog_text_queue);
}
-void core_init(void)
+void core_init_paths(int argc, char *argv[])
+{
+ static struct poptOption options[] = {
+ { "config", 0, POPT_ARG_STRING, NULL, 0, "Configuration file location (~/.irssi/config)", "PATH" },
+ { "home", 0, POPT_ARG_STRING, NULL, 0, "Irssi home dir location (~/.irssi)", "PATH" },
+ { NULL, '\0', 0, NULL }
+ };
+ int n, len;
+
+ for (n = 1; n < argc; n++) {
+ if (strncmp(argv[n], "--home=", 7) == 0) {
+ g_free_not_null(irssi_dir);
+ irssi_dir = convert_home(argv[n]+7);
+ len = strlen(irssi_dir);
+ if (irssi_dir[len-1] == G_DIR_SEPARATOR)
+ irssi_dir[len-1] = '\0';
+ break;
+ }
+ if (strncmp(argv[n], "--config=", 9) == 0) {
+ g_free_not_null(irssi_config_file);
+ irssi_config_file = convert_home(argv[n]+9);
+ break;
+ }
+ }
+
+ args_register(options);
+
+ if (irssi_dir == NULL)
+ irssi_dir = g_strdup_printf(IRSSI_DIR_FULL, g_get_home_dir());
+ if (irssi_config_file == NULL)
+ irssi_config_file = g_strdup_printf("%s/config", irssi_dir);
+}
+
+void core_init(int argc, char *argv[])
{
dialog_type_queue = NULL;
dialog_text_queue = NULL;
@@ -179,4 +225,7 @@ void core_deinit(void)
pidwait_deinit();
#endif
modules_deinit();
+
+ g_free(irssi_dir);
+ g_free(irssi_config_file);
}
diff --git a/src/core/core.h b/src/core/core.h
index 61d6ef70..eda825ab 100644
--- a/src/core/core.h
+++ b/src/core/core.h
@@ -11,6 +11,8 @@
extern int irssi_gui;
+void core_init_paths(int argc, char *argv[]);
+
void core_init(void);
void core_deinit(void);
diff --git a/src/core/modules.c b/src/core/modules.c
index a76b6765..b675b211 100644
--- a/src/core/modules.c
+++ b/src/core/modules.c
@@ -255,7 +255,7 @@ static GModule *module_open(const char *name)
path = g_strdup(name);
else {
/* first try from home dir */
- str = g_strdup_printf("%s/.irssi/modules", g_get_home_dir());
+ str = g_strdup_printf("%s/modules", get_irssi_dir());
path = g_module_build_path(str, name);
g_free(str);
diff --git a/src/core/settings.c b/src/core/settings.c
index 983ca7d2..9f7b21a3 100644
--- a/src/core/settings.c
+++ b/src/core/settings.c
@@ -483,14 +483,13 @@ static CONFIG_REC *parse_configfile(const char *fname)
CONFIG_REC *config;
struct stat statbuf;
const char *path;
- char *real_fname, *str;
+ char *str;
- real_fname = fname != NULL ? g_strdup(fname) :
- g_strdup_printf("%s"G_DIR_SEPARATOR_S".irssi"
- G_DIR_SEPARATOR_S"config", g_get_home_dir());
+ if (fname == NULL)
+ fname = get_irssi_config();
- if (stat(real_fname, &statbuf) == 0)
- path = real_fname;
+ if (stat(fname, &statbuf) == 0)
+ path = fname;
else {
/* user configuration file not found, use the default one
from sysconfdir */
@@ -517,9 +516,8 @@ static CONFIG_REC *parse_configfile(const char *fname)
else
config_parse_data(config, default_config, "internal");
- config_change_file_name(config, real_fname, 0660);
- irssi_config_save_state(real_fname);
- g_free(real_fname);
+ config_change_file_name(config, fname, 0660);
+ irssi_config_save_state(fname);
return config;
}
@@ -528,17 +526,16 @@ static void init_configfile(void)
struct stat statbuf;
char *str;
- str = g_strdup_printf("%s"G_DIR_SEPARATOR_S".irssi", g_get_home_dir());
- if (stat(str, &statbuf) != 0) {
+ if (stat(get_irssi_dir(), &statbuf) != 0) {
/* ~/.irssi not found, create it. */
- if (mkpath(str, 0700) != 0) {
- g_error("Couldn't create %s directory", str);
+ if (mkpath(get_irssi_dir(), 0700) != 0) {
+ g_error("Couldn't create %s directory", get_irssi_dir());
}
} else if (!S_ISDIR(statbuf.st_mode)) {
g_error("%s is not a directory.\n"
- "You should remove it with command: rm ~/.irssi", str);
+ "You should remove it with command: rm %s",
+ get_irssi_dir(), get_irssi_dir());
}
- g_free(str);
mainconfig = parse_configfile(NULL);
config_last_modifycounter = mainconfig->modifycounter;
@@ -559,11 +556,9 @@ int settings_reread(const char *fname)
CONFIG_REC *tempconfig;
char *str;
- if (fname == NULL) fname = "~/.irssi/config";
-
- str = convert_home(fname);
+ str = convert_home(fname);
tempconfig = parse_configfile(str);
- g_free(str);
+ g_free(str);
if (tempconfig == NULL) {
signal_emit("gui dialog", 2, "error", g_strerror(errno));
diff --git a/src/fe-common/core/autorun.c b/src/fe-common/core/autorun.c
index b305b82e..8035e97e 100644
--- a/src/fe-common/core/autorun.c
+++ b/src/fe-common/core/autorun.c
@@ -32,7 +32,7 @@ static void sig_autorun(void)
int f, ret, recvlen;
/* open ~/.irssi/startup and run all commands in it */
- path = g_strdup_printf("%s/.irssi/startup", g_get_home_dir());
+ path = g_strdup_printf("%s/startup", get_irssi_dir());
f = open(path, O_RDONLY);
g_free(path);
if (f == -1) {
diff --git a/src/fe-common/core/fe-settings.c b/src/fe-common/core/fe-settings.c
index d9bf8c72..f44138fb 100644
--- a/src/fe-common/core/fe-settings.c
+++ b/src/fe-common/core/fe-settings.c
@@ -247,13 +247,12 @@ static void cmd_reload(const char *data)
{
char *fname;
- fname = *data != '\0' ? g_strdup(data) :
- g_strdup_printf("%s/.irssi/config", g_get_home_dir());
+ fname = *data == '\0' ? NULL : g_strdup(data);
if (settings_reread(fname)) {
printformat(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
TXT_CONFIG_RELOADED, fname);
}
- g_free(fname);
+ g_free_not_null(fname);
}
static void settings_save_fe(const char *fname)
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c
index 7fcd31ac..a371a953 100644
--- a/src/fe-common/core/themes.c
+++ b/src/fe-common/core/themes.c
@@ -701,7 +701,7 @@ THEME_REC *theme_load(const char *setname)
theme = theme_find(name);
/* check home dir */
- fname = g_strdup_printf("%s/.irssi/%s.theme", g_get_home_dir(), name);
+ fname = g_strdup_printf("%s/%s.theme", get_irssi_dir(), name);
if (stat(fname, &statbuf) != 0) {
/* check global config dir */
g_free(fname);
@@ -1005,7 +1005,7 @@ static void theme_save(THEME_REC *theme)
g_hash_table_foreach(theme->modules, (GHFunc) module_save, config);
/* always save the theme to ~/.irssi/ */
- path = g_strdup_printf("%s/.irssi/%s", g_get_home_dir(),
+ path = g_strdup_printf("%s/%s", get_irssi_dir(),
g_basename(theme->path));
ok = config_write(config, path, 0660) == 0;
@@ -1135,8 +1135,7 @@ static void themes_read(void)
/* first there's default theme.. */
current_theme = theme_load("default");
if (current_theme == NULL) {
- fname = g_strdup_printf("%s/.irssi/default.theme",
- g_get_home_dir());
+ fname = g_strdup_printf("%s/default.theme", get_irssi_dir());
current_theme = theme_create(fname, "default");
current_theme->default_color = 0;
current_theme->default_real_color = 7;
diff --git a/src/fe-none/irssi.c b/src/fe-none/irssi.c
index d87d3434..69ad0fcb 100644
--- a/src/fe-none/irssi.c
+++ b/src/fe-none/irssi.c
@@ -85,6 +85,8 @@ void noui_deinit(void)
int main(int argc, char **argv)
{
+ core_init_paths(argc, argv);
+
#ifdef HAVE_SOCKS
SOCKSinit(argv[0]);
#endif
diff --git a/src/fe-text/Makefile.am b/src/fe-text/Makefile.am
index bddf2409..2b80dd17 100644
--- a/src/fe-text/Makefile.am
+++ b/src/fe-text/Makefile.am
@@ -33,6 +33,7 @@ irssi_SOURCES = \
statusbar-items.c \
textbuffer.c \
textbuffer-commands.c \
+ textbuffer-reformat.c \
textbuffer-view.c \
irssi.c \
module-formats.c
diff --git a/src/fe-text/gui-printtext.c b/src/fe-text/gui-printtext.c
index 52cc5c9e..e8566f1a 100644
--- a/src/fe-text/gui-printtext.c
+++ b/src/fe-text/gui-printtext.c
@@ -31,9 +31,6 @@
int mirc_colors[] = { 15, 0, 1, 2, 12, 6, 5, 4, 14, 10, 3, 11, 9, 13, 8, 7 };
static int scrollback_lines, scrollback_hours, scrollback_burst_remove;
-static int scrollback_save_formats;
-static GString *format;
-
static int last_color, last_flags;
static int next_xpos, next_ypos;
@@ -137,7 +134,8 @@ static void line_add_colors(TEXT_BUFFER_REC *buffer, LINE_REC **line,
data[pos++] = LINE_CMD_INDENT;
}
- *line = textbuffer_insert(buffer, *line, data, pos, NULL);
+ if (pos > 0)
+ *line = textbuffer_insert(buffer, *line, data, pos, NULL);
last_flags = flags;
last_color = fg | (bg << 4);
@@ -155,6 +153,7 @@ static void sig_gui_print_text(WINDOW_REC *window, void *fgcolor,
void *bgcolor, void *pflags,
char *str, void *level)
{
+ GUI_WINDOW_REC *gui;
TEXT_BUFFER_VIEW_REC *view;
LINE_REC *insert_after;
LINE_INFO_REC lineinfo;
@@ -178,15 +177,18 @@ static void sig_gui_print_text(WINDOW_REC *window, void *fgcolor,
lineinfo.level = GPOINTER_TO_INT(level);
lineinfo.time = time(NULL);
- view = WINDOW_GUI(window)->view;
- insert_after = WINDOW_GUI(window)->use_insert_after ?
- WINDOW_GUI(window)->insert_after : view->buffer->cur_line;
+ gui = WINDOW_GUI(window);
+ view = gui->view;
+ insert_after = gui->use_insert_after ?
+ gui->insert_after : view->buffer->cur_line;
if (flags & GUI_PRINT_FLAG_NEWLINE)
view_add_eol(view, &insert_after);
line_add_colors(view->buffer, &insert_after, fg, bg, flags);
- textbuffer_insert(view->buffer, insert_after,
- str, strlen(str), &lineinfo);
+ insert_after = textbuffer_insert(view->buffer, insert_after,
+ str, strlen(str), &lineinfo);
+ if (gui->use_insert_after)
+ gui->insert_after = insert_after;
}
static void sig_gui_printtext_finished(WINDOW_REC *window)
@@ -205,61 +207,23 @@ static void sig_gui_printtext_finished(WINDOW_REC *window)
remove_old_lines(view);
}
-static void sig_print_format(THEME_REC *theme, const char *module,
- TEXT_DEST_REC *dest, void *formatnump,
- char **args)
-{
- FORMAT_REC *formats;
- int formatnum, n;
-
- if (!scrollback_save_formats)
- return;
-
- formatnum = GPOINTER_TO_INT(formatnump);
- formats = g_hash_table_lookup(default_formats, module);
-
- /* <module><format_name><arg...> */
- g_string_truncate(format, 0);
-
- g_string_append_c(format, '\0');
- g_string_append_c(format, (char)LINE_CMD_FORMAT);
-
- g_string_append(format, module);
-
- g_string_append_c(format, '\0');
- g_string_append_c(format, (char)LINE_CMD_FORMAT);
-
- g_string_append(format, formats[formatnum].tag);
-
- for (n = 0; n < formats[formatnum].params; n++) {
- g_string_append_c(format, '\0');
- g_string_append_c(format, (char)LINE_CMD_FORMAT);
-
- g_string_append(format, args[n]);
- }
-}
-
static void read_settings(void)
{
scrollback_lines = settings_get_int("scrollback_lines");
scrollback_hours = settings_get_int("scrollback_hours");
scrollback_burst_remove = settings_get_int("scrollback_burst_remove");
- scrollback_save_formats = settings_get_bool("scrollback_save_formats");
}
void gui_printtext_init(void)
{
next_xpos = next_ypos = -1;
- format = g_string_new(NULL);
settings_add_int("history", "scrollback_lines", 500);
settings_add_int("history", "scrollback_hours", 24);
settings_add_int("history", "scrollback_burst_remove", 10);
- settings_add_bool("history", "scrollback_save_formats", FALSE);
signal_add("gui print text", (SIGNAL_FUNC) sig_gui_print_text);
signal_add("gui print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
- signal_add("print format", (SIGNAL_FUNC) sig_print_format);
signal_add("setup changed", (SIGNAL_FUNC) read_settings);
read_settings();
@@ -267,10 +231,7 @@ void gui_printtext_init(void)
void gui_printtext_deinit(void)
{
- g_string_free(format, TRUE);
-
signal_remove("gui print text", (SIGNAL_FUNC) sig_gui_print_text);
signal_remove("print text finished", (SIGNAL_FUNC) sig_gui_printtext_finished);
- signal_remove("print format", (SIGNAL_FUNC) sig_print_format);
signal_remove("setup changed", (SIGNAL_FUNC) read_settings);
}
diff --git a/src/fe-text/irssi.c b/src/fe-text/irssi.c
index ec55f10f..a2dc04a0 100644
--- a/src/fe-text/irssi.c
+++ b/src/fe-text/irssi.c
@@ -38,6 +38,7 @@
#include "gui-readline.h"
#include "statusbar.h"
#include "gui-windows.h"
+#include "textbuffer-reformat.h"
#include <signal.h>
@@ -117,6 +118,7 @@ static void textui_finish_init(void)
textbuffer_init();
textbuffer_view_init();
textbuffer_commands_init();
+ textbuffer_reformat_init();
gui_entry_init();
gui_expandos_init();
gui_printtext_init();
@@ -166,6 +168,7 @@ static void textui_deinit(void)
mainwindows_deinit();
gui_expandos_deinit();
gui_entry_deinit();
+ textbuffer_reformat_deinit();
textbuffer_commands_deinit();
textbuffer_view_deinit();
textbuffer_deinit();
@@ -192,7 +195,7 @@ static void check_oldcrap(void)
int found;
/* check that default.theme is up-to-date */
- path = g_strdup_printf("%s/.irssi/default.theme", g_get_home_dir());
+ path = g_strdup_printf("%s/default.theme", get_irssi_dir());
f = fopen(path, "r+");
if (f == NULL) {
g_free(path);
@@ -208,7 +211,7 @@ static void check_oldcrap(void)
return;
}
- printf("\nYou seem to have old default.theme in ~/.irssi/ directory.\n");
+ printf("\nYou seem to have old default.theme in "IRSSI_DIR_SHORT"/ directory.\n");
printf("Themeing system has changed a bit since last irssi release,\n");
printf("you should either delete your old default.theme or manually\n");
printf("merge it with the new default.theme.\n\n");
@@ -224,16 +227,13 @@ static void check_oldcrap(void)
static void check_files(void)
{
struct stat statbuf;
- char *path;
- path = g_strdup_printf("%s/.irssi", g_get_home_dir());
- if (stat(path, &statbuf) != 0) {
+ if (stat(get_irssi_dir(), &statbuf) != 0) {
/* ~/.irssi doesn't exist, first time running irssi */
display_firsttimer = TRUE;
} else {
check_oldcrap();
}
- g_free(path);
}
#ifdef WIN32
@@ -253,6 +253,8 @@ static void winsock_init(void)
int main(int argc, char **argv)
{
+ core_init_paths(argc, argv);
+
check_files();
#ifdef WIN32
winsock_init();
diff --git a/src/fe-text/textbuffer-commands.c b/src/fe-text/textbuffer-commands.c
index 24847dac..2de83515 100644
--- a/src/fe-text/textbuffer-commands.c
+++ b/src/fe-text/textbuffer-commands.c
@@ -26,6 +26,7 @@
#include "printtext.h"
#include "gui-windows.h"
+#include "textbuffer-reformat.h"
/* SYNTAX: CLEAR */
static void cmd_clear(const char *data)
@@ -205,21 +206,21 @@ static void cmd_scrollback_end(const char *data)
/* SYNTAX: SCROLLBACK REDRAW */
static void cmd_scrollback_redraw(void)
{
-#if 0
GUI_WINDOW_REC *gui;
- GList *tmp, *next;
+ LINE_REC *line, *next;
gui = WINDOW_GUI(active_win);
screen_refresh_freeze();
- for (tmp = gui->lines; tmp != NULL; tmp = next) {
- next = tmp->next;
- gui_window_reformat_line(active_win, tmp->data);
+ line = textbuffer_view_get_lines(gui->view);
+ while (line != NULL) {
+ next = line->next;
+ textbuffer_reformat_line(active_win, line);
+ line = next;
}
gui_window_redraw(active_win);
screen_refresh_thaw();
-#endif
}
static void cmd_scrollback_status(void)
diff --git a/src/fe-text/textbuffer.c b/src/fe-text/textbuffer.c
index 06cb2fe9..3c11aea3 100644
--- a/src/fe-text/textbuffer.c
+++ b/src/fe-text/textbuffer.c
@@ -462,174 +462,6 @@ GList *textbuffer_find_text(TEXT_BUFFER_REC *buffer, LINE_REC *startline,
return matches;
}
-#if 0 /* FIXME: saving formats is broken */
-static char *line_read_format(unsigned const char **text)
-{
- GString *str;
- char *ret;
-
- str = g_string_new(NULL);
- for (;;) {
- if (**text == '\0') {
- if ((*text)[1] == LINE_CMD_EOL) {
- /* leave text at \0<eof> */
- break;
- }
- if ((*text)[1] == LINE_CMD_FORMAT_CONT) {
- /* leave text at \0<format_cont> */
- break;
- }
- (*text)++;
-
- if (**text == LINE_CMD_FORMAT) {
- /* move text to start after \0<format> */
- (*text)++;
- break;
- }
-
- if (**text == LINE_CMD_CONTINUE) {
- unsigned char *tmp;
-
- memcpy(&tmp, (*text)+1, sizeof(char *));
- *text = tmp;
- continue;
- } else if (**text & 0x80)
- (*text)++;
- continue;
- }
-
- g_string_append_c(str, (char) **text);
- (*text)++;
- }
-
- ret = str->str;
- g_string_free(str, FALSE);
- return ret;
-}
-
-static char *textbuffer_line_get_format(WINDOW_REC *window, LINE_REC *line,
- GString *raw)
-{
- const unsigned char *text;
- char *module, *format_name, *args[MAX_FORMAT_PARAMS], *ret;
- TEXT_DEST_REC dest;
- int formatnum, argcount;
-
- text = (const unsigned char *) line->text;
-
- /* skip the beginning of the line until we find the format */
- g_free(line_read_format(&text));
- if (text[1] == LINE_CMD_FORMAT_CONT) {
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_FORMAT_CONT);
- return NULL;
- }
-
- /* read format information */
- module = line_read_format(&text);
- format_name = line_read_format(&text);
-
- if (raw != NULL) {
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_FORMAT);
-
- g_string_append(raw, module);
-
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_FORMAT);
-
- g_string_append(raw, format_name);
- }
-
- formatnum = format_find_tag(module, format_name);
- if (formatnum == -1)
- ret = NULL;
- else {
- argcount = 0;
- memset(args, 0, sizeof(args));
- while (*text != '\0' || text[1] != LINE_CMD_EOL) {
- args[argcount] = line_read_format(&text);
- if (raw != NULL) {
- g_string_append_c(raw, '\0');
- g_string_append_c(raw,
- (char)LINE_CMD_FORMAT);
-
- g_string_append(raw, args[argcount]);
- }
- argcount++;
- }
-
- /* get the format text */
- format_create_dest(&dest, NULL, NULL, line->level, window);
- ret = format_get_text_theme_charargs(current_theme,
- module, &dest,
- formatnum, args);
- while (argcount > 0)
- g_free(args[--argcount]);
- }
-
- g_free(module);
- g_free(format_name);
-
- return ret;
-}
-
-void textbuffer_reformat_line(WINDOW_REC *window, LINE_REC *line)
-{
- GUI_WINDOW_REC *gui;
- TEXT_DEST_REC dest;
- GString *raw;
- char *str, *tmp, *prestr, *linestart, *leveltag;
-
- gui = WINDOW_GUI(window);
-
- raw = g_string_new(NULL);
- str = textbuffer_line_get_format(window, line, raw);
-
- if (str == NULL && raw->len == 2 &&
- raw->str[1] == (char)LINE_CMD_FORMAT_CONT) {
- /* multiline format, format explained in one the
- following lines. remove this line. */
- textbuffer_line_remove(window, line, FALSE);
- } else if (str != NULL) {
- /* FIXME: ugly ugly .. and this can't handle
- non-formatted lines.. */
- g_string_append_c(raw, '\0');
- g_string_append_c(raw, (char)LINE_CMD_EOL);
-
- textbuffer_line_text_free(gui, line);
-
- gui->temp_line = line;
- gui->temp_line->text = gui->cur_text->buffer+gui->cur_text->pos;
- gui->cur_text->lines++;
- gui->eol_marked = FALSE;
-
- format_create_dest(&dest, NULL, NULL, line->level, window);
-
- linestart = format_get_line_start(current_theme, &dest, line->time);
- leveltag = format_get_level_tag(current_theme, &dest);
-
- prestr = g_strconcat(linestart == NULL ? "" : linestart,
- leveltag, NULL);
- g_free_not_null(linestart);
- g_free_not_null(leveltag);
-
- tmp = format_add_linestart(str, prestr);
- g_free(str);
- g_free(prestr);
-
- format_send_to_gui(&dest, tmp);
- g_free(tmp);
-
- textbuffer_line_append(gui, raw->str, raw->len);
-
- gui->eol_marked = TRUE;
- gui->temp_line = NULL;
- }
- g_string_free(raw, TRUE);
-}
-#endif
-
void textbuffer_init(void)
{
buffer_chunk = g_mem_chunk_new("text buffer chunk",
diff --git a/src/irc/bot/bot-users.c b/src/irc/bot/bot-users.c
index b6305b51..bc9906a6 100644
--- a/src/irc/bot/bot-users.c
+++ b/src/irc/bot/bot-users.c
@@ -531,7 +531,7 @@ static void botuser_config_read(void)
char *fname;
/* Read users from ~/.irssi/users */
- fname = g_strdup_printf("%s/.irssi/users", g_get_home_dir());
+ fname = g_strdup_printf("%s/users", get_irssi_dir());
userconfig = config_open(fname, 0600);
g_free(fname);
diff --git a/src/irc/bot/botnet-connection.c b/src/irc/bot/botnet-connection.c
index d1a583e1..59da48f6 100644
--- a/src/irc/bot/botnet-connection.c
+++ b/src/irc/bot/botnet-connection.c
@@ -426,7 +426,7 @@ static void botnet_event(BOT_REC *bot, const char *data)
bot_send_cmdv(bot, "%s - MASTER %s", bot->botnet->nick, bot->botnet->master->nick);
/* send our current user configuration */
- fname = g_strdup_printf("%s/.irssi/users.temp", g_get_home_dir());
+ fname = g_strdup_printf("%s/users.temp", get_irssi_dir());
botuser_save(fname);
botnet_send_file(bot->botnet, bot->nick, fname);
g_free(fname);
diff --git a/src/irc/bot/botnet.c b/src/irc/bot/botnet.c
index 935b337e..15c64b80 100644
--- a/src/irc/bot/botnet.c
+++ b/src/irc/bot/botnet.c
@@ -636,7 +636,7 @@ static void botnet_event_file(BOT_REC *bot, const char *data, const char *sender
bot = node->data;
if (bot->file_handle <= 0) {
/* first line - data contains file name */
- str = g_strdup_printf("%s/.irssi/%s", g_get_home_dir(), data);
+ str = g_strdup_printf("%s/%s", get_irssi_dir(), data);
bot->file_handle = open(str, O_CREAT|O_TRUNC|O_WRONLY, 0600);
g_free(str);
} else if (*data == '\0') {
@@ -755,7 +755,7 @@ static void botnet_config_read(void)
char *fname;
/* Read botnets from ~/.irssi/botnets */
- fname = g_strdup_printf("%s/.irssi/botnets", g_get_home_dir());
+ fname = g_strdup_printf("%s/botnets", get_irssi_dir());
config = config_open(fname, -1);
g_free(fname);
diff --git a/src/irc/core/irc-log.c b/src/irc/core/irc-log.c
index 2b23bdf8..717686df 100644
--- a/src/irc/core/irc-log.c
+++ b/src/irc/core/irc-log.c
@@ -98,7 +98,7 @@ void irc_log_init(void)
away_filepos = 0;
away_msgs = 0;
- settings_add_str("log", "awaylog_file", "~/.irssi/away.log");
+ settings_add_str("log", "awaylog_file", IRSSI_DIR_SHORT"/away.log");
settings_add_str("log", "awaylog_level", "msgs hilight");
signal_add("log written", (SIGNAL_FUNC) sig_log_written);
diff --git a/src/perl/perl.c b/src/perl/perl.c
index 9fbab064..6fe5d3b5 100644
--- a/src/perl/perl.c
+++ b/src/perl/perl.c
@@ -184,7 +184,7 @@ static void cmd_run(const char *data)
g_strdup(data) : g_strdup_printf("%s.pl", data);
/* check from ~/.irssi/scripts/ */
- fname = g_strdup_printf("%s/.irssi/scripts/%s", g_get_home_dir(), name);
+ fname = g_strdup_printf("%s/scripts/%s", get_irssi_dir(), name);
if (stat(fname, &statbuf) != 0) {
/* check from SCRIPTDIR */
g_free(fname),
@@ -368,7 +368,7 @@ static void irssi_perl_autorun(void)
struct stat statbuf;
char *path, *fname;
- path = g_strdup_printf("%s/.irssi/scripts/autorun", g_get_home_dir());
+ path = g_strdup_printf("%s/scripts/autorun", get_irssi_dir());
dirp = opendir(path);
if (dirp == NULL) {
g_free(path);