Buffers ordered by number, unique color for each nick, action messages now like messages (not crappy msgs), --enable-debug replaced by --with-debug for ./configure script

This commit is contained in:
Sebastien Helleu 2004-07-02 23:19:36 +00:00
parent 062e5ea1ae
commit b9a40bbe21
18 changed files with 122 additions and 84 deletions

View File

@ -1,13 +1,19 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2004-07-01
ChangeLog - 2004-07-03
Version 0.0.7 (under dev!):
* windows management (split terminal horizontally/vertically)
* windows management improved: buffers ordered by number, split terminal
horizontally/vertically
* unique color for each nick (based on nickname)
* action messages are now considered as messages, not crappy joins/parts
* fixed display bug when nicklist is displayed at bottom of screen
* added history limit (text buffer & commands)
* replaced --enable-debug with --with-debug option for ./configure, which is
now integer: 1 = compiler debug flag, 2 = same 1 with verbose debug messages
in WeeChat (default: 0 = no debug)
Version 0.0.6 (2004-06-05):
* improved channel highlight (priority to message vs join/part)

3
TODO
View File

@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2004-07-01
TODO - 2004-07-03
Legend:
# done
@ -22,6 +22,7 @@ v0.0.7:
* Interface:
+ split terminal in multiple windows (horizontally/vertically)
+ hotlist (channels with activity) and auto-jump to channels
+ internationalization (traduce WeeChat in many languages)
* Configuration:

View File

@ -59,7 +59,7 @@ AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (defa
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging messages (default=no)],enable_debug=yes,enable_debug=no)
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
enable_plugins="no"
enable_python="no"
@ -108,13 +108,16 @@ fi
AC_SUBST(PLUGINS_LIBS)
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE(DEBUG)
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
CFLAGS="-Wall -W -pipe -O2 -g"
else
CFLAGS="-Wall -W -pipe -O2"
fi
if test "x$debug" = "x2" ; then
AC_DEFINE(DEBUG)
fi
AC_OUTPUT([Makefile
src/Makefile
src/common/Makefile
@ -146,6 +149,15 @@ if test "x$listgui" = "x" ; then
AC_MSG_ERROR([No interface specified... Please specify at least Curses, Gtk or Qt.])
fi
msg_debug_compiler="No"
msg_debug_verbose="No"
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
msg_debug_compiler="Yes"
fi
if test "x$debug" = "x2" ; then
msg_debug_verbose="Yes"
fi
echo
echo Interfaces.................... :$listgui
echo
@ -154,7 +166,8 @@ echo Build with Perl support....... : $enable_perl
echo Build with Python support..... : $enable_python
echo Build with Ruby support....... : $enable_ruby
echo
echo Print debugging messages...... : $enable_debug
echo Compile with debug info....... : $msg_debug_compiler
echo Print debugging messages...... : $msg_debug_verbose
echo
eval eval echo WeeChat will be installed in $bindir.
echo

View File

@ -28,4 +28,6 @@ lib_weechat_main_a_SOURCES = weechat.c \
weeconfig.c \
weeconfig.h \
history.c \
history.h
history.h \
hotlist.c \
hotlist.h

View File

@ -840,11 +840,11 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
COLOR_WIN_STATUS);
}
if (SERVER(ptr_buffer)->is_connected)
wprintw (ptr_win->win_status, "[%s] ",
SERVER(ptr_buffer)->name);
wprintw (ptr_win->win_status, "%d:[%s] ",
ptr_buffer->number, SERVER(ptr_buffer)->name);
else
wprintw (ptr_win->win_status, "(%s) ",
SERVER(ptr_buffer)->name);
wprintw (ptr_win->win_status, "%d:(%s) ",
ptr_buffer->number, SERVER(ptr_buffer)->name);
}
if (SERVER(ptr_buffer) && CHANNEL(ptr_buffer))
{
@ -880,7 +880,9 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS);
}
wprintw (ptr_win->win_status, "%s", CHANNEL(ptr_buffer)->name);
wprintw (ptr_win->win_status, "%d:%s",
ptr_buffer->number,
CHANNEL(ptr_buffer)->name);
if (ptr_win->buffer == CHANNEL(ptr_buffer)->buffer)
{
/* display channel modes */
@ -914,7 +916,8 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
if (!SERVER(ptr_buffer))
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
wprintw (ptr_win->win_status, _("[not connected] "));
wprintw (ptr_win->win_status, _("%d:[not connected] "),
ptr_buffer->number);
}
}

View File

@ -145,6 +145,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
{
new_buffer->num_displayed = 0;
new_buffer->number = (gui_buffers) ? last_gui_buffer->number + 1 : 1;
/* assign server and channel to buffer */
SERVER(new_buffer) = server;

View File

@ -127,6 +127,8 @@ struct t_gui_buffer
{
int num_displayed; /* number of windows displaying buffer */
int number; /* buffer number (for jump/switch) */
/* server/channel */
void *server; /* buffer's server */
void *channel; /* buffer's channel */

View File

@ -37,34 +37,18 @@
*/
int
nick_find_color (t_irc_channel *channel)
nick_find_color (t_irc_channel *channel, t_irc_nick *nick)
{
int i, color_less_used, min_used;
int count_used[COLOR_WIN_NICK_NUMBER];
t_irc_nick *ptr_nick;
int i, color;
/* initialize array for counting usage of color */
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
count_used[i] = 0;
/* summarize each color usage */
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
count_used[ptr_nick->color - COLOR_WIN_NICK_FIRST]++;
/* look for color less used on channel */
color_less_used = -1;
min_used = INT_MAX;
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
color = 0;
for (i = 0; i < strlen(nick->nick); i++)
{
if (count_used[i] < min_used)
{
color_less_used = i;
min_used = count_used[i];
}
color += (int)(nick->nick[i]);
}
color = (color % COLOR_WIN_NICK_NUMBER);
return (color_less_used < 0) ?
COLOR_WIN_NICK_FIRST : COLOR_WIN_NICK_FIRST + color_less_used;
return COLOR_WIN_NICK_FIRST + color;
}
/*
@ -195,7 +179,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
new_nick->color = COLOR_WIN_NICK_SELF;
else
new_nick->color = nick_find_color (channel);
new_nick->color = nick_find_color (channel, new_nick);
nick_insert_sorted (channel, new_nick);
@ -235,6 +219,10 @@ nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick)
if (nick->nick)
free (nick->nick);
nick->nick = strdup (new_nick);
if (strcasecmp (nick->nick, SERVER(channel->buffer)->nick) == 0)
nick->color = COLOR_WIN_NICK_SELF;
else
nick->color = nick_find_color (channel, nick);
/* insert again nick into sorted list */
nick_resort (channel, nick);

View File

@ -944,8 +944,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
{
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
@ -955,8 +957,9 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
host, pos);
}
else
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n", pos);
}

View File

@ -1,13 +1,19 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2004-07-01
ChangeLog - 2004-07-03
Version 0.0.7 (under dev!):
* windows management (split terminal horizontally/vertically)
* windows management improved: buffers ordered by number, split terminal
horizontally/vertically
* unique color for each nick (based on nickname)
* action messages are now considered as messages, not crappy joins/parts
* fixed display bug when nicklist is displayed at bottom of screen
* added history limit (text buffer & commands)
* replaced --enable-debug with --with-debug option for ./configure, which is
now integer: 1 = compiler debug flag, 2 = same 1 with verbose debug messages
in WeeChat (default: 0 = no debug)
Version 0.0.6 (2004-06-05):
* improved channel highlight (priority to message vs join/part)

View File

@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
TODO - 2004-07-01
TODO - 2004-07-03
Legend:
# done
@ -22,6 +22,7 @@ v0.0.7:
* Interface:
+ split terminal in multiple windows (horizontally/vertically)
+ hotlist (channels with activity) and auto-jump to channels
+ internationalization (traduce WeeChat in many languages)
* Configuration:

View File

@ -59,7 +59,7 @@ AC_ARG_ENABLE(curses, [ --disable-curses Turn off Curses interface (defa
AC_ARG_ENABLE(gtk, [ --enable-gtk Turn on Gtk+ interface (default=no)],enable_gtk=yes,enable_gtk=no)
AC_ARG_ENABLE(qt, [ --enable-qt Turn on Qt interface (default=no)],enable_qt=yes,enable_qt=no)
AC_ARG_ENABLE(perl, [ --enable-perl Turn on Perl plugins (default=no)],enable_perl=yes,enable_perl=no)
AC_ARG_ENABLE(debug, [ --enable-debug Turn on debugging messages (default=no)],enable_debug=yes,enable_debug=no)
AC_ARG_WITH(debug, [ --with-debug Debugging: 0=no debug, 1=debug compilation, 2=debug compilation + verbose msgs (default=0)],debug=$withval,debug=0)
enable_plugins="no"
enable_python="no"
@ -108,13 +108,16 @@ fi
AC_SUBST(PLUGINS_LIBS)
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE(DEBUG)
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
CFLAGS="-Wall -W -pipe -O2 -g"
else
CFLAGS="-Wall -W -pipe -O2"
fi
if test "x$debug" = "x2" ; then
AC_DEFINE(DEBUG)
fi
AC_OUTPUT([Makefile
src/Makefile
src/common/Makefile
@ -146,6 +149,15 @@ if test "x$listgui" = "x" ; then
AC_MSG_ERROR([No interface specified... Please specify at least Curses, Gtk or Qt.])
fi
msg_debug_compiler="No"
msg_debug_verbose="No"
if test "x$debug" = "x1" || test "x$debug" = "x2" ; then
msg_debug_compiler="Yes"
fi
if test "x$debug" = "x2" ; then
msg_debug_verbose="Yes"
fi
echo
echo Interfaces.................... :$listgui
echo
@ -154,7 +166,8 @@ echo Build with Perl support....... : $enable_perl
echo Build with Python support..... : $enable_python
echo Build with Ruby support....... : $enable_ruby
echo
echo Print debugging messages...... : $enable_debug
echo Compile with debug info....... : $msg_debug_compiler
echo Print debugging messages...... : $msg_debug_verbose
echo
eval eval echo WeeChat will be installed in $bindir.
echo

View File

@ -28,4 +28,6 @@ lib_weechat_main_a_SOURCES = weechat.c \
weeconfig.c \
weeconfig.h \
history.c \
history.h
history.h \
hotlist.c \
hotlist.h

View File

@ -840,11 +840,11 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
COLOR_WIN_STATUS);
}
if (SERVER(ptr_buffer)->is_connected)
wprintw (ptr_win->win_status, "[%s] ",
SERVER(ptr_buffer)->name);
wprintw (ptr_win->win_status, "%d:[%s] ",
ptr_buffer->number, SERVER(ptr_buffer)->name);
else
wprintw (ptr_win->win_status, "(%s) ",
SERVER(ptr_buffer)->name);
wprintw (ptr_win->win_status, "%d:(%s) ",
ptr_buffer->number, SERVER(ptr_buffer)->name);
}
if (SERVER(ptr_buffer) && CHANNEL(ptr_buffer))
{
@ -880,7 +880,9 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
gui_window_set_color (ptr_win->win_status,
COLOR_WIN_STATUS);
}
wprintw (ptr_win->win_status, "%s", CHANNEL(ptr_buffer)->name);
wprintw (ptr_win->win_status, "%d:%s",
ptr_buffer->number,
CHANNEL(ptr_buffer)->name);
if (ptr_win->buffer == CHANNEL(ptr_buffer)->buffer)
{
/* display channel modes */
@ -914,7 +916,8 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
if (!SERVER(ptr_buffer))
{
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
wprintw (ptr_win->win_status, _("[not connected] "));
wprintw (ptr_win->win_status, _("%d:[not connected] "),
ptr_buffer->number);
}
}

View File

@ -145,6 +145,7 @@ gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
{
new_buffer->num_displayed = 0;
new_buffer->number = (gui_buffers) ? last_gui_buffer->number + 1 : 1;
/* assign server and channel to buffer */
SERVER(new_buffer) = server;

View File

@ -127,6 +127,8 @@ struct t_gui_buffer
{
int num_displayed; /* number of windows displaying buffer */
int number; /* buffer number (for jump/switch) */
/* server/channel */
void *server; /* buffer's server */
void *channel; /* buffer's channel */

View File

@ -37,34 +37,18 @@
*/
int
nick_find_color (t_irc_channel *channel)
nick_find_color (t_irc_channel *channel, t_irc_nick *nick)
{
int i, color_less_used, min_used;
int count_used[COLOR_WIN_NICK_NUMBER];
t_irc_nick *ptr_nick;
int i, color;
/* initialize array for counting usage of color */
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
count_used[i] = 0;
/* summarize each color usage */
for (ptr_nick = channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
count_used[ptr_nick->color - COLOR_WIN_NICK_FIRST]++;
/* look for color less used on channel */
color_less_used = -1;
min_used = INT_MAX;
for (i = 0; i < COLOR_WIN_NICK_NUMBER; i++)
color = 0;
for (i = 0; i < strlen(nick->nick); i++)
{
if (count_used[i] < min_used)
{
color_less_used = i;
min_used = count_used[i];
}
color += (int)(nick->nick[i]);
}
color = (color % COLOR_WIN_NICK_NUMBER);
return (color_less_used < 0) ?
COLOR_WIN_NICK_FIRST : COLOR_WIN_NICK_FIRST + color_less_used;
return COLOR_WIN_NICK_FIRST + color;
}
/*
@ -195,7 +179,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
if (strcasecmp (new_nick->nick, SERVER(channel->buffer)->nick) == 0)
new_nick->color = COLOR_WIN_NICK_SELF;
else
new_nick->color = nick_find_color (channel);
new_nick->color = nick_find_color (channel, new_nick);
nick_insert_sorted (channel, new_nick);
@ -235,6 +219,10 @@ nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick)
if (nick->nick)
free (nick->nick);
nick->nick = strdup (new_nick);
if (strcasecmp (nick->nick, SERVER(channel->buffer)->nick) == 0)
nick->color = COLOR_WIN_NICK_SELF;
else
nick->color = nick_find_color (channel, nick);
/* insert again nick into sorted list */
nick_resort (channel, nick);

View File

@ -944,8 +944,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
{
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
&& (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
@ -955,8 +957,9 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
host, pos);
}
else
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT_NICK, "%s", host);
gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n", pos);
}