Improve color configuration
* Rename color options (it made no sense!!)
* Use default values
* Do not crash anymore when the colors options are buggy in the mcabberrc
--- a/mcabber/ChangeLog Sat Jul 02 19:27:15 2005 +0100
+++ b/mcabber/ChangeLog Sun Jul 03 00:21:59 2005 +0100
@@ -5,6 +5,8 @@
can be sent.
* Ctrl-o (accept-line-and-down-history)
* Add "/roster search jid|name" to look for somebody in the current buddylist
+ * Color configuration handling improvement.
+ NOTE: configuration file needs to be updated; see sample config. file!
-- Mikael, ?
--- a/mcabber/NEWS Sat Jul 02 19:27:15 2005 +0100
+++ b/mcabber/NEWS Sun Jul 03 00:21:59 2005 +0100
@@ -0,0 +1,10 @@
+mcabber (0.6.2-dev)
+
+ * Support for old style (i.e. < 0.6.1) history logfiles has been removed.
+ You can upgrade your logfiles with the script "contrib/conv_log_dates.pl"
+ if you haven't already done it.
+ * The colors option names have changed (and they aren't mandatory anymore).
+ Please look at the sample config. file to update your mcabberrc.
+
+ -- Mikael, ?
+
--- a/mcabber/mcabberrc.example Sat Jul 02 19:27:15 2005 +0100
+++ b/mcabber/mcabberrc.example Sun Jul 03 00:21:59 2005 +0100
@@ -44,15 +44,11 @@
#debug = /home/mikael/mcabber.log
# The colors
-# NOTE: the following settings may or may not be used currently... :)
+# Colors are: black, red, green, yellow, blue, magenta, cyan, white
+#color_background = blue
+#color_general = white
+#color_newmessage = red
+#color_rosternormal = magenta
+#color_rosterselect = black
+#color_backselected = cyan
-# Colors are: black, red, green, yellow, blue, magenta, cyan, white
-color_background = blue
-color_backselected = cyan
-color_borderlines = white
-color_jidonline = green
-color_newmsg = red
-color_jidofflineselected = red
-color_jidoffline = magenta
-color_text = white
-
--- a/mcabber/src/TODO Sat Jul 02 19:27:15 2005 +0100
+++ b/mcabber/src/TODO Sun Jul 03 00:21:59 2005 +0100
@@ -3,8 +3,6 @@
* We should display a warning when we can't write (any more) logs
(bad dir, no space left...)
-* Colors are misnamed
-* Buggy (or inexistent) color setup makes (m)cabber crash
TODO:
--- a/mcabber/src/screen.c Sat Jul 02 19:27:15 2005 +0100
+++ b/mcabber/src/screen.c Sun Jul 03 00:21:59 2005 +0100
@@ -134,26 +134,28 @@
void ParseColors(void)
{
- char *colors[11] = {
+ char *colors[8] = {
"", "",
- "borderlines",
- "jidonline",
+ "general",
"newmsg",
- "jidofflineselected",
- "jidoffline",
- "text",
+ "rosterselect",
+ "rosternormal",
NULL
};
char *tmp = malloc(1024);
- char *color1;
+ char *color;
char *background = cfg_read("color_background");
char *backselected = cfg_read("color_backselected");
int i = 0;
+ // Default values
+ if (!background) background = "blue";
+ if (!backselected) backselected = "cyan";
+
while (colors[i]) {
sprintf(tmp, "color_%s", colors[i]);
- color1 = cfg_read(tmp);
+ color = cfg_read(tmp);
switch (i + 1) {
case 1:
@@ -163,22 +165,20 @@
init_pair(2, COLOR_WHITE, COLOR_BLACK);
break;
case 3:
- init_pair(3, FindColor(color1), FindColor(background));
+ init_pair(3, ((color) ? FindColor(color) : COLOR_WHITE),
+ FindColor(background));
break;
case 4:
- init_pair(4, FindColor(color1), FindColor(backselected));
+ init_pair(4, ((color) ? FindColor(color) : COLOR_RED),
+ FindColor(background));
break;
case 5:
- init_pair(5, FindColor(color1), FindColor(background));
+ init_pair(5, ((color) ? FindColor(color) : COLOR_BLACK),
+ FindColor(backselected));
break;
case 6:
- init_pair(6, FindColor(color1), FindColor(backselected));
- break;
- case 7:
- init_pair(7, FindColor(color1), FindColor(background));
- break;
- case 8:
- init_pair(8, FindColor(color1), FindColor(background));
+ init_pair(6, ((color) ? FindColor(color) : COLOR_MAGENTA),
+ FindColor(background));
break;
}
i++;
--- a/mcabber/src/screen.h Sat Jul 02 19:27:15 2005 +0100
+++ b/mcabber/src/screen.h Sun Jul 03 00:21:59 2005 +0100
@@ -4,12 +4,10 @@
#include <ncurses.h>
#include <glib.h>
-//#define COLOR_NMSG 1
#define COLOR_GENERAL 3
-//#define COLOR_BD_CON 4
-#define COLOR_NMSG 5
-#define COLOR_BD_DESSEL 6
-#define COLOR_BD_DES 7
+#define COLOR_NMSG 4
+#define COLOR_BD_DESSEL 5
+#define COLOR_BD_DES 6
#define LOG_WIN_HEIGHT (5+2)
#define ROSTER_WIDTH 24