From: Jonathan Neuschäfer Date: Wed, 23 May 2012 01:21:05 +0000 (+0200) Subject: screen_chat: add an option to set the message prefix X-Git-Tag: release-0.21~25^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=99eeda05059e04a53f4b750b811fe0c5b841ff9a;p=ncmpc.git screen_chat: add an option to set the message prefix --- diff --git a/src/conf.c b/src/conf.c index 50feefe..f9b6918 100644 --- a/src/conf.c +++ b/src/conf.c @@ -80,6 +80,7 @@ #define CONF_LYRICS_SHOW_PLUGIN "lyrics-show-plugin" #define CONF_TEXT_EDITOR "text-editor" #define CONF_TEXT_EDITOR_ASK "text-editor-ask" +#define CONF_CHAT_PREFIX "chat-prefix" #define CONF_SECOND_COLUMN "second-column" static bool @@ -543,6 +544,12 @@ parse_line(char *line) options.text_editor_ask = str2bool(value); #else {} +#endif + else if (!strcasecmp(name, CONF_CHAT_PREFIX)) +#ifdef ENABLE_CHAT_SCREEN + options.chat_prefix = get_format(value); +#else + {} #endif else if (!strcasecmp(CONF_SECOND_COLUMN, name)) #ifdef NCMPC_MINI diff --git a/src/options.c b/src/options.c index 0129b23..6f674c6 100644 --- a/src/options.c +++ b/src/options.c @@ -409,4 +409,7 @@ options_deinit(void) #ifdef ENABLE_LYRICS_SCREEN g_free(options.text_editor); #endif +#ifdef ENABLE_CHAT_SCREEN + g_free(options.chat_prefix); +#endif } diff --git a/src/options.h b/src/options.h index c1a833d..74dfd42 100644 --- a/src/options.h +++ b/src/options.h @@ -51,6 +51,9 @@ typedef struct { bool lyrics_show_plugin; char *text_editor; bool text_editor_ask; +#endif +#ifdef ENABLE_CHAT_SCREEN + char *chat_prefix; #endif bool find_wrap; bool find_show_last_pattern; diff --git a/src/screen_chat.c b/src/screen_chat.c index 6daca65..2b887ba 100644 --- a/src/screen_chat.c +++ b/src/screen_chat.c @@ -147,6 +147,12 @@ screen_chat_get_prefix(void) if (prefix) return prefix; + if (options.chat_prefix) { + /* Options are encoded in the "locale" charset */ + prefix = locale_to_utf8(options.chat_prefix); + return prefix; + } + prefix = g_strconcat("<", g_get_user_name(), "> ", NULL); return prefix; }