mirror of
https://github.com/profanity-im/profanity.git
synced 2024-12-04 14:46:46 -05:00
Moved function to get chat log dir to log.c
This commit is contained in:
parent
66647546f4
commit
0b4c464919
13
src/files.c
13
src/files.c
@ -45,19 +45,6 @@ files_create_directories(void)
|
|||||||
_files_create_themes_directory();
|
_files_create_themes_directory();
|
||||||
}
|
}
|
||||||
|
|
||||||
gchar *
|
|
||||||
files_get_chatlog_dir(void)
|
|
||||||
{
|
|
||||||
gchar *xdg_data = xdg_get_data_home();
|
|
||||||
GString *chatlogs_dir = g_string_new(xdg_data);
|
|
||||||
g_string_append(chatlogs_dir, "/profanity/chatlogs");
|
|
||||||
gchar *result = strdup(chatlogs_dir->str);
|
|
||||||
g_free(xdg_data);
|
|
||||||
g_string_free(chatlogs_dir, TRUE);
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
gchar *
|
gchar *
|
||||||
files_get_preferences_file(void)
|
files_get_preferences_file(void)
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,6 @@
|
|||||||
#define FILES_H
|
#define FILES_H
|
||||||
|
|
||||||
void files_create_directories(void);
|
void files_create_directories(void);
|
||||||
gchar* files_get_chatlog_dir(void);
|
|
||||||
gchar* files_get_preferences_file(void);
|
gchar* files_get_preferences_file(void);
|
||||||
gchar* files_get_log_file(void);
|
gchar* files_get_log_file(void);
|
||||||
gchar* files_get_themes_dir(void);
|
gchar* files_get_themes_dir(void);
|
||||||
|
17
src/log.c
17
src/log.c
@ -62,6 +62,7 @@ static void _free_chat_log(struct dated_chat_log *dated_log);
|
|||||||
static gboolean _key_equals(void *key1, void *key2);
|
static gboolean _key_equals(void *key1, void *key2);
|
||||||
static char * _get_log_filename(const char * const other, const char * const login,
|
static char * _get_log_filename(const char * const other, const char * const login,
|
||||||
GDateTime *dt, gboolean create);
|
GDateTime *dt, gboolean create);
|
||||||
|
static gchar * _get_chatlog_dir(void);
|
||||||
|
|
||||||
static void _rotate_log_file(void);
|
static void _rotate_log_file(void);
|
||||||
|
|
||||||
@ -358,7 +359,7 @@ static char *
|
|||||||
_get_log_filename(const char * const other, const char * const login,
|
_get_log_filename(const char * const other, const char * const login,
|
||||||
GDateTime *dt, gboolean create)
|
GDateTime *dt, gboolean create)
|
||||||
{
|
{
|
||||||
gchar *chatlogs_dir = files_get_chatlog_dir();
|
gchar *chatlogs_dir = _get_chatlog_dir();
|
||||||
GString *log_file = g_string_new(chatlogs_dir);
|
GString *log_file = g_string_new(chatlogs_dir);
|
||||||
g_free(chatlogs_dir);
|
g_free(chatlogs_dir);
|
||||||
|
|
||||||
@ -384,3 +385,17 @@ _get_log_filename(const char * const other, const char * const login,
|
|||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gchar *
|
||||||
|
_get_chatlog_dir(void)
|
||||||
|
{
|
||||||
|
gchar *xdg_data = xdg_get_data_home();
|
||||||
|
GString *chatlogs_dir = g_string_new(xdg_data);
|
||||||
|
g_string_append(chatlogs_dir, "/profanity/chatlogs");
|
||||||
|
gchar *result = strdup(chatlogs_dir->str);
|
||||||
|
g_free(xdg_data);
|
||||||
|
g_string_free(chatlogs_dir, TRUE);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user