mirror of
https://github.com/weechat/weechat.git
synced 2026-06-19 09:34:47 +02:00
Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| c94e1204aa | |||
| 2d438492d7 | |||
| 8959ba9759 | |||
| b9e5c94032 | |||
| 4c660ad565 | |||
| ab393805fb | |||
| dea586e5f1 | |||
| e1afa31563 | |||
| 750a5cbc6d | |||
| 77fab4ae29 | |||
| 622a18fb3f | |||
| 97b34b36fc | |||
| fb21a1c7f9 | |||
| f02ba717a0 | |||
| 9e6938bdf7 | |||
| b9a40bbe21 | |||
| 062e5ea1ae | |||
| 66ff97166f | |||
| 095f296529 | |||
| 340176d635 | |||
| fed6c36d19 | |||
| 3f84a8456a |
@@ -1,12 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2004-06-05
|
||||
WeeChat known bugs, 2004-08-08
|
||||
|
||||
- ./configure does not check that Curses headers are installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- ./configure does not check that Perl headers & libraries are installed
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- problem when resizing terminal and that some windows are outside new term size
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(IRC protocol is under dev!)
|
||||
- too much opened channels => display bug
|
||||
|
||||
@@ -1,9 +1,22 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2004-06-05
|
||||
ChangeLog - 2004-08-08
|
||||
|
||||
|
||||
Version 0.0.7 (2004-08-08):
|
||||
* new "col_status_delimiters" config option
|
||||
* /buffer command added, buffers ordered by number, auto-jump to active
|
||||
buffers (alt-a), jump to buffers by number (alt-number)
|
||||
* /window command added, 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)
|
||||
* fixed bug when opened private win and remote user changes his nick
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2004-08-08
|
||||
|
||||
WeeChat 0.0.7 released.
|
||||
|
||||
* FlashCode, 2004-06-05
|
||||
|
||||
WeeChat 0.0.6 released.
|
||||
|
||||
* FlashCode, 2004-02-07
|
||||
|
||||
WeeChat 0.0.5 released.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2004-06-05
|
||||
TODO - 2004-08-08
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,7 +10,7 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.6:
|
||||
v0.0.8:
|
||||
------
|
||||
|
||||
* General:
|
||||
@@ -18,13 +18,14 @@ v0.0.6:
|
||||
+ Solaris version
|
||||
|
||||
* IRC protocol:
|
||||
# "/mode" command: change the user/channels modes
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
# "/query" command: start private conversation
|
||||
|
||||
* Interface:
|
||||
+ "/buffer" command, buffers ordered by number, auto-jump to active
|
||||
buffers (alt-a), jump to buffers by number (alt-number)
|
||||
+ "/window" command, split terminal in multiple windows
|
||||
(horizontally/vertically)
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
# display current channel modes (example : #weechat(+nt))
|
||||
|
||||
* Configuration:
|
||||
+ add missing options for config file
|
||||
@@ -63,10 +64,7 @@ Future versions:
|
||||
+ Gtk GUI
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
- forget some old lines that were displayed long time ago (now all is saved,
|
||||
if WeeChat is running for long time, a lot of memory is used!)
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- tab key with empty command line should switch to next window (like F7)
|
||||
@@ -79,10 +77,6 @@ Future versions:
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
|
||||
* Configuration:
|
||||
- load config file after GUI (so init values by default (colors, ...) before
|
||||
loading config)
|
||||
|
||||
* Plugins:
|
||||
- Python plugin
|
||||
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||
|
||||
+21
-7
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.6, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.0.7, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.6])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.7])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -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,11 +108,15 @@ 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
|
||||
|
||||
CFLAGS="-Wall -W -pipe -O2"
|
||||
if test "x$debug" = "x2" ; then
|
||||
AC_DEFINE(DEBUG)
|
||||
fi
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
@@ -145,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
|
||||
@@ -153,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
|
||||
|
||||
Vendored
+6
@@ -1,3 +1,9 @@
|
||||
weechat (0.0.7-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.7, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 08 Aug 2004 21:00:00 +0200
|
||||
|
||||
weechat (0.0.6-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.6, see ChangeLog for detail.
|
||||
|
||||
Vendored
-8
@@ -21,14 +21,6 @@ Description: Fast, light and extensible IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-gtk
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-common
|
||||
Architecture: all
|
||||
Replaces: weechat
|
||||
|
||||
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 05 Jun 2004 11:30:00 +0200.
|
||||
Sat, 08 Aug 2004 21:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
|
||||
Vendored
+2
-2
@@ -17,7 +17,7 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-perl --enable-gtk
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-perl
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ install: build
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
||||
dh_install --sourcedir=debian/weechat
|
||||
install -o root -g root -m 755 src/gui/curses/weechat-curses $(CURDIR)/debian/weechat-curses/usr/bin
|
||||
install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||
#install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
|
||||
+17
-8
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.0.6 - June, 05 2004
|
||||
@subtitle Documentation for WeeChat v0.0.7 - July, 04 2004
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -156,7 +156,7 @@ Mandrake/Redhat (or any RPM compatible distribution)@*
|
||||
To install: @kbd{rpm -i /path/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
To install: see Gentoo documentation
|
||||
To install: @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (not available!)
|
||||
@item
|
||||
@@ -178,7 +178,7 @@ Nota: to build only some interfaces, you can give parameters
|
||||
to ./configure, type @kbd{./configure --help} for help about options.@*
|
||||
|
||||
Then get root privileges and install WeeChat:@*
|
||||
@kbd{su -}@*
|
||||
@kbd{su}@*
|
||||
(enter root password)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@@ -343,12 +343,12 @@ Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status
|
||||
Color for status bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
@item col_status_active
|
||||
Color for active window (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_status_data_msg
|
||||
Color for window with new messages (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightred'@*
|
||||
@item col_status_highlight
|
||||
Color for window with highlight (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_status_data_other
|
||||
Color for window with new data (not messages) (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
|
||||
@@ -572,14 +572,23 @@ Execute command or send message@*
|
||||
Call again last commands/messages@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Show window history@*
|
||||
Show buffer history@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Switch to previous / next window@*
|
||||
Switch to previous / next buffer@*
|
||||
@*
|
||||
@item F8
|
||||
Switch to next window@*
|
||||
@*
|
||||
@item Alt + left arrow / Alt + right arrow
|
||||
Same as F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Switch to next buffer with activity (with priority: highlight, message, other)@*
|
||||
@*
|
||||
@item Alt + digit (1-9)
|
||||
Switch to buffer by number@*
|
||||
@*
|
||||
@item F10
|
||||
Remove last infobar message@*
|
||||
@*
|
||||
|
||||
+17
-8
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.0.6 - 5 juin 2004
|
||||
@subtitle Documentation pour WeeChat v0.0.7 - 04 juillet 2004
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -155,7 +155,7 @@ Mandrake/Redhat (ou toute distribution compatible avec les RPM)@*
|
||||
Pour installer : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
Pour installer : voir la documentation Gentoo
|
||||
Pour installer : @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (non disponible !)
|
||||
@item
|
||||
@@ -177,7 +177,7 @@ Note: pour ne construire que certaines interfaces, vous pouvez passer des param@
|
||||
@`a ./configure, tapez @kbd{./configure --help} pour de l'aide sur ces options.@*
|
||||
|
||||
Obtenez les droits root et installez WeeChat :@*
|
||||
@kbd{su -}@*
|
||||
@kbd{su}@*
|
||||
(entrez le mot de passe de root)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@@ -343,12 +343,12 @@ Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status
|
||||
Couleur pour la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
@item col_status_active
|
||||
Couleur pour la fen@^etre active (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_status_data_msg
|
||||
Couleur pour une fen@^etre avec de nouvelles infos (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightred'@*
|
||||
@item col_status_highlight
|
||||
Color for window with highlight (status bar)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_status_data_other
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (pas des infos) (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
|
||||
@@ -572,14 +572,23 @@ Ex@'ecuter la commande ou envoyer le message@*
|
||||
Rappeler les derni@`eres commandes/messages@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Afficher l'historique de la fen@^etre@*
|
||||
Afficher l'historique du tampon@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Aller @`a la fen@^etre pr@'ec@'edente / suivante@*
|
||||
Aller au tampon pr@'ec@'edent@*
|
||||
@*
|
||||
@item F8
|
||||
Aller @`a la fen@^etre suivante@*
|
||||
@*
|
||||
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
|
||||
Identique @`a F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Sauter au tampon avec activit@'e (avec priorit@'e: highlight, message, autre)@*
|
||||
@*
|
||||
@item Alt + chiffre (1-9)
|
||||
Sauter au tampon avec ce num@'ero@*
|
||||
@*
|
||||
@item F10
|
||||
Effacer le dernier message de la barre d'infos@*
|
||||
@*
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.6 - 05 de Junho de 2004
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.7 - 04 de Julho de 2004
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -154,7 +154,7 @@ Mandrake/Redhat (ou outra distro compat@'ivel com RPMs)@*
|
||||
Instala@,{c}@~ao : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
Instala@,{c}@~ao : ver a documenta@,{c}@~ao da Gentoo
|
||||
Instala@,{c}@~ao : @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (non disponible !)
|
||||
@item
|
||||
@@ -176,7 +176,7 @@ Nota: Para compilar certas interfaces, podes passar par@^ametros
|
||||
ao ./configure, escreve @kbd{./configure --help} para veres as op@,{c}@~oes.@*
|
||||
|
||||
Obter os direitos do root e instalar o Weechat :@*
|
||||
@kbd{su -}@*
|
||||
@kbd{su}@*
|
||||
(escreve aqui a palavra-passe do superutilizador)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@@ -277,6 +277,12 @@ Ir para a janela anterior/seguinte@*
|
||||
@item Alt + Seta da esquerda / Alt + Seta da direita
|
||||
Identico a F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
|
||||
@*
|
||||
@item Alt + d@'igito (1-9)
|
||||
Comute ao amortecedor pelo n@'umero@*
|
||||
@*
|
||||
@item F10
|
||||
Apagar a @'ultima mensagem da barra do info@*
|
||||
@*
|
||||
|
||||
+404
-345
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
+118
-26
@@ -43,6 +43,13 @@ t_weechat_command weechat_commands[] =
|
||||
N_("alias_name: name of alias\ncommand: command name (WeeChat "
|
||||
"or IRC command, without first '/')\n" "arguments: arguments for command"),
|
||||
0, MAX_ARGS, NULL, weechat_cmd_alias },
|
||||
{ "buffer", N_("manage buffers"),
|
||||
N_("[action | number]"),
|
||||
N_("action: action to do:\n"
|
||||
" move move buffer in the list (may be relative, for example -1)\n"
|
||||
" list list opened buffers (no parameter implies this list)\n"
|
||||
"number: jump to buffer by number"),
|
||||
0, MAX_ARGS, weechat_cmd_buffer, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
N_("[-all]"),
|
||||
N_("-all: clear all windows"),
|
||||
@@ -77,7 +84,7 @@ t_weechat_command weechat_commands[] =
|
||||
"nick2: alternate nick for server\n"
|
||||
"nick3: second alternate nick for server\n"
|
||||
"username: user name\n"
|
||||
"realname: real name of user\n"),
|
||||
"realname: real name of user"),
|
||||
0, MAX_ARGS, weechat_cmd_server, NULL },
|
||||
{ "save", N_("save config to disk"),
|
||||
N_("[file]"), N_("file: filename for writing config"),
|
||||
@@ -88,6 +95,14 @@ t_weechat_command weechat_commands[] =
|
||||
{ "unalias", N_("remove an alias"),
|
||||
N_("alias_name"), N_("alias_name: name of alias to remove"),
|
||||
1, 1, NULL, weechat_cmd_unalias },
|
||||
{ "window", N_("manage windows"),
|
||||
N_("[action]"),
|
||||
N_("action: action to do:\n"
|
||||
" close close current window (under development!)\n"
|
||||
" list list opened windows (no parameter implies this list)\n"
|
||||
" splith split current window horizontally\n"
|
||||
" splitv split current window vertically"),
|
||||
0, MAX_ARGS, weechat_cmd_window, NULL },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -707,46 +722,46 @@ user_command (t_irc_server *server, char *command)
|
||||
{
|
||||
if ((command[0] == '/') && (command[1] == '/'))
|
||||
command++;
|
||||
if (server && (!WIN_IS_SERVER(gui_current_window)))
|
||||
if (server && (!BUFFER_IS_SERVER(gui_current_window->buffer)))
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
command);
|
||||
|
||||
if (WIN_IS_PRIVATE(gui_current_window))
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window), server->nick);
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window->buffer), server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (CHANNEL(gui_current_window)->window, ptr_nick,
|
||||
irc_display_nick (CHANNEL(gui_current_window->buffer)->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot find nick for sending message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_printf ((server) ? server->window : NULL,
|
||||
gui_printf ((server) ? server->buffer : NULL,
|
||||
_("This window is not a channel!\n"));
|
||||
}
|
||||
}
|
||||
@@ -810,6 +825,49 @@ weechat_cmd_alias (char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_buffer: manage buffers
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_buffer (int argc, char **argv)
|
||||
{
|
||||
int number;
|
||||
char *error;
|
||||
|
||||
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0)))
|
||||
{
|
||||
/* list opened bufferss */
|
||||
gui_printf (NULL, "buffer list -- NOT DEVELOPED!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcasecmp (argv[0], "move") == 0)
|
||||
{
|
||||
/* move buffer to another number in the list */
|
||||
gui_printf (NULL, "buffer move -- NOT DEVELOPED!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
number = strtol (argv[0], &error, 10);
|
||||
if (error)
|
||||
{
|
||||
gui_printf (NULL, _("%s incorrect buffer number\n"),
|
||||
WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
if (!gui_switch_to_buffer_by_number (gui_current_window, number))
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s buffer \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, argv[0], "buffer");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_clear: display or create alias
|
||||
*/
|
||||
@@ -820,7 +878,7 @@ weechat_cmd_clear (int argc, char **argv)
|
||||
if (argc == 1)
|
||||
{
|
||||
if (strcmp (argv[0], "-all") == 0)
|
||||
gui_window_clear_all ();
|
||||
gui_buffer_clear_all ();
|
||||
else
|
||||
{
|
||||
gui_printf (NULL,
|
||||
@@ -830,7 +888,7 @@ weechat_cmd_clear (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_window_clear (gui_current_window);
|
||||
gui_buffer_clear (gui_current_window->buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -857,9 +915,9 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (!ptr_server->window)
|
||||
if (!ptr_server->buffer)
|
||||
{
|
||||
if (!gui_window_new (ptr_server, NULL, 1))
|
||||
if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 1))
|
||||
return -1;
|
||||
}
|
||||
if (server_connect (ptr_server))
|
||||
@@ -906,7 +964,7 @@ weechat_cmd_disconnect (int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
server_disconnect (ptr_server);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1300,7 +1358,7 @@ weechat_cmd_server (int argc, char **argv)
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("has been deleted\n"));
|
||||
|
||||
server_free (server_found);
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1441,7 +1499,7 @@ weechat_cmd_server (int argc, char **argv)
|
||||
|
||||
if (new_server->autoconnect)
|
||||
{
|
||||
(void) gui_window_new (new_server, NULL, 1);
|
||||
(void) gui_buffer_new (gui_current_window, new_server, NULL, 1);
|
||||
if (server_connect (new_server))
|
||||
irc_login (new_server);
|
||||
}
|
||||
@@ -1487,7 +1545,7 @@ weechat_cmd_set (char *arguments)
|
||||
if (ptr_option->handler_change == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s option '%s' can not be changed while WeeChat is running\n"),
|
||||
_("%s option \"%s\" can not be changed while WeeChat is running\n"),
|
||||
WEECHAT_ERROR, option);
|
||||
}
|
||||
else
|
||||
@@ -1499,13 +1557,13 @@ weechat_cmd_set (char *arguments)
|
||||
gui_printf (NULL, " %s = %s\n", option, value);
|
||||
}
|
||||
else
|
||||
gui_printf (NULL, _("%s incorrect value for option '%s'\n"),
|
||||
gui_printf (NULL, _("%s incorrect value for option \"%s\"\n"),
|
||||
WEECHAT_ERROR, option);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (NULL, _("%s config option '%s' not found\n"),
|
||||
gui_printf (NULL, _("%s config option \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, option);
|
||||
}
|
||||
}
|
||||
@@ -1575,15 +1633,15 @@ weechat_cmd_set (char *arguments)
|
||||
if (number_found == 0)
|
||||
{
|
||||
if (value)
|
||||
gui_printf (NULL, _("No config option found with '%s'\n"),
|
||||
gui_printf (NULL, _("No config option found with \"%s\"\n"),
|
||||
value);
|
||||
else
|
||||
gui_printf (NULL, _("No config option found with '%s'\n"));
|
||||
gui_printf (NULL, _("No config option found with \"%s\"\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value)
|
||||
gui_printf (NULL, _("%d config option(s) found with '%s'\n"),
|
||||
gui_printf (NULL, _("%d config option(s) found with \"%s\"\n"),
|
||||
number_found, value);
|
||||
else
|
||||
gui_printf (NULL, _("%d config option(s) found\n"),
|
||||
@@ -1619,3 +1677,37 @@ weechat_cmd_unalias (char *arguments)
|
||||
arguments);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_window: manage windows
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_window (int argc, char **argv)
|
||||
{
|
||||
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0)))
|
||||
{
|
||||
/* list opened windows */
|
||||
gui_printf (NULL, "window list -- NOT DEVELOPED!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcasecmp (argv[0], "splith") == 0)
|
||||
{
|
||||
/* split window horizontally */
|
||||
gui_window_split_horiz (gui_current_window);
|
||||
}
|
||||
else if (strcasecmp (argv[0], "splitv") == 0)
|
||||
{
|
||||
/* split window vertically */
|
||||
gui_window_split_vertic (gui_current_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "window");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
@@ -76,5 +77,6 @@ extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
||||
+49
-8
@@ -29,11 +29,14 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_last = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
int num_history_general = 0;
|
||||
|
||||
|
||||
/*
|
||||
@@ -41,27 +44,65 @@ t_history *history_general_ptr = NULL;
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *window, char *string)
|
||||
history_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history;
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
/* add history to general history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
|
||||
/* add history to general history */
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
else
|
||||
history_general_last = new_history;
|
||||
new_history->next_history = history_general;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
num_history_general++;
|
||||
|
||||
/* add history to local history */
|
||||
if (((t_gui_window *)(window))->history)
|
||||
((t_gui_window *)(window))->history->prev_history = new_history;
|
||||
new_history->next_history = ((t_gui_window *)(window))->history;
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (num_history_general > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = history_general_last->prev_history;
|
||||
history_general_last->prev_history->next_history = NULL;
|
||||
if (history_general_last->text)
|
||||
free (history_general_last->text);
|
||||
free (history_general_last);
|
||||
history_general_last = ptr_history;
|
||||
num_history_general--;
|
||||
}
|
||||
}
|
||||
|
||||
/* add history to local history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_window *)window)->history = new_history;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* hotlist.c: WeeChat hotlist (buffers with activity) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "hotlist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_weechat_hotlist *hotlist = NULL;
|
||||
t_weechat_hotlist *last_hotlist = NULL;
|
||||
t_gui_buffer *hotlist_initial_buffer = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* hotlist_search: find hotlist with buffer pointer
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_search (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (ptr_hotlist->buffer == buffer)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_find_pos: find position for a inserting in hotlist (for sorting hotlist)
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_find_pos (t_weechat_hotlist *new_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (new_hotlist->priority > ptr_hotlist->priority)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_add: add a buffer to hotlist, with priority
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_add (int priority, t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist, *pos_hotlist;
|
||||
|
||||
if ((pos_hotlist = hotlist_search (buffer)))
|
||||
{
|
||||
/* return if priority is greater or equal than the one to add */
|
||||
if (pos_hotlist->priority >= priority)
|
||||
return;
|
||||
/* remove buffer if present with lower priority and go on */
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
|
||||
if ((new_hotlist = (t_weechat_hotlist *) malloc (sizeof (t_weechat_hotlist))) == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s cannot add a buffer to hotlist\n"), WEECHAT_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
new_hotlist->priority = priority;
|
||||
new_hotlist->buffer = buffer;
|
||||
|
||||
if (hotlist)
|
||||
{
|
||||
pos_hotlist = hotlist_find_pos (new_hotlist);
|
||||
|
||||
if (pos_hotlist)
|
||||
{
|
||||
/* insert hotlist into the hotlist (before hotlist found) */
|
||||
new_hotlist->prev_hotlist = pos_hotlist->prev_hotlist;
|
||||
new_hotlist->next_hotlist = pos_hotlist;
|
||||
if (pos_hotlist->prev_hotlist)
|
||||
pos_hotlist->prev_hotlist->next_hotlist = new_hotlist;
|
||||
else
|
||||
hotlist = new_hotlist;
|
||||
pos_hotlist->prev_hotlist = new_hotlist;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add hotlist to the end */
|
||||
new_hotlist->prev_hotlist = last_hotlist;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
last_hotlist->next_hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_hotlist->prev_hotlist = NULL;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_free: free a hotlist and remove it from hotlist queue
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_free (t_weechat_hotlist *ptr_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist;
|
||||
|
||||
/* remove hotlist from queue */
|
||||
if (last_hotlist == ptr_hotlist)
|
||||
last_hotlist = ptr_hotlist->prev_hotlist;
|
||||
if (ptr_hotlist->prev_hotlist)
|
||||
{
|
||||
(ptr_hotlist->prev_hotlist)->next_hotlist = ptr_hotlist->next_hotlist;
|
||||
new_hotlist = hotlist;
|
||||
}
|
||||
else
|
||||
new_hotlist = ptr_hotlist->next_hotlist;
|
||||
|
||||
if (ptr_hotlist->next_hotlist)
|
||||
(ptr_hotlist->next_hotlist)->prev_hotlist = ptr_hotlist->prev_hotlist;
|
||||
|
||||
free (ptr_hotlist);
|
||||
hotlist = new_hotlist;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_remove_buffer: remove a buffer from hotlist
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_remove_buffer (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *pos_hotlist;
|
||||
|
||||
pos_hotlist = hotlist_search (buffer);
|
||||
if (pos_hotlist)
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_HOTLIST_H
|
||||
#define __WEECHAT_HOTLIST_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
typedef struct t_weechat_hotlist t_weechat_hotlist;
|
||||
|
||||
struct t_weechat_hotlist
|
||||
{
|
||||
int priority; /* 0=crappy msg (join/part), 1=msg, */
|
||||
/* 2=nick highlight */
|
||||
t_gui_buffer *buffer; /* associated buffer */
|
||||
t_weechat_hotlist *prev_hotlist; /* link to previous hotlist */
|
||||
t_weechat_hotlist *next_hotlist; /* link to next hotlist */
|
||||
};
|
||||
|
||||
extern t_weechat_hotlist *hotlist;
|
||||
extern t_gui_buffer *hotlist_initial_buffer;
|
||||
|
||||
extern void hotlist_add (int, t_gui_buffer *);
|
||||
extern void hotlist_free (t_weechat_hotlist *);
|
||||
extern void hotlist_remove_buffer (t_gui_buffer *);
|
||||
|
||||
#endif /* hotlist.h */
|
||||
@@ -103,7 +103,7 @@ wee_log_printf (char *message, ...)
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
else
|
||||
fprintf (log_file, "[????-??-?? ??:??:??] %s", buffer);
|
||||
fprintf (log_file, "%s", buffer);
|
||||
fflush (log_file);
|
||||
}
|
||||
|
||||
|
||||
+29
-24
@@ -109,33 +109,33 @@ t_config_option weechat_options_look[] =
|
||||
{ "look_nicklist", N_("display nicklist window"),
|
||||
N_("display nicklist window (for channel windows)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_nicklist, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nicklist, NULL, config_change_buffers },
|
||||
{ "look_nicklist_position", N_("nicklist position"),
|
||||
N_("nicklist position (top, left, right (default), bottom)"),
|
||||
OPTION_TYPE_INT_WITH_STRING, 0, 0, 0,
|
||||
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_windows },
|
||||
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_buffers },
|
||||
{ "look_nicklist_min_size", N_("min size for nicklist"),
|
||||
N_("min size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no min size))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_buffers },
|
||||
{ "look_nicklist_max_size", N_("max size for nicklist"),
|
||||
N_("max size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no max size; if min == max and > 0, then size is fixed))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_buffers },
|
||||
{ "look_no_nickname", N_("text to display instead of nick when not connected"),
|
||||
N_("text to display instead of nick when not connected"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_window_content },
|
||||
"-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_buffer_content },
|
||||
{ "look_nickmode", N_("display nick mode ((half)op/voice) before each nick"),
|
||||
N_("display nick mode ((half)op/voice) before each nick"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_nickmode, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nickmode, NULL, config_change_buffers },
|
||||
{ "look_nickmode_empty", N_("display space if nick mode is not (half)op/voice"),
|
||||
N_("display space if nick mode is not (half)op/voice"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_buffers },
|
||||
{ "look_nick_completor", N_("the string inserted after nick completion"),
|
||||
N_("the string inserted after nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -143,11 +143,11 @@ t_config_option weechat_options_look[] =
|
||||
{ "look_infobar", N_("enable info bar"),
|
||||
N_("enable info bar"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_infobar, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_infobar, NULL, config_change_buffers },
|
||||
{ "look_infobar_timestamp", N_("timestamp for time in infobar"),
|
||||
N_("timestamp for time in infobar"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_window_content },
|
||||
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },
|
||||
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
|
||||
N_("delay (in seconds) for highlight messages in infobar "
|
||||
"(0 = disable highlight notifications in infobar)"),
|
||||
@@ -172,8 +172,9 @@ int cfg_col_chat_dark;
|
||||
int cfg_col_chat_highlight;
|
||||
int cfg_col_chat_bg;
|
||||
int cfg_col_status;
|
||||
int cfg_col_status_active;
|
||||
int cfg_col_status_delimiters;
|
||||
int cfg_col_status_data_msg;
|
||||
int cfg_col_status_data_highlight;
|
||||
int cfg_col_status_data_other;
|
||||
int cfg_col_status_more;
|
||||
int cfg_col_status_bg;
|
||||
@@ -255,18 +256,22 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for status bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_status, NULL, &config_change_color },
|
||||
{ "col_status_active", N_("color for active window"),
|
||||
N_("color for active window (status bar)"),
|
||||
{ "col_status_delimiters", N_("color for status bar delimiters"),
|
||||
N_("color for status bar delimiters"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"yellow", NULL, &cfg_col_status_active, NULL, &config_change_color },
|
||||
"cyan", NULL, &cfg_col_status_delimiters, NULL, &config_change_color },
|
||||
{ "col_status_data_msg", N_("color for window with new messages"),
|
||||
N_("color for window with new messages (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightred", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
|
||||
"yellow", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
|
||||
{ "col_status_highlight", N_("color for window with highlight"),
|
||||
N_("color for window with highlight (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightmagenta", NULL, &cfg_col_status_data_highlight, NULL, &config_change_color },
|
||||
{ "col_status_data_other", N_("color for window with new data (not messages)"),
|
||||
N_("color for window with new data (not messages) (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightmagenta", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
"gray", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
{ "col_status_more", N_("color for \"*MORE*\" text"),
|
||||
N_("color for window with new data (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -615,24 +620,24 @@ config_change_title ()
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_windows: called when windows change (for example nicklist)
|
||||
* config_change_buffers: called when buffers change (for example nicklist)
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_windows ()
|
||||
config_change_buffers ()
|
||||
{
|
||||
gui_switch_to_window (gui_current_window);
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_window_content: called when content of a window changes
|
||||
* config_change_buffer_content: called when content of a buffer changes
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_window_content ()
|
||||
config_change_buffer_content ()
|
||||
{
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1258,8 +1263,8 @@ config_write (char *config_name)
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
|
||||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
|
||||
if ((i == CONFIG_SECTION_LOG) || (i == CONFIG_SECTION_DCC) ||
|
||||
(i == CONFIG_SECTION_PROXY))
|
||||
fprintf (file,
|
||||
"# WARNING!!! Options for section \"%s\" are not developed!\n",
|
||||
config_sections[i].section_name);
|
||||
|
||||
@@ -106,8 +106,9 @@ extern int cfg_col_chat_dark;
|
||||
extern int cfg_col_chat_highlight;
|
||||
extern int cfg_col_chat_bg;
|
||||
extern int cfg_col_status;
|
||||
extern int cfg_col_status_active;
|
||||
extern int cfg_col_status_delimiters;
|
||||
extern int cfg_col_status_data_msg;
|
||||
extern int cfg_col_status_data_highlight;
|
||||
extern int cfg_col_status_data_other;
|
||||
extern int cfg_col_status_more;
|
||||
extern int cfg_col_status_bg;
|
||||
@@ -158,8 +159,8 @@ extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
|
||||
extern char *config_get_section ();
|
||||
extern void config_change_noop ();
|
||||
extern void config_change_title ();
|
||||
extern void config_change_windows ();
|
||||
extern void config_change_window_content ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
|
||||
+875
-841
File diff suppressed because it is too large
Load Diff
+208
-154
@@ -37,6 +37,7 @@
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
#define KEY_ESCAPE 27
|
||||
@@ -49,7 +50,7 @@ void
|
||||
gui_read_keyb ()
|
||||
{
|
||||
int key, i;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
char new_char[2];
|
||||
|
||||
key = getch ();
|
||||
@@ -59,15 +60,30 @@ gui_read_keyb ()
|
||||
{
|
||||
/* resize event */
|
||||
case KEY_RESIZE:
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_calculate_pos_size (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
break;
|
||||
/* previous window */
|
||||
/* inactive function keys */
|
||||
case KEY_F(1):
|
||||
case KEY_F(2):
|
||||
case KEY_F(3):
|
||||
case KEY_F(4):
|
||||
case KEY_F(5):
|
||||
case KEY_F(9):
|
||||
case KEY_F(11):
|
||||
case KEY_F(12):
|
||||
break;
|
||||
/* previous buffer in window */
|
||||
case KEY_F(6):
|
||||
gui_switch_to_previous_window ();
|
||||
gui_switch_to_previous_buffer (gui_current_window);
|
||||
break;
|
||||
/* next buffer in window */
|
||||
case KEY_F(7):
|
||||
gui_switch_to_next_buffer (gui_current_window);
|
||||
break;
|
||||
/* next window */
|
||||
case KEY_F(7):
|
||||
gui_switch_to_next_window ();
|
||||
case KEY_F(8):
|
||||
gui_switch_to_next_window (gui_current_window);
|
||||
break;
|
||||
/* remove last infobar message */
|
||||
case KEY_F(10):
|
||||
@@ -75,218 +91,223 @@ gui_read_keyb ()
|
||||
break;
|
||||
/* cursor up */
|
||||
case KEY_UP:
|
||||
if (gui_current_window->ptr_history)
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
{
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->ptr_history->next_history;
|
||||
if (!gui_current_window->ptr_history)
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->history;
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->ptr_history->next_history;
|
||||
if (!gui_current_window->buffer->ptr_history)
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->history;
|
||||
}
|
||||
else
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->history;
|
||||
if (gui_current_window->ptr_history)
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->history;
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
{
|
||||
gui_current_window->input_buffer_size =
|
||||
strlen (gui_current_window->ptr_history->text);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
strcpy (gui_current_window->input_buffer,
|
||||
gui_current_window->ptr_history->text);
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_size =
|
||||
strlen (gui_current_window->buffer->ptr_history->text);
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->input_buffer_size;
|
||||
strcpy (gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->ptr_history->text);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* cursor down */
|
||||
case KEY_DOWN:
|
||||
if (gui_current_window->ptr_history)
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
{
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->ptr_history->prev_history;
|
||||
if (gui_current_window->ptr_history)
|
||||
gui_current_window->input_buffer_size =
|
||||
strlen (gui_current_window->ptr_history->text);
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->ptr_history->prev_history;
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
gui_current_window->buffer->input_buffer_size =
|
||||
strlen (gui_current_window->buffer->ptr_history->text);
|
||||
else
|
||||
gui_current_window->input_buffer_size = 0;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
if (gui_current_window->ptr_history)
|
||||
strcpy (gui_current_window->input_buffer,
|
||||
gui_current_window->ptr_history->text);
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_size = 0;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->input_buffer_size;
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
strcpy (gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->ptr_history->text);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* cursor left */
|
||||
case KEY_LEFT:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (gui_current_window->buffer->input_buffer_pos > 0)
|
||||
{
|
||||
gui_current_window->input_buffer_pos--;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos--;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* cursor right */
|
||||
case KEY_RIGHT:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
if (gui_current_window->buffer->input_buffer_pos <
|
||||
gui_current_window->buffer->input_buffer_size)
|
||||
{
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* home key */
|
||||
case KEY_HOME:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (gui_current_window->buffer->input_buffer_pos > 0)
|
||||
{
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos = 0;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* end key */
|
||||
case KEY_END:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
if (gui_current_window->buffer->input_buffer_pos <
|
||||
gui_current_window->buffer->input_buffer_size)
|
||||
{
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->input_buffer_size;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* page up */
|
||||
case KEY_PPAGE:
|
||||
gui_move_page_up ();
|
||||
gui_move_page_up (gui_current_window);
|
||||
break;
|
||||
/* page down */
|
||||
case KEY_NPAGE:
|
||||
gui_move_page_down ();
|
||||
gui_move_page_down (gui_current_window);
|
||||
break;
|
||||
/* erase before cursor and move cursor to the left */
|
||||
case 127:
|
||||
case KEY_BACKSPACE:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (gui_current_window->buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos-1;
|
||||
while (gui_current_window->input_buffer[i])
|
||||
i = gui_current_window->buffer->input_buffer_pos-1;
|
||||
while (gui_current_window->buffer->input_buffer[i])
|
||||
{
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i+1];
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i+1];
|
||||
i++;
|
||||
}
|
||||
gui_current_window->input_buffer_size--;
|
||||
gui_current_window->input_buffer_pos--;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_current_window->buffer->input_buffer_size--;
|
||||
gui_current_window->buffer->input_buffer_pos--;
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
}
|
||||
break;
|
||||
/* Control + Backspace */
|
||||
case 0x08:
|
||||
gui_delete_previous_word ();
|
||||
gui_delete_previous_word (gui_current_window->buffer);
|
||||
break;
|
||||
/* erase char under cursor */
|
||||
case KEY_DC:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
if (gui_current_window->buffer->input_buffer_pos <
|
||||
gui_current_window->buffer->input_buffer_size)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos;
|
||||
while (gui_current_window->input_buffer[i])
|
||||
i = gui_current_window->buffer->input_buffer_pos;
|
||||
while (gui_current_window->buffer->input_buffer[i])
|
||||
{
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i+1];
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i+1];
|
||||
i++;
|
||||
}
|
||||
gui_current_window->input_buffer_size--;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_current_window->buffer->input_buffer_size--;
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
}
|
||||
break;
|
||||
/* Tab : completion */
|
||||
case '\t':
|
||||
completion_search (&(gui_current_window->completion),
|
||||
CHANNEL(gui_current_window),
|
||||
gui_current_window->input_buffer,
|
||||
gui_current_window->input_buffer_size,
|
||||
gui_current_window->input_buffer_pos);
|
||||
if (gui_current_window->completion.word_found)
|
||||
completion_search (&(gui_current_window->buffer->completion),
|
||||
CHANNEL(gui_current_window->buffer),
|
||||
gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->input_buffer_size,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
if (gui_current_window->buffer->completion.word_found)
|
||||
{
|
||||
// replace word with new completed word into input buffer
|
||||
gui_current_window->input_buffer_size +=
|
||||
gui_current_window->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
|
||||
if (gui_current_window->completion.diff_size > 0)
|
||||
if (gui_current_window->buffer->completion.diff_size > 0)
|
||||
{
|
||||
for (i = gui_current_window->input_buffer_size - 1;
|
||||
i >= gui_current_window->completion.position_replace +
|
||||
(int)strlen (gui_current_window->completion.word_found); i--)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i -
|
||||
gui_current_window->completion.diff_size];
|
||||
for (i = gui_current_window->buffer->input_buffer_size - 1;
|
||||
i >= gui_current_window->buffer->completion.position_replace +
|
||||
(int)strlen (gui_current_window->buffer->completion.word_found); i--)
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i -
|
||||
gui_current_window->buffer->completion.diff_size];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = gui_current_window->completion.position_replace +
|
||||
strlen (gui_current_window->completion.word_found);
|
||||
i < gui_current_window->input_buffer_size; i++)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i -
|
||||
gui_current_window->completion.diff_size];
|
||||
for (i = gui_current_window->buffer->completion.position_replace +
|
||||
strlen (gui_current_window->buffer->completion.word_found);
|
||||
i < gui_current_window->buffer->input_buffer_size; i++)
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i -
|
||||
gui_current_window->buffer->completion.diff_size];
|
||||
}
|
||||
|
||||
strncpy (gui_current_window->input_buffer + gui_current_window->completion.position_replace,
|
||||
gui_current_window->completion.word_found,
|
||||
strlen (gui_current_window->completion.word_found));
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->completion.position_replace +
|
||||
strlen (gui_current_window->completion.word_found);
|
||||
gui_current_window->completion.position =
|
||||
gui_current_window->input_buffer_pos;
|
||||
strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
|
||||
gui_current_window->buffer->completion.word_found,
|
||||
strlen (gui_current_window->buffer->completion.word_found));
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->completion.position_replace +
|
||||
strlen (gui_current_window->buffer->completion.word_found);
|
||||
gui_current_window->buffer->completion.position =
|
||||
gui_current_window->buffer->input_buffer_pos;
|
||||
|
||||
/* add space or completor to the end of completion, if needed */
|
||||
if (gui_current_window->completion.base_word[0] == '/')
|
||||
if (gui_current_window->buffer->completion.base_word[0] == '/')
|
||||
{
|
||||
if (gui_current_window->input_buffer[gui_current_window->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (" ",
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position++;
|
||||
gui_current_window->input_buffer_pos++;
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gui_current_window->completion.base_word_pos == 0)
|
||||
if (gui_current_window->buffer->completion.base_word_pos == 0)
|
||||
{
|
||||
if (strncmp (gui_current_window->input_buffer + gui_current_window->input_buffer_pos,
|
||||
if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
|
||||
cfg_look_completor, strlen (cfg_look_completor)) != 0)
|
||||
gui_buffer_insert_string (cfg_look_completor,
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position += strlen (cfg_look_completor);
|
||||
gui_current_window->input_buffer_pos += strlen (cfg_look_completor);
|
||||
if (gui_current_window->input_buffer[gui_current_window->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (" ",
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position++;
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
cfg_look_completor,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
|
||||
gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* escape code (for control-key) */
|
||||
case KEY_ESCAPE:
|
||||
if ((key = getch()) != ERR)
|
||||
{
|
||||
/*gui_printf (gui_current_window->buffer,
|
||||
"[Debug] key pressed = %d, as octal: %o\n", key, key);*/
|
||||
switch (key)
|
||||
{
|
||||
case KEY_LEFT:
|
||||
gui_switch_to_previous_window ();
|
||||
gui_switch_to_previous_buffer (gui_current_window);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
gui_switch_to_next_window ();
|
||||
gui_switch_to_next_buffer (gui_current_window);
|
||||
break;
|
||||
case 79:
|
||||
/* TODO: replace 79 by constant name! */
|
||||
@@ -298,50 +319,84 @@ gui_read_keyb ()
|
||||
{
|
||||
/* Control + Right */
|
||||
case 99:
|
||||
gui_move_next_word ();
|
||||
gui_move_next_word (gui_current_window->buffer);
|
||||
break;
|
||||
/* Control + Left */
|
||||
case 100:
|
||||
gui_move_previous_word ();
|
||||
gui_move_previous_word (gui_current_window->buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* Alt-number */
|
||||
case 48: /* Alt-0 */
|
||||
case 49: /* Alt-1 */
|
||||
case 50: /* Alt-2 */
|
||||
case 51: /* Alt-3 */
|
||||
case 52: /* Alt-4 */
|
||||
case 53: /* Alt-5 */
|
||||
case 54: /* Alt-6 */
|
||||
case 55: /* Alt-7 */
|
||||
case 56: /* Alt-8 */
|
||||
case 57: /* Alt-9 */
|
||||
gui_switch_to_buffer_by_number (gui_current_window, (key == 48) ? 10 : key - 48);
|
||||
break;
|
||||
/* Alt-A */
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (hotlist)
|
||||
{
|
||||
if (!hotlist_initial_buffer)
|
||||
hotlist_initial_buffer = gui_current_window->buffer;
|
||||
gui_switch_to_buffer (gui_current_window, hotlist->buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hotlist_initial_buffer)
|
||||
{
|
||||
gui_switch_to_buffer (gui_current_window, hotlist_initial_buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
hotlist_initial_buffer = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* send command/message */
|
||||
case '\n':
|
||||
if (gui_current_window->input_buffer_size > 0)
|
||||
if (gui_current_window->buffer->input_buffer_size > 0)
|
||||
{
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
history_add (gui_current_window, gui_current_window->input_buffer);
|
||||
gui_current_window->input_buffer_size = 0;
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
gui_current_window->input_buffer_1st_display = 0;
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_current_window->ptr_history = NULL;
|
||||
ptr_window = gui_current_window;
|
||||
user_command (SERVER(gui_current_window),
|
||||
gui_current_window->input_buffer);
|
||||
if (ptr_window == gui_current_window)
|
||||
gui_draw_window_input (ptr_window);
|
||||
if (ptr_window)
|
||||
ptr_window->input_buffer[0] = '\0';
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
|
||||
gui_current_window->buffer->input_buffer_size = 0;
|
||||
gui_current_window->buffer->input_buffer_pos = 0;
|
||||
gui_current_window->buffer->input_buffer_1st_display = 0;
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
gui_current_window->buffer->ptr_history = NULL;
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer->input_buffer);
|
||||
if (ptr_buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
if (ptr_buffer)
|
||||
ptr_buffer->input_buffer[0] = '\0';
|
||||
}
|
||||
break;
|
||||
/* other key => add to input buffer */
|
||||
default:
|
||||
/*gui_printf (gui_current_window,
|
||||
"[Debug] key pressed = %d, as octal: %o\n", key, key);*/
|
||||
/*gui_printf (gui_current_window->buffer,
|
||||
"[Debug] key pressed = %d, as octal: %o\n", key, key);*/
|
||||
new_char[0] = key;
|
||||
new_char[1] = '\0';
|
||||
gui_buffer_insert_string (new_char,
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
new_char,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -373,14 +428,13 @@ gui_main_loop ()
|
||||
if (local_time->tm_min != old_min)
|
||||
{
|
||||
old_min = local_time->tm_min;
|
||||
gui_redraw_window_infobar (gui_current_window);
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
|
||||
/* second has changed ? => count down time for infobar, if needed */
|
||||
if (local_time->tm_sec != old_sec)
|
||||
{
|
||||
old_sec = local_time->tm_sec;
|
||||
/* TODO: manage splitted windows! */
|
||||
if (gui_infobar && gui_infobar->remaining_time > 0)
|
||||
{
|
||||
gui_infobar->remaining_time--;
|
||||
|
||||
+357
-200
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
@@ -42,79 +44,62 @@ int gui_ready; /* = 1 if GUI is initialized */
|
||||
t_gui_window *gui_windows = NULL; /* pointer to first window */
|
||||
t_gui_window *last_gui_window = NULL; /* pointer to last window */
|
||||
t_gui_window *gui_current_window = NULL; /* pointer to current window */
|
||||
|
||||
t_gui_buffer *gui_buffers = NULL; /* pointer to first buffer */
|
||||
t_gui_buffer *last_gui_buffer = NULL; /* pointer to last buffer */
|
||||
t_gui_infobar *gui_infobar; /* pointer to infobar content */
|
||||
|
||||
|
||||
/*
|
||||
* gui_window_new: create a new window
|
||||
* (TODO: add coordinates and size, for splited windows)
|
||||
*/
|
||||
|
||||
t_gui_window *
|
||||
gui_window_new (void *server, void *channel, int switch_to_window
|
||||
/*int x, int y, int width, int height*/)
|
||||
gui_window_new (int x, int y, int width, int height)
|
||||
{
|
||||
t_gui_window *new_window;
|
||||
|
||||
if (gui_windows)
|
||||
{
|
||||
/* use first window if no server was assigned to this window */
|
||||
if (!SERVER(gui_windows))
|
||||
{
|
||||
if (server)
|
||||
((t_irc_server *)(server))->window = gui_windows;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->window = gui_windows;
|
||||
SERVER(gui_windows) = server;
|
||||
CHANNEL(gui_windows) = channel;
|
||||
return gui_windows;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
#endif
|
||||
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
|
||||
{
|
||||
new_window->is_displayed = 0;
|
||||
new_window->win_x = x;
|
||||
new_window->win_y = y;
|
||||
new_window->win_width = width;
|
||||
new_window->win_height = height;
|
||||
|
||||
/* assign server and channel to window */
|
||||
SERVER(new_window) = server;
|
||||
CHANNEL(new_window) = channel;
|
||||
/* assign window to server and channel */
|
||||
if (server && !channel)
|
||||
SERVER(new_window)->window = new_window;
|
||||
if (channel)
|
||||
CHANNEL(new_window)->window = new_window;
|
||||
new_window->win_chat_x = 0;
|
||||
new_window->win_chat_y = 0;
|
||||
new_window->win_chat_width = 0;
|
||||
new_window->win_chat_height = 0;
|
||||
new_window->win_chat_cursor_x = 0;
|
||||
new_window->win_chat_cursor_y = 0;
|
||||
|
||||
gui_calculate_pos_size (new_window);
|
||||
new_window->win_nick_x = 0;
|
||||
new_window->win_nick_y = 0;
|
||||
new_window->win_nick_width = 0;
|
||||
new_window->win_nick_height = 0;
|
||||
|
||||
/* init windows */
|
||||
gui_window_init_subwindows(new_window);
|
||||
new_window->win_title = NULL;
|
||||
new_window->win_chat = NULL;
|
||||
new_window->win_nick = NULL;
|
||||
new_window->win_status = NULL;
|
||||
new_window->win_infobar = NULL;
|
||||
new_window->win_input = NULL;
|
||||
new_window->win_separator = NULL;
|
||||
|
||||
/* init lines */
|
||||
new_window->lines = NULL;
|
||||
new_window->last_line = NULL;
|
||||
new_window->first_line_displayed = 1;
|
||||
new_window->textview_chat = NULL;
|
||||
new_window->textbuffer_chat = NULL;
|
||||
new_window->texttag_chat = NULL;
|
||||
new_window->textview_nicklist = NULL;
|
||||
new_window->textbuffer_nicklist = NULL;
|
||||
|
||||
new_window->buffer = NULL;
|
||||
|
||||
new_window->first_line_displayed = 0;
|
||||
new_window->sub_lines = 0;
|
||||
new_window->line_complete = 1;
|
||||
new_window->unread_data = 0;
|
||||
|
||||
/* init input buffer */
|
||||
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
||||
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
||||
new_window->input_buffer[0] = '\0';
|
||||
new_window->input_buffer_size = 0;
|
||||
new_window->input_buffer_pos = 0;
|
||||
new_window->input_buffer_1st_display = 0;
|
||||
|
||||
/* init completion */
|
||||
completion_init (&(new_window->completion));
|
||||
|
||||
/* init history */
|
||||
new_window->history = NULL;
|
||||
new_window->ptr_history = NULL;
|
||||
|
||||
/* switch to new window */
|
||||
if (switch_to_window)
|
||||
gui_switch_to_window (new_window);
|
||||
|
||||
/* add window to windows queue */
|
||||
new_window->prev_window = last_gui_window;
|
||||
@@ -124,9 +109,6 @@ gui_window_new (void *server, void *channel, int switch_to_window
|
||||
gui_windows = new_window;
|
||||
last_gui_window = new_window;
|
||||
new_window->next_window = NULL;
|
||||
|
||||
/* redraw whole screen */
|
||||
gui_redraw_window (gui_current_window);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
@@ -135,52 +117,155 @@ gui_window_new (void *server, void *channel, int switch_to_window
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_clear: clear window content
|
||||
* gui_buffer_new: create a new buffer in current window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_clear (t_gui_window *window)
|
||||
t_gui_buffer *
|
||||
gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to_buffer)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
t_gui_buffer *new_buffer;
|
||||
|
||||
while (window->lines)
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("creating new buffer\n");
|
||||
#endif
|
||||
if (gui_buffers)
|
||||
{
|
||||
ptr_line = window->lines->next_line;
|
||||
while (window->lines->messages)
|
||||
/* use first buffer if no server was assigned to this buffer */
|
||||
if (!SERVER(gui_buffers))
|
||||
{
|
||||
ptr_message = window->lines->messages->next_message;
|
||||
if (window->lines->messages->message)
|
||||
free (window->lines->messages->message);
|
||||
free (window->lines->messages);
|
||||
window->lines->messages = ptr_message;
|
||||
if (server)
|
||||
((t_irc_server *)(server))->buffer = gui_buffers;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->buffer = gui_buffers;
|
||||
SERVER(gui_buffers) = server;
|
||||
CHANNEL(gui_buffers) = channel;
|
||||
return gui_buffers;
|
||||
}
|
||||
free (window->lines);
|
||||
window->lines = ptr_line;
|
||||
}
|
||||
|
||||
window->lines = NULL;
|
||||
window->last_line = NULL;
|
||||
window->first_line_displayed = 1;
|
||||
window->sub_lines = 0;
|
||||
window->line_complete = 1;
|
||||
window->unread_data = 0;
|
||||
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
|
||||
{
|
||||
new_buffer->num_displayed = 0;
|
||||
new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
|
||||
|
||||
/* assign server and channel to buffer */
|
||||
SERVER(new_buffer) = server;
|
||||
CHANNEL(new_buffer) = channel;
|
||||
/* assign buffer to server and channel */
|
||||
if (server && !channel)
|
||||
SERVER(new_buffer)->buffer = new_buffer;
|
||||
if (channel)
|
||||
CHANNEL(new_buffer)->buffer = new_buffer;
|
||||
|
||||
if (!window->buffer)
|
||||
{
|
||||
window->buffer = new_buffer;
|
||||
window->first_line_displayed = 1;
|
||||
window->sub_lines = 0;
|
||||
gui_calculate_pos_size (window);
|
||||
gui_window_init_subwindows (window);
|
||||
}
|
||||
|
||||
/* init lines */
|
||||
new_buffer->lines = NULL;
|
||||
new_buffer->last_line = NULL;
|
||||
new_buffer->num_lines = 0;
|
||||
new_buffer->line_complete = 1;
|
||||
|
||||
/* init input buffer */
|
||||
new_buffer->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
||||
new_buffer->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
||||
new_buffer->input_buffer[0] = '\0';
|
||||
new_buffer->input_buffer_size = 0;
|
||||
new_buffer->input_buffer_pos = 0;
|
||||
new_buffer->input_buffer_1st_display = 0;
|
||||
|
||||
/* init completion */
|
||||
completion_init (&(new_buffer->completion));
|
||||
|
||||
/* init history */
|
||||
new_buffer->history = NULL;
|
||||
new_buffer->last_history = NULL;
|
||||
new_buffer->ptr_history = NULL;
|
||||
new_buffer->num_history = 0;
|
||||
|
||||
/* add buffer to buffers queue */
|
||||
new_buffer->prev_buffer = last_gui_buffer;
|
||||
if (gui_buffers)
|
||||
last_gui_buffer->next_buffer = new_buffer;
|
||||
else
|
||||
gui_buffers = new_buffer;
|
||||
last_gui_buffer = new_buffer;
|
||||
new_buffer->next_buffer = NULL;
|
||||
|
||||
/* switch to new buffer */
|
||||
if (switch_to_buffer)
|
||||
gui_switch_to_buffer (window, new_buffer);
|
||||
|
||||
/* redraw buffer */
|
||||
gui_redraw_buffer (new_buffer);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (window == gui_current_window)
|
||||
gui_redraw_window_chat (window);
|
||||
return new_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_clear_all: clear all windows content
|
||||
* gui_buffer_clear: clear buffer content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_clear_all ()
|
||||
gui_buffer_clear (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
while (buffer->lines->messages)
|
||||
{
|
||||
ptr_message = buffer->lines->messages->next_message;
|
||||
if (buffer->lines->messages->message)
|
||||
free (buffer->lines->messages->message);
|
||||
free (buffer->lines->messages);
|
||||
buffer->lines->messages = ptr_message;
|
||||
}
|
||||
free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
|
||||
buffer->lines = NULL;
|
||||
buffer->last_line = NULL;
|
||||
buffer->num_lines = 0;
|
||||
buffer->line_complete = 1;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
gui_window_clear (ptr_win);
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
{
|
||||
ptr_win->first_line_displayed = 1;
|
||||
ptr_win->sub_lines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_clear_all: clear all buffers content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_clear_all ()
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
gui_buffer_clear (ptr_buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -210,8 +295,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
|
||||
ptr_infobar->next_infobar = gui_infobar;
|
||||
gui_infobar = ptr_infobar;
|
||||
/* TODO: manage splitted windows! */
|
||||
gui_redraw_window_infobar (gui_current_window);
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
wee_log_printf (_("%s not enough memory for infobar message\n"),
|
||||
@@ -234,116 +318,161 @@ gui_infobar_remove ()
|
||||
free (gui_infobar->text);
|
||||
free (gui_infobar);
|
||||
gui_infobar = new_infobar;
|
||||
/* TODO: manage splitted windows! */
|
||||
gui_redraw_window_infobar (gui_current_window);
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_free: delete a window
|
||||
* gui_line_free: delete a line from a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
gui_line_free (t_gui_line *line)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
int create_new;
|
||||
|
||||
create_new = (window->server || window->channel);
|
||||
|
||||
/* TODO: manage splitted windows! */
|
||||
if ((window == gui_current_window) &&
|
||||
((window->next_window) || (window->prev_window)))
|
||||
gui_switch_to_previous_window ();
|
||||
|
||||
/* free lines and messages */
|
||||
while (window->lines)
|
||||
while (line->messages)
|
||||
{
|
||||
ptr_line = window->lines->next_line;
|
||||
while (window->lines->messages)
|
||||
{
|
||||
ptr_message = window->lines->messages->next_message;
|
||||
if (window->lines->messages->message)
|
||||
free (window->lines->messages->message);
|
||||
free (window->lines->messages);
|
||||
window->lines->messages = ptr_message;
|
||||
}
|
||||
free (window->lines);
|
||||
window->lines = ptr_line;
|
||||
ptr_message = line->messages->next_message;
|
||||
if (line->messages->message)
|
||||
free (line->messages->message);
|
||||
free (line->messages);
|
||||
line->messages = ptr_message;
|
||||
}
|
||||
if (window->input_buffer)
|
||||
free (window->input_buffer);
|
||||
|
||||
completion_free (&(window->completion));
|
||||
|
||||
/* remove window from windows list */
|
||||
if (window->prev_window)
|
||||
window->prev_window->next_window = window->next_window;
|
||||
if (window->next_window)
|
||||
window->next_window->prev_window = window->prev_window;
|
||||
if (gui_windows == window)
|
||||
gui_windows = window->next_window;
|
||||
if (last_gui_window == window)
|
||||
last_gui_window = window->prev_window;
|
||||
|
||||
free (window);
|
||||
|
||||
/* always at least one window */
|
||||
if (!gui_windows && create_new)
|
||||
(void) gui_window_new (NULL, NULL, 1);
|
||||
free (line);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a window
|
||||
* gui_buffer_free: delete a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_gui_line *ptr_line;
|
||||
int create_new;
|
||||
|
||||
create_new = (buffer->server || buffer->channel);
|
||||
|
||||
hotlist_remove_buffer (buffer);
|
||||
if (hotlist_initial_buffer == buffer)
|
||||
hotlist_initial_buffer = NULL;
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if ((buffer == ptr_win->buffer) &&
|
||||
((buffer->next_buffer) || (buffer->prev_buffer)))
|
||||
gui_switch_to_previous_buffer (ptr_win);
|
||||
}
|
||||
}
|
||||
|
||||
/* decrease buffer number for all next buffers */
|
||||
for (ptr_buffer = buffer->next_buffer; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number--;
|
||||
}
|
||||
|
||||
/* free lines and messages */
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
if (buffer->input_buffer)
|
||||
free (buffer->input_buffer);
|
||||
|
||||
completion_free (&(buffer->completion));
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
if (buffer->prev_buffer)
|
||||
buffer->prev_buffer->next_buffer = buffer->next_buffer;
|
||||
if (buffer->next_buffer)
|
||||
buffer->next_buffer->prev_buffer = buffer->prev_buffer;
|
||||
if (gui_buffers == buffer)
|
||||
gui_buffers = buffer->next_buffer;
|
||||
if (last_gui_buffer == buffer)
|
||||
last_gui_buffer = buffer->prev_buffer;
|
||||
|
||||
free (buffer);
|
||||
|
||||
/* always at least one buffer */
|
||||
if (!gui_buffers && create_new && switch_to_another)
|
||||
(void) gui_buffer_new (gui_windows, NULL, NULL, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a buffer
|
||||
*/
|
||||
|
||||
t_gui_line *
|
||||
gui_new_line (t_gui_window *window)
|
||||
gui_new_line (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *new_line;
|
||||
t_gui_line *new_line, *ptr_line;
|
||||
|
||||
if ((new_line = (t_gui_line *) malloc (sizeof (struct t_gui_line))))
|
||||
{
|
||||
new_line->length = 0;
|
||||
new_line->length_align = 0;
|
||||
new_line->line_with_message = 0;
|
||||
new_line->line_with_highlight = 0;
|
||||
new_line->messages = NULL;
|
||||
new_line->last_message = NULL;
|
||||
if (!window->lines)
|
||||
window->lines = new_line;
|
||||
if (!buffer->lines)
|
||||
buffer->lines = new_line;
|
||||
else
|
||||
window->last_line->next_line = new_line;
|
||||
new_line->prev_line = window->last_line;
|
||||
buffer->last_line->next_line = new_line;
|
||||
new_line->prev_line = buffer->last_line;
|
||||
new_line->next_line = NULL;
|
||||
window->last_line = new_line;
|
||||
buffer->last_line = new_line;
|
||||
buffer->num_lines++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("%s not enough memory for new line!\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove one line if necessary */
|
||||
if ((cfg_history_max_lines > 0)
|
||||
&& (buffer->num_lines > cfg_history_max_lines))
|
||||
{
|
||||
if (buffer->last_line == buffer->lines)
|
||||
buffer->last_line = NULL;
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
ptr_line->prev_line = NULL;
|
||||
buffer->num_lines--;
|
||||
//if (buffer->first_line_displayed)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
return new_line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_message: create a new message for last line of window
|
||||
* gui_new_message: create a new message for last line of a buffer
|
||||
*/
|
||||
|
||||
t_gui_message *
|
||||
gui_new_message (t_gui_window *window)
|
||||
gui_new_message (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_message *new_message;
|
||||
|
||||
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
|
||||
{
|
||||
if (!window->last_line->messages)
|
||||
window->last_line->messages = new_message;
|
||||
if (!buffer->last_line->messages)
|
||||
buffer->last_line->messages = new_message;
|
||||
else
|
||||
window->last_line->last_message->next_message = new_message;
|
||||
new_message->prev_message = window->last_line->last_message;
|
||||
buffer->last_line->last_message->next_message = new_message;
|
||||
new_message->prev_message = buffer->last_line->last_message;
|
||||
new_message->next_message = NULL;
|
||||
window->last_line->last_message = new_message;
|
||||
buffer->last_line->last_message = new_message;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -359,16 +488,16 @@ gui_new_message (t_gui_window *window)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_optimize_input_buffer_size (t_gui_window *window)
|
||||
gui_optimize_input_buffer_size (t_gui_buffer *buffer)
|
||||
{
|
||||
int optimal_size;
|
||||
|
||||
optimal_size = ((window->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
||||
optimal_size = ((buffer->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
||||
INPUT_BUFFER_BLOCK_SIZE) + INPUT_BUFFER_BLOCK_SIZE;
|
||||
if (window->input_buffer_alloc != optimal_size)
|
||||
if (buffer->input_buffer_alloc != optimal_size)
|
||||
{
|
||||
window->input_buffer_alloc = optimal_size;
|
||||
window->input_buffer = realloc (window->input_buffer, optimal_size);
|
||||
buffer->input_buffer_alloc = optimal_size;
|
||||
buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,25 +506,25 @@ gui_optimize_input_buffer_size (t_gui_window *window)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_delete_previous_word ()
|
||||
gui_delete_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i, j, num_char_deleted, num_char_end;
|
||||
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos - 1;
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] != ' '))
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
}
|
||||
}
|
||||
@@ -403,20 +532,20 @@ gui_delete_previous_word ()
|
||||
if (i >= 0)
|
||||
i++;
|
||||
i++;
|
||||
num_char_deleted = gui_current_window->input_buffer_pos - i;
|
||||
num_char_end = gui_current_window->input_buffer_size -
|
||||
gui_current_window->input_buffer_pos;
|
||||
num_char_deleted = buffer->input_buffer_pos - i;
|
||||
num_char_end = buffer->input_buffer_size -
|
||||
buffer->input_buffer_pos;
|
||||
|
||||
for (j = 0; j < num_char_end; j++)
|
||||
gui_current_window->input_buffer[i + j] =
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_pos + j];
|
||||
buffer->input_buffer[i + j] =
|
||||
buffer->input_buffer[buffer->input_buffer_pos + j];
|
||||
|
||||
gui_current_window->input_buffer_size -= num_char_deleted;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_current_window->input_buffer_pos = i;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
buffer->input_buffer_size -= num_char_deleted;
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
buffer->input_buffer_pos = i;
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->completion.position = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,26 +554,26 @@ gui_delete_previous_word ()
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_previous_word ()
|
||||
gui_move_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos - 1;
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i < 0)
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
buffer->input_buffer_pos = 0;
|
||||
else
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] != ' '))
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
gui_current_window->input_buffer_pos = i + 1;
|
||||
buffer->input_buffer_pos = i + 1;
|
||||
}
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,32 +582,32 @@ gui_move_previous_word ()
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_next_word ()
|
||||
gui_move_next_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size + 1)
|
||||
if (buffer->input_buffer_pos <
|
||||
buffer->input_buffer_size + 1)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos;
|
||||
while ((i <= gui_current_window->input_buffer_size) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
i = buffer->input_buffer_pos;
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i++;
|
||||
if (i > gui_current_window->input_buffer_size)
|
||||
gui_current_window->input_buffer_pos = i - 1;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos = i - 1;
|
||||
else
|
||||
{
|
||||
while ((i <= gui_current_window->input_buffer_size) &&
|
||||
(gui_current_window->input_buffer[i] != ' '))
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i++;
|
||||
if (i > gui_current_window->input_buffer_size)
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos =
|
||||
buffer->input_buffer_size;
|
||||
else
|
||||
gui_current_window->input_buffer_pos = i;
|
||||
buffer->input_buffer_pos = i;
|
||||
|
||||
}
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,24 +616,52 @@ gui_move_next_word ()
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_insert_string (char *string, int pos)
|
||||
gui_buffer_insert_string (t_gui_buffer *buffer, char *string, int pos)
|
||||
{
|
||||
int i, start, end, length;
|
||||
|
||||
length = strlen (string);
|
||||
|
||||
/* increase buffer size */
|
||||
gui_current_window->input_buffer_size += length;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
buffer->input_buffer_size += length;
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
|
||||
/* move end of string to the right */
|
||||
start = pos + length;
|
||||
end = gui_current_window->input_buffer_size - 1;
|
||||
end = buffer->input_buffer_size - 1;
|
||||
for (i = end; i >= start; i--)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i - length];
|
||||
buffer->input_buffer[i] =
|
||||
buffer->input_buffer[i - length];
|
||||
|
||||
/* insert new string */
|
||||
strncpy (gui_current_window->input_buffer + pos, string, length);
|
||||
strncpy (buffer->input_buffer + pos, string, length);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_buffer_by_number: switch to another buffer with number
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_switch_to_buffer_by_number (t_gui_window *window, int number)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* buffer is currently displayed ? */
|
||||
if (number == window->buffer->number)
|
||||
return window->buffer;
|
||||
|
||||
/* search for buffer in the list */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if ((ptr_buffer != window->buffer) && (number == ptr_buffer->number))
|
||||
{
|
||||
gui_switch_to_buffer (window, ptr_buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return ptr_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* buffer not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+121
-101
@@ -26,56 +26,58 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 38
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_CHAT_HIGHLIGHT 11
|
||||
#define COLOR_WIN_STATUS 12
|
||||
#define COLOR_WIN_STATUS_ACTIVE 13
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 15
|
||||
#define COLOR_WIN_STATUS_MORE 16
|
||||
#define COLOR_WIN_INFOBAR 17
|
||||
#define COLOR_WIN_INFOBAR_HIGHLIGHT 18
|
||||
#define COLOR_WIN_INPUT 19
|
||||
#define COLOR_WIN_INPUT_CHANNEL 20
|
||||
#define COLOR_WIN_INPUT_NICK 21
|
||||
#define COLOR_WIN_NICK 22
|
||||
#define COLOR_WIN_NICK_OP 23
|
||||
#define COLOR_WIN_NICK_HALFOP 24
|
||||
#define COLOR_WIN_NICK_VOICE 25
|
||||
#define COLOR_WIN_NICK_SEP 26
|
||||
#define COLOR_WIN_NICK_SELF 27
|
||||
#define COLOR_WIN_NICK_PRIVATE 28
|
||||
#define COLOR_WIN_NICK_FIRST 29
|
||||
#define COLOR_WIN_NICK_LAST 38
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define NUM_COLORS 39
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_CHAT_HIGHLIGHT 11
|
||||
#define COLOR_WIN_STATUS 12
|
||||
#define COLOR_WIN_STATUS_DELIMITERS 13
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 15
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 16
|
||||
#define COLOR_WIN_STATUS_MORE 17
|
||||
#define COLOR_WIN_INFOBAR 18
|
||||
#define COLOR_WIN_INFOBAR_HIGHLIGHT 19
|
||||
#define COLOR_WIN_INPUT 20
|
||||
#define COLOR_WIN_INPUT_CHANNEL 21
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_OP 24
|
||||
#define COLOR_WIN_NICK_HALFOP 25
|
||||
#define COLOR_WIN_NICK_VOICE 26
|
||||
#define COLOR_WIN_NICK_SEP 27
|
||||
#define COLOR_WIN_NICK_SELF 28
|
||||
#define COLOR_WIN_NICK_PRIVATE 29
|
||||
#define COLOR_WIN_NICK_FIRST 30
|
||||
#define COLOR_WIN_NICK_LAST 39
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
|
||||
#define SERVER(window) ((t_irc_server *)(window->server))
|
||||
#define CHANNEL(window) ((t_irc_channel *)(window->channel))
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define WIN_IS_SERVER(window) (SERVER(window) && !CHANNEL(window))
|
||||
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
|
||||
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
|
||||
#define BUFFER_IS_SERVER(buffer) (SERVER(buffer) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
|
||||
#define MSG_TYPE_TIME 0
|
||||
#define MSG_TYPE_NICK 1
|
||||
#define MSG_TYPE_INFO 2
|
||||
#define MSG_TYPE_MSG 3
|
||||
#define MSG_TYPE_TIME 1
|
||||
#define MSG_TYPE_NICK 2
|
||||
#define MSG_TYPE_INFO 4
|
||||
#define MSG_TYPE_MSG 8
|
||||
#define MSG_TYPE_HIGHLIGHT 16
|
||||
|
||||
#define gui_printf_color(window, color, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
#define gui_printf_color(buffer, color, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
|
||||
#define gui_printf(window, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
#define gui_printf(buffer, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
@@ -95,6 +97,7 @@ struct t_gui_line
|
||||
int length; /* length of the line (in char) */
|
||||
int length_align; /* alignment length (time or time/nick) */
|
||||
int line_with_message; /* line contains a message from a user? */
|
||||
int line_with_highlight; /* line contains highlight */
|
||||
t_gui_message *messages; /* messages for the line */
|
||||
t_gui_message *last_message; /* last message of the line */
|
||||
t_gui_line *prev_line; /* link to previous line */
|
||||
@@ -121,16 +124,49 @@ struct t_gui_infobar
|
||||
t_gui_infobar *next_infobar; /* next message for infobar */
|
||||
};
|
||||
|
||||
typedef struct t_gui_buffer t_gui_buffer;
|
||||
|
||||
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 */
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
t_gui_line *last_line; /* last line of chat window */
|
||||
int num_lines; /* number of lines in the window */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size (user input length) */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *last_history; /* last command in history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
int num_history; /* number of commands in history */
|
||||
|
||||
/* link to previous/next buffer */
|
||||
t_gui_buffer *prev_buffer; /* link to previous buffer */
|
||||
t_gui_buffer *next_buffer; /* link to next buffer */
|
||||
};
|
||||
|
||||
typedef struct t_gui_window t_gui_window;
|
||||
|
||||
struct t_gui_window
|
||||
{
|
||||
int is_displayed; /* = 1 if window is displayed */
|
||||
|
||||
/* server/channel */
|
||||
void *server; /* window's server */
|
||||
void *channel; /* window's channel */
|
||||
|
||||
/* global position & size */
|
||||
int win_x, win_y; /* position of window */
|
||||
int win_width, win_height; /* window geometry */
|
||||
@@ -149,11 +185,12 @@ struct t_gui_window
|
||||
|
||||
/* windows for Curses GUI */
|
||||
void *win_title; /* title window */
|
||||
void *win_chat; /* chat window (exemple: channel) */
|
||||
void *win_chat; /* chat window (example: channel) */
|
||||
void *win_nick; /* nick window */
|
||||
void *win_status; /* status window */
|
||||
void *win_infobar; /* info bar window */
|
||||
void *win_input; /* input window */
|
||||
void *win_separator; /* separation between 2 splited (V) win */
|
||||
|
||||
/* windows for Gtk GUI */
|
||||
void *textview_chat; /* textview widget for chat */
|
||||
@@ -165,29 +202,11 @@ struct t_gui_window
|
||||
/* windows for Qt GUI */
|
||||
/* TODO: declare Qt window */
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
t_gui_line *last_line; /* last line of chat window */
|
||||
t_gui_buffer *buffer; /* buffer currently displayed in window */
|
||||
|
||||
int first_line_displayed; /* = 1 if first line is displayed */
|
||||
int sub_lines; /* if > 0 then do not display until end */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
int unread_data; /* highlight windows with unread data */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size (user input length) */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
|
||||
/* link to next window */
|
||||
t_gui_window *prev_window; /* link to previous window */
|
||||
t_gui_window *next_window; /* link to next window */
|
||||
};
|
||||
@@ -198,55 +217,56 @@ extern int gui_ready;
|
||||
extern t_gui_window *gui_windows;
|
||||
extern t_gui_window *last_gui_window;
|
||||
extern t_gui_window *gui_current_window;
|
||||
extern t_gui_buffer *gui_buffers;
|
||||
extern t_gui_buffer *last_gui_buffer;
|
||||
extern t_gui_infobar *gui_infobar;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
/* GUI independent functions */
|
||||
extern t_gui_window *gui_window_new (/*@null@*/ void *, /*@null@*/ void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
|
||||
extern void gui_window_clear (t_gui_window *);
|
||||
extern void gui_window_clear_all ();
|
||||
extern t_gui_window *gui_window_new (int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_infobar_remove ();
|
||||
extern t_gui_line *gui_new_line (t_gui_window *);
|
||||
extern t_gui_message *gui_new_message (t_gui_window *);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_window *);
|
||||
extern void gui_delete_previous_word ();
|
||||
extern void gui_move_previous_word ();
|
||||
extern void gui_move_next_word ();
|
||||
extern void gui_buffer_insert_string (char *, int);
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern t_gui_message *gui_new_message (t_gui_buffer *);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
|
||||
extern void gui_delete_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
/* GUI dependant functions */
|
||||
extern int gui_assign_color (int *, char *);
|
||||
extern int gui_get_color_by_name (char *);
|
||||
extern char *gui_get_color_by_value (int);
|
||||
extern int gui_window_has_nicklist (t_gui_window *);
|
||||
extern int gui_buffer_has_nicklist (t_gui_buffer *);
|
||||
extern void gui_calculate_pos_size (t_gui_window *);
|
||||
extern void gui_draw_window_title (t_gui_window *);
|
||||
extern void gui_redraw_window_title (t_gui_window *);
|
||||
extern void gui_draw_window_chat (t_gui_window *);
|
||||
extern void gui_redraw_window_chat (t_gui_window *);
|
||||
extern void gui_draw_window_nick (t_gui_window *);
|
||||
extern void gui_redraw_window_nick (t_gui_window *);
|
||||
extern void gui_draw_window_status (t_gui_window *);
|
||||
extern void gui_redraw_window_status (t_gui_window *);
|
||||
extern void gui_draw_window_infobar (t_gui_window *);
|
||||
extern void gui_redraw_window_infobar (t_gui_window *);
|
||||
extern void gui_draw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window (t_gui_window *);
|
||||
extern void gui_switch_to_window (t_gui_window *);
|
||||
extern void gui_switch_to_previous_window ();
|
||||
extern void gui_switch_to_next_window ();
|
||||
extern void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_status (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_input (t_gui_buffer *, int);
|
||||
extern void gui_redraw_buffer (t_gui_buffer *);
|
||||
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
|
||||
extern void gui_switch_to_previous_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_window (t_gui_window *);
|
||||
extern void gui_move_page_up ();
|
||||
extern void gui_move_page_down ();
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_window_split_horiz (t_gui_window *);
|
||||
extern void gui_window_split_vertic (t_gui_window *);
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
extern void gui_init ();
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_end ();
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_window *, int, int, char *, ...);
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_main_loop ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -41,7 +41,7 @@ char *channel_modes = "iklmnst";
|
||||
|
||||
t_irc_channel *
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
int switch_to_window)
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_irc_channel *new_channel;
|
||||
|
||||
@@ -72,7 +72,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
server->channels = new_channel;
|
||||
server->last_channel = new_channel;
|
||||
|
||||
gui_window_new (server, new_channel, switch_to_window);
|
||||
gui_buffer_new (gui_current_window, server, new_channel, switch_to_buffer);
|
||||
|
||||
/* all is ok, return address of new channel */
|
||||
return new_channel;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* irc-dcc.c: DCC communications (files & chat) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* dcc_connect: connect to another host
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_connect ()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_send: send DCC request (file or chat)
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_send ()
|
||||
{
|
||||
}
|
||||
+25
-25
@@ -41,16 +41,16 @@
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
{
|
||||
if (prefix[0] == prefix[2])
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -59,45 +59,45 @@ irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "<");
|
||||
if (cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_op)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
else
|
||||
{
|
||||
if (nick->is_halfop)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else
|
||||
{
|
||||
if (nick->has_voice)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (color_nick < 0)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", nick->nick);
|
||||
else
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
@@ -106,7 +106,7 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
"%s", nick->nick);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "> ");
|
||||
}
|
||||
|
||||
@@ -115,21 +115,21 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_mode (t_gui_window *window, char *channel_name, char set_flag,
|
||||
irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
char *symbol, char *nick_host, char *message, char *param)
|
||||
{
|
||||
irc_display_prefix (window, PREFIX_INFO);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
irc_display_prefix (buffer, PREFIX_INFO);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
if (param)
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s\n", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
|
||||
}
|
||||
|
||||
+18
-26
@@ -37,34 +37,18 @@
|
||||
*/
|
||||
|
||||
int
|
||||
nick_find_color (t_irc_channel *channel)
|
||||
nick_find_color (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 = strlen (nick->nick) - 1; i >= 0; 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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -182,7 +166,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
/* alloc memory for new nick */
|
||||
if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
|
||||
{
|
||||
gui_printf (channel->window,
|
||||
gui_printf (channel->buffer,
|
||||
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
@@ -192,10 +176,10 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->window)->nick) == 0)
|
||||
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 (new_nick);
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
@@ -231,10 +215,18 @@ nick_resort (t_irc_channel *channel, t_irc_nick *nick)
|
||||
void
|
||||
nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick)
|
||||
{
|
||||
int nick_is_me;
|
||||
|
||||
nick_is_me = (strcmp (nick->nick, SERVER(channel->buffer)->nick) == 0) ? 1 : 0;
|
||||
|
||||
/* change nickname */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
nick->nick = strdup (new_nick);
|
||||
if (nick_is_me)
|
||||
nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
nick->color = nick_find_color (nick);
|
||||
|
||||
/* insert again nick into sorted list */
|
||||
nick_resort (channel, nick);
|
||||
|
||||
+366
-331
File diff suppressed because it is too large
Load Diff
+65
-65
@@ -56,7 +56,7 @@ irc_login (t_irc_server *server)
|
||||
hostname[sizeof (hostname) - 1] = '\0';
|
||||
if (!hostname[0])
|
||||
strcpy (hostname, _("unknown"));
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s: using local hostname \"%s\"\n"),
|
||||
PACKAGE_NAME, hostname);
|
||||
server_sendf (server,
|
||||
@@ -198,15 +198,15 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s -o %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
return 0;
|
||||
@@ -221,16 +221,16 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s -v %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
return -1;
|
||||
@@ -310,15 +310,15 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
server_sendf (server, "KICK %s\r\n", arguments);
|
||||
else
|
||||
{
|
||||
if (WIN_IS_CHANNEL (gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
|
||||
{
|
||||
server_sendf (server,
|
||||
"KICK %s %s\r\n",
|
||||
CHANNEL(gui_current_window)->name, arguments);
|
||||
CHANNEL(gui_current_window->buffer)->name, arguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
return -1;
|
||||
@@ -388,19 +388,19 @@ irc_cmd_send_lusers (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_cmd_send_me (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
return -1;
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
|
||||
CHANNEL(gui_current_window)->name, arguments);
|
||||
irc_display_prefix (gui_current_window, PREFIX_ACTION_ME);
|
||||
gui_printf_color (gui_current_window,
|
||||
CHANNEL(gui_current_window->buffer)->name, arguments);
|
||||
irc_display_prefix (gui_current_window->buffer, PREFIX_ACTION_ME);
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
COLOR_WIN_CHAT_NICK, "%s", server->nick);
|
||||
gui_printf_color (gui_current_window,
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
COLOR_WIN_CHAT, " %s\n", arguments);
|
||||
return 0;
|
||||
}
|
||||
@@ -459,25 +459,25 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
if (strcmp (arguments, "*") == 0)
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
return -1;
|
||||
}
|
||||
ptr_channel = CHANNEL(gui_current_window);
|
||||
ptr_channel = CHANNEL(gui_current_window->buffer);
|
||||
ptr_nick = nick_search (ptr_channel, server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (ptr_channel->window, ptr_nick,
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
|
||||
@@ -492,14 +492,14 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_nick = nick_search (ptr_channel, server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (ptr_channel->window, ptr_nick,
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
}
|
||||
@@ -513,26 +513,26 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -543,7 +543,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
return -1;
|
||||
@@ -562,16 +562,16 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
|
||||
server_sendf (server, "NAMES %s\r\n", arguments);
|
||||
else
|
||||
{
|
||||
if (!WIN_IS_CHANNEL(gui_current_window))
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
server_sendf (server, "NAMES %s\r\n",
|
||||
CHANNEL(gui_current_window)->name);
|
||||
CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -609,16 +609,16 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s +o %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
return -1;
|
||||
@@ -663,36 +663,36 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window)->name;
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_args = arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
if (WIN_IS_PRIVATE(gui_current_window))
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
{
|
||||
ptr_channel = CHANNEL(gui_current_window);
|
||||
gui_window_free (ptr_channel->window);
|
||||
ptr_channel = CHANNEL(gui_current_window->buffer);
|
||||
gui_buffer_free (ptr_channel->buffer, 1);
|
||||
channel_free (server, ptr_channel);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
gui_redraw_window_input (gui_current_window);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
return 0;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window)->name;
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_args = NULL;
|
||||
}
|
||||
|
||||
@@ -753,29 +753,29 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
/* display text if given */
|
||||
if (pos)
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -970,14 +970,14 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
|
||||
/* look for current channel if not specified */
|
||||
if (!channel_name)
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window)->name;
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
}
|
||||
|
||||
if (new_topic)
|
||||
@@ -1040,8 +1040,8 @@ irc_cmd_send_version (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (arguments)
|
||||
{
|
||||
if (WIN_IS_CHANNEL(gui_current_window) &&
|
||||
nick_search (CHANNEL(gui_current_window), arguments))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer) &&
|
||||
nick_search (CHANNEL(gui_current_window->buffer), arguments))
|
||||
server_sendf (server, "PRIVMSG %s :\01VERSION\01\r\n",
|
||||
arguments);
|
||||
else
|
||||
@@ -1050,8 +1050,8 @@ irc_cmd_send_version (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->window, PREFIX_INFO);
|
||||
gui_printf (server->window, _("%s, compiled on %s %s\n"),
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s, compiled on %s %s\n"),
|
||||
PACKAGE_STRING,
|
||||
__DATE__, __TIME__);
|
||||
server_sendf (server, "VERSION\r\n");
|
||||
@@ -1068,16 +1068,16 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s +v %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
return -1;
|
||||
|
||||
+24
-26
@@ -78,7 +78,7 @@ server_init (t_irc_server *server)
|
||||
server->is_away = 0;
|
||||
server->server_read = -1;
|
||||
server->server_write = -1;
|
||||
server->window = NULL;
|
||||
server->buffer = NULL;
|
||||
server->channels = NULL;
|
||||
server->last_channel = NULL;
|
||||
}
|
||||
@@ -270,8 +270,6 @@ server_free (t_irc_server *server)
|
||||
(server->next_server)->prev_server = server->prev_server;
|
||||
|
||||
server_destroy (server);
|
||||
if (server->window)
|
||||
gui_window_free (server->window);
|
||||
free (server);
|
||||
irc_servers = new_irc_servers;
|
||||
}
|
||||
@@ -377,11 +375,11 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
size_buf = strlen (buffer);
|
||||
buffer[size_buf - 2] = '\0';
|
||||
#ifdef DEBUG
|
||||
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
#endif
|
||||
buffer[size_buf - 2] = '\r';
|
||||
if (server_send (server, buffer, size_buf) <= 0)
|
||||
gui_printf (server->window, _("%s error sending data to IRC server\n"),
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
|
||||
@@ -397,7 +395,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
message = (t_irc_message *) malloc (sizeof (t_irc_message));
|
||||
if (!message)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
return;
|
||||
@@ -408,7 +406,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
message->data = (char *) malloc (strlen (unterminated_message) +
|
||||
strlen (msg) + 1);
|
||||
if (!message->data)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
else
|
||||
@@ -462,14 +460,14 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
(char *) realloc (unterminated_message,
|
||||
strlen (buffer) + 1);
|
||||
if (!unterminated_message)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
else
|
||||
strcpy (unterminated_message, buffer);
|
||||
return;
|
||||
}
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
@@ -493,7 +491,7 @@ server_msgq_flush ()
|
||||
if (recv_msgq->data)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
|
||||
gui_printf (gui_current_window->buffer, "[DEBUG] %s\n", recv_msgq->data);
|
||||
#endif
|
||||
|
||||
ptr_data = recv_msgq->data;
|
||||
@@ -542,15 +540,15 @@ server_msgq_flush ()
|
||||
command, args))
|
||||
{
|
||||
case -1:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Command '%s' failed!\n"), command);
|
||||
break;
|
||||
case -2:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("No command to execute!\n"));
|
||||
break;
|
||||
case -3:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Unknown command: cmd=%s, args=%s\n"),
|
||||
command, args);
|
||||
break;
|
||||
@@ -602,7 +600,7 @@ server_connect (t_irc_server *server)
|
||||
int error;
|
||||
int server_pipe[2];
|
||||
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s: connecting to %s:%d...\n"),
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
wee_log_printf (_("connecting to server %s:%d...\n"),
|
||||
@@ -612,7 +610,7 @@ server_connect (t_irc_server *server)
|
||||
/* create pipe */
|
||||
if (pipe (server_pipe) < 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
server_free (server);
|
||||
return 0;
|
||||
@@ -626,14 +624,14 @@ server_connect (t_irc_server *server)
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
|
||||
@@ -641,7 +639,7 @@ server_connect (t_irc_server *server)
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
close (server->server_read);
|
||||
@@ -657,14 +655,14 @@ server_connect (t_irc_server *server)
|
||||
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
|
||||
if (error != 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
WEECHAT_ERORR "server_connect: can't bind to hostname\n");
|
||||
return 0;
|
||||
} */
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
@@ -674,13 +672,13 @@ server_connect (t_irc_server *server)
|
||||
}
|
||||
|
||||
/* connection to server */
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||
|
||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
@@ -708,7 +706,7 @@ server_auto_connect (int command_line)
|
||||
if ( ((command_line) && (ptr_server->command_line))
|
||||
|| ((!command_line) && (ptr_server->autoconnect)) )
|
||||
{
|
||||
(void) gui_window_new (ptr_server, NULL, 1);
|
||||
(void) gui_buffer_new (gui_current_window, ptr_server, NULL, 1);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
}
|
||||
@@ -726,12 +724,12 @@ server_disconnect (t_irc_server *server)
|
||||
|
||||
if (server->is_connected)
|
||||
{
|
||||
/* write disconnection message on each channel/private window */
|
||||
/* write disconnection message on each channel/private buffer */
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
irc_display_prefix (ptr_channel->window, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->window, _("Disconnected from server!\n"));
|
||||
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
|
||||
/* close communication with server */
|
||||
|
||||
+5
-5
@@ -83,7 +83,7 @@ struct t_irc_channel
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_window *window; /* GUI window allocated for channel */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for channel */
|
||||
t_irc_channel *prev_channel; /* link to previous channel */
|
||||
t_irc_channel *next_channel; /* link to next channel */
|
||||
};
|
||||
@@ -116,7 +116,7 @@ struct t_irc_server
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
t_gui_window *window; /* GUI window allocated for server */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for server */
|
||||
t_irc_channel *channels; /* opened channels on server */
|
||||
t_irc_channel *last_channel; /* last opened channal on server */
|
||||
t_irc_server *prev_server; /* link to previous server */
|
||||
@@ -204,9 +204,9 @@ extern void dcc_send ();
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_window *, char *);
|
||||
extern void irc_display_nick (t_gui_window *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
|
||||
char *, char *);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
|
||||
+15
-15
@@ -120,7 +120,7 @@ static XS (XS_IRC_register)
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print: print message to current window
|
||||
* IRC::print: print message to current buffer
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print)
|
||||
@@ -135,8 +135,8 @@ static XS (XS_IRC_print)
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
message = SvPV (ST (i), integer);
|
||||
irc_display_prefix (gui_current_window, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window, "%s", message);
|
||||
irc_display_prefix (gui_current_window->buffer, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window->buffer, "%s", message);
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
@@ -151,7 +151,7 @@ static XS (XS_IRC_print_with_channel)
|
||||
{
|
||||
int integer;
|
||||
char *message, *channel, *server = NULL;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
dXSARGS;
|
||||
@@ -167,9 +167,9 @@ static XS (XS_IRC_print_with_channel)
|
||||
server = NULL;
|
||||
}
|
||||
|
||||
/* look for window for printing message */
|
||||
/* look for buffer for printing message */
|
||||
channel = SvPV (ST (1), integer);
|
||||
ptr_window = NULL;
|
||||
ptr_buffer = NULL;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
@@ -180,25 +180,25 @@ static XS (XS_IRC_print_with_channel)
|
||||
{
|
||||
if (strcasecmp (ptr_channel->name, channel) == 0)
|
||||
{
|
||||
ptr_window = ptr_channel->window;
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ptr_window)
|
||||
if (ptr_buffer)
|
||||
break;
|
||||
}
|
||||
|
||||
/* window found => display message & return 1 */
|
||||
if (ptr_window)
|
||||
/* buffer found => display message & return 1 */
|
||||
if (ptr_buffer)
|
||||
{
|
||||
message = SvPV (ST (0), integer);
|
||||
irc_display_prefix (ptr_window, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_window, "%s", message);
|
||||
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s", message);
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/* no window found => return 0 */
|
||||
/* no buffer found => return 0 */
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -307,8 +307,8 @@ static XS (XS_IRC_get_info)
|
||||
}
|
||||
else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) )
|
||||
{
|
||||
if (WIN_IS_CHANNEL (gui_current_window))
|
||||
info = CHANNEL (gui_current_window)->name;
|
||||
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
|
||||
info = CHANNEL (gui_current_window->buffer)->name;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) )
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "June 2004" "FlashCode"
|
||||
.TH WEECHAT 1 "August 2004" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat \- Wee Enhanced Environment for Chat
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.0.6
|
||||
%define version 0.0.7
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -41,6 +41,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Sat Aug 08 2004 FlashCode <flashcode@flashtux.org> 0.0.7-1
|
||||
- Released version 0.0.7
|
||||
* Sat Jun 05 2004 FlashCode <flashcode@flashtux.org> 0.0.6-1
|
||||
- Released version 0.0.6
|
||||
* Thu Feb 02 2004 FlashCode <flashcode@flashtux.org> 0.0.5-1
|
||||
|
||||
+2
-1
@@ -1,12 +1,13 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
WeeChat known bugs, 2004-06-05
|
||||
WeeChat known bugs, 2004-08-08
|
||||
|
||||
- ./configure does not check that Curses headers are installed
|
||||
- ./configure does not check that Gtk 2.0 libraries are installed
|
||||
- ./configure does not check that Perl headers & libraries are installed
|
||||
- too much nicks in the channel (> height of window) => display bug
|
||||
- problem when resizing terminal and that some windows are outside new term size
|
||||
- some IRC commands are marked as 'unknown' when received
|
||||
(IRC protocol is under dev!)
|
||||
- too much opened channels => display bug
|
||||
|
||||
+14
-1
@@ -1,9 +1,22 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2004-06-05
|
||||
ChangeLog - 2004-08-08
|
||||
|
||||
|
||||
Version 0.0.7 (2004-08-08):
|
||||
* new "col_status_delimiters" config option
|
||||
* /buffer command added, buffers ordered by number, auto-jump to active
|
||||
buffers (alt-a), jump to buffers by number (alt-number)
|
||||
* /window command added, 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)
|
||||
* fixed bug when opened private win and remote user changes his nick
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
* FlashCode, 2004-08-08
|
||||
|
||||
WeeChat 0.0.7 released.
|
||||
|
||||
* FlashCode, 2004-06-05
|
||||
|
||||
WeeChat 0.0.6 released.
|
||||
|
||||
* FlashCode, 2004-02-07
|
||||
|
||||
WeeChat 0.0.5 released.
|
||||
|
||||
+6
-12
@@ -1,7 +1,7 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
TODO - 2004-06-05
|
||||
TODO - 2004-08-08
|
||||
|
||||
Legend:
|
||||
# done
|
||||
@@ -10,7 +10,7 @@ Legend:
|
||||
? is this really necessary?
|
||||
|
||||
|
||||
v0.0.6:
|
||||
v0.0.8:
|
||||
------
|
||||
|
||||
* General:
|
||||
@@ -18,13 +18,14 @@ v0.0.6:
|
||||
+ Solaris version
|
||||
|
||||
* IRC protocol:
|
||||
# "/mode" command: change the user/channels modes
|
||||
+ "/dcc" command (for chat and sending/receiving files)
|
||||
# "/query" command: start private conversation
|
||||
|
||||
* Interface:
|
||||
+ "/buffer" command, buffers ordered by number, auto-jump to active
|
||||
buffers (alt-a), jump to buffers by number (alt-number)
|
||||
+ "/window" command, split terminal in multiple windows
|
||||
(horizontally/vertically)
|
||||
+ internationalization (traduce WeeChat in many languages)
|
||||
# display current channel modes (example : #weechat(+nt))
|
||||
|
||||
* Configuration:
|
||||
+ add missing options for config file
|
||||
@@ -63,10 +64,7 @@ Future versions:
|
||||
+ Gtk GUI
|
||||
- color for nicks (except own nick) when nick colors are disabled
|
||||
- interpret special chars in messages (color & bold for example)
|
||||
- many channel windows in one window/term (window split)
|
||||
- add lag indicator
|
||||
- forget some old lines that were displayed long time ago (now all is saved,
|
||||
if WeeChat is running for long time, a lot of memory is used!)
|
||||
- improve completion (for example complete command parameters when possible)
|
||||
- understand incomplete commands if unambigous (for example: /he for /help is ok)
|
||||
- tab key with empty command line should switch to next window (like F7)
|
||||
@@ -79,10 +77,6 @@ Future versions:
|
||||
- SSL support
|
||||
- IPv6 protocol implementation
|
||||
|
||||
* Configuration:
|
||||
- load config file after GUI (so init values by default (colors, ...) before
|
||||
loading config)
|
||||
|
||||
* Plugins:
|
||||
- Python plugin
|
||||
- "/python load" and "/python unload" commands to (un)load Python scripts
|
||||
|
||||
+21
-7
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.6, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.0.7, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.6])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.7])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
@@ -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,11 +108,15 @@ 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
|
||||
|
||||
CFLAGS="-Wall -W -pipe -O2"
|
||||
if test "x$debug" = "x2" ; then
|
||||
AC_DEFINE(DEBUG)
|
||||
fi
|
||||
|
||||
AC_OUTPUT([Makefile
|
||||
src/Makefile
|
||||
@@ -145,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
|
||||
@@ -153,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
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
weechat (0.0.7-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.7, see ChangeLog for detail.
|
||||
|
||||
-- FlashCode <flashcode@flashtux.org> Sat, 08 Aug 2004 21:00:00 +0200
|
||||
|
||||
weechat (0.0.6-1) unstable; urgency=low
|
||||
|
||||
* WeeChat version 0.0.6, see ChangeLog for detail.
|
||||
|
||||
@@ -21,14 +21,6 @@ Description: Fast, light and extensible IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-gtk
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, weechat-common (= ${Source-Version})
|
||||
Description: Fast, light and extensible IRC client
|
||||
WeeChat (Wee Enhanced Environment for Chat) is a fast and light IRC client
|
||||
for many operating systems. Everything can be done with a keyboard.
|
||||
It is customizable and extensible with scripts.
|
||||
|
||||
Package: weechat-common
|
||||
Architecture: all
|
||||
Replaces: weechat
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
This package was debianized by FlashCode <flashcode@flashtux.org> on
|
||||
Sat, 05 Jun 2004 11:30:00 +0200.
|
||||
Sat, 08 Aug 2004 21:00:00 +0200.
|
||||
|
||||
It was downloaded from http://weechat.flashtux.org/download
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ endif
|
||||
configure: configure-stamp
|
||||
configure-stamp:
|
||||
dh_testdir
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-perl --enable-gtk
|
||||
./configure --prefix=/usr --sysconfdir=/etc --enable-perl
|
||||
touch configure-stamp
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ install: build
|
||||
$(MAKE) install DESTDIR=$(CURDIR)/debian/weechat
|
||||
dh_install --sourcedir=debian/weechat
|
||||
install -o root -g root -m 755 src/gui/curses/weechat-curses $(CURDIR)/debian/weechat-curses/usr/bin
|
||||
install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||
#install -o root -g root -m 755 src/gui/gtk/weechat-gtk $(CURDIR)/debian/weechat-gtk/usr/bin
|
||||
|
||||
|
||||
# Build architecture-independent files here.
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - User guide
|
||||
@subtitle Fast, light and extensible IRC client
|
||||
@subtitle Documentation for WeeChat v0.0.6 - June, 05 2004
|
||||
@subtitle Documentation for WeeChat v0.0.7 - July, 04 2004
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -156,7 +156,7 @@ Mandrake/Redhat (or any RPM compatible distribution)@*
|
||||
To install: @kbd{rpm -i /path/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
To install: see Gentoo documentation
|
||||
To install: @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (not available!)
|
||||
@item
|
||||
@@ -178,7 +178,7 @@ Nota: to build only some interfaces, you can give parameters
|
||||
to ./configure, type @kbd{./configure --help} for help about options.@*
|
||||
|
||||
Then get root privileges and install WeeChat:@*
|
||||
@kbd{su -}@*
|
||||
@kbd{su}@*
|
||||
(enter root password)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@@ -343,12 +343,12 @@ Type: color (Curses or Gtk color), default value: 'default'@*
|
||||
@item col_status
|
||||
Color for status bar@*
|
||||
Type: color (Curses or Gtk color), default value: 'gray'@*
|
||||
@item col_status_active
|
||||
Color for active window (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_status_data_msg
|
||||
Color for window with new messages (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightred'@*
|
||||
@item col_status_highlight
|
||||
Color for window with highlight (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'yellow'@*
|
||||
@item col_status_data_other
|
||||
Color for window with new data (not messages) (status bar)@*
|
||||
Type: color (Curses or Gtk color), default value: 'lightmagenta'@*
|
||||
@@ -572,14 +572,23 @@ Execute command or send message@*
|
||||
Call again last commands/messages@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Show window history@*
|
||||
Show buffer history@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Switch to previous / next window@*
|
||||
Switch to previous / next buffer@*
|
||||
@*
|
||||
@item F8
|
||||
Switch to next window@*
|
||||
@*
|
||||
@item Alt + left arrow / Alt + right arrow
|
||||
Same as F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Switch to next buffer with activity (with priority: highlight, message, other)@*
|
||||
@*
|
||||
@item Alt + digit (1-9)
|
||||
Switch to buffer by number@*
|
||||
@*
|
||||
@item F10
|
||||
Remove last infobar message@*
|
||||
@*
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guide utilisateur
|
||||
@subtitle Client IRC rapide, l@'eger et extensible
|
||||
@subtitle Documentation pour WeeChat v0.0.6 - 5 juin 2004
|
||||
@subtitle Documentation pour WeeChat v0.0.7 - 04 juillet 2004
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -155,7 +155,7 @@ Mandrake/Redhat (ou toute distribution compatible avec les RPM)@*
|
||||
Pour installer : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
Pour installer : voir la documentation Gentoo
|
||||
Pour installer : @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (non disponible !)
|
||||
@item
|
||||
@@ -177,7 +177,7 @@ Note: pour ne construire que certaines interfaces, vous pouvez passer des param@
|
||||
@`a ./configure, tapez @kbd{./configure --help} pour de l'aide sur ces options.@*
|
||||
|
||||
Obtenez les droits root et installez WeeChat :@*
|
||||
@kbd{su -}@*
|
||||
@kbd{su}@*
|
||||
(entrez le mot de passe de root)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@@ -343,12 +343,12 @@ Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'default'@*
|
||||
@item col_status
|
||||
Couleur pour la barre de statut@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'gray'@*
|
||||
@item col_status_active
|
||||
Couleur pour la fen@^etre active (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_status_data_msg
|
||||
Couleur pour une fen@^etre avec de nouvelles infos (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightred'@*
|
||||
@item col_status_highlight
|
||||
Color for window with highlight (status bar)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'yellow'@*
|
||||
@item col_status_data_other
|
||||
Couleur pour une fen@^etre avec des nouvelles donn@'ees (pas des infos) (barre de statut)@*
|
||||
Type: couleur (couleur Curses ou Gtk), valeur par d@'efaut: 'lightmagenta'@*
|
||||
@@ -572,14 +572,23 @@ Ex@'ecuter la commande ou envoyer le message@*
|
||||
Rappeler les derni@`eres commandes/messages@*
|
||||
@*
|
||||
@item PageUp / PageDown
|
||||
Afficher l'historique de la fen@^etre@*
|
||||
Afficher l'historique du tampon@*
|
||||
@*
|
||||
@item F6 / F7
|
||||
Aller @`a la fen@^etre pr@'ec@'edente / suivante@*
|
||||
Aller au tampon pr@'ec@'edent@*
|
||||
@*
|
||||
@item F8
|
||||
Aller @`a la fen@^etre suivante@*
|
||||
@*
|
||||
@item Alt + fl@`eche gauche / Alt + fl@`eche droite
|
||||
Identique @`a F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Sauter au tampon avec activit@'e (avec priorit@'e: highlight, message, autre)@*
|
||||
@*
|
||||
@item Alt + chiffre (1-9)
|
||||
Sauter au tampon avec ce num@'ero@*
|
||||
@*
|
||||
@item F10
|
||||
Effacer le dernier message de la barre d'infos@*
|
||||
@*
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
|
||||
@title WeeChat - Guia do Utilizador
|
||||
@subtitle Cliente de IRC rapido, leve e extencivel
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.6 - 05 de Junho de 2004
|
||||
@subtitle Documenta@,{c}@~ao do WeeChat v0.0.7 - 04 de Julho de 2004
|
||||
|
||||
@image{weechat_image}
|
||||
|
||||
@@ -154,7 +154,7 @@ Mandrake/Redhat (ou outra distro compat@'ivel com RPMs)@*
|
||||
Instala@,{c}@~ao : @kbd{rpm -i /chemin/weechat-x.y.z-1.i386.rpm}
|
||||
@item
|
||||
Gentoo@*
|
||||
Instala@,{c}@~ao : ver a documenta@,{c}@~ao da Gentoo
|
||||
Instala@,{c}@~ao : @kbd{emerge weechat}
|
||||
@item
|
||||
*BSD (non disponible !)
|
||||
@item
|
||||
@@ -176,7 +176,7 @@ Nota: Para compilar certas interfaces, podes passar par@^ametros
|
||||
ao ./configure, escreve @kbd{./configure --help} para veres as op@,{c}@~oes.@*
|
||||
|
||||
Obter os direitos do root e instalar o Weechat :@*
|
||||
@kbd{su -}@*
|
||||
@kbd{su}@*
|
||||
(escreve aqui a palavra-passe do superutilizador)@*
|
||||
@kbd{make install}@*
|
||||
|
||||
@@ -277,6 +277,12 @@ Ir para a janela anterior/seguinte@*
|
||||
@item Alt + Seta da esquerda / Alt + Seta da direita
|
||||
Identico a F6 / F7@*
|
||||
@*
|
||||
@item Alt + A
|
||||
Comute ao amortecedor seguinte com atividade (com prioridade: destaque, mensagem, outra)@*
|
||||
@*
|
||||
@item Alt + d@'igito (1-9)
|
||||
Comute ao amortecedor pelo n@'umero@*
|
||||
@*
|
||||
@item F10
|
||||
Apagar a @'ultima mensagem da barra do info@*
|
||||
@*
|
||||
|
||||
+410
-333
File diff suppressed because it is too large
Load Diff
+404
-345
File diff suppressed because it is too large
Load Diff
@@ -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
|
||||
|
||||
+118
-26
@@ -43,6 +43,13 @@ t_weechat_command weechat_commands[] =
|
||||
N_("alias_name: name of alias\ncommand: command name (WeeChat "
|
||||
"or IRC command, without first '/')\n" "arguments: arguments for command"),
|
||||
0, MAX_ARGS, NULL, weechat_cmd_alias },
|
||||
{ "buffer", N_("manage buffers"),
|
||||
N_("[action | number]"),
|
||||
N_("action: action to do:\n"
|
||||
" move move buffer in the list (may be relative, for example -1)\n"
|
||||
" list list opened buffers (no parameter implies this list)\n"
|
||||
"number: jump to buffer by number"),
|
||||
0, MAX_ARGS, weechat_cmd_buffer, NULL },
|
||||
{ "clear", N_("clear window(s)"),
|
||||
N_("[-all]"),
|
||||
N_("-all: clear all windows"),
|
||||
@@ -77,7 +84,7 @@ t_weechat_command weechat_commands[] =
|
||||
"nick2: alternate nick for server\n"
|
||||
"nick3: second alternate nick for server\n"
|
||||
"username: user name\n"
|
||||
"realname: real name of user\n"),
|
||||
"realname: real name of user"),
|
||||
0, MAX_ARGS, weechat_cmd_server, NULL },
|
||||
{ "save", N_("save config to disk"),
|
||||
N_("[file]"), N_("file: filename for writing config"),
|
||||
@@ -88,6 +95,14 @@ t_weechat_command weechat_commands[] =
|
||||
{ "unalias", N_("remove an alias"),
|
||||
N_("alias_name"), N_("alias_name: name of alias to remove"),
|
||||
1, 1, NULL, weechat_cmd_unalias },
|
||||
{ "window", N_("manage windows"),
|
||||
N_("[action]"),
|
||||
N_("action: action to do:\n"
|
||||
" close close current window (under development!)\n"
|
||||
" list list opened windows (no parameter implies this list)\n"
|
||||
" splith split current window horizontally\n"
|
||||
" splitv split current window vertically"),
|
||||
0, MAX_ARGS, weechat_cmd_window, NULL },
|
||||
{ NULL, NULL, NULL, NULL, 0, 0, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -707,46 +722,46 @@ user_command (t_irc_server *server, char *command)
|
||||
{
|
||||
if ((command[0] == '/') && (command[1] == '/'))
|
||||
command++;
|
||||
if (server && (!WIN_IS_SERVER(gui_current_window)))
|
||||
if (server && (!BUFFER_IS_SERVER(gui_current_window->buffer)))
|
||||
{
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
command);
|
||||
|
||||
if (WIN_IS_PRIVATE(gui_current_window))
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
{
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window), server->nick);
|
||||
ptr_nick = nick_search (CHANNEL(gui_current_window->buffer), server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (CHANNEL(gui_current_window)->window, ptr_nick,
|
||||
irc_display_nick (CHANNEL(gui_current_window->buffer)->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color (CHANNEL(gui_current_window)->window,
|
||||
gui_printf_color (CHANNEL(gui_current_window->buffer)->buffer,
|
||||
COLOR_WIN_CHAT, "%s\n", command);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot find nick for sending message\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_printf ((server) ? server->window : NULL,
|
||||
gui_printf ((server) ? server->buffer : NULL,
|
||||
_("This window is not a channel!\n"));
|
||||
}
|
||||
}
|
||||
@@ -810,6 +825,49 @@ weechat_cmd_alias (char *arguments)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_buffer: manage buffers
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_buffer (int argc, char **argv)
|
||||
{
|
||||
int number;
|
||||
char *error;
|
||||
|
||||
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0)))
|
||||
{
|
||||
/* list opened bufferss */
|
||||
gui_printf (NULL, "buffer list -- NOT DEVELOPED!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcasecmp (argv[0], "move") == 0)
|
||||
{
|
||||
/* move buffer to another number in the list */
|
||||
gui_printf (NULL, "buffer move -- NOT DEVELOPED!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
number = strtol (argv[0], &error, 10);
|
||||
if (error)
|
||||
{
|
||||
gui_printf (NULL, _("%s incorrect buffer number\n"),
|
||||
WEECHAT_ERROR);
|
||||
return -1;
|
||||
}
|
||||
if (!gui_switch_to_buffer_by_number (gui_current_window, number))
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s buffer \"%s\" not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, argv[0], "buffer");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_clear: display or create alias
|
||||
*/
|
||||
@@ -820,7 +878,7 @@ weechat_cmd_clear (int argc, char **argv)
|
||||
if (argc == 1)
|
||||
{
|
||||
if (strcmp (argv[0], "-all") == 0)
|
||||
gui_window_clear_all ();
|
||||
gui_buffer_clear_all ();
|
||||
else
|
||||
{
|
||||
gui_printf (NULL,
|
||||
@@ -830,7 +888,7 @@ weechat_cmd_clear (int argc, char **argv)
|
||||
}
|
||||
}
|
||||
else
|
||||
gui_window_clear (gui_current_window);
|
||||
gui_buffer_clear (gui_current_window->buffer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -857,9 +915,9 @@ weechat_cmd_connect (int argc, char **argv)
|
||||
WEECHAT_ERROR, argv[0]);
|
||||
return -1;
|
||||
}
|
||||
if (!ptr_server->window)
|
||||
if (!ptr_server->buffer)
|
||||
{
|
||||
if (!gui_window_new (ptr_server, NULL, 1))
|
||||
if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 1))
|
||||
return -1;
|
||||
}
|
||||
if (server_connect (ptr_server))
|
||||
@@ -906,7 +964,7 @@ weechat_cmd_disconnect (int argc, char **argv)
|
||||
return -1;
|
||||
}
|
||||
server_disconnect (ptr_server);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1300,7 +1358,7 @@ weechat_cmd_server (int argc, char **argv)
|
||||
gui_printf_color (NULL, COLOR_WIN_CHAT, _("has been deleted\n"));
|
||||
|
||||
server_free (server_found);
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1441,7 +1499,7 @@ weechat_cmd_server (int argc, char **argv)
|
||||
|
||||
if (new_server->autoconnect)
|
||||
{
|
||||
(void) gui_window_new (new_server, NULL, 1);
|
||||
(void) gui_buffer_new (gui_current_window, new_server, NULL, 1);
|
||||
if (server_connect (new_server))
|
||||
irc_login (new_server);
|
||||
}
|
||||
@@ -1487,7 +1545,7 @@ weechat_cmd_set (char *arguments)
|
||||
if (ptr_option->handler_change == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s option '%s' can not be changed while WeeChat is running\n"),
|
||||
_("%s option \"%s\" can not be changed while WeeChat is running\n"),
|
||||
WEECHAT_ERROR, option);
|
||||
}
|
||||
else
|
||||
@@ -1499,13 +1557,13 @@ weechat_cmd_set (char *arguments)
|
||||
gui_printf (NULL, " %s = %s\n", option, value);
|
||||
}
|
||||
else
|
||||
gui_printf (NULL, _("%s incorrect value for option '%s'\n"),
|
||||
gui_printf (NULL, _("%s incorrect value for option \"%s\"\n"),
|
||||
WEECHAT_ERROR, option);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (NULL, _("%s config option '%s' not found\n"),
|
||||
gui_printf (NULL, _("%s config option \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, option);
|
||||
}
|
||||
}
|
||||
@@ -1575,15 +1633,15 @@ weechat_cmd_set (char *arguments)
|
||||
if (number_found == 0)
|
||||
{
|
||||
if (value)
|
||||
gui_printf (NULL, _("No config option found with '%s'\n"),
|
||||
gui_printf (NULL, _("No config option found with \"%s\"\n"),
|
||||
value);
|
||||
else
|
||||
gui_printf (NULL, _("No config option found with '%s'\n"));
|
||||
gui_printf (NULL, _("No config option found with \"%s\"\n"));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value)
|
||||
gui_printf (NULL, _("%d config option(s) found with '%s'\n"),
|
||||
gui_printf (NULL, _("%d config option(s) found with \"%s\"\n"),
|
||||
number_found, value);
|
||||
else
|
||||
gui_printf (NULL, _("%d config option(s) found\n"),
|
||||
@@ -1619,3 +1677,37 @@ weechat_cmd_unalias (char *arguments)
|
||||
arguments);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* weechat_cmd_window: manage windows
|
||||
*/
|
||||
|
||||
int
|
||||
weechat_cmd_window (int argc, char **argv)
|
||||
{
|
||||
if ((argc == 0) || ((argc == 1) && (strcasecmp (argv[0], "list") == 0)))
|
||||
{
|
||||
/* list opened windows */
|
||||
gui_printf (NULL, "window list -- NOT DEVELOPED!\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcasecmp (argv[0], "splith") == 0)
|
||||
{
|
||||
/* split window horizontally */
|
||||
gui_window_split_horiz (gui_current_window);
|
||||
}
|
||||
else if (strcasecmp (argv[0], "splitv") == 0)
|
||||
{
|
||||
/* split window vertically */
|
||||
gui_window_split_vertic (gui_current_window);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s unknown option for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "window");
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@ extern t_weechat_alias *alias_new (char *, char *);
|
||||
extern int exec_weechat_command (t_irc_server *, char *);
|
||||
extern void user_command (t_irc_server *, char *);
|
||||
extern int weechat_cmd_alias (char *);
|
||||
extern int weechat_cmd_buffer (int, char **);
|
||||
extern int weechat_cmd_clear (int, char **);
|
||||
extern int weechat_cmd_connect (int, char **);
|
||||
extern int weechat_cmd_disconnect (int, char **);
|
||||
@@ -76,5 +77,6 @@ extern int weechat_cmd_save (int, char **);
|
||||
extern int weechat_cmd_server (int, char **);
|
||||
extern int weechat_cmd_set (char *);
|
||||
extern int weechat_cmd_unalias (char *);
|
||||
extern int weechat_cmd_window (int, char **);
|
||||
|
||||
#endif /* command.h */
|
||||
|
||||
@@ -29,11 +29,14 @@
|
||||
|
||||
#include "weechat.h"
|
||||
#include "history.h"
|
||||
#include "weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_history *history_general = NULL;
|
||||
t_history *history_general_last = NULL;
|
||||
t_history *history_general_ptr = NULL;
|
||||
int num_history_general = 0;
|
||||
|
||||
|
||||
/*
|
||||
@@ -41,27 +44,65 @@ t_history *history_general_ptr = NULL;
|
||||
*/
|
||||
|
||||
void
|
||||
history_add (void *window, char *string)
|
||||
history_add (void *buffer, char *string)
|
||||
{
|
||||
t_history *new_history;
|
||||
t_history *new_history, *ptr_history;
|
||||
|
||||
/* add history to general history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
|
||||
/* add history to general history */
|
||||
if (history_general)
|
||||
history_general->prev_history = new_history;
|
||||
else
|
||||
history_general_last = new_history;
|
||||
new_history->next_history = history_general;
|
||||
new_history->prev_history = NULL;
|
||||
history_general = new_history;
|
||||
num_history_general++;
|
||||
|
||||
/* add history to local history */
|
||||
if (((t_gui_window *)(window))->history)
|
||||
((t_gui_window *)(window))->history->prev_history = new_history;
|
||||
new_history->next_history = ((t_gui_window *)(window))->history;
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (num_history_general > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = history_general_last->prev_history;
|
||||
history_general_last->prev_history->next_history = NULL;
|
||||
if (history_general_last->text)
|
||||
free (history_general_last->text);
|
||||
free (history_general_last);
|
||||
history_general_last = ptr_history;
|
||||
num_history_general--;
|
||||
}
|
||||
}
|
||||
|
||||
/* add history to local history */
|
||||
new_history = (t_history *)malloc (sizeof (t_history));
|
||||
if (new_history)
|
||||
{
|
||||
new_history->text = strdup (string);
|
||||
|
||||
if (((t_gui_buffer *)(buffer))->history)
|
||||
((t_gui_buffer *)(buffer))->history->prev_history = new_history;
|
||||
else
|
||||
((t_gui_buffer *)(buffer))->last_history = new_history;
|
||||
new_history->next_history = ((t_gui_buffer *)(buffer))->history;
|
||||
new_history->prev_history = NULL;
|
||||
((t_gui_window *)window)->history = new_history;
|
||||
((t_gui_buffer *)buffer)->history = new_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
|
||||
/* remove one command if necessary */
|
||||
if ((cfg_history_max_commands > 0)
|
||||
&& (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
|
||||
{
|
||||
ptr_history = ((t_gui_buffer *)buffer)->last_history->prev_history;
|
||||
((t_gui_buffer *)buffer)->last_history->prev_history->next_history = NULL;
|
||||
if (((t_gui_buffer *)buffer)->last_history->text)
|
||||
free (((t_gui_buffer *)buffer)->last_history->text);
|
||||
free (((t_gui_buffer *)buffer)->last_history);
|
||||
((t_gui_buffer *)buffer)->last_history = ptr_history;
|
||||
((t_gui_buffer *)(buffer))->num_history++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* hotlist.c: WeeChat hotlist (buffers with activity) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "weechat.h"
|
||||
#include "hotlist.h"
|
||||
#include "../irc/irc.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_weechat_hotlist *hotlist = NULL;
|
||||
t_weechat_hotlist *last_hotlist = NULL;
|
||||
t_gui_buffer *hotlist_initial_buffer = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* hotlist_search: find hotlist with buffer pointer
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_search (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (ptr_hotlist->buffer == buffer)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_find_pos: find position for a inserting in hotlist (for sorting hotlist)
|
||||
*/
|
||||
|
||||
t_weechat_hotlist *
|
||||
hotlist_find_pos (t_weechat_hotlist *new_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *ptr_hotlist;
|
||||
|
||||
for (ptr_hotlist = hotlist; ptr_hotlist; ptr_hotlist = ptr_hotlist->next_hotlist)
|
||||
{
|
||||
if (new_hotlist->priority > ptr_hotlist->priority)
|
||||
return ptr_hotlist;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_add: add a buffer to hotlist, with priority
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_add (int priority, t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist, *pos_hotlist;
|
||||
|
||||
if ((pos_hotlist = hotlist_search (buffer)))
|
||||
{
|
||||
/* return if priority is greater or equal than the one to add */
|
||||
if (pos_hotlist->priority >= priority)
|
||||
return;
|
||||
/* remove buffer if present with lower priority and go on */
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
|
||||
if ((new_hotlist = (t_weechat_hotlist *) malloc (sizeof (t_weechat_hotlist))) == NULL)
|
||||
{
|
||||
gui_printf (NULL,
|
||||
_("%s cannot add a buffer to hotlist\n"), WEECHAT_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
new_hotlist->priority = priority;
|
||||
new_hotlist->buffer = buffer;
|
||||
|
||||
if (hotlist)
|
||||
{
|
||||
pos_hotlist = hotlist_find_pos (new_hotlist);
|
||||
|
||||
if (pos_hotlist)
|
||||
{
|
||||
/* insert hotlist into the hotlist (before hotlist found) */
|
||||
new_hotlist->prev_hotlist = pos_hotlist->prev_hotlist;
|
||||
new_hotlist->next_hotlist = pos_hotlist;
|
||||
if (pos_hotlist->prev_hotlist)
|
||||
pos_hotlist->prev_hotlist->next_hotlist = new_hotlist;
|
||||
else
|
||||
hotlist = new_hotlist;
|
||||
pos_hotlist->prev_hotlist = new_hotlist;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* add hotlist to the end */
|
||||
new_hotlist->prev_hotlist = last_hotlist;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
last_hotlist->next_hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
new_hotlist->prev_hotlist = NULL;
|
||||
new_hotlist->next_hotlist = NULL;
|
||||
hotlist = new_hotlist;
|
||||
last_hotlist = new_hotlist;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_free: free a hotlist and remove it from hotlist queue
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_free (t_weechat_hotlist *ptr_hotlist)
|
||||
{
|
||||
t_weechat_hotlist *new_hotlist;
|
||||
|
||||
/* remove hotlist from queue */
|
||||
if (last_hotlist == ptr_hotlist)
|
||||
last_hotlist = ptr_hotlist->prev_hotlist;
|
||||
if (ptr_hotlist->prev_hotlist)
|
||||
{
|
||||
(ptr_hotlist->prev_hotlist)->next_hotlist = ptr_hotlist->next_hotlist;
|
||||
new_hotlist = hotlist;
|
||||
}
|
||||
else
|
||||
new_hotlist = ptr_hotlist->next_hotlist;
|
||||
|
||||
if (ptr_hotlist->next_hotlist)
|
||||
(ptr_hotlist->next_hotlist)->prev_hotlist = ptr_hotlist->prev_hotlist;
|
||||
|
||||
free (ptr_hotlist);
|
||||
hotlist = new_hotlist;
|
||||
}
|
||||
|
||||
/*
|
||||
* hotlist_remove_buffer: remove a buffer from hotlist
|
||||
*/
|
||||
|
||||
void
|
||||
hotlist_remove_buffer (t_gui_buffer *buffer)
|
||||
{
|
||||
t_weechat_hotlist *pos_hotlist;
|
||||
|
||||
pos_hotlist = hotlist_search (buffer);
|
||||
if (pos_hotlist)
|
||||
hotlist_free (pos_hotlist);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __WEECHAT_HOTLIST_H
|
||||
#define __WEECHAT_HOTLIST_H 1
|
||||
|
||||
#include "../irc/irc.h"
|
||||
|
||||
typedef struct t_weechat_hotlist t_weechat_hotlist;
|
||||
|
||||
struct t_weechat_hotlist
|
||||
{
|
||||
int priority; /* 0=crappy msg (join/part), 1=msg, */
|
||||
/* 2=nick highlight */
|
||||
t_gui_buffer *buffer; /* associated buffer */
|
||||
t_weechat_hotlist *prev_hotlist; /* link to previous hotlist */
|
||||
t_weechat_hotlist *next_hotlist; /* link to next hotlist */
|
||||
};
|
||||
|
||||
extern t_weechat_hotlist *hotlist;
|
||||
extern t_gui_buffer *hotlist_initial_buffer;
|
||||
|
||||
extern void hotlist_add (int, t_gui_buffer *);
|
||||
extern void hotlist_free (t_weechat_hotlist *);
|
||||
extern void hotlist_remove_buffer (t_gui_buffer *);
|
||||
|
||||
#endif /* hotlist.h */
|
||||
@@ -103,7 +103,7 @@ wee_log_printf (char *message, ...)
|
||||
date_tmp->tm_hour, date_tmp->tm_min, date_tmp->tm_sec,
|
||||
buffer);
|
||||
else
|
||||
fprintf (log_file, "[????-??-?? ??:??:??] %s", buffer);
|
||||
fprintf (log_file, "%s", buffer);
|
||||
fflush (log_file);
|
||||
}
|
||||
|
||||
|
||||
@@ -109,33 +109,33 @@ t_config_option weechat_options_look[] =
|
||||
{ "look_nicklist", N_("display nicklist window"),
|
||||
N_("display nicklist window (for channel windows)"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_nicklist, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nicklist, NULL, config_change_buffers },
|
||||
{ "look_nicklist_position", N_("nicklist position"),
|
||||
N_("nicklist position (top, left, right (default), bottom)"),
|
||||
OPTION_TYPE_INT_WITH_STRING, 0, 0, 0,
|
||||
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_windows },
|
||||
"right", cfg_look_nicklist_position_values, &cfg_look_nicklist_position, NULL, config_change_buffers },
|
||||
{ "look_nicklist_min_size", N_("min size for nicklist"),
|
||||
N_("min size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no min size))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nicklist_min_size, NULL, config_change_buffers },
|
||||
{ "look_nicklist_max_size", N_("max size for nicklist"),
|
||||
N_("max size for nicklist (width or height, depending on look_nicklist_position "
|
||||
"(0 = no max size; if min == max and > 0, then size is fixed))"),
|
||||
OPTION_TYPE_INT, 0, 100, 0,
|
||||
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nicklist_max_size, NULL, config_change_buffers },
|
||||
{ "look_no_nickname", N_("text to display instead of nick when not connected"),
|
||||
N_("text to display instead of nick when not connected"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_window_content },
|
||||
"-cmd-", NULL, NULL, &cfg_look_no_nickname, config_change_buffer_content },
|
||||
{ "look_nickmode", N_("display nick mode ((half)op/voice) before each nick"),
|
||||
N_("display nick mode ((half)op/voice) before each nick"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_nickmode, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nickmode, NULL, config_change_buffers },
|
||||
{ "look_nickmode_empty", N_("display space if nick mode is not (half)op/voice"),
|
||||
N_("display space if nick mode is not (half)op/voice"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_FALSE,
|
||||
NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_nickmode_empty, NULL, config_change_buffers },
|
||||
{ "look_nick_completor", N_("the string inserted after nick completion"),
|
||||
N_("the string inserted after nick completion"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -143,11 +143,11 @@ t_config_option weechat_options_look[] =
|
||||
{ "look_infobar", N_("enable info bar"),
|
||||
N_("enable info bar"),
|
||||
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
|
||||
NULL, NULL, &cfg_look_infobar, NULL, config_change_windows },
|
||||
NULL, NULL, &cfg_look_infobar, NULL, config_change_buffers },
|
||||
{ "look_infobar_timestamp", N_("timestamp for time in infobar"),
|
||||
N_("timestamp for time in infobar"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_window_content },
|
||||
"%B, %A %d %G - %H:%M", NULL, NULL, &cfg_look_infobar_timestamp, config_change_buffer_content },
|
||||
{ "look_infobar_delay_highlight", N_("delay (in seconds) for highlight messages in infobar"),
|
||||
N_("delay (in seconds) for highlight messages in infobar "
|
||||
"(0 = disable highlight notifications in infobar)"),
|
||||
@@ -172,8 +172,9 @@ int cfg_col_chat_dark;
|
||||
int cfg_col_chat_highlight;
|
||||
int cfg_col_chat_bg;
|
||||
int cfg_col_status;
|
||||
int cfg_col_status_active;
|
||||
int cfg_col_status_delimiters;
|
||||
int cfg_col_status_data_msg;
|
||||
int cfg_col_status_data_highlight;
|
||||
int cfg_col_status_data_other;
|
||||
int cfg_col_status_more;
|
||||
int cfg_col_status_bg;
|
||||
@@ -255,18 +256,22 @@ t_config_option weechat_options_colors[] =
|
||||
N_("color for status bar"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"gray", NULL, &cfg_col_status, NULL, &config_change_color },
|
||||
{ "col_status_active", N_("color for active window"),
|
||||
N_("color for active window (status bar)"),
|
||||
{ "col_status_delimiters", N_("color for status bar delimiters"),
|
||||
N_("color for status bar delimiters"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"yellow", NULL, &cfg_col_status_active, NULL, &config_change_color },
|
||||
"cyan", NULL, &cfg_col_status_delimiters, NULL, &config_change_color },
|
||||
{ "col_status_data_msg", N_("color for window with new messages"),
|
||||
N_("color for window with new messages (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightred", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
|
||||
"yellow", NULL, &cfg_col_status_data_msg, NULL, &config_change_color },
|
||||
{ "col_status_highlight", N_("color for window with highlight"),
|
||||
N_("color for window with highlight (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightmagenta", NULL, &cfg_col_status_data_highlight, NULL, &config_change_color },
|
||||
{ "col_status_data_other", N_("color for window with new data (not messages)"),
|
||||
N_("color for window with new data (not messages) (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightmagenta", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
"gray", NULL, &cfg_col_status_data_other, NULL, &config_change_color },
|
||||
{ "col_status_more", N_("color for \"*MORE*\" text"),
|
||||
N_("color for window with new data (status bar)"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
@@ -615,24 +620,24 @@ config_change_title ()
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_windows: called when windows change (for example nicklist)
|
||||
* config_change_buffers: called when buffers change (for example nicklist)
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_windows ()
|
||||
config_change_buffers ()
|
||||
{
|
||||
gui_switch_to_window (gui_current_window);
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
* config_change_window_content: called when content of a window changes
|
||||
* config_change_buffer_content: called when content of a buffer changes
|
||||
*/
|
||||
|
||||
void
|
||||
config_change_window_content ()
|
||||
config_change_buffer_content ()
|
||||
{
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1258,8 +1263,8 @@ config_write (char *config_name)
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
if ((i == CONFIG_SECTION_HISTORY) || (i == CONFIG_SECTION_LOG) ||
|
||||
(i == CONFIG_SECTION_DCC) || (i == CONFIG_SECTION_PROXY))
|
||||
if ((i == CONFIG_SECTION_LOG) || (i == CONFIG_SECTION_DCC) ||
|
||||
(i == CONFIG_SECTION_PROXY))
|
||||
fprintf (file,
|
||||
"# WARNING!!! Options for section \"%s\" are not developed!\n",
|
||||
config_sections[i].section_name);
|
||||
|
||||
@@ -106,8 +106,9 @@ extern int cfg_col_chat_dark;
|
||||
extern int cfg_col_chat_highlight;
|
||||
extern int cfg_col_chat_bg;
|
||||
extern int cfg_col_status;
|
||||
extern int cfg_col_status_active;
|
||||
extern int cfg_col_status_delimiters;
|
||||
extern int cfg_col_status_data_msg;
|
||||
extern int cfg_col_status_data_highlight;
|
||||
extern int cfg_col_status_data_other;
|
||||
extern int cfg_col_status_more;
|
||||
extern int cfg_col_status_bg;
|
||||
@@ -158,8 +159,8 @@ extern t_config_option * weechat_options [CONFIG_NUMBER_SECTIONS];
|
||||
extern char *config_get_section ();
|
||||
extern void config_change_noop ();
|
||||
extern void config_change_title ();
|
||||
extern void config_change_windows ();
|
||||
extern void config_change_window_content ();
|
||||
extern void config_change_buffers ();
|
||||
extern void config_change_buffer_content ();
|
||||
extern void config_change_color ();
|
||||
extern int config_option_set_value (t_config_option *, char *);
|
||||
extern t_config_option *config_option_search (char *);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
+208
-154
@@ -37,6 +37,7 @@
|
||||
#include "../gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/command.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../../irc/irc.h"
|
||||
|
||||
#define KEY_ESCAPE 27
|
||||
@@ -49,7 +50,7 @@ void
|
||||
gui_read_keyb ()
|
||||
{
|
||||
int key, i;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
char new_char[2];
|
||||
|
||||
key = getch ();
|
||||
@@ -59,15 +60,30 @@ gui_read_keyb ()
|
||||
{
|
||||
/* resize event */
|
||||
case KEY_RESIZE:
|
||||
gui_redraw_window (gui_current_window);
|
||||
gui_calculate_pos_size (gui_current_window);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
break;
|
||||
/* previous window */
|
||||
/* inactive function keys */
|
||||
case KEY_F(1):
|
||||
case KEY_F(2):
|
||||
case KEY_F(3):
|
||||
case KEY_F(4):
|
||||
case KEY_F(5):
|
||||
case KEY_F(9):
|
||||
case KEY_F(11):
|
||||
case KEY_F(12):
|
||||
break;
|
||||
/* previous buffer in window */
|
||||
case KEY_F(6):
|
||||
gui_switch_to_previous_window ();
|
||||
gui_switch_to_previous_buffer (gui_current_window);
|
||||
break;
|
||||
/* next buffer in window */
|
||||
case KEY_F(7):
|
||||
gui_switch_to_next_buffer (gui_current_window);
|
||||
break;
|
||||
/* next window */
|
||||
case KEY_F(7):
|
||||
gui_switch_to_next_window ();
|
||||
case KEY_F(8):
|
||||
gui_switch_to_next_window (gui_current_window);
|
||||
break;
|
||||
/* remove last infobar message */
|
||||
case KEY_F(10):
|
||||
@@ -75,218 +91,223 @@ gui_read_keyb ()
|
||||
break;
|
||||
/* cursor up */
|
||||
case KEY_UP:
|
||||
if (gui_current_window->ptr_history)
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
{
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->ptr_history->next_history;
|
||||
if (!gui_current_window->ptr_history)
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->history;
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->ptr_history->next_history;
|
||||
if (!gui_current_window->buffer->ptr_history)
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->history;
|
||||
}
|
||||
else
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->history;
|
||||
if (gui_current_window->ptr_history)
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->history;
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
{
|
||||
gui_current_window->input_buffer_size =
|
||||
strlen (gui_current_window->ptr_history->text);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
strcpy (gui_current_window->input_buffer,
|
||||
gui_current_window->ptr_history->text);
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_size =
|
||||
strlen (gui_current_window->buffer->ptr_history->text);
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->input_buffer_size;
|
||||
strcpy (gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->ptr_history->text);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* cursor down */
|
||||
case KEY_DOWN:
|
||||
if (gui_current_window->ptr_history)
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
{
|
||||
gui_current_window->ptr_history =
|
||||
gui_current_window->ptr_history->prev_history;
|
||||
if (gui_current_window->ptr_history)
|
||||
gui_current_window->input_buffer_size =
|
||||
strlen (gui_current_window->ptr_history->text);
|
||||
gui_current_window->buffer->ptr_history =
|
||||
gui_current_window->buffer->ptr_history->prev_history;
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
gui_current_window->buffer->input_buffer_size =
|
||||
strlen (gui_current_window->buffer->ptr_history->text);
|
||||
else
|
||||
gui_current_window->input_buffer_size = 0;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
if (gui_current_window->ptr_history)
|
||||
strcpy (gui_current_window->input_buffer,
|
||||
gui_current_window->ptr_history->text);
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_size = 0;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->input_buffer_size;
|
||||
if (gui_current_window->buffer->ptr_history)
|
||||
strcpy (gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->ptr_history->text);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* cursor left */
|
||||
case KEY_LEFT:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (gui_current_window->buffer->input_buffer_pos > 0)
|
||||
{
|
||||
gui_current_window->input_buffer_pos--;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos--;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* cursor right */
|
||||
case KEY_RIGHT:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
if (gui_current_window->buffer->input_buffer_pos <
|
||||
gui_current_window->buffer->input_buffer_size)
|
||||
{
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* home key */
|
||||
case KEY_HOME:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (gui_current_window->buffer->input_buffer_pos > 0)
|
||||
{
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos = 0;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* end key */
|
||||
case KEY_END:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
if (gui_current_window->buffer->input_buffer_pos <
|
||||
gui_current_window->buffer->input_buffer_size)
|
||||
{
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->input_buffer_size;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* page up */
|
||||
case KEY_PPAGE:
|
||||
gui_move_page_up ();
|
||||
gui_move_page_up (gui_current_window);
|
||||
break;
|
||||
/* page down */
|
||||
case KEY_NPAGE:
|
||||
gui_move_page_down ();
|
||||
gui_move_page_down (gui_current_window);
|
||||
break;
|
||||
/* erase before cursor and move cursor to the left */
|
||||
case 127:
|
||||
case KEY_BACKSPACE:
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (gui_current_window->buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos-1;
|
||||
while (gui_current_window->input_buffer[i])
|
||||
i = gui_current_window->buffer->input_buffer_pos-1;
|
||||
while (gui_current_window->buffer->input_buffer[i])
|
||||
{
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i+1];
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i+1];
|
||||
i++;
|
||||
}
|
||||
gui_current_window->input_buffer_size--;
|
||||
gui_current_window->input_buffer_pos--;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_current_window->buffer->input_buffer_size--;
|
||||
gui_current_window->buffer->input_buffer_pos--;
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
}
|
||||
break;
|
||||
/* Control + Backspace */
|
||||
case 0x08:
|
||||
gui_delete_previous_word ();
|
||||
gui_delete_previous_word (gui_current_window->buffer);
|
||||
break;
|
||||
/* erase char under cursor */
|
||||
case KEY_DC:
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size)
|
||||
if (gui_current_window->buffer->input_buffer_pos <
|
||||
gui_current_window->buffer->input_buffer_size)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos;
|
||||
while (gui_current_window->input_buffer[i])
|
||||
i = gui_current_window->buffer->input_buffer_pos;
|
||||
while (gui_current_window->buffer->input_buffer[i])
|
||||
{
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i+1];
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i+1];
|
||||
i++;
|
||||
}
|
||||
gui_current_window->input_buffer_size--;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_current_window->buffer->input_buffer_size--;
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
}
|
||||
break;
|
||||
/* Tab : completion */
|
||||
case '\t':
|
||||
completion_search (&(gui_current_window->completion),
|
||||
CHANNEL(gui_current_window),
|
||||
gui_current_window->input_buffer,
|
||||
gui_current_window->input_buffer_size,
|
||||
gui_current_window->input_buffer_pos);
|
||||
if (gui_current_window->completion.word_found)
|
||||
completion_search (&(gui_current_window->buffer->completion),
|
||||
CHANNEL(gui_current_window->buffer),
|
||||
gui_current_window->buffer->input_buffer,
|
||||
gui_current_window->buffer->input_buffer_size,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
if (gui_current_window->buffer->completion.word_found)
|
||||
{
|
||||
// replace word with new completed word into input buffer
|
||||
gui_current_window->input_buffer_size +=
|
||||
gui_current_window->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_current_window->buffer->input_buffer_size +=
|
||||
gui_current_window->buffer->completion.diff_size;
|
||||
gui_optimize_input_buffer_size (gui_current_window->buffer);
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
|
||||
if (gui_current_window->completion.diff_size > 0)
|
||||
if (gui_current_window->buffer->completion.diff_size > 0)
|
||||
{
|
||||
for (i = gui_current_window->input_buffer_size - 1;
|
||||
i >= gui_current_window->completion.position_replace +
|
||||
(int)strlen (gui_current_window->completion.word_found); i--)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i -
|
||||
gui_current_window->completion.diff_size];
|
||||
for (i = gui_current_window->buffer->input_buffer_size - 1;
|
||||
i >= gui_current_window->buffer->completion.position_replace +
|
||||
(int)strlen (gui_current_window->buffer->completion.word_found); i--)
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i -
|
||||
gui_current_window->buffer->completion.diff_size];
|
||||
}
|
||||
else
|
||||
{
|
||||
for (i = gui_current_window->completion.position_replace +
|
||||
strlen (gui_current_window->completion.word_found);
|
||||
i < gui_current_window->input_buffer_size; i++)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i -
|
||||
gui_current_window->completion.diff_size];
|
||||
for (i = gui_current_window->buffer->completion.position_replace +
|
||||
strlen (gui_current_window->buffer->completion.word_found);
|
||||
i < gui_current_window->buffer->input_buffer_size; i++)
|
||||
gui_current_window->buffer->input_buffer[i] =
|
||||
gui_current_window->buffer->input_buffer[i -
|
||||
gui_current_window->buffer->completion.diff_size];
|
||||
}
|
||||
|
||||
strncpy (gui_current_window->input_buffer + gui_current_window->completion.position_replace,
|
||||
gui_current_window->completion.word_found,
|
||||
strlen (gui_current_window->completion.word_found));
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->completion.position_replace +
|
||||
strlen (gui_current_window->completion.word_found);
|
||||
gui_current_window->completion.position =
|
||||
gui_current_window->input_buffer_pos;
|
||||
strncpy (gui_current_window->buffer->input_buffer + gui_current_window->buffer->completion.position_replace,
|
||||
gui_current_window->buffer->completion.word_found,
|
||||
strlen (gui_current_window->buffer->completion.word_found));
|
||||
gui_current_window->buffer->input_buffer_pos =
|
||||
gui_current_window->buffer->completion.position_replace +
|
||||
strlen (gui_current_window->buffer->completion.word_found);
|
||||
gui_current_window->buffer->completion.position =
|
||||
gui_current_window->buffer->input_buffer_pos;
|
||||
|
||||
/* add space or completor to the end of completion, if needed */
|
||||
if (gui_current_window->completion.base_word[0] == '/')
|
||||
if (gui_current_window->buffer->completion.base_word[0] == '/')
|
||||
{
|
||||
if (gui_current_window->input_buffer[gui_current_window->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (" ",
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position++;
|
||||
gui_current_window->input_buffer_pos++;
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gui_current_window->completion.base_word_pos == 0)
|
||||
if (gui_current_window->buffer->completion.base_word_pos == 0)
|
||||
{
|
||||
if (strncmp (gui_current_window->input_buffer + gui_current_window->input_buffer_pos,
|
||||
if (strncmp (gui_current_window->buffer->input_buffer + gui_current_window->buffer->input_buffer_pos,
|
||||
cfg_look_completor, strlen (cfg_look_completor)) != 0)
|
||||
gui_buffer_insert_string (cfg_look_completor,
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position += strlen (cfg_look_completor);
|
||||
gui_current_window->input_buffer_pos += strlen (cfg_look_completor);
|
||||
if (gui_current_window->input_buffer[gui_current_window->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (" ",
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->completion.position++;
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
cfg_look_completor,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position += strlen (cfg_look_completor);
|
||||
gui_current_window->buffer->input_buffer_pos += strlen (cfg_look_completor);
|
||||
if (gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_pos] != ' ')
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
" ",
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->completion.position++;
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
}
|
||||
}
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
}
|
||||
break;
|
||||
/* escape code (for control-key) */
|
||||
case KEY_ESCAPE:
|
||||
if ((key = getch()) != ERR)
|
||||
{
|
||||
/*gui_printf (gui_current_window->buffer,
|
||||
"[Debug] key pressed = %d, as octal: %o\n", key, key);*/
|
||||
switch (key)
|
||||
{
|
||||
case KEY_LEFT:
|
||||
gui_switch_to_previous_window ();
|
||||
gui_switch_to_previous_buffer (gui_current_window);
|
||||
break;
|
||||
case KEY_RIGHT:
|
||||
gui_switch_to_next_window ();
|
||||
gui_switch_to_next_buffer (gui_current_window);
|
||||
break;
|
||||
case 79:
|
||||
/* TODO: replace 79 by constant name! */
|
||||
@@ -298,50 +319,84 @@ gui_read_keyb ()
|
||||
{
|
||||
/* Control + Right */
|
||||
case 99:
|
||||
gui_move_next_word ();
|
||||
gui_move_next_word (gui_current_window->buffer);
|
||||
break;
|
||||
/* Control + Left */
|
||||
case 100:
|
||||
gui_move_previous_word ();
|
||||
gui_move_previous_word (gui_current_window->buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* Alt-number */
|
||||
case 48: /* Alt-0 */
|
||||
case 49: /* Alt-1 */
|
||||
case 50: /* Alt-2 */
|
||||
case 51: /* Alt-3 */
|
||||
case 52: /* Alt-4 */
|
||||
case 53: /* Alt-5 */
|
||||
case 54: /* Alt-6 */
|
||||
case 55: /* Alt-7 */
|
||||
case 56: /* Alt-8 */
|
||||
case 57: /* Alt-9 */
|
||||
gui_switch_to_buffer_by_number (gui_current_window, (key == 48) ? 10 : key - 48);
|
||||
break;
|
||||
/* Alt-A */
|
||||
case 'a':
|
||||
case 'A':
|
||||
if (hotlist)
|
||||
{
|
||||
if (!hotlist_initial_buffer)
|
||||
hotlist_initial_buffer = gui_current_window->buffer;
|
||||
gui_switch_to_buffer (gui_current_window, hotlist->buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hotlist_initial_buffer)
|
||||
{
|
||||
gui_switch_to_buffer (gui_current_window, hotlist_initial_buffer);
|
||||
gui_redraw_buffer (gui_current_window->buffer);
|
||||
hotlist_initial_buffer = NULL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
/* send command/message */
|
||||
case '\n':
|
||||
if (gui_current_window->input_buffer_size > 0)
|
||||
if (gui_current_window->buffer->input_buffer_size > 0)
|
||||
{
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
history_add (gui_current_window, gui_current_window->input_buffer);
|
||||
gui_current_window->input_buffer_size = 0;
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
gui_current_window->input_buffer_1st_display = 0;
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_current_window->ptr_history = NULL;
|
||||
ptr_window = gui_current_window;
|
||||
user_command (SERVER(gui_current_window),
|
||||
gui_current_window->input_buffer);
|
||||
if (ptr_window == gui_current_window)
|
||||
gui_draw_window_input (ptr_window);
|
||||
if (ptr_window)
|
||||
ptr_window->input_buffer[0] = '\0';
|
||||
gui_current_window->buffer->input_buffer[gui_current_window->buffer->input_buffer_size] = '\0';
|
||||
history_add (gui_current_window->buffer, gui_current_window->buffer->input_buffer);
|
||||
gui_current_window->buffer->input_buffer_size = 0;
|
||||
gui_current_window->buffer->input_buffer_pos = 0;
|
||||
gui_current_window->buffer->input_buffer_1st_display = 0;
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
gui_current_window->buffer->ptr_history = NULL;
|
||||
ptr_buffer = gui_current_window->buffer;
|
||||
user_command (SERVER(gui_current_window->buffer),
|
||||
gui_current_window->buffer->input_buffer);
|
||||
if (ptr_buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_input (ptr_buffer, 0);
|
||||
if (ptr_buffer)
|
||||
ptr_buffer->input_buffer[0] = '\0';
|
||||
}
|
||||
break;
|
||||
/* other key => add to input buffer */
|
||||
default:
|
||||
/*gui_printf (gui_current_window,
|
||||
"[Debug] key pressed = %d, as octal: %o\n", key, key);*/
|
||||
/*gui_printf (gui_current_window->buffer,
|
||||
"[Debug] key pressed = %d, as octal: %o\n", key, key);*/
|
||||
new_char[0] = key;
|
||||
new_char[1] = '\0';
|
||||
gui_buffer_insert_string (new_char,
|
||||
gui_current_window->input_buffer_pos);
|
||||
gui_current_window->input_buffer_pos++;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
gui_buffer_insert_string (gui_current_window->buffer,
|
||||
new_char,
|
||||
gui_current_window->buffer->input_buffer_pos);
|
||||
gui_current_window->buffer->input_buffer_pos++;
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 0);
|
||||
gui_current_window->buffer->completion.position = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -373,14 +428,13 @@ gui_main_loop ()
|
||||
if (local_time->tm_min != old_min)
|
||||
{
|
||||
old_min = local_time->tm_min;
|
||||
gui_redraw_window_infobar (gui_current_window);
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
|
||||
/* second has changed ? => count down time for infobar, if needed */
|
||||
if (local_time->tm_sec != old_sec)
|
||||
{
|
||||
old_sec = local_time->tm_sec;
|
||||
/* TODO: manage splitted windows! */
|
||||
if (gui_infobar && gui_infobar->remaining_time > 0)
|
||||
{
|
||||
gui_infobar->remaining_time--;
|
||||
|
||||
+357
-200
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "gui.h"
|
||||
#include "../../common/weeconfig.h"
|
||||
#include "../../common/hotlist.h"
|
||||
#include "../irc/irc.h"
|
||||
|
||||
|
||||
@@ -42,79 +44,62 @@ int gui_ready; /* = 1 if GUI is initialized */
|
||||
t_gui_window *gui_windows = NULL; /* pointer to first window */
|
||||
t_gui_window *last_gui_window = NULL; /* pointer to last window */
|
||||
t_gui_window *gui_current_window = NULL; /* pointer to current window */
|
||||
|
||||
t_gui_buffer *gui_buffers = NULL; /* pointer to first buffer */
|
||||
t_gui_buffer *last_gui_buffer = NULL; /* pointer to last buffer */
|
||||
t_gui_infobar *gui_infobar; /* pointer to infobar content */
|
||||
|
||||
|
||||
/*
|
||||
* gui_window_new: create a new window
|
||||
* (TODO: add coordinates and size, for splited windows)
|
||||
*/
|
||||
|
||||
t_gui_window *
|
||||
gui_window_new (void *server, void *channel, int switch_to_window
|
||||
/*int x, int y, int width, int height*/)
|
||||
gui_window_new (int x, int y, int width, int height)
|
||||
{
|
||||
t_gui_window *new_window;
|
||||
|
||||
if (gui_windows)
|
||||
{
|
||||
/* use first window if no server was assigned to this window */
|
||||
if (!SERVER(gui_windows))
|
||||
{
|
||||
if (server)
|
||||
((t_irc_server *)(server))->window = gui_windows;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->window = gui_windows;
|
||||
SERVER(gui_windows) = server;
|
||||
CHANNEL(gui_windows) = channel;
|
||||
return gui_windows;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("creating new window (x:%d, y:%d, width:%d, height:%d)\n",
|
||||
x, y, width, height);
|
||||
#endif
|
||||
if ((new_window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
|
||||
{
|
||||
new_window->is_displayed = 0;
|
||||
new_window->win_x = x;
|
||||
new_window->win_y = y;
|
||||
new_window->win_width = width;
|
||||
new_window->win_height = height;
|
||||
|
||||
/* assign server and channel to window */
|
||||
SERVER(new_window) = server;
|
||||
CHANNEL(new_window) = channel;
|
||||
/* assign window to server and channel */
|
||||
if (server && !channel)
|
||||
SERVER(new_window)->window = new_window;
|
||||
if (channel)
|
||||
CHANNEL(new_window)->window = new_window;
|
||||
new_window->win_chat_x = 0;
|
||||
new_window->win_chat_y = 0;
|
||||
new_window->win_chat_width = 0;
|
||||
new_window->win_chat_height = 0;
|
||||
new_window->win_chat_cursor_x = 0;
|
||||
new_window->win_chat_cursor_y = 0;
|
||||
|
||||
gui_calculate_pos_size (new_window);
|
||||
new_window->win_nick_x = 0;
|
||||
new_window->win_nick_y = 0;
|
||||
new_window->win_nick_width = 0;
|
||||
new_window->win_nick_height = 0;
|
||||
|
||||
/* init windows */
|
||||
gui_window_init_subwindows(new_window);
|
||||
new_window->win_title = NULL;
|
||||
new_window->win_chat = NULL;
|
||||
new_window->win_nick = NULL;
|
||||
new_window->win_status = NULL;
|
||||
new_window->win_infobar = NULL;
|
||||
new_window->win_input = NULL;
|
||||
new_window->win_separator = NULL;
|
||||
|
||||
/* init lines */
|
||||
new_window->lines = NULL;
|
||||
new_window->last_line = NULL;
|
||||
new_window->first_line_displayed = 1;
|
||||
new_window->textview_chat = NULL;
|
||||
new_window->textbuffer_chat = NULL;
|
||||
new_window->texttag_chat = NULL;
|
||||
new_window->textview_nicklist = NULL;
|
||||
new_window->textbuffer_nicklist = NULL;
|
||||
|
||||
new_window->buffer = NULL;
|
||||
|
||||
new_window->first_line_displayed = 0;
|
||||
new_window->sub_lines = 0;
|
||||
new_window->line_complete = 1;
|
||||
new_window->unread_data = 0;
|
||||
|
||||
/* init input buffer */
|
||||
new_window->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
||||
new_window->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
||||
new_window->input_buffer[0] = '\0';
|
||||
new_window->input_buffer_size = 0;
|
||||
new_window->input_buffer_pos = 0;
|
||||
new_window->input_buffer_1st_display = 0;
|
||||
|
||||
/* init completion */
|
||||
completion_init (&(new_window->completion));
|
||||
|
||||
/* init history */
|
||||
new_window->history = NULL;
|
||||
new_window->ptr_history = NULL;
|
||||
|
||||
/* switch to new window */
|
||||
if (switch_to_window)
|
||||
gui_switch_to_window (new_window);
|
||||
|
||||
/* add window to windows queue */
|
||||
new_window->prev_window = last_gui_window;
|
||||
@@ -124,9 +109,6 @@ gui_window_new (void *server, void *channel, int switch_to_window
|
||||
gui_windows = new_window;
|
||||
last_gui_window = new_window;
|
||||
new_window->next_window = NULL;
|
||||
|
||||
/* redraw whole screen */
|
||||
gui_redraw_window (gui_current_window);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
@@ -135,52 +117,155 @@ gui_window_new (void *server, void *channel, int switch_to_window
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_clear: clear window content
|
||||
* gui_buffer_new: create a new buffer in current window
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_clear (t_gui_window *window)
|
||||
t_gui_buffer *
|
||||
gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to_buffer)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
t_gui_buffer *new_buffer;
|
||||
|
||||
while (window->lines)
|
||||
#ifdef DEBUG
|
||||
wee_log_printf ("creating new buffer\n");
|
||||
#endif
|
||||
if (gui_buffers)
|
||||
{
|
||||
ptr_line = window->lines->next_line;
|
||||
while (window->lines->messages)
|
||||
/* use first buffer if no server was assigned to this buffer */
|
||||
if (!SERVER(gui_buffers))
|
||||
{
|
||||
ptr_message = window->lines->messages->next_message;
|
||||
if (window->lines->messages->message)
|
||||
free (window->lines->messages->message);
|
||||
free (window->lines->messages);
|
||||
window->lines->messages = ptr_message;
|
||||
if (server)
|
||||
((t_irc_server *)(server))->buffer = gui_buffers;
|
||||
if (channel)
|
||||
((t_irc_channel *)(channel))->buffer = gui_buffers;
|
||||
SERVER(gui_buffers) = server;
|
||||
CHANNEL(gui_buffers) = channel;
|
||||
return gui_buffers;
|
||||
}
|
||||
free (window->lines);
|
||||
window->lines = ptr_line;
|
||||
}
|
||||
|
||||
window->lines = NULL;
|
||||
window->last_line = NULL;
|
||||
window->first_line_displayed = 1;
|
||||
window->sub_lines = 0;
|
||||
window->line_complete = 1;
|
||||
window->unread_data = 0;
|
||||
if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
|
||||
{
|
||||
new_buffer->num_displayed = 0;
|
||||
new_buffer->number = (last_gui_buffer) ? last_gui_buffer->number + 1 : 1;
|
||||
|
||||
/* assign server and channel to buffer */
|
||||
SERVER(new_buffer) = server;
|
||||
CHANNEL(new_buffer) = channel;
|
||||
/* assign buffer to server and channel */
|
||||
if (server && !channel)
|
||||
SERVER(new_buffer)->buffer = new_buffer;
|
||||
if (channel)
|
||||
CHANNEL(new_buffer)->buffer = new_buffer;
|
||||
|
||||
if (!window->buffer)
|
||||
{
|
||||
window->buffer = new_buffer;
|
||||
window->first_line_displayed = 1;
|
||||
window->sub_lines = 0;
|
||||
gui_calculate_pos_size (window);
|
||||
gui_window_init_subwindows (window);
|
||||
}
|
||||
|
||||
/* init lines */
|
||||
new_buffer->lines = NULL;
|
||||
new_buffer->last_line = NULL;
|
||||
new_buffer->num_lines = 0;
|
||||
new_buffer->line_complete = 1;
|
||||
|
||||
/* init input buffer */
|
||||
new_buffer->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
|
||||
new_buffer->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
|
||||
new_buffer->input_buffer[0] = '\0';
|
||||
new_buffer->input_buffer_size = 0;
|
||||
new_buffer->input_buffer_pos = 0;
|
||||
new_buffer->input_buffer_1st_display = 0;
|
||||
|
||||
/* init completion */
|
||||
completion_init (&(new_buffer->completion));
|
||||
|
||||
/* init history */
|
||||
new_buffer->history = NULL;
|
||||
new_buffer->last_history = NULL;
|
||||
new_buffer->ptr_history = NULL;
|
||||
new_buffer->num_history = 0;
|
||||
|
||||
/* add buffer to buffers queue */
|
||||
new_buffer->prev_buffer = last_gui_buffer;
|
||||
if (gui_buffers)
|
||||
last_gui_buffer->next_buffer = new_buffer;
|
||||
else
|
||||
gui_buffers = new_buffer;
|
||||
last_gui_buffer = new_buffer;
|
||||
new_buffer->next_buffer = NULL;
|
||||
|
||||
/* switch to new buffer */
|
||||
if (switch_to_buffer)
|
||||
gui_switch_to_buffer (window, new_buffer);
|
||||
|
||||
/* redraw buffer */
|
||||
gui_redraw_buffer (new_buffer);
|
||||
}
|
||||
else
|
||||
return NULL;
|
||||
|
||||
if (window == gui_current_window)
|
||||
gui_redraw_window_chat (window);
|
||||
return new_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_clear_all: clear all windows content
|
||||
* gui_buffer_clear: clear buffer content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_clear_all ()
|
||||
gui_buffer_clear (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
while (buffer->lines->messages)
|
||||
{
|
||||
ptr_message = buffer->lines->messages->next_message;
|
||||
if (buffer->lines->messages->message)
|
||||
free (buffer->lines->messages->message);
|
||||
free (buffer->lines->messages);
|
||||
buffer->lines->messages = ptr_message;
|
||||
}
|
||||
free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
|
||||
buffer->lines = NULL;
|
||||
buffer->last_line = NULL;
|
||||
buffer->num_lines = 0;
|
||||
buffer->line_complete = 1;
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
gui_window_clear (ptr_win);
|
||||
{
|
||||
if (ptr_win->buffer == buffer)
|
||||
{
|
||||
ptr_win->first_line_displayed = 1;
|
||||
ptr_win->sub_lines = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (buffer == gui_current_window->buffer)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_clear_all: clear all buffers content
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_clear_all ()
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
gui_buffer_clear (ptr_buffer);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -210,8 +295,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
|
||||
ptr_infobar->remaining_time = (time_displayed <= 0) ? -1 : time_displayed;
|
||||
ptr_infobar->next_infobar = gui_infobar;
|
||||
gui_infobar = ptr_infobar;
|
||||
/* TODO: manage splitted windows! */
|
||||
gui_redraw_window_infobar (gui_current_window);
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
else
|
||||
wee_log_printf (_("%s not enough memory for infobar message\n"),
|
||||
@@ -234,116 +318,161 @@ gui_infobar_remove ()
|
||||
free (gui_infobar->text);
|
||||
free (gui_infobar);
|
||||
gui_infobar = new_infobar;
|
||||
/* TODO: manage splitted windows! */
|
||||
gui_redraw_window_infobar (gui_current_window);
|
||||
gui_draw_buffer_infobar (gui_current_window->buffer, 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_free: delete a window
|
||||
* gui_line_free: delete a line from a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_window_free (t_gui_window *window)
|
||||
gui_line_free (t_gui_line *line)
|
||||
{
|
||||
t_gui_line *ptr_line;
|
||||
t_gui_message *ptr_message;
|
||||
int create_new;
|
||||
|
||||
create_new = (window->server || window->channel);
|
||||
|
||||
/* TODO: manage splitted windows! */
|
||||
if ((window == gui_current_window) &&
|
||||
((window->next_window) || (window->prev_window)))
|
||||
gui_switch_to_previous_window ();
|
||||
|
||||
/* free lines and messages */
|
||||
while (window->lines)
|
||||
while (line->messages)
|
||||
{
|
||||
ptr_line = window->lines->next_line;
|
||||
while (window->lines->messages)
|
||||
{
|
||||
ptr_message = window->lines->messages->next_message;
|
||||
if (window->lines->messages->message)
|
||||
free (window->lines->messages->message);
|
||||
free (window->lines->messages);
|
||||
window->lines->messages = ptr_message;
|
||||
}
|
||||
free (window->lines);
|
||||
window->lines = ptr_line;
|
||||
ptr_message = line->messages->next_message;
|
||||
if (line->messages->message)
|
||||
free (line->messages->message);
|
||||
free (line->messages);
|
||||
line->messages = ptr_message;
|
||||
}
|
||||
if (window->input_buffer)
|
||||
free (window->input_buffer);
|
||||
|
||||
completion_free (&(window->completion));
|
||||
|
||||
/* remove window from windows list */
|
||||
if (window->prev_window)
|
||||
window->prev_window->next_window = window->next_window;
|
||||
if (window->next_window)
|
||||
window->next_window->prev_window = window->prev_window;
|
||||
if (gui_windows == window)
|
||||
gui_windows = window->next_window;
|
||||
if (last_gui_window == window)
|
||||
last_gui_window = window->prev_window;
|
||||
|
||||
free (window);
|
||||
|
||||
/* always at least one window */
|
||||
if (!gui_windows && create_new)
|
||||
(void) gui_window_new (NULL, NULL, 1);
|
||||
free (line);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a window
|
||||
* gui_buffer_free: delete a buffer
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_free (t_gui_buffer *buffer, int switch_to_another)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_gui_line *ptr_line;
|
||||
int create_new;
|
||||
|
||||
create_new = (buffer->server || buffer->channel);
|
||||
|
||||
hotlist_remove_buffer (buffer);
|
||||
if (hotlist_initial_buffer == buffer)
|
||||
hotlist_initial_buffer = NULL;
|
||||
|
||||
if (switch_to_another)
|
||||
{
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
if ((buffer == ptr_win->buffer) &&
|
||||
((buffer->next_buffer) || (buffer->prev_buffer)))
|
||||
gui_switch_to_previous_buffer (ptr_win);
|
||||
}
|
||||
}
|
||||
|
||||
/* decrease buffer number for all next buffers */
|
||||
for (ptr_buffer = buffer->next_buffer; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
ptr_buffer->number--;
|
||||
}
|
||||
|
||||
/* free lines and messages */
|
||||
while (buffer->lines)
|
||||
{
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
}
|
||||
if (buffer->input_buffer)
|
||||
free (buffer->input_buffer);
|
||||
|
||||
completion_free (&(buffer->completion));
|
||||
|
||||
/* remove buffer from buffers list */
|
||||
if (buffer->prev_buffer)
|
||||
buffer->prev_buffer->next_buffer = buffer->next_buffer;
|
||||
if (buffer->next_buffer)
|
||||
buffer->next_buffer->prev_buffer = buffer->prev_buffer;
|
||||
if (gui_buffers == buffer)
|
||||
gui_buffers = buffer->next_buffer;
|
||||
if (last_gui_buffer == buffer)
|
||||
last_gui_buffer = buffer->prev_buffer;
|
||||
|
||||
free (buffer);
|
||||
|
||||
/* always at least one buffer */
|
||||
if (!gui_buffers && create_new && switch_to_another)
|
||||
(void) gui_buffer_new (gui_windows, NULL, NULL, 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_line: create new line for a buffer
|
||||
*/
|
||||
|
||||
t_gui_line *
|
||||
gui_new_line (t_gui_window *window)
|
||||
gui_new_line (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_line *new_line;
|
||||
t_gui_line *new_line, *ptr_line;
|
||||
|
||||
if ((new_line = (t_gui_line *) malloc (sizeof (struct t_gui_line))))
|
||||
{
|
||||
new_line->length = 0;
|
||||
new_line->length_align = 0;
|
||||
new_line->line_with_message = 0;
|
||||
new_line->line_with_highlight = 0;
|
||||
new_line->messages = NULL;
|
||||
new_line->last_message = NULL;
|
||||
if (!window->lines)
|
||||
window->lines = new_line;
|
||||
if (!buffer->lines)
|
||||
buffer->lines = new_line;
|
||||
else
|
||||
window->last_line->next_line = new_line;
|
||||
new_line->prev_line = window->last_line;
|
||||
buffer->last_line->next_line = new_line;
|
||||
new_line->prev_line = buffer->last_line;
|
||||
new_line->next_line = NULL;
|
||||
window->last_line = new_line;
|
||||
buffer->last_line = new_line;
|
||||
buffer->num_lines++;
|
||||
}
|
||||
else
|
||||
{
|
||||
wee_log_printf (_("%s not enough memory for new line!\n"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* remove one line if necessary */
|
||||
if ((cfg_history_max_lines > 0)
|
||||
&& (buffer->num_lines > cfg_history_max_lines))
|
||||
{
|
||||
if (buffer->last_line == buffer->lines)
|
||||
buffer->last_line = NULL;
|
||||
ptr_line = buffer->lines->next_line;
|
||||
gui_line_free (buffer->lines);
|
||||
buffer->lines = ptr_line;
|
||||
ptr_line->prev_line = NULL;
|
||||
buffer->num_lines--;
|
||||
//if (buffer->first_line_displayed)
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
}
|
||||
|
||||
return new_line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_new_message: create a new message for last line of window
|
||||
* gui_new_message: create a new message for last line of a buffer
|
||||
*/
|
||||
|
||||
t_gui_message *
|
||||
gui_new_message (t_gui_window *window)
|
||||
gui_new_message (t_gui_buffer *buffer)
|
||||
{
|
||||
t_gui_message *new_message;
|
||||
|
||||
if ((new_message = (t_gui_message *) malloc (sizeof (struct t_gui_message))))
|
||||
{
|
||||
if (!window->last_line->messages)
|
||||
window->last_line->messages = new_message;
|
||||
if (!buffer->last_line->messages)
|
||||
buffer->last_line->messages = new_message;
|
||||
else
|
||||
window->last_line->last_message->next_message = new_message;
|
||||
new_message->prev_message = window->last_line->last_message;
|
||||
buffer->last_line->last_message->next_message = new_message;
|
||||
new_message->prev_message = buffer->last_line->last_message;
|
||||
new_message->next_message = NULL;
|
||||
window->last_line->last_message = new_message;
|
||||
buffer->last_line->last_message = new_message;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -359,16 +488,16 @@ gui_new_message (t_gui_window *window)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_optimize_input_buffer_size (t_gui_window *window)
|
||||
gui_optimize_input_buffer_size (t_gui_buffer *buffer)
|
||||
{
|
||||
int optimal_size;
|
||||
|
||||
optimal_size = ((window->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
||||
optimal_size = ((buffer->input_buffer_size / INPUT_BUFFER_BLOCK_SIZE) *
|
||||
INPUT_BUFFER_BLOCK_SIZE) + INPUT_BUFFER_BLOCK_SIZE;
|
||||
if (window->input_buffer_alloc != optimal_size)
|
||||
if (buffer->input_buffer_alloc != optimal_size)
|
||||
{
|
||||
window->input_buffer_alloc = optimal_size;
|
||||
window->input_buffer = realloc (window->input_buffer, optimal_size);
|
||||
buffer->input_buffer_alloc = optimal_size;
|
||||
buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,25 +506,25 @@ gui_optimize_input_buffer_size (t_gui_window *window)
|
||||
*/
|
||||
|
||||
void
|
||||
gui_delete_previous_word ()
|
||||
gui_delete_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i, j, num_char_deleted, num_char_end;
|
||||
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos - 1;
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] != ' '))
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
if (i >= 0)
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
}
|
||||
}
|
||||
@@ -403,20 +532,20 @@ gui_delete_previous_word ()
|
||||
if (i >= 0)
|
||||
i++;
|
||||
i++;
|
||||
num_char_deleted = gui_current_window->input_buffer_pos - i;
|
||||
num_char_end = gui_current_window->input_buffer_size -
|
||||
gui_current_window->input_buffer_pos;
|
||||
num_char_deleted = buffer->input_buffer_pos - i;
|
||||
num_char_end = buffer->input_buffer_size -
|
||||
buffer->input_buffer_pos;
|
||||
|
||||
for (j = 0; j < num_char_end; j++)
|
||||
gui_current_window->input_buffer[i + j] =
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_pos + j];
|
||||
buffer->input_buffer[i + j] =
|
||||
buffer->input_buffer[buffer->input_buffer_pos + j];
|
||||
|
||||
gui_current_window->input_buffer_size -= num_char_deleted;
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
gui_current_window->input_buffer_pos = i;
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->completion.position = -1;
|
||||
buffer->input_buffer_size -= num_char_deleted;
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
buffer->input_buffer_pos = i;
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->completion.position = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -425,26 +554,26 @@ gui_delete_previous_word ()
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_previous_word ()
|
||||
gui_move_previous_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (gui_current_window->input_buffer_pos > 0)
|
||||
if (buffer->input_buffer_pos > 0)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos - 1;
|
||||
i = buffer->input_buffer_pos - 1;
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i--;
|
||||
if (i < 0)
|
||||
gui_current_window->input_buffer_pos = 0;
|
||||
buffer->input_buffer_pos = 0;
|
||||
else
|
||||
{
|
||||
while ((i >= 0) &&
|
||||
(gui_current_window->input_buffer[i] != ' '))
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i--;
|
||||
gui_current_window->input_buffer_pos = i + 1;
|
||||
buffer->input_buffer_pos = i + 1;
|
||||
}
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -453,32 +582,32 @@ gui_move_previous_word ()
|
||||
*/
|
||||
|
||||
void
|
||||
gui_move_next_word ()
|
||||
gui_move_next_word (t_gui_buffer *buffer)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (gui_current_window->input_buffer_pos <
|
||||
gui_current_window->input_buffer_size + 1)
|
||||
if (buffer->input_buffer_pos <
|
||||
buffer->input_buffer_size + 1)
|
||||
{
|
||||
i = gui_current_window->input_buffer_pos;
|
||||
while ((i <= gui_current_window->input_buffer_size) &&
|
||||
(gui_current_window->input_buffer[i] == ' '))
|
||||
i = buffer->input_buffer_pos;
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] == ' '))
|
||||
i++;
|
||||
if (i > gui_current_window->input_buffer_size)
|
||||
gui_current_window->input_buffer_pos = i - 1;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos = i - 1;
|
||||
else
|
||||
{
|
||||
while ((i <= gui_current_window->input_buffer_size) &&
|
||||
(gui_current_window->input_buffer[i] != ' '))
|
||||
while ((i <= buffer->input_buffer_size) &&
|
||||
(buffer->input_buffer[i] != ' '))
|
||||
i++;
|
||||
if (i > gui_current_window->input_buffer_size)
|
||||
gui_current_window->input_buffer_pos =
|
||||
gui_current_window->input_buffer_size;
|
||||
if (i > buffer->input_buffer_size)
|
||||
buffer->input_buffer_pos =
|
||||
buffer->input_buffer_size;
|
||||
else
|
||||
gui_current_window->input_buffer_pos = i;
|
||||
buffer->input_buffer_pos = i;
|
||||
|
||||
}
|
||||
gui_draw_window_input (gui_current_window);
|
||||
gui_draw_buffer_input (buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -487,24 +616,52 @@ gui_move_next_word ()
|
||||
*/
|
||||
|
||||
void
|
||||
gui_buffer_insert_string (char *string, int pos)
|
||||
gui_buffer_insert_string (t_gui_buffer *buffer, char *string, int pos)
|
||||
{
|
||||
int i, start, end, length;
|
||||
|
||||
length = strlen (string);
|
||||
|
||||
/* increase buffer size */
|
||||
gui_current_window->input_buffer_size += length;
|
||||
gui_optimize_input_buffer_size (gui_current_window);
|
||||
gui_current_window->input_buffer[gui_current_window->input_buffer_size] = '\0';
|
||||
buffer->input_buffer_size += length;
|
||||
gui_optimize_input_buffer_size (buffer);
|
||||
buffer->input_buffer[buffer->input_buffer_size] = '\0';
|
||||
|
||||
/* move end of string to the right */
|
||||
start = pos + length;
|
||||
end = gui_current_window->input_buffer_size - 1;
|
||||
end = buffer->input_buffer_size - 1;
|
||||
for (i = end; i >= start; i--)
|
||||
gui_current_window->input_buffer[i] =
|
||||
gui_current_window->input_buffer[i - length];
|
||||
buffer->input_buffer[i] =
|
||||
buffer->input_buffer[i - length];
|
||||
|
||||
/* insert new string */
|
||||
strncpy (gui_current_window->input_buffer + pos, string, length);
|
||||
strncpy (buffer->input_buffer + pos, string, length);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_switch_to_buffer_by_number: switch to another buffer with number
|
||||
*/
|
||||
|
||||
t_gui_buffer *
|
||||
gui_switch_to_buffer_by_number (t_gui_window *window, int number)
|
||||
{
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
/* buffer is currently displayed ? */
|
||||
if (number == window->buffer->number)
|
||||
return window->buffer;
|
||||
|
||||
/* search for buffer in the list */
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if ((ptr_buffer != window->buffer) && (number == ptr_buffer->number))
|
||||
{
|
||||
gui_switch_to_buffer (window, ptr_buffer);
|
||||
gui_redraw_buffer (window->buffer);
|
||||
return ptr_buffer;
|
||||
}
|
||||
}
|
||||
|
||||
/* buffer not found */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
+121
-101
@@ -26,56 +26,58 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 38
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_CHAT_HIGHLIGHT 11
|
||||
#define COLOR_WIN_STATUS 12
|
||||
#define COLOR_WIN_STATUS_ACTIVE 13
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 15
|
||||
#define COLOR_WIN_STATUS_MORE 16
|
||||
#define COLOR_WIN_INFOBAR 17
|
||||
#define COLOR_WIN_INFOBAR_HIGHLIGHT 18
|
||||
#define COLOR_WIN_INPUT 19
|
||||
#define COLOR_WIN_INPUT_CHANNEL 20
|
||||
#define COLOR_WIN_INPUT_NICK 21
|
||||
#define COLOR_WIN_NICK 22
|
||||
#define COLOR_WIN_NICK_OP 23
|
||||
#define COLOR_WIN_NICK_HALFOP 24
|
||||
#define COLOR_WIN_NICK_VOICE 25
|
||||
#define COLOR_WIN_NICK_SEP 26
|
||||
#define COLOR_WIN_NICK_SELF 27
|
||||
#define COLOR_WIN_NICK_PRIVATE 28
|
||||
#define COLOR_WIN_NICK_FIRST 29
|
||||
#define COLOR_WIN_NICK_LAST 38
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define NUM_COLORS 39
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
#define COLOR_WIN_CHAT_TIME_SEP 4
|
||||
#define COLOR_WIN_CHAT_PREFIX1 5
|
||||
#define COLOR_WIN_CHAT_PREFIX2 6
|
||||
#define COLOR_WIN_CHAT_NICK 7
|
||||
#define COLOR_WIN_CHAT_HOST 8
|
||||
#define COLOR_WIN_CHAT_CHANNEL 9
|
||||
#define COLOR_WIN_CHAT_DARK 10
|
||||
#define COLOR_WIN_CHAT_HIGHLIGHT 11
|
||||
#define COLOR_WIN_STATUS 12
|
||||
#define COLOR_WIN_STATUS_DELIMITERS 13
|
||||
#define COLOR_WIN_STATUS_DATA_MSG 14
|
||||
#define COLOR_WIN_STATUS_DATA_HIGHLIGHT 15
|
||||
#define COLOR_WIN_STATUS_DATA_OTHER 16
|
||||
#define COLOR_WIN_STATUS_MORE 17
|
||||
#define COLOR_WIN_INFOBAR 18
|
||||
#define COLOR_WIN_INFOBAR_HIGHLIGHT 19
|
||||
#define COLOR_WIN_INPUT 20
|
||||
#define COLOR_WIN_INPUT_CHANNEL 21
|
||||
#define COLOR_WIN_INPUT_NICK 22
|
||||
#define COLOR_WIN_NICK 23
|
||||
#define COLOR_WIN_NICK_OP 24
|
||||
#define COLOR_WIN_NICK_HALFOP 25
|
||||
#define COLOR_WIN_NICK_VOICE 26
|
||||
#define COLOR_WIN_NICK_SEP 27
|
||||
#define COLOR_WIN_NICK_SELF 28
|
||||
#define COLOR_WIN_NICK_PRIVATE 29
|
||||
#define COLOR_WIN_NICK_FIRST 30
|
||||
#define COLOR_WIN_NICK_LAST 39
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
|
||||
#define SERVER(window) ((t_irc_server *)(window->server))
|
||||
#define CHANNEL(window) ((t_irc_channel *)(window->channel))
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
#define WIN_IS_SERVER(window) (SERVER(window) && !CHANNEL(window))
|
||||
#define WIN_IS_CHANNEL(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_CHANNEL))
|
||||
#define WIN_IS_PRIVATE(window) (CHANNEL(window) && (CHANNEL(window)->type == CHAT_PRIVATE))
|
||||
#define BUFFER_IS_SERVER(buffer) (SERVER(buffer) && !CHANNEL(buffer))
|
||||
#define BUFFER_IS_CHANNEL(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_CHANNEL))
|
||||
#define BUFFER_IS_PRIVATE(buffer) (CHANNEL(buffer) && (CHANNEL(buffer)->type == CHAT_PRIVATE))
|
||||
|
||||
#define MSG_TYPE_TIME 0
|
||||
#define MSG_TYPE_NICK 1
|
||||
#define MSG_TYPE_INFO 2
|
||||
#define MSG_TYPE_MSG 3
|
||||
#define MSG_TYPE_TIME 1
|
||||
#define MSG_TYPE_NICK 2
|
||||
#define MSG_TYPE_INFO 4
|
||||
#define MSG_TYPE_MSG 8
|
||||
#define MSG_TYPE_HIGHLIGHT 16
|
||||
|
||||
#define gui_printf_color(window, color, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
#define gui_printf_color(buffer, color, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, color, fmt, ##argz)
|
||||
|
||||
#define gui_printf(window, fmt, argz...) \
|
||||
gui_printf_color_type(window, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
#define gui_printf(buffer, fmt, argz...) \
|
||||
gui_printf_color_type(buffer, MSG_TYPE_INFO, -1, fmt, ##argz)
|
||||
|
||||
typedef struct t_gui_message t_gui_message;
|
||||
|
||||
@@ -95,6 +97,7 @@ struct t_gui_line
|
||||
int length; /* length of the line (in char) */
|
||||
int length_align; /* alignment length (time or time/nick) */
|
||||
int line_with_message; /* line contains a message from a user? */
|
||||
int line_with_highlight; /* line contains highlight */
|
||||
t_gui_message *messages; /* messages for the line */
|
||||
t_gui_message *last_message; /* last message of the line */
|
||||
t_gui_line *prev_line; /* link to previous line */
|
||||
@@ -121,16 +124,49 @@ struct t_gui_infobar
|
||||
t_gui_infobar *next_infobar; /* next message for infobar */
|
||||
};
|
||||
|
||||
typedef struct t_gui_buffer t_gui_buffer;
|
||||
|
||||
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 */
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
t_gui_line *last_line; /* last line of chat window */
|
||||
int num_lines; /* number of lines in the window */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size (user input length) */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *last_history; /* last command in history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
int num_history; /* number of commands in history */
|
||||
|
||||
/* link to previous/next buffer */
|
||||
t_gui_buffer *prev_buffer; /* link to previous buffer */
|
||||
t_gui_buffer *next_buffer; /* link to next buffer */
|
||||
};
|
||||
|
||||
typedef struct t_gui_window t_gui_window;
|
||||
|
||||
struct t_gui_window
|
||||
{
|
||||
int is_displayed; /* = 1 if window is displayed */
|
||||
|
||||
/* server/channel */
|
||||
void *server; /* window's server */
|
||||
void *channel; /* window's channel */
|
||||
|
||||
/* global position & size */
|
||||
int win_x, win_y; /* position of window */
|
||||
int win_width, win_height; /* window geometry */
|
||||
@@ -149,11 +185,12 @@ struct t_gui_window
|
||||
|
||||
/* windows for Curses GUI */
|
||||
void *win_title; /* title window */
|
||||
void *win_chat; /* chat window (exemple: channel) */
|
||||
void *win_chat; /* chat window (example: channel) */
|
||||
void *win_nick; /* nick window */
|
||||
void *win_status; /* status window */
|
||||
void *win_infobar; /* info bar window */
|
||||
void *win_input; /* input window */
|
||||
void *win_separator; /* separation between 2 splited (V) win */
|
||||
|
||||
/* windows for Gtk GUI */
|
||||
void *textview_chat; /* textview widget for chat */
|
||||
@@ -165,29 +202,11 @@ struct t_gui_window
|
||||
/* windows for Qt GUI */
|
||||
/* TODO: declare Qt window */
|
||||
|
||||
/* chat content (lines, line is composed by many messages) */
|
||||
t_gui_line *lines; /* lines of chat window */
|
||||
t_gui_line *last_line; /* last line of chat window */
|
||||
t_gui_buffer *buffer; /* buffer currently displayed in window */
|
||||
|
||||
int first_line_displayed; /* = 1 if first line is displayed */
|
||||
int sub_lines; /* if > 0 then do not display until end */
|
||||
int line_complete; /* current line complete ? (\n ending) */
|
||||
int unread_data; /* highlight windows with unread data */
|
||||
|
||||
/* inupt buffer */
|
||||
char *input_buffer; /* input buffer */
|
||||
int input_buffer_alloc; /* input buffer: allocated size in mem */
|
||||
int input_buffer_size; /* buffer size (user input length) */
|
||||
int input_buffer_pos; /* position into buffer */
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* completion */
|
||||
t_completion completion; /* for cmds/nicks completion */
|
||||
|
||||
/* history */
|
||||
t_history *history; /* commands history */
|
||||
t_history *ptr_history; /* current command in history */
|
||||
|
||||
/* link to next window */
|
||||
t_gui_window *prev_window; /* link to previous window */
|
||||
t_gui_window *next_window; /* link to next window */
|
||||
};
|
||||
@@ -198,55 +217,56 @@ extern int gui_ready;
|
||||
extern t_gui_window *gui_windows;
|
||||
extern t_gui_window *last_gui_window;
|
||||
extern t_gui_window *gui_current_window;
|
||||
extern t_gui_buffer *gui_buffers;
|
||||
extern t_gui_buffer *last_gui_buffer;
|
||||
extern t_gui_infobar *gui_infobar;
|
||||
|
||||
/* prototypes */
|
||||
|
||||
/* GUI independent functions */
|
||||
extern t_gui_window *gui_window_new (/*@null@*/ void *, /*@null@*/ void *, int /*int, int, int, int*/); /* TODO: add coordinates and size */
|
||||
extern void gui_window_clear (t_gui_window *);
|
||||
extern void gui_window_clear_all ();
|
||||
extern t_gui_window *gui_window_new (int, int, int, int);
|
||||
extern t_gui_buffer *gui_buffer_new (t_gui_window *, void *, void *, int);
|
||||
extern void gui_buffer_clear (t_gui_buffer *);
|
||||
extern void gui_buffer_clear_all ();
|
||||
extern void gui_infobar_printf (int, int, char *, ...);
|
||||
extern void gui_infobar_remove ();
|
||||
extern t_gui_line *gui_new_line (t_gui_window *);
|
||||
extern t_gui_message *gui_new_message (t_gui_window *);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_window *);
|
||||
extern void gui_delete_previous_word ();
|
||||
extern void gui_move_previous_word ();
|
||||
extern void gui_move_next_word ();
|
||||
extern void gui_buffer_insert_string (char *, int);
|
||||
extern void gui_buffer_free (t_gui_buffer *, int);
|
||||
extern t_gui_line *gui_new_line (t_gui_buffer *);
|
||||
extern t_gui_message *gui_new_message (t_gui_buffer *);
|
||||
extern void gui_optimize_input_buffer_size (t_gui_buffer *);
|
||||
extern void gui_delete_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_previous_word (t_gui_buffer *);
|
||||
extern void gui_move_next_word (t_gui_buffer *);
|
||||
extern void gui_buffer_insert_string (t_gui_buffer *, char *, int);
|
||||
extern t_gui_buffer *gui_switch_to_buffer_by_number (t_gui_window *, int);
|
||||
/* GUI dependant functions */
|
||||
extern int gui_assign_color (int *, char *);
|
||||
extern int gui_get_color_by_name (char *);
|
||||
extern char *gui_get_color_by_value (int);
|
||||
extern int gui_window_has_nicklist (t_gui_window *);
|
||||
extern int gui_buffer_has_nicklist (t_gui_buffer *);
|
||||
extern void gui_calculate_pos_size (t_gui_window *);
|
||||
extern void gui_draw_window_title (t_gui_window *);
|
||||
extern void gui_redraw_window_title (t_gui_window *);
|
||||
extern void gui_draw_window_chat (t_gui_window *);
|
||||
extern void gui_redraw_window_chat (t_gui_window *);
|
||||
extern void gui_draw_window_nick (t_gui_window *);
|
||||
extern void gui_redraw_window_nick (t_gui_window *);
|
||||
extern void gui_draw_window_status (t_gui_window *);
|
||||
extern void gui_redraw_window_status (t_gui_window *);
|
||||
extern void gui_draw_window_infobar (t_gui_window *);
|
||||
extern void gui_redraw_window_infobar (t_gui_window *);
|
||||
extern void gui_draw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window_input (t_gui_window *);
|
||||
extern void gui_redraw_window (t_gui_window *);
|
||||
extern void gui_switch_to_window (t_gui_window *);
|
||||
extern void gui_switch_to_previous_window ();
|
||||
extern void gui_switch_to_next_window ();
|
||||
extern void gui_draw_buffer_title (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_chat (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_nick (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_status (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_infobar (t_gui_buffer *, int);
|
||||
extern void gui_draw_buffer_input (t_gui_buffer *, int);
|
||||
extern void gui_redraw_buffer (t_gui_buffer *);
|
||||
extern void gui_switch_to_buffer (t_gui_window *, t_gui_buffer *);
|
||||
extern void gui_switch_to_previous_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_buffer (t_gui_window *);
|
||||
extern void gui_switch_to_next_window (t_gui_window *);
|
||||
extern void gui_move_page_up ();
|
||||
extern void gui_move_page_down ();
|
||||
extern void gui_window_init_subwindows (t_gui_window *);
|
||||
extern void gui_window_split_horiz (t_gui_window *);
|
||||
extern void gui_window_split_vertic (t_gui_window *);
|
||||
extern void gui_pre_init (int *, char **[]);
|
||||
extern void gui_init_colors ();
|
||||
extern void gui_set_window_title ();
|
||||
extern void gui_init ();
|
||||
extern void gui_window_free (t_gui_window *);
|
||||
extern void gui_end ();
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_window *, int, int, char *, ...);
|
||||
extern void gui_printf_color_type (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
|
||||
extern void gui_main_loop ();
|
||||
|
||||
#endif /* gui.h */
|
||||
|
||||
@@ -41,7 +41,7 @@ char *channel_modes = "iklmnst";
|
||||
|
||||
t_irc_channel *
|
||||
channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
int switch_to_window)
|
||||
int switch_to_buffer)
|
||||
{
|
||||
t_irc_channel *new_channel;
|
||||
|
||||
@@ -72,7 +72,7 @@ channel_new (t_irc_server *server, int channel_type, char *channel_name,
|
||||
server->channels = new_channel;
|
||||
server->last_channel = new_channel;
|
||||
|
||||
gui_window_new (server, new_channel, switch_to_window);
|
||||
gui_buffer_new (gui_current_window, server, new_channel, switch_to_buffer);
|
||||
|
||||
/* all is ok, return address of new channel */
|
||||
return new_channel;
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Copyright (c) 2004 by FlashCode <flashcode@flashtux.org>
|
||||
* See README for License detail, AUTHORS for developers list.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/* irc-dcc.c: DCC communications (files & chat) */
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
|
||||
|
||||
/*
|
||||
* dcc_connect: connect to another host
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_connect ()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_send: send DCC request (file or chat)
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_send ()
|
||||
{
|
||||
}
|
||||
@@ -41,16 +41,16 @@
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
irc_display_prefix (t_gui_buffer *buffer, char *prefix)
|
||||
{
|
||||
if (prefix[0] == prefix[2])
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%c ", prefix[2]);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_PREFIX1, "%s ", prefix);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -59,45 +59,45 @@ irc_display_prefix (t_gui_window *window, char *prefix)
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
irc_display_nick (t_gui_buffer *buffer, t_irc_nick *nick, int message_type,
|
||||
int display_around, int color_nick, int no_nickmode)
|
||||
{
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "<");
|
||||
if (cfg_look_nickmode)
|
||||
{
|
||||
if (nick->is_op)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_OP, "@");
|
||||
else
|
||||
{
|
||||
if (nick->is_halfop)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_HALFOP, "%%");
|
||||
else
|
||||
{
|
||||
if (nick->has_voice)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_NICK_VOICE, "+");
|
||||
else
|
||||
if (cfg_look_nickmode_empty && !no_nickmode)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (color_nick < 0)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
COLOR_WIN_CHAT_HIGHLIGHT,
|
||||
"%s", nick->nick);
|
||||
else
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type,
|
||||
(color_nick) ?
|
||||
((cfg_look_color_nicks) ?
|
||||
@@ -106,7 +106,7 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
"%s", nick->nick);
|
||||
|
||||
if (display_around)
|
||||
gui_printf_color_type (window,
|
||||
gui_printf_color_type (buffer,
|
||||
message_type, COLOR_WIN_CHAT_DARK, "> ");
|
||||
}
|
||||
|
||||
@@ -115,21 +115,21 @@ irc_display_nick (t_gui_window *window, t_irc_nick *nick, int message_type,
|
||||
*/
|
||||
|
||||
void
|
||||
irc_display_mode (t_gui_window *window, char *channel_name, char set_flag,
|
||||
irc_display_mode (t_gui_buffer *buffer, char *channel_name, char set_flag,
|
||||
char *symbol, char *nick_host, char *message, char *param)
|
||||
{
|
||||
irc_display_prefix (window, PREFIX_INFO);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
irc_display_prefix (buffer, PREFIX_INFO);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "[");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, "/");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_DARK, "] ");
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s", nick_host);
|
||||
if (param)
|
||||
{
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (window, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s ", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT_NICK, "%s\n", param);
|
||||
}
|
||||
else
|
||||
gui_printf_color (window, COLOR_WIN_CHAT, " %s\n", message);
|
||||
gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
|
||||
}
|
||||
|
||||
+18
-26
@@ -37,34 +37,18 @@
|
||||
*/
|
||||
|
||||
int
|
||||
nick_find_color (t_irc_channel *channel)
|
||||
nick_find_color (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 = strlen (nick->nick) - 1; i >= 0; 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;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -182,7 +166,7 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
/* alloc memory for new nick */
|
||||
if ((new_nick = (t_irc_nick *) malloc (sizeof (t_irc_nick))) == NULL)
|
||||
{
|
||||
gui_printf (channel->window,
|
||||
gui_printf (channel->buffer,
|
||||
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
@@ -192,10 +176,10 @@ nick_new (t_irc_channel *channel, char *nick_name,
|
||||
new_nick->is_op = is_op;
|
||||
new_nick->is_halfop = is_halfop;
|
||||
new_nick->has_voice = has_voice;
|
||||
if (strcasecmp (new_nick->nick, SERVER(channel->window)->nick) == 0)
|
||||
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 (new_nick);
|
||||
|
||||
nick_insert_sorted (channel, new_nick);
|
||||
|
||||
@@ -231,10 +215,18 @@ nick_resort (t_irc_channel *channel, t_irc_nick *nick)
|
||||
void
|
||||
nick_change (t_irc_channel *channel, t_irc_nick *nick, char *new_nick)
|
||||
{
|
||||
int nick_is_me;
|
||||
|
||||
nick_is_me = (strcmp (nick->nick, SERVER(channel->buffer)->nick) == 0) ? 1 : 0;
|
||||
|
||||
/* change nickname */
|
||||
if (nick->nick)
|
||||
free (nick->nick);
|
||||
nick->nick = strdup (new_nick);
|
||||
if (nick_is_me)
|
||||
nick->color = COLOR_WIN_NICK_SELF;
|
||||
else
|
||||
nick->color = nick_find_color (nick);
|
||||
|
||||
/* insert again nick into sorted list */
|
||||
nick_resort (channel, nick);
|
||||
|
||||
+366
-331
File diff suppressed because it is too large
Load Diff
+65
-65
@@ -56,7 +56,7 @@ irc_login (t_irc_server *server)
|
||||
hostname[sizeof (hostname) - 1] = '\0';
|
||||
if (!hostname[0])
|
||||
strcpy (hostname, _("unknown"));
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s: using local hostname \"%s\"\n"),
|
||||
PACKAGE_NAME, hostname);
|
||||
server_sendf (server,
|
||||
@@ -198,15 +198,15 @@ irc_cmd_send_deop (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s -o %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "deop");
|
||||
return 0;
|
||||
@@ -221,16 +221,16 @@ irc_cmd_send_devoice (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s -v %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "devoice");
|
||||
return -1;
|
||||
@@ -310,15 +310,15 @@ irc_cmd_send_kick (t_irc_server *server, char *arguments)
|
||||
server_sendf (server, "KICK %s\r\n", arguments);
|
||||
else
|
||||
{
|
||||
if (WIN_IS_CHANNEL (gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
|
||||
{
|
||||
server_sendf (server,
|
||||
"KICK %s %s\r\n",
|
||||
CHANNEL(gui_current_window)->name, arguments);
|
||||
CHANNEL(gui_current_window->buffer)->name, arguments);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "kick");
|
||||
return -1;
|
||||
@@ -388,19 +388,19 @@ irc_cmd_send_lusers (t_irc_server *server, char *arguments)
|
||||
int
|
||||
irc_cmd_send_me (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "me");
|
||||
return -1;
|
||||
}
|
||||
server_sendf (server, "PRIVMSG %s :\01ACTION %s\01\r\n",
|
||||
CHANNEL(gui_current_window)->name, arguments);
|
||||
irc_display_prefix (gui_current_window, PREFIX_ACTION_ME);
|
||||
gui_printf_color (gui_current_window,
|
||||
CHANNEL(gui_current_window->buffer)->name, arguments);
|
||||
irc_display_prefix (gui_current_window->buffer, PREFIX_ACTION_ME);
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
COLOR_WIN_CHAT_NICK, "%s", server->nick);
|
||||
gui_printf_color (gui_current_window,
|
||||
gui_printf_color (gui_current_window->buffer,
|
||||
COLOR_WIN_CHAT, " %s\n", arguments);
|
||||
return 0;
|
||||
}
|
||||
@@ -459,25 +459,25 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
if (strcmp (arguments, "*") == 0)
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "msg *");
|
||||
return -1;
|
||||
}
|
||||
ptr_channel = CHANNEL(gui_current_window);
|
||||
ptr_channel = CHANNEL(gui_current_window->buffer);
|
||||
ptr_nick = nick_search (ptr_channel, server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (ptr_channel->window, ptr_nick,
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", ptr_channel->name, pos);
|
||||
@@ -492,14 +492,14 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_nick = nick_search (ptr_channel, server->nick);
|
||||
if (ptr_nick)
|
||||
{
|
||||
irc_display_nick (ptr_channel->window, ptr_nick,
|
||||
irc_display_nick (ptr_channel->buffer, ptr_nick,
|
||||
MSG_TYPE_NICK, 1, 1, 0);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
}
|
||||
else
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s nick not found for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
}
|
||||
@@ -513,26 +513,26 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -543,7 +543,7 @@ irc_cmd_send_msg (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s wrong argument count for \"%s\" command\n"),
|
||||
WEECHAT_ERROR, "msg");
|
||||
return -1;
|
||||
@@ -562,16 +562,16 @@ irc_cmd_send_names (t_irc_server *server, char *arguments)
|
||||
server_sendf (server, "NAMES %s\r\n", arguments);
|
||||
else
|
||||
{
|
||||
if (!WIN_IS_CHANNEL(gui_current_window))
|
||||
if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "names");
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
server_sendf (server, "NAMES %s\r\n",
|
||||
CHANNEL(gui_current_window)->name);
|
||||
CHANNEL(gui_current_window->buffer)->name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -609,16 +609,16 @@ irc_cmd_send_op (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s +o %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "op");
|
||||
return -1;
|
||||
@@ -663,36 +663,36 @@ irc_cmd_send_part (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window)->name;
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_args = arguments;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "part");
|
||||
return -1;
|
||||
}
|
||||
if (WIN_IS_PRIVATE(gui_current_window))
|
||||
if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
|
||||
{
|
||||
ptr_channel = CHANNEL(gui_current_window);
|
||||
gui_window_free (ptr_channel->window);
|
||||
ptr_channel = CHANNEL(gui_current_window->buffer);
|
||||
gui_buffer_free (ptr_channel->buffer, 1);
|
||||
channel_free (server, ptr_channel);
|
||||
gui_redraw_window_status (gui_current_window);
|
||||
gui_redraw_window_input (gui_current_window);
|
||||
gui_draw_buffer_status (gui_current_window->buffer, 1);
|
||||
gui_draw_buffer_input (gui_current_window->buffer, 1);
|
||||
return 0;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window)->name;
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
pos_args = NULL;
|
||||
}
|
||||
|
||||
@@ -753,29 +753,29 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
ptr_channel = channel_new (server, CHAT_PRIVATE, arguments, 1);
|
||||
if (!ptr_channel)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create new private window \"%s\"\n"),
|
||||
WEECHAT_ERROR,
|
||||
arguments);
|
||||
return -1;
|
||||
}
|
||||
gui_redraw_window_title (ptr_channel->window);
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
|
||||
/* display text if given */
|
||||
if (pos)
|
||||
{
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "<");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_NICK_SELF,
|
||||
"%s", server->nick);
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_NICK,
|
||||
COLOR_WIN_CHAT_DARK, "> ");
|
||||
gui_printf_color_type (ptr_channel->window,
|
||||
gui_printf_color_type (ptr_channel->buffer,
|
||||
MSG_TYPE_MSG,
|
||||
COLOR_WIN_CHAT, "%s\n", pos);
|
||||
server_sendf (server, "PRIVMSG %s :%s\r\n", arguments, pos);
|
||||
@@ -970,14 +970,14 @@ irc_cmd_send_topic (t_irc_server *server, char *arguments)
|
||||
/* look for current channel if not specified */
|
||||
if (!channel_name)
|
||||
{
|
||||
if (WIN_IS_SERVER(gui_current_window))
|
||||
if (BUFFER_IS_SERVER(gui_current_window->buffer))
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can not be executed on a server window\n"),
|
||||
WEECHAT_ERROR, "topic");
|
||||
return -1;
|
||||
}
|
||||
channel_name = CHANNEL(gui_current_window)->name;
|
||||
channel_name = CHANNEL(gui_current_window->buffer)->name;
|
||||
}
|
||||
|
||||
if (new_topic)
|
||||
@@ -1040,8 +1040,8 @@ irc_cmd_send_version (t_irc_server *server, char *arguments)
|
||||
{
|
||||
if (arguments)
|
||||
{
|
||||
if (WIN_IS_CHANNEL(gui_current_window) &&
|
||||
nick_search (CHANNEL(gui_current_window), arguments))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer) &&
|
||||
nick_search (CHANNEL(gui_current_window->buffer), arguments))
|
||||
server_sendf (server, "PRIVMSG %s :\01VERSION\01\r\n",
|
||||
arguments);
|
||||
else
|
||||
@@ -1050,8 +1050,8 @@ irc_cmd_send_version (t_irc_server *server, char *arguments)
|
||||
}
|
||||
else
|
||||
{
|
||||
irc_display_prefix (server->window, PREFIX_INFO);
|
||||
gui_printf (server->window, _("%s, compiled on %s %s\n"),
|
||||
irc_display_prefix (server->buffer, PREFIX_INFO);
|
||||
gui_printf (server->buffer, _("%s, compiled on %s %s\n"),
|
||||
PACKAGE_STRING,
|
||||
__DATE__, __TIME__);
|
||||
server_sendf (server, "VERSION\r\n");
|
||||
@@ -1068,16 +1068,16 @@ irc_cmd_send_voice (t_irc_server *server, int argc, char **argv)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (WIN_IS_CHANNEL(gui_current_window))
|
||||
if (BUFFER_IS_CHANNEL(gui_current_window->buffer))
|
||||
{
|
||||
for (i = 0; i < argc; i++)
|
||||
server_sendf (server, "MODE %s +v %s\r\n",
|
||||
CHANNEL(gui_current_window)->name,
|
||||
CHANNEL(gui_current_window->buffer)->name,
|
||||
argv[i]);
|
||||
}
|
||||
else
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s \"%s\" command can only be executed in a channel window\n"),
|
||||
WEECHAT_ERROR, "voice");
|
||||
return -1;
|
||||
|
||||
@@ -78,7 +78,7 @@ server_init (t_irc_server *server)
|
||||
server->is_away = 0;
|
||||
server->server_read = -1;
|
||||
server->server_write = -1;
|
||||
server->window = NULL;
|
||||
server->buffer = NULL;
|
||||
server->channels = NULL;
|
||||
server->last_channel = NULL;
|
||||
}
|
||||
@@ -270,8 +270,6 @@ server_free (t_irc_server *server)
|
||||
(server->next_server)->prev_server = server->prev_server;
|
||||
|
||||
server_destroy (server);
|
||||
if (server->window)
|
||||
gui_window_free (server->window);
|
||||
free (server);
|
||||
irc_servers = new_irc_servers;
|
||||
}
|
||||
@@ -377,11 +375,11 @@ server_sendf (t_irc_server * server, char *fmt, ...)
|
||||
size_buf = strlen (buffer);
|
||||
buffer[size_buf - 2] = '\0';
|
||||
#ifdef DEBUG
|
||||
gui_printf (server->window, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
gui_printf (server->buffer, "[DEBUG] Sending to server >>> %s\n", buffer);
|
||||
#endif
|
||||
buffer[size_buf - 2] = '\r';
|
||||
if (server_send (server, buffer, size_buf) <= 0)
|
||||
gui_printf (server->window, _("%s error sending data to IRC server\n"),
|
||||
gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
|
||||
@@ -397,7 +395,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
message = (t_irc_message *) malloc (sizeof (t_irc_message));
|
||||
if (!message)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
return;
|
||||
@@ -408,7 +406,7 @@ server_msgq_add_msg (t_irc_server *server, char *msg)
|
||||
message->data = (char *) malloc (strlen (unterminated_message) +
|
||||
strlen (msg) + 1);
|
||||
if (!message->data)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
else
|
||||
@@ -462,14 +460,14 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
|
||||
(char *) realloc (unterminated_message,
|
||||
strlen (buffer) + 1);
|
||||
if (!unterminated_message)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s not enough memory for received IRC message\n"),
|
||||
WEECHAT_ERROR);
|
||||
else
|
||||
strcpy (unterminated_message, buffer);
|
||||
return;
|
||||
}
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s unable to explode received buffer\n"),
|
||||
WEECHAT_ERROR);
|
||||
}
|
||||
@@ -493,7 +491,7 @@ server_msgq_flush ()
|
||||
if (recv_msgq->data)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
gui_printf (gui_current_window, "[DEBUG] %s\n", recv_msgq->data);
|
||||
gui_printf (gui_current_window->buffer, "[DEBUG] %s\n", recv_msgq->data);
|
||||
#endif
|
||||
|
||||
ptr_data = recv_msgq->data;
|
||||
@@ -542,15 +540,15 @@ server_msgq_flush ()
|
||||
command, args))
|
||||
{
|
||||
case -1:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Command '%s' failed!\n"), command);
|
||||
break;
|
||||
case -2:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("No command to execute!\n"));
|
||||
break;
|
||||
case -3:
|
||||
gui_printf (recv_msgq->server->window,
|
||||
gui_printf (recv_msgq->server->buffer,
|
||||
_("Unknown command: cmd=%s, args=%s\n"),
|
||||
command, args);
|
||||
break;
|
||||
@@ -602,7 +600,7 @@ server_connect (t_irc_server *server)
|
||||
int error;
|
||||
int server_pipe[2];
|
||||
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s: connecting to %s:%d...\n"),
|
||||
PACKAGE_NAME, server->address, server->port);
|
||||
wee_log_printf (_("connecting to server %s:%d...\n"),
|
||||
@@ -612,7 +610,7 @@ server_connect (t_irc_server *server)
|
||||
/* create pipe */
|
||||
if (pipe (server_pipe) < 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot create pipe\n"), WEECHAT_ERROR);
|
||||
server_free (server);
|
||||
return 0;
|
||||
@@ -626,14 +624,14 @@ server_connect (t_irc_server *server)
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_REUSEADDR\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
set = 1;
|
||||
if (setsockopt
|
||||
(server->sock4, SOL_SOCKET, SO_KEEPALIVE, (char *) &set,
|
||||
sizeof (set)) == -1)
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
|
||||
WEECHAT_ERROR);
|
||||
|
||||
@@ -641,7 +639,7 @@ server_connect (t_irc_server *server)
|
||||
ip4_hostent = gethostbyname (server->address);
|
||||
if (!ip4_hostent)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s address \"%s\" not found\n"),
|
||||
WEECHAT_ERROR, server->address);
|
||||
close (server->server_read);
|
||||
@@ -657,14 +655,14 @@ server_connect (t_irc_server *server)
|
||||
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
|
||||
if (error != 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
WEECHAT_ERORR "server_connect: can't bind to hostname\n");
|
||||
return 0;
|
||||
} */
|
||||
ip_address = inet_ntoa (addr.sin_addr);
|
||||
if (!ip_address)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s IP address not found\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
@@ -674,13 +672,13 @@ server_connect (t_irc_server *server)
|
||||
}
|
||||
|
||||
/* connection to server */
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s: server IP is: %s\n"), PACKAGE_NAME, ip_address);
|
||||
|
||||
error = connect (server->sock4, (struct sockaddr *) &addr, sizeof (addr));
|
||||
if (error != 0)
|
||||
{
|
||||
gui_printf (server->window,
|
||||
gui_printf (server->buffer,
|
||||
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
|
||||
close (server->server_read);
|
||||
close (server->server_write);
|
||||
@@ -708,7 +706,7 @@ server_auto_connect (int command_line)
|
||||
if ( ((command_line) && (ptr_server->command_line))
|
||||
|| ((!command_line) && (ptr_server->autoconnect)) )
|
||||
{
|
||||
(void) gui_window_new (ptr_server, NULL, 1);
|
||||
(void) gui_buffer_new (gui_current_window, ptr_server, NULL, 1);
|
||||
if (server_connect (ptr_server))
|
||||
irc_login (ptr_server);
|
||||
}
|
||||
@@ -726,12 +724,12 @@ server_disconnect (t_irc_server *server)
|
||||
|
||||
if (server->is_connected)
|
||||
{
|
||||
/* write disconnection message on each channel/private window */
|
||||
/* write disconnection message on each channel/private buffer */
|
||||
for (ptr_channel = server->channels; ptr_channel;
|
||||
ptr_channel = ptr_channel->next_channel)
|
||||
{
|
||||
irc_display_prefix (ptr_channel->window, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->window, _("Disconnected from server!\n"));
|
||||
irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
|
||||
gui_printf (ptr_channel->buffer, _("Disconnected from server!\n"));
|
||||
}
|
||||
|
||||
/* close communication with server */
|
||||
|
||||
@@ -83,7 +83,7 @@ struct t_irc_channel
|
||||
char *key; /* channel key (NULL if no key is set) */
|
||||
t_irc_nick *nicks; /* nicks on the channel */
|
||||
t_irc_nick *last_nick; /* last nick on the channel */
|
||||
t_gui_window *window; /* GUI window allocated for channel */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for channel */
|
||||
t_irc_channel *prev_channel; /* link to previous channel */
|
||||
t_irc_channel *next_channel; /* link to next channel */
|
||||
};
|
||||
@@ -116,7 +116,7 @@ struct t_irc_server
|
||||
int is_away; /* 1 is user is marker as away */
|
||||
int server_read; /* pipe for reading server data */
|
||||
int server_write; /* pipe for sending data to server */
|
||||
t_gui_window *window; /* GUI window allocated for server */
|
||||
t_gui_buffer *buffer; /* GUI buffer allocated for server */
|
||||
t_irc_channel *channels; /* opened channels on server */
|
||||
t_irc_channel *last_channel; /* last opened channal on server */
|
||||
t_irc_server *prev_server; /* link to previous server */
|
||||
@@ -204,9 +204,9 @@ extern void dcc_send ();
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_window *, char *);
|
||||
extern void irc_display_nick (t_gui_window *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_window *, char *, char, char *, char *,
|
||||
extern void irc_display_prefix (/*@null@*/ t_gui_buffer *, char *);
|
||||
extern void irc_display_nick (t_gui_buffer *, t_irc_nick *, int, int, int, int);
|
||||
extern void irc_display_mode (t_gui_buffer *, char *, char, char *, char *,
|
||||
char *, char *);
|
||||
|
||||
/* IRC protocol (irc-commands.c) */
|
||||
|
||||
@@ -120,7 +120,7 @@ static XS (XS_IRC_register)
|
||||
}
|
||||
|
||||
/*
|
||||
* IRC::print: print message to current window
|
||||
* IRC::print: print message to current buffer
|
||||
*/
|
||||
|
||||
static XS (XS_IRC_print)
|
||||
@@ -135,8 +135,8 @@ static XS (XS_IRC_print)
|
||||
for (i = 0; i < items; i++)
|
||||
{
|
||||
message = SvPV (ST (i), integer);
|
||||
irc_display_prefix (gui_current_window, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window, "%s", message);
|
||||
irc_display_prefix (gui_current_window->buffer, PREFIX_PLUGIN);
|
||||
gui_printf (gui_current_window->buffer, "%s", message);
|
||||
}
|
||||
|
||||
XSRETURN_EMPTY;
|
||||
@@ -151,7 +151,7 @@ static XS (XS_IRC_print_with_channel)
|
||||
{
|
||||
int integer;
|
||||
char *message, *channel, *server = NULL;
|
||||
t_gui_window *ptr_window;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
t_irc_server *ptr_server;
|
||||
t_irc_channel *ptr_channel;
|
||||
dXSARGS;
|
||||
@@ -167,9 +167,9 @@ static XS (XS_IRC_print_with_channel)
|
||||
server = NULL;
|
||||
}
|
||||
|
||||
/* look for window for printing message */
|
||||
/* look for buffer for printing message */
|
||||
channel = SvPV (ST (1), integer);
|
||||
ptr_window = NULL;
|
||||
ptr_buffer = NULL;
|
||||
for (ptr_server = irc_servers; ptr_server;
|
||||
ptr_server = ptr_server->next_server)
|
||||
{
|
||||
@@ -180,25 +180,25 @@ static XS (XS_IRC_print_with_channel)
|
||||
{
|
||||
if (strcasecmp (ptr_channel->name, channel) == 0)
|
||||
{
|
||||
ptr_window = ptr_channel->window;
|
||||
ptr_buffer = ptr_channel->buffer;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ptr_window)
|
||||
if (ptr_buffer)
|
||||
break;
|
||||
}
|
||||
|
||||
/* window found => display message & return 1 */
|
||||
if (ptr_window)
|
||||
/* buffer found => display message & return 1 */
|
||||
if (ptr_buffer)
|
||||
{
|
||||
message = SvPV (ST (0), integer);
|
||||
irc_display_prefix (ptr_window, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_window, "%s", message);
|
||||
irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
|
||||
gui_printf (ptr_buffer, "%s", message);
|
||||
XSRETURN_YES;
|
||||
}
|
||||
|
||||
/* no window found => return 0 */
|
||||
/* no buffer found => return 0 */
|
||||
XSRETURN_NO;
|
||||
}
|
||||
|
||||
@@ -307,8 +307,8 @@ static XS (XS_IRC_get_info)
|
||||
}
|
||||
else if ( (strcasecmp (arg, "2") == 0) || (strcasecmp (arg, "channel") == 0) )
|
||||
{
|
||||
if (WIN_IS_CHANNEL (gui_current_window))
|
||||
info = CHANNEL (gui_current_window)->name;
|
||||
if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
|
||||
info = CHANNEL (gui_current_window->buffer)->name;
|
||||
}
|
||||
else if ( (strcasecmp (arg, "3") == 0) || (strcasecmp (arg, "server") == 0) )
|
||||
{
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
.TH WEECHAT 1 "June 2004" "FlashCode"
|
||||
.TH WEECHAT 1 "August 2004" "FlashCode"
|
||||
|
||||
.SH NAME
|
||||
weechat \- Wee Enhanced Environment for Chat
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
%define name weechat
|
||||
%define version 0.0.6
|
||||
%define version 0.0.7
|
||||
%define release 1
|
||||
|
||||
Name: %{name}
|
||||
@@ -41,6 +41,8 @@ rm -rf $RPM_BUILD_ROOT
|
||||
/usr/local/bin/weechat-curses
|
||||
|
||||
%changelog
|
||||
* Sat Aug 08 2004 FlashCode <flashcode@flashtux.org> 0.0.7-1
|
||||
- Released version 0.0.7
|
||||
* Sat Jun 05 2004 FlashCode <flashcode@flashtux.org> 0.0.6-1
|
||||
- Released version 0.0.6
|
||||
* Thu Feb 02 2004 FlashCode <flashcode@flashtux.org> 0.0.5-1
|
||||
|
||||
Reference in New Issue
Block a user