Code

screen_interface: make cols/rows unsigned
[ncmpc.git] / src / screen_chat.c
index 6daca65aecd25f31fc3788b887f08b04e39c9f8c..f79e73fcf7b0195b2a97885a6b0ab0e6ee640e36 100644 (file)
@@ -1,5 +1,5 @@
 /* ncmpc (Ncurses MPD Client)
- * (c) 2004-2012 The Music Player Daemon Project
+ * (c) 2004-2017 The Music Player Daemon Project
  * Project homepage: http://musicpd.org
  *
  * This program is free software; you can redistribute it and/or modify
@@ -74,7 +74,7 @@ check_chat_support(struct mpdclient *c)
 }
 
 static void
-screen_chat_init(WINDOW *w, int cols, int rows)
+screen_chat_init(WINDOW *w, unsigned cols, unsigned rows)
 {
        screen_text_init(&text, w, cols, rows);
 }
@@ -92,7 +92,7 @@ screen_chat_open(struct mpdclient *c)
 }
 
 static void
-screen_chat_resize(int cols, int rows)
+screen_chat_resize(unsigned cols, unsigned rows)
 {
        screen_text_resize(&text, cols, rows);
 }
@@ -106,14 +106,12 @@ screen_chat_paint(void)
 static void
 process_message(struct mpd_message *message)
 {
-       char *message_text;
-
        assert(message != NULL);
        /* You'll have to move this out of screen_chat, if you want to use
           client-to-client messages anywhere else */
        assert(g_strcmp0(mpd_message_get_channel(message), chat_channel) == 0);
 
-       message_text = utf8_to_locale(mpd_message_get_text(message));
+       char *message_text = utf8_to_locale(mpd_message_get_text(message));
        screen_text_append(&text, message_text);
        g_free(message_text);
 
@@ -147,6 +145,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;
 }
@@ -190,7 +194,7 @@ screen_chat_cmd(struct mpdclient *c, command_t cmd)
 }
 
 static const char *
-screen_chat_title(G_GNUC_UNUSED char *s, G_GNUC_UNUSED size_t size)
+screen_chat_title(gcc_unused char *s, gcc_unused size_t size)
 {
        return _("Chat");
 }