summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--BUGS3
-rw-r--r--ChangeLog2
-rw-r--r--TODO2
-rw-r--r--configure.in5
-rw-r--r--po/fr.po200
-rw-r--r--po/weechat.pot194
-rw-r--r--src/common/command.c44
-rw-r--r--src/common/history.c30
-rw-r--r--src/common/weeconfig.c32
-rw-r--r--src/common/weeconfig.h4
-rw-r--r--src/gui/curses/gui-display.c1820
-rw-r--r--src/gui/curses/gui-input.c315
-rw-r--r--src/gui/gui-common.c487
-rw-r--r--src/gui/gui.h166
-rw-r--r--src/irc/irc-channel.c4
-rw-r--r--src/irc/irc-display.c50
-rw-r--r--src/irc/irc-nick.c4
-rw-r--r--src/irc/irc-recv.c614
-rw-r--r--src/irc/irc-send.c130
-rw-r--r--src/irc/irc-server.c52
-rw-r--r--src/irc/irc.h10
-rw-r--r--src/plugins/perl/wee-perl.c30
-rw-r--r--weechat/BUGS3
-rw-r--r--weechat/ChangeLog2
-rw-r--r--weechat/TODO2
-rw-r--r--weechat/configure.in5
-rw-r--r--weechat/po/fr.po200
-rw-r--r--weechat/po/weechat.pot194
-rw-r--r--weechat/src/common/command.c44
-rw-r--r--weechat/src/common/history.c30
-rw-r--r--weechat/src/common/weeconfig.c32
-rw-r--r--weechat/src/common/weeconfig.h4
-rw-r--r--weechat/src/gui/curses/gui-display.c1820
-rw-r--r--weechat/src/gui/curses/gui-input.c315
-rw-r--r--weechat/src/gui/gui-common.c487
-rw-r--r--weechat/src/gui/gui.h166
-rw-r--r--weechat/src/irc/irc-channel.c4
-rw-r--r--weechat/src/irc/irc-display.c50
-rw-r--r--weechat/src/irc/irc-nick.c4
-rw-r--r--weechat/src/irc/irc-recv.c614
-rw-r--r--weechat/src/irc/irc-send.c130
-rw-r--r--weechat/src/irc/irc-server.c52
-rw-r--r--weechat/src/irc/irc.h10
-rw-r--r--weechat/src/plugins/perl/wee-perl.c30
44 files changed, 4304 insertions, 4092 deletions
diff --git a/BUGS b/BUGS
index 7e0afaf75..07613ec97 100644
--- a/BUGS
+++ b/BUGS
@@ -1,12 +1,13 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-WeeChat known bugs, 2004-06-05
+WeeChat known bugs, 2004-07-01
- ./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
diff --git a/ChangeLog b/ChangeLog
index b116d26cb..2bc0d6b0c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2004-06-23
+ChangeLog - 2004-07-01
Version 0.0.7 (under dev!):
diff --git a/TODO b/TODO
index cc9f133ca..4975cb845 100644
--- a/TODO
+++ b/TODO
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-TODO - 2004-06-23
+TODO - 2004-07-01
Legend:
# done
diff --git a/configure.in b/configure.in
index 19ed4637e..9b2abeea1 100644
--- a/configure.in
+++ b/configure.in
@@ -110,10 +110,11 @@ AC_SUBST(PLUGINS_LIBS)
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE(DEBUG)
+ CFLAGS="-Wall -W -pipe -O2 -g"
+else
+ CFLAGS="-Wall -W -pipe -O2"
fi
-CFLAGS="-Wall -W -pipe -O2"
-
AC_OUTPUT([Makefile
src/Makefile
src/common/Makefile
diff --git a/po/fr.po b/po/fr.po
index 2c9f5c616..9d728f7d6 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.0.7-pre2\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2004-06-05 10:52+0200\n"
+"POT-Creation-Date: 2004-06-27 15:36+0200\n"
"PO-Revision-Date: 2004-06-05 10:52+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1172,7 +1172,7 @@ msgstr "%s utilisateur non trouvé pour la commande \"%s\"\n"
msgid "%s cannot create new private window \"%s\"\n"
msgstr "%s impossible de créer la fenêtre privée \"%s\"\n"
-#: src/irc/irc-send.c:547 src/common/command.c:1118
+#: src/irc/irc-send.c:547 src/common/command.c:1126
#, c-format
msgid "%s wrong argument count for \"%s\" command\n"
msgstr "%s nombre de paramètres erroné pour la commande \"%s\"\n"
@@ -1618,11 +1618,11 @@ msgstr ""
"%s impossible d'ajouter la fonction pour le message \"%s\" (mémoire "
"insuffisante)\n"
-#: src/gui/curses/gui-display.c:952
+#: src/gui/curses/gui-display.c:919
msgid "[not connected] "
msgstr "[non connecté] "
-#: src/gui/curses/gui-display.c:959 src/gui/curses/gui-display.c:962
+#: src/gui/curses/gui-display.c:927 src/gui/curses/gui-display.c:930
msgid "-MORE-"
msgstr "-PLUS-"
@@ -1630,17 +1630,17 @@ msgstr "-PLUS-"
msgid "server"
msgstr "serveur"
-#: src/gui/gui-common.c:217
+#: src/gui/gui-common.c:303
#, c-format
msgid "%s not enough memory for infobar message\n"
msgstr "%s pas assez de mémoire pour un message de la barre d'infos\n"
-#: src/gui/gui-common.c:323
+#: src/gui/gui-common.c:421
#, c-format
msgid "%s not enough memory for new line!\n"
msgstr "%s pas assez de mémoire pour une nouvelle ligne !\n"
-#: src/gui/gui-common.c:350
+#: src/gui/gui-common.c:464
msgid "not enough memory!\n"
msgstr "pas assez de mémoire !\n"
@@ -1798,29 +1798,52 @@ msgstr "nom_alias"
msgid "alias_name: name of alias to remove"
msgstr "nom_alias: nom de l'alias à supprimer"
-#: src/common/command.c:340
+#: src/common/command.c:91
+msgid "manage windows"
+msgstr "gestion des fenêtres"
+
+#: src/common/command.c:92
+msgid "[action]"
+msgstr "[action]"
+
+#: src/common/command.c:93
+msgid ""
+"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"
+msgstr ""
+"action: action à effectuer:\n"
+" close ferme la fenêtre courante (en développement !)\n"
+" list liste toutes les fenêtres ouvertes (pas de paramètre affiche cette "
+"liste)\n"
+" splith éclate la fenêtre en deux horizontalement\n"
+" splitv éclate la fenêtre en deux verticalement"
+
+#: src/common/command.c:348
#, c-format
msgid "%s alias or command \"%s\" already exists!\n"
msgstr "%s l'alias ou la commande \"%s\" existe déjà !\n"
-#: src/common/command.c:349
+#: src/common/command.c:357
#, c-format
msgid "%s alias cannot run another alias!\n"
msgstr "%s l'alias ne peux pas lancer un autre alias !\n"
-#: src/common/command.c:355
+#: src/common/command.c:363
#, c-format
msgid "%s target command \"%s\" does not exist!\n"
msgstr "%s la commande cible \"%s\" n'existe pas !\n"
-#: src/common/command.c:541
+#: src/common/command.c:549
#, c-format
msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n"
msgstr ""
"%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: %d "
"paramètre%s)\n"
-#: src/common/command.c:550
+#: src/common/command.c:558
#, c-format
msgid ""
"%s wrong argument count for %s command \"%s\" (expected: between %d and %d "
@@ -1829,19 +1852,19 @@ msgstr ""
"%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: entre "
"%d et %d paramètre%s)\n"
-#: src/common/command.c:569
+#: src/common/command.c:577
#, c-format
msgid "%s %s command \"%s\" failed\n"
msgstr "%s %s la commande \"%s\" a échoué\n"
-#: src/common/command.c:594
+#: src/common/command.c:602
#, c-format
msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n"
msgstr ""
"%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: %d "
"paramètre%s)\n"
-#: src/common/command.c:603
+#: src/common/command.c:611
#, c-format
msgid ""
"%s wrong argument count for IRC command \"%s\" (expected: between %d and %d "
@@ -1850,134 +1873,134 @@ msgstr ""
"%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: "
"entre %d et %d paramètre%s)\n"
-#: src/common/command.c:616
+#: src/common/command.c:624
#, c-format
msgid "%s command \"%s\" needs a server connection!\n"
msgstr "%s la commande \"%s\" nécessite une connexion au serveur !\n"
-#: src/common/command.c:628
+#: src/common/command.c:636
#, c-format
msgid "%s IRC command \"%s\" failed\n"
msgstr "%s la commande IRC \"%s\" a échoué\n"
-#: src/common/command.c:675
+#: src/common/command.c:683
#, c-format
msgid "%s unknown command \"%s\" (type /help for help)\n"
msgstr "%s commande \"%s\" inconnue (tapez /help pour l'aide)\n"
-#: src/common/command.c:744
+#: src/common/command.c:752
#, c-format
msgid "%s cannot find nick for sending message\n"
msgstr "%s impossible de trouver le pseudo pour envoyer le message\n"
-#: src/common/command.c:750
+#: src/common/command.c:758
msgid "This window is not a channel!\n"
msgstr "Cette fenêtre n'est pas un canal !\n"
-#: src/common/command.c:776 src/common/command.c:788
+#: src/common/command.c:784 src/common/command.c:796
#, c-format
msgid "%s missing arguments for \"%s\" command\n"
msgstr "%s paramètres manquants pour la commande \"%s\"\n"
-#: src/common/command.c:783
+#: src/common/command.c:791
#, c-format
msgid "Alias \"%s\" => \"%s\" created\n"
msgstr "Alias \"%s\" => \"%s\" créé\n"
-#: src/common/command.c:798
+#: src/common/command.c:806
msgid "List of aliases:\n"
msgstr "Liste des alias:\n"
-#: src/common/command.c:808
+#: src/common/command.c:816
msgid "No alias defined.\n"
msgstr "Aucun alias défini.\n"
-#: src/common/command.c:827
+#: src/common/command.c:835
#, c-format
msgid "unknown parameter \"%s\" for \"%s\" command\n"
msgstr "paramètre inconnu \"%s\" pour la commande \"%s\"\n"
-#: src/common/command.c:856
+#: src/common/command.c:864
#, c-format
msgid "%s already connected to server \"%s\"!\n"
msgstr "%s déjà connecté au serveur \"%s\" !\n"
-#: src/common/command.c:879 src/common/command.c:914
+#: src/common/command.c:887 src/common/command.c:922
#, c-format
msgid "%s server \"%s\" not found\n"
msgstr "%s serveur \"%s\" non trouvé\n"
-#: src/common/command.c:904
+#: src/common/command.c:912
#, c-format
msgid "%s not connected to server \"%s\"!\n"
msgstr "%s non connecté au serveur \"%s\" !\n"
-#: src/common/command.c:933
+#: src/common/command.c:941
#, c-format
msgid "> List of %s internal commands:\n"
msgstr "> Liste des commandes internes %s:\n"
-#: src/common/command.c:938
+#: src/common/command.c:946
msgid "> List of IRC commands:\n"
msgstr "> Liste des commandes IRC:\n"
-#: src/common/command.c:953
+#: src/common/command.c:961
#, c-format
msgid "> Help on %s internal command \"%s\":\n"
msgstr "> Aide sur la commande interne %s \"%s\":\n"
-#: src/common/command.c:956 src/common/command.c:977
+#: src/common/command.c:964 src/common/command.c:985
#, c-format
msgid "Syntax: /%s %s\n"
msgstr "Syntaxe: /%s %s\n"
-#: src/common/command.c:975
+#: src/common/command.c:983
#, c-format
msgid "> Help on IRC command \"%s\":\n"
msgstr "> Aide sur la commande IRC \"%s\":\n"
-#: src/common/command.c:991
+#: src/common/command.c:999
#, c-format
msgid "No help available, \"%s\" is an unknown command\n"
msgstr "Pas d'aide disponible, la commande \"%s\" est inconnue\n"
-#: src/common/command.c:1016
+#: src/common/command.c:1024
msgid "Registered Perl scripts:\n"
msgstr "Scripts Perl enregistrés :\n"
-#: src/common/command.c:1033 src/common/command.c:1055
-#: src/common/command.c:1077
+#: src/common/command.c:1041 src/common/command.c:1063
+#: src/common/command.c:1085
msgid " (none)\n"
msgstr " (aucun)\n"
-#: src/common/command.c:1038
+#: src/common/command.c:1046
msgid "Perl message handlers:\n"
msgstr "Fonctions Perl pour messages :\n"
-#: src/common/command.c:1047
+#: src/common/command.c:1055
#, c-format
msgid " IRC(%s) => Perl(%s)\n"
msgstr " IRC(%s) => Perl(%s)\n"
-#: src/common/command.c:1060
+#: src/common/command.c:1068
msgid "Perl command handlers:\n"
msgstr "Commandes Perl :\n"
-#: src/common/command.c:1069
+#: src/common/command.c:1077
#, c-format
msgid " Command /%s => Perl(%s)\n"
msgstr " Commande /%s => Perl(%s)\n"
-#: src/common/command.c:1087
+#: src/common/command.c:1095
msgid "Perl scripts unloaded\n"
msgstr "Scripts Perl déchargés\n"
-#: src/common/command.c:1112
+#: src/common/command.c:1120
#, c-format
msgid "%s unknown option for \"%s\" command\n"
msgstr "%s option inconnue pour la commande \"%s\"\n"
-#: src/common/command.c:1123
+#: src/common/command.c:1131
msgid ""
"WeeChat was build without Perl support.\n"
"Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n"
@@ -1986,193 +2009,194 @@ msgstr ""
"Merci de reconstruire WeeChat avec l'option \"--enable-perl\" pour le "
"script ./configure\n"
-#: src/common/command.c:1167
+#: src/common/command.c:1175
msgid "Server: "
msgstr "Serveur: "
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "connected"
msgstr "connecté"
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "not connected"
msgstr "non connecté"
-#: src/common/command.c:1185
+#: src/common/command.c:1193
#, c-format
msgid " Autoconnect: %s%s\n"
msgstr " Autoconnect: %s%s\n"
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "yes"
msgstr "oui"
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "no"
msgstr "non"
-#: src/common/command.c:1188
+#: src/common/command.c:1196
msgid " (temporary server, will not be saved)"
msgstr " (serveur temporaire, ne sera pas sauvé)"
-#: src/common/command.c:1193
+#: src/common/command.c:1201
#, c-format
msgid " Hostname : %s\n"
msgstr " Nom/IP : %s\n"
-#: src/common/command.c:1198
+#: src/common/command.c:1206
#, c-format
msgid " Port : %d\n"
msgstr " Port : %d\n"
-#: src/common/command.c:1204
+#: src/common/command.c:1212
msgid " Password : (hidden)\n"
msgstr " Mot passe : (caché)\n"
-#: src/common/command.c:1208
+#: src/common/command.c:1216
msgid " Password : (none)\n"
msgstr " Mot passe : (aucun)\n"
-#: src/common/command.c:1212
+#: src/common/command.c:1220
#, c-format
msgid " Nicks : %s"
msgstr " Pseudos : %s"
-#: src/common/command.c:1229
+#: src/common/command.c:1237
#, c-format
msgid " Username : %s\n"
msgstr " Nom utilis.: %s\n"
-#: src/common/command.c:1234
+#: src/common/command.c:1242
#, c-format
msgid " Realname : %s\n"
msgstr " Nom réel : %s\n"
-#: src/common/command.c:1240
+#: src/common/command.c:1248
#, c-format
msgid " Command : %s\n"
msgstr " Commande : %s\n"
-#: src/common/command.c:1245
+#: src/common/command.c:1253
msgid " Command : (none)\n"
msgstr " Commande : (aucune)\n"
-#: src/common/command.c:1250
+#: src/common/command.c:1258
#, c-format
msgid " Auto-join : %s\n"
msgstr " Auto-join : %s\n"
-#: src/common/command.c:1255
+#: src/common/command.c:1263
msgid " Auto-join : (none)\n"
msgstr " Auto-join : (aucun)\n"
-#: src/common/command.c:1259
+#: src/common/command.c:1267
msgid "No server.\n"
msgstr "Pas de serveur.\n"
-#: src/common/command.c:1268
+#: src/common/command.c:1276
#, c-format
msgid "%s missing servername for \"%s\" command\n"
msgstr "%s il manque le nom du serveur pour la commande \"%s\"\n"
-#: src/common/command.c:1274
+#: src/common/command.c:1282
#, c-format
msgid "%s too much arguments for \"%s\" command, ignoring arguments\n"
msgstr "%s trop de paramètres pour la commande \"%s\", paramètres ignorés\n"
-#: src/common/command.c:1291
+#: src/common/command.c:1299
#, c-format
msgid "%s server \"%s\" not found for \"%s\" command\n"
msgstr "%s le serveur \"%s\" n'existe pas pour la commande \"%s\"\n"
-#: src/common/command.c:1297 src/common/command.c:1428
+#: src/common/command.c:1305 src/common/command.c:1436
msgid "Server"
msgstr "Serveur"
-#: src/common/command.c:1300
+#: src/common/command.c:1308
msgid "has been deleted\n"
msgstr "a été supprimé\n"
-#: src/common/command.c:1314
+#: src/common/command.c:1322
#, c-format
msgid "%s missing parameters for \"%s\" command\n"
msgstr "%s paramètres manquants pour la commande \"%s\"\n"
-#: src/common/command.c:1323
+#: src/common/command.c:1331
#, c-format
msgid "%s server \"%s\" already exists, can't create it!\n"
msgstr "%s le serveur \"%s\" existe déjà, impossible de le créer !\n"
-#: src/common/command.c:1347 src/common/command.c:1373
-#: src/common/command.c:1385 src/common/command.c:1409
+#: src/common/command.c:1355 src/common/command.c:1381
+#: src/common/command.c:1393 src/common/command.c:1417
#, c-format
msgid "%s missing password for \"%s\" parameter\n"
msgstr "%s mot de passe manquant pour le paramètre \"%s\"\n"
-#: src/common/command.c:1359
+#: src/common/command.c:1367
#, c-format
msgid "%s missing nick(s) for \"%s\" parameter\n"
msgstr "%s pseudo(s) manquant(s) pour le paramètre \"%s\"\n"
-#: src/common/command.c:1397
+#: src/common/command.c:1405
#, c-format
msgid "%s missing command for \"%s\" parameter\n"
msgstr "%s commande manquante pour le paramètre \"%s\"\n"
-#: src/common/command.c:1431
+#: src/common/command.c:1439
msgid "created\n"
msgstr "créé\n"
-#: src/common/command.c:1436
+#: src/common/command.c:1444
#, c-format
msgid "%s unable to create server\n"
msgstr "%s impossible de créer le serveur\n"
-#: src/common/command.c:1490
+#: src/common/command.c:1498
#, c-format
msgid "%s option '%s' can not be changed while WeeChat is running\n"
msgstr "%s l'option '%s' ne peut pas être changée lorsque WeeChat tourne\n"
-#: src/common/command.c:1502
+#: src/common/command.c:1510
#, c-format
msgid "%s incorrect value for option '%s'\n"
msgstr "%s valeur incorrecte pour l'option '%s'\n"
-#: src/common/command.c:1508
+#: src/common/command.c:1516
#, c-format
msgid "%s config option '%s' not found\n"
msgstr "%s option de configuration '%s' non trouvée\n"
-#: src/common/command.c:1558
+#: src/common/command.c:1566
msgid "(unknown)"
msgstr "(inconnu)"
-#: src/common/command.c:1578 src/common/command.c:1581
+#: src/common/command.c:1586 src/common/command.c:1589
#, c-format
msgid "No config option found with '%s'\n"
msgstr "Aucune option de configuration trouvée avec '%s'\n"
-#: src/common/command.c:1586
+#: src/common/command.c:1594
#, c-format
msgid "%d config option(s) found with '%s'\n"
msgstr "%d option(s) de configuration trouvées avec '%s'\n"
-#: src/common/command.c:1589
+#: src/common/command.c:1597
#, c-format
msgid "%d config option(s) found\n"
msgstr "%d option(s) de configuration trouvées\n"
-#: src/common/command.c:1609
+#: src/common/command.c:1617
#, c-format
msgid "%s alias or command \"%s\" not found\n"
msgstr "%s alias ou commande \"%s\" non trouvé\n"
-#: src/common/command.c:1618
+#: src/common/command.c:1626
#, c-format
msgid "Alias \"%s\" removed\n"
msgstr "Alias \"%s\" supprimé\n"
#: src/common/weechat.c:118
+#, c-format
msgid ""
"WeeChat configuration options (~/.weechat/weechat.rc):\n"
"\n"
@@ -2181,6 +2205,7 @@ msgstr ""
"\n"
#: src/common/weechat.c:131
+#, c-format
msgid " . type boolean (values: 'on' or 'off')\n"
msgstr " . type booléen (valeurs: 'on' ou 'off')\n"
@@ -2201,6 +2226,7 @@ msgid " . default value: %d\n"
msgstr " . valeur par défaut: %d\n"
#: src/common/weechat.c:144
+#, c-format
msgid " . type string (values: "
msgstr " . type chaîne (valeurs: "
@@ -2209,10 +2235,12 @@ msgid "empty"
msgstr "vide"
#: src/common/weechat.c:160
+#, c-format
msgid " . type color (Curses or Gtk color, look at WeeChat doc)\n"
msgstr " . type couleur (couleur Curses ou Gtk, voir la doc WeeChat)\n"
#: src/common/weechat.c:166
+#, c-format
msgid " . type string (any string)\n"
msgstr " . type chaîne (toute chaîne)\n"
@@ -2226,6 +2254,7 @@ msgstr ""
"\n"
#: src/common/weechat.c:178
+#, c-format
msgid ""
"Moreover, you can define aliases in [alias] section, by adding lines like:\n"
msgstr ""
@@ -2233,6 +2262,7 @@ msgstr ""
"des lignes comme :\n"
#: src/common/weechat.c:180
+#, c-format
msgid ""
"where 'j' is alias name, and 'join' associated command.\n"
"\n"
diff --git a/po/weechat.pot b/po/weechat.pot
index ca0bcecf8..162d02377 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2004-06-05 10:52+0200\n"
+"POT-Creation-Date: 2004-06-27 15:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1078,7 +1078,7 @@ msgstr ""
msgid "%s cannot create new private window \"%s\"\n"
msgstr ""
-#: src/irc/irc-send.c:547 src/common/command.c:1118
+#: src/irc/irc-send.c:547 src/common/command.c:1126
#, c-format
msgid "%s wrong argument count for \"%s\" command\n"
msgstr ""
@@ -1511,11 +1511,11 @@ msgstr ""
msgid "%s unable to add handler for \"%s\" message (not enough memory)\n"
msgstr ""
-#: src/gui/curses/gui-display.c:952
+#: src/gui/curses/gui-display.c:919
msgid "[not connected] "
msgstr ""
-#: src/gui/curses/gui-display.c:959 src/gui/curses/gui-display.c:962
+#: src/gui/curses/gui-display.c:927 src/gui/curses/gui-display.c:930
msgid "-MORE-"
msgstr ""
@@ -1523,17 +1523,17 @@ msgstr ""
msgid "server"
msgstr ""
-#: src/gui/gui-common.c:217
+#: src/gui/gui-common.c:303
#, c-format
msgid "%s not enough memory for infobar message\n"
msgstr ""
-#: src/gui/gui-common.c:323
+#: src/gui/gui-common.c:421
#, c-format
msgid "%s not enough memory for new line!\n"
msgstr ""
-#: src/gui/gui-common.c:350
+#: src/gui/gui-common.c:464
msgid "not enough memory!\n"
msgstr ""
@@ -1672,376 +1672,395 @@ msgstr ""
msgid "alias_name: name of alias to remove"
msgstr ""
-#: src/common/command.c:340
+#: src/common/command.c:91
+msgid "manage windows"
+msgstr ""
+
+#: src/common/command.c:92
+msgid "[action]"
+msgstr ""
+
+#: src/common/command.c:93
+msgid ""
+"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"
+msgstr ""
+
+#: src/common/command.c:348
#, c-format
msgid "%s alias or command \"%s\" already exists!\n"
msgstr ""
-#: src/common/command.c:349
+#: src/common/command.c:357
#, c-format
msgid "%s alias cannot run another alias!\n"
msgstr ""
-#: src/common/command.c:355
+#: src/common/command.c:363
#, c-format
msgid "%s target command \"%s\" does not exist!\n"
msgstr ""
-#: src/common/command.c:541
+#: src/common/command.c:549
#, c-format
msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n"
msgstr ""
-#: src/common/command.c:550
+#: src/common/command.c:558
#, c-format
msgid ""
"%s wrong argument count for %s command \"%s\" (expected: between %d and %d "
"arg%s)\n"
msgstr ""
-#: src/common/command.c:569
+#: src/common/command.c:577
#, c-format
msgid "%s %s command \"%s\" failed\n"
msgstr ""
-#: src/common/command.c:594
+#: src/common/command.c:602
#, c-format
msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n"
msgstr ""
-#: src/common/command.c:603
+#: src/common/command.c:611
#, c-format
msgid ""
"%s wrong argument count for IRC command \"%s\" (expected: between %d and %d "
"arg%s)\n"
msgstr ""
-#: src/common/command.c:616
+#: src/common/command.c:624
#, c-format
msgid "%s command \"%s\" needs a server connection!\n"
msgstr ""
-#: src/common/command.c:628
+#: src/common/command.c:636
#, c-format
msgid "%s IRC command \"%s\" failed\n"
msgstr ""
-#: src/common/command.c:675
+#: src/common/command.c:683
#, c-format
msgid "%s unknown command \"%s\" (type /help for help)\n"
msgstr ""
-#: src/common/command.c:744
+#: src/common/command.c:752
#, c-format
msgid "%s cannot find nick for sending message\n"
msgstr ""
-#: src/common/command.c:750
+#: src/common/command.c:758
msgid "This window is not a channel!\n"
msgstr ""
-#: src/common/command.c:776 src/common/command.c:788
+#: src/common/command.c:784 src/common/command.c:796
#, c-format
msgid "%s missing arguments for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:783
+#: src/common/command.c:791
#, c-format
msgid "Alias \"%s\" => \"%s\" created\n"
msgstr ""
-#: src/common/command.c:798
+#: src/common/command.c:806
msgid "List of aliases:\n"
msgstr ""
-#: src/common/command.c:808
+#: src/common/command.c:816
msgid "No alias defined.\n"
msgstr ""
-#: src/common/command.c:827
+#: src/common/command.c:835
#, c-format
msgid "unknown parameter \"%s\" for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:856
+#: src/common/command.c:864
#, c-format
msgid "%s already connected to server \"%s\"!\n"
msgstr ""
-#: src/common/command.c:879 src/common/command.c:914
+#: src/common/command.c:887 src/common/command.c:922
#, c-format
msgid "%s server \"%s\" not found\n"
msgstr ""
-#: src/common/command.c:904
+#: src/common/command.c:912
#, c-format
msgid "%s not connected to server \"%s\"!\n"
msgstr ""
-#: src/common/command.c:933
+#: src/common/command.c:941
#, c-format
msgid "> List of %s internal commands:\n"
msgstr ""
-#: src/common/command.c:938
+#: src/common/command.c:946
msgid "> List of IRC commands:\n"
msgstr ""
-#: src/common/command.c:953
+#: src/common/command.c:961
#, c-format
msgid "> Help on %s internal command \"%s\":\n"
msgstr ""
-#: src/common/command.c:956 src/common/command.c:977
+#: src/common/command.c:964 src/common/command.c:985
#, c-format
msgid "Syntax: /%s %s\n"
msgstr ""
-#: src/common/command.c:975
+#: src/common/command.c:983
#, c-format
msgid "> Help on IRC command \"%s\":\n"
msgstr ""
-#: src/common/command.c:991
+#: src/common/command.c:999
#, c-format
msgid "No help available, \"%s\" is an unknown command\n"
msgstr ""
-#: src/common/command.c:1016
+#: src/common/command.c:1024
msgid "Registered Perl scripts:\n"
msgstr ""
-#: src/common/command.c:1033 src/common/command.c:1055
-#: src/common/command.c:1077
+#: src/common/command.c:1041 src/common/command.c:1063
+#: src/common/command.c:1085
msgid " (none)\n"
msgstr ""
-#: src/common/command.c:1038
+#: src/common/command.c:1046
msgid "Perl message handlers:\n"
msgstr ""
-#: src/common/command.c:1047
+#: src/common/command.c:1055
#, c-format
msgid " IRC(%s) => Perl(%s)\n"
msgstr ""
-#: src/common/command.c:1060
+#: src/common/command.c:1068
msgid "Perl command handlers:\n"
msgstr ""
-#: src/common/command.c:1069
+#: src/common/command.c:1077
#, c-format
msgid " Command /%s => Perl(%s)\n"
msgstr ""
-#: src/common/command.c:1087
+#: src/common/command.c:1095
msgid "Perl scripts unloaded\n"
msgstr ""
-#: src/common/command.c:1112
+#: src/common/command.c:1120
#, c-format
msgid "%s unknown option for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1123
+#: src/common/command.c:1131
msgid ""
"WeeChat was build without Perl support.\n"
"Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n"
msgstr ""
-#: src/common/command.c:1167
+#: src/common/command.c:1175
msgid "Server: "
msgstr ""
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "connected"
msgstr ""
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "not connected"
msgstr ""
-#: src/common/command.c:1185
+#: src/common/command.c:1193
#, c-format
msgid " Autoconnect: %s%s\n"
msgstr ""
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "yes"
msgstr ""
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "no"
msgstr ""
-#: src/common/command.c:1188
+#: src/common/command.c:1196
msgid " (temporary server, will not be saved)"
msgstr ""
-#: src/common/command.c:1193
+#: src/common/command.c:1201
#, c-format
msgid " Hostname : %s\n"
msgstr ""
-#: src/common/command.c:1198
+#: src/common/command.c:1206
#, c-format
msgid " Port : %d\n"
msgstr ""
-#: src/common/command.c:1204
+#: src/common/command.c:1212
msgid " Password : (hidden)\n"
msgstr ""
-#: src/common/command.c:1208
+#: src/common/command.c:1216
msgid " Password : (none)\n"
msgstr ""
-#: src/common/command.c:1212
+#: src/common/command.c:1220
#, c-format
msgid " Nicks : %s"
msgstr ""
-#: src/common/command.c:1229
+#: src/common/command.c:1237
#, c-format
msgid " Username : %s\n"
msgstr ""
-#: src/common/command.c:1234
+#: src/common/command.c:1242
#, c-format
msgid " Realname : %s\n"
msgstr ""
-#: src/common/command.c:1240
+#: src/common/command.c:1248
#, c-format
msgid " Command : %s\n"
msgstr ""
-#: src/common/command.c:1245
+#: src/common/command.c:1253
msgid " Command : (none)\n"
msgstr ""
-#: src/common/command.c:1250
+#: src/common/command.c:1258
#, c-format
msgid " Auto-join : %s\n"
msgstr ""
-#: src/common/command.c:1255
+#: src/common/command.c:1263
msgid " Auto-join : (none)\n"
msgstr ""
-#: src/common/command.c:1259
+#: src/common/command.c:1267
msgid "No server.\n"
msgstr ""
-#: src/common/command.c:1268
+#: src/common/command.c:1276
#, c-format
msgid "%s missing servername for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1274
+#: src/common/command.c:1282
#, c-format
msgid "%s too much arguments for \"%s\" command, ignoring arguments\n"
msgstr ""
-#: src/common/command.c:1291
+#: src/common/command.c:1299
#, c-format
msgid "%s server \"%s\" not found for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1297 src/common/command.c:1428
+#: src/common/command.c:1305 src/common/command.c:1436
msgid "Server"
msgstr ""
-#: src/common/command.c:1300
+#: src/common/command.c:1308
msgid "has been deleted\n"
msgstr ""
-#: src/common/command.c:1314
+#: src/common/command.c:1322
#, c-format
msgid "%s missing parameters for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1323
+#: src/common/command.c:1331
#, c-format
msgid "%s server \"%s\" already exists, can't create it!\n"
msgstr ""
-#: src/common/command.c:1347 src/common/command.c:1373
-#: src/common/command.c:1385 src/common/command.c:1409
+#: src/common/command.c:1355 src/common/command.c:1381
+#: src/common/command.c:1393 src/common/command.c:1417
#, c-format
msgid "%s missing password for \"%s\" parameter\n"
msgstr ""
-#: src/common/command.c:1359
+#: src/common/command.c:1367
#, c-format
msgid "%s missing nick(s) for \"%s\" parameter\n"
msgstr ""
-#: src/common/command.c:1397
+#: src/common/command.c:1405
#, c-format
msgid "%s missing command for \"%s\" parameter\n"
msgstr ""
-#: src/common/command.c:1431
+#: src/common/command.c:1439
msgid "created\n"
msgstr ""
-#: src/common/command.c:1436
+#: src/common/command.c:1444
#, c-format
msgid "%s unable to create server\n"
msgstr ""
-#: src/common/command.c:1490
+#: src/common/command.c:1498
#, c-format
msgid "%s option '%s' can not be changed while WeeChat is running\n"
msgstr ""
-#: src/common/command.c:1502
+#: src/common/command.c:1510
#, c-format
msgid "%s incorrect value for option '%s'\n"
msgstr ""
-#: src/common/command.c:1508
+#: src/common/command.c:1516
#, c-format
msgid "%s config option '%s' not found\n"
msgstr ""
-#: src/common/command.c:1558
+#: src/common/command.c:1566
msgid "(unknown)"
msgstr ""
-#: src/common/command.c:1578 src/common/command.c:1581
+#: src/common/command.c:1586 src/common/command.c:1589
#, c-format
msgid "No config option found with '%s'\n"
msgstr ""
-#: src/common/command.c:1586
+#: src/common/command.c:1594
#, c-format
msgid "%d config option(s) found with '%s'\n"
msgstr ""
-#: src/common/command.c:1589
+#: src/common/command.c:1597
#, c-format
msgid "%d config option(s) found\n"
msgstr ""
-#: src/common/command.c:1609
+#: src/common/command.c:1617
#, c-format
msgid "%s alias or command \"%s\" not found\n"
msgstr ""
-#: src/common/command.c:1618
+#: src/common/command.c:1626
#, c-format
msgid "Alias \"%s\" removed\n"
msgstr ""
#: src/common/weechat.c:118
+#, c-format
msgid ""
"WeeChat configuration options (~/.weechat/weechat.rc):\n"
"\n"
msgstr ""
#: src/common/weechat.c:131
+#, c-format
msgid " . type boolean (values: 'on' or 'off')\n"
msgstr ""
@@ -2062,6 +2081,7 @@ msgid " . default value: %d\n"
msgstr ""
#: src/common/weechat.c:144
+#, c-format
msgid " . type string (values: "
msgstr ""
@@ -2070,10 +2090,12 @@ msgid "empty"
msgstr ""
#: src/common/weechat.c:160
+#, c-format
msgid " . type color (Curses or Gtk color, look at WeeChat doc)\n"
msgstr ""
#: src/common/weechat.c:166
+#, c-format
msgid " . type string (any string)\n"
msgstr ""
@@ -2085,11 +2107,13 @@ msgid ""
msgstr ""
#: src/common/weechat.c:178
+#, c-format
msgid ""
"Moreover, you can define aliases in [alias] section, by adding lines like:\n"
msgstr ""
#: src/common/weechat.c:180
+#, c-format
msgid ""
"where 'j' is alias name, and 'join' associated command.\n"
"\n"
diff --git a/src/common/command.c b/src/common/command.c
index 44bc3e89d..873adeff8 100644
--- a/src/common/command.c
+++ b/src/common/command.c
@@ -91,7 +91,7 @@ t_weechat_command weechat_commands[] =
{ "window", N_("manage windows"),
N_("[action]"),
N_("action: action to do:\n"
- " close close current window\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"),
@@ -715,46 +715,46 @@ user_command (t_irc_server *server, char *command)
{
if ((command[0] == '/') && (command[1] == '/'))
command++;
- if (server && (!VIEW_IS_SERVER(gui_current_view)))
+ if (server && (!BUFFER_IS_SERVER(gui_current_window->buffer)))
{
server_sendf (server, "PRIVMSG %s :%s\r\n",
- CHANNEL(gui_current_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
command);
- if (VIEW_IS_PRIVATE(gui_current_view))
+ if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
{
- gui_printf_color_type (CHANNEL(gui_current_view)->view,
+ gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
- gui_printf_color_type (CHANNEL(gui_current_view)->view,
+ 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_view)->view,
+ gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (CHANNEL(gui_current_view)->view,
+ 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_view), server->nick);
+ ptr_nick = nick_search (CHANNEL(gui_current_window->buffer), server->nick);
if (ptr_nick)
{
- irc_display_nick (CHANNEL(gui_current_view)->view, 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_view)->view,
+ gui_printf_color (CHANNEL(gui_current_window->buffer)->buffer,
COLOR_WIN_CHAT, "%s\n", command);
}
else
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot find nick for sending message\n"),
WEECHAT_ERROR);
}
}
else
- gui_printf ((server) ? server->view : NULL,
+ gui_printf ((server) ? server->buffer : NULL,
_("This window is not a channel!\n"));
}
}
@@ -828,7 +828,7 @@ weechat_cmd_clear (int argc, char **argv)
if (argc == 1)
{
if (strcmp (argv[0], "-all") == 0)
- gui_view_clear_all ();
+ gui_buffer_clear_all ();
else
{
gui_printf (NULL,
@@ -838,7 +838,7 @@ weechat_cmd_clear (int argc, char **argv)
}
}
else
- gui_view_clear (gui_current_view);
+ gui_buffer_clear (gui_current_window->buffer);
return 0;
}
@@ -865,9 +865,9 @@ weechat_cmd_connect (int argc, char **argv)
WEECHAT_ERROR, argv[0]);
return -1;
}
- if (!ptr_server->view)
+ if (!ptr_server->buffer)
{
- if (!gui_view_new (gui_current_view->window, ptr_server, NULL, 1))
+ if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 1))
return -1;
}
if (server_connect (ptr_server))
@@ -914,7 +914,7 @@ weechat_cmd_disconnect (int argc, char **argv)
return -1;
}
server_disconnect (ptr_server);
- gui_redraw_view_status (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
}
else
{
@@ -1308,7 +1308,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_view (gui_current_view);
+ gui_redraw_buffer (gui_current_window->buffer);
return 0;
}
@@ -1449,7 +1449,7 @@ weechat_cmd_server (int argc, char **argv)
if (new_server->autoconnect)
{
- (void) gui_view_new (gui_current_view->window, new_server, NULL, 1);
+ (void) gui_buffer_new (gui_current_window, new_server, NULL, 1);
if (server_connect (new_server))
irc_login (new_server);
}
@@ -1648,12 +1648,12 @@ weechat_cmd_window (int argc, char **argv)
if (strcasecmp (argv[0], "splith") == 0)
{
/* split window horizontally */
- gui_printf (NULL, "window splith -- NOT DEVELOPED!\n");
+ gui_window_split_horiz (gui_current_window);
}
else if (strcasecmp (argv[0], "splitv") == 0)
{
/* split window vertically */
- gui_printf (NULL, "window splitv -- NOT DEVELOPED!\n");
+ gui_window_split_vertic (gui_current_window);
}
else
return -1;
diff --git a/src/common/history.c b/src/common/history.c
index e4c4269b9..6724662c1 100644
--- a/src/common/history.c
+++ b/src/common/history.c
@@ -44,7 +44,7 @@ int num_history_general = 0;
*/
void
-history_add (void *view, char *string)
+history_add (void *buffer, char *string)
{
t_history *new_history, *ptr_history;
@@ -83,26 +83,26 @@ history_add (void *view, char *string)
{
new_history->text = strdup (string);
- if (((t_gui_view *)(view))->history)
- ((t_gui_view *)(view))->history->prev_history = new_history;
+ if (((t_gui_buffer *)(buffer))->history)
+ ((t_gui_buffer *)(buffer))->history->prev_history = new_history;
else
- ((t_gui_view *)(view))->last_history = new_history;
- new_history->next_history = ((t_gui_view *)(view))->history;
+ ((t_gui_buffer *)(buffer))->last_history = new_history;
+ new_history->next_history = ((t_gui_buffer *)(buffer))->history;
new_history->prev_history = NULL;
- ((t_gui_view *)view)->history = new_history;
- ((t_gui_view *)(view))->num_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_view *)(view))->num_history > cfg_history_max_commands))
+ && (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
{
- ptr_history = ((t_gui_view *)view)->last_history->prev_history;
- ((t_gui_view *)view)->last_history->prev_history->next_history = NULL;
- if (((t_gui_view *)view)->last_history->text)
- free (((t_gui_view *)view)->last_history->text);
- free (((t_gui_view *)view)->last_history);
- ((t_gui_view *)view)->last_history = ptr_history;
- ((t_gui_view *)(view))->num_history++;
+ 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++;
}
}
}
diff --git a/src/common/weeconfig.c b/src/common/weeconfig.c
index 8cfa9d6e1..ccbec9a83 100644
--- a/src/common/weeconfig.c
+++ b/src/common/weeconfig.c
@@ -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_views },
+ 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_views },
+ "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_views },
+ 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_views },
+ 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_view_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_views },
+ 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_views },
+ 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_views },
+ 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_view_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)"),
@@ -615,24 +615,24 @@ config_change_title ()
}
/*
- * config_change_views: called when views change (for example nicklist)
+ * config_change_buffers: called when buffers change (for example nicklist)
*/
void
-config_change_views ()
+config_change_buffers ()
{
- gui_switch_to_view (gui_current_view);
- gui_redraw_view (gui_current_view);
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
}
/*
- * config_change_view_content: called when content of a view changes
+ * config_change_buffer_content: called when content of a buffer changes
*/
void
-config_change_view_content ()
+config_change_buffer_content ()
{
- gui_redraw_view (gui_current_view);
+ gui_redraw_buffer (gui_current_window->buffer);
}
/*
diff --git a/src/common/weeconfig.h b/src/common/weeconfig.h
index 3fa2c84be..4cba0be79 100644
--- a/src/common/weeconfig.h
+++ b/src/common/weeconfig.h
@@ -158,8 +158,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_views ();
-extern void config_change_view_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 *);
diff --git a/src/gui/curses/gui-display.c b/src/gui/curses/gui-display.c
index 5d15fdb16..5aadb6c38 100644
--- a/src/gui/curses/gui-display.c
+++ b/src/gui/curses/gui-display.c
@@ -153,138 +153,130 @@ gui_window_set_color (WINDOW *window, int num_color)
}
/*
- * gui_view_has_nicklist: returns 1 if view has nicklist
+ * gui_buffer_has_nicklist: returns 1 if buffer has nicklist
*/
int
-gui_view_has_nicklist (t_gui_view *view)
+gui_buffer_has_nicklist (t_gui_buffer *buffer)
{
- return (((CHANNEL(view)) && (CHANNEL(view)->type == CHAT_CHANNEL)) ? 1 : 0);
+ return (((CHANNEL(buffer)) && (CHANNEL(buffer)->type == CHAT_CHANNEL)) ? 1 : 0);
}
/*
- * gui_calculate_pos_size: calculate position and size for a view & subviews
+ * gui_calculate_pos_size: calculate position and size for a buffer & subwindows
*/
void
-gui_calculate_pos_size (t_gui_view *view)
+gui_calculate_pos_size (t_gui_window *window)
{
int max_length, lines;
int num_nicks, num_op, num_halfop, num_voice, num_normal;
- /* global position & size */
- /* TODO: get values from function parameters */
- view->window->win_x = 0;
- view->window->win_y = 0;
- view->window->win_width = COLS;
- view->window->win_height = LINES;
-
/* init chat & nicklist settings */
- /* TODO: calculate values from function parameters */
- if (cfg_look_nicklist && VIEW_IS_CHANNEL(view))
+ if (cfg_look_nicklist && BUFFER_IS_CHANNEL(window->buffer))
{
- max_length = nick_get_max_length (CHANNEL(view));
+ max_length = nick_get_max_length (CHANNEL(window->buffer));
switch (cfg_look_nicklist_position)
{
case CFG_LOOK_NICKLIST_LEFT:
- view->window->win_chat_x = max_length + 2;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS - max_length - 2;
- view->window->win_nick_x = 0;
- view->window->win_nick_y = 1;
- view->window->win_nick_width = max_length + 2;
+ window->win_chat_x = window->win_x + max_length + 2;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width - max_length - 2;
+ window->win_nick_x = window->win_x + 0;
+ window->win_nick_y = window->win_y + 1;
+ window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
- view->window->win_chat_height = LINES - 4;
- view->window->win_nick_height = LINES - 4;
+ window->win_chat_height = window->win_height - 4;
+ window->win_nick_height = window->win_height - 4;
}
else
{
- view->window->win_chat_height = LINES - 3;
- view->window->win_nick_height = LINES - 3;
+ window->win_chat_height = window->win_height - 3;
+ window->win_nick_height = window->win_height - 3;
}
break;
case CFG_LOOK_NICKLIST_RIGHT:
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS - max_length - 2;
- view->window->win_nick_x = COLS - max_length - 2;
- view->window->win_nick_y = 1;
- view->window->win_nick_width = max_length + 2;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width - max_length - 2;
+ window->win_nick_x = window->win_x + window->win_width - max_length - 2;
+ window->win_nick_y = window->win_y + 1;
+ window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
- view->window->win_chat_height = LINES - 4;
- view->window->win_nick_height = LINES - 4;
+ window->win_chat_height = window->win_height - 4;
+ window->win_nick_height = window->win_height - 4;
}
else
{
- view->window->win_chat_height = LINES - 3;
- view->window->win_nick_height = LINES - 3;
+ window->win_chat_height = window->win_height - 3;
+ window->win_nick_height = window->win_height - 3;
}
break;
case CFG_LOOK_NICKLIST_TOP:
- nick_count (CHANNEL(view), &num_nicks, &num_op, &num_halfop,
- &num_voice, &num_normal);
- if (((max_length + 2) * num_nicks) % COLS == 0)
- lines = ((max_length + 2) * num_nicks) / COLS;
+ nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
+ &num_halfop, &num_voice, &num_normal);
+ if (((max_length + 2) * num_nicks) % window->win_width == 0)
+ lines = ((max_length + 2) * num_nicks) / window->win_width;
else
- lines = (((max_length + 2) * num_nicks) / COLS) + 1;
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1 + (lines + 1);
- view->window->win_chat_width = COLS;
+ lines = (((max_length + 2) * num_nicks) / window->win_width) + 1;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1 + (lines + 1);
+ window->win_chat_width = window->win_width;
if (cfg_look_infobar)
- view->window->win_chat_height = LINES - 3 - (lines + 1) - 1;
+ window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
else
- view->window->win_chat_height = LINES - 3 - (lines + 1);
- view->window->win_nick_x = 0;
- view->window->win_nick_y = 1;
- view->window->win_nick_width = COLS;
- view->window->win_nick_height = lines + 1;
+ window->win_chat_height = window->win_height - 3 - (lines + 1);
+ window->win_nick_x = window->win_x;
+ window->win_nick_y = window->win_y + 1;
+ window->win_nick_width = window->win_width;
+ window->win_nick_height = lines + 1;
break;
case CFG_LOOK_NICKLIST_BOTTOM:
- nick_count (CHANNEL(view), &num_nicks, &num_op, &num_halfop,
- &num_voice, &num_normal);
- if (((max_length + 2) * num_nicks) % COLS == 0)
- lines = ((max_length + 2) * num_nicks) / COLS;
+ nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
+ &num_halfop, &num_voice, &num_normal);
+ if (((max_length + 2) * num_nicks) % window->win_width == 0)
+ lines = ((max_length + 2) * num_nicks) / window->win_width;
else
- lines = (((max_length + 2) * num_nicks) / COLS) + 1;
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS;
+ lines = (((max_length + 2) * num_nicks) / window->win_width) + 1;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width;
if (cfg_look_infobar)
- view->window->win_chat_height = LINES - 3 - (lines + 1) - 1;
+ window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
else
- view->window->win_chat_height = LINES - 3 - (lines + 1);
- view->window->win_nick_x = 0;
+ window->win_chat_height = window->win_height - 3 - (lines + 1);
+ window->win_nick_x = window->win_x;
if (cfg_look_infobar)
- view->window->win_nick_y = LINES - 2 - (lines + 1) - 1;
+ window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1) - 1;
else
- view->window->win_nick_y = LINES - 2 - (lines + 1);
- view->window->win_nick_width = COLS;
- view->window->win_nick_height = lines + 1;
+ window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1);
+ window->win_nick_width = window->win_width;
+ window->win_nick_height = lines + 1;
break;
}
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = 0;
+ window->win_chat_cursor_x = window->win_x;
+ window->win_chat_cursor_y = window->win_y;
}
else
{
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width;
if (cfg_look_infobar)
- view->window->win_chat_height = LINES - 4;
+ window->win_chat_height = window->win_height - 4;
else
- view->window->win_chat_height = LINES - 3;
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = 0;
- view->window->win_nick_x = -1;
- view->window->win_nick_y = -1;
- view->window->win_nick_width = -1;
- view->window->win_nick_height = -1;
+ window->win_chat_height = window->win_height - 3;
+ window->win_chat_cursor_x = window->win_x;
+ window->win_chat_cursor_y = window->win_y;
+ window->win_nick_x = -1;
+ window->win_nick_y = -1;
+ window->win_nick_width = -1;
+ window->win_nick_height = -1;
}
}
@@ -300,57 +292,49 @@ gui_curses_window_clear (WINDOW *window)
}
/*
- * gui_draw_view_title: draw title window for a view
+ * gui_draw_buffer_title: draw title window for a buffer
*/
void
-gui_draw_view_title (t_gui_view *view)
+gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
char format[32];
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- {
- gui_window_set_color (view->window->win_title, COLOR_WIN_TITLE);
- wborder (view->window->win_title, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_title);
- refresh ();
- }
- if (CHANNEL(view))
- {
- snprintf (format, 32, "%%-%ds", view->window->win_width);
- if (CHANNEL(view)->topic)
- mvwprintw (view->window->win_title, 0, 0, format,
- CHANNEL(view)->topic);
- }
- else
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- /* TODO: change this copyright as title? */
- mvwprintw (view->window->win_title, 0, 0,
- "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
- mvwprintw (view->window->win_title, 0, COLS - strlen (WEECHAT_COPYRIGHT),
- "%s", WEECHAT_COPYRIGHT);
+ if (ptr_win->buffer == buffer)
+ {
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_title);
+
+ if (has_colors ())
+ {
+ gui_window_set_color (ptr_win->win_title, COLOR_WIN_TITLE);
+ wborder (ptr_win->win_title, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_title);
+ refresh ();
+ }
+ if (CHANNEL(buffer))
+ {
+ snprintf (format, 32, "%%-%ds", ptr_win->win_width);
+ if (CHANNEL(buffer)->topic)
+ mvwprintw (ptr_win->win_title, 0, 0, format,
+ CHANNEL(buffer)->topic);
+ }
+ else
+ {
+ /* TODO: change this copyright as title? */
+ mvwprintw (ptr_win->win_title, 0, 0,
+ "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
+ mvwprintw (ptr_win->win_title, 0,
+ ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
+ "%s", WEECHAT_COPYRIGHT);
+ }
+ wrefresh (ptr_win->win_title);
+ refresh ();
+ }
}
- wrefresh (view->window->win_title);
- refresh ();
-}
-
-/*
- * gui_redraw_view_title: redraw title window for a view
- */
-
-void
-gui_redraw_view_title (t_gui_view *view)
-{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- gui_curses_window_clear (view->window->win_title);
- gui_draw_view_title (view);
}
/*
@@ -360,20 +344,20 @@ gui_redraw_view_title (t_gui_view *view)
*/
int
-gui_get_line_num_splits (t_gui_view *view, t_gui_line *line)
+gui_get_line_num_splits (t_gui_window *window, t_gui_line *line)
{
int length, width;
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
- if (line->length_align >= view->window->win_chat_width - 5)
+ if (line->length_align >= window->win_chat_width - 5)
{
length = line->length;
- width = view->window->win_chat_width;
+ width = window->win_chat_width;
}
else
{
length = line->length - line->length_align;
- width = view->window->win_chat_width - line->length_align;
+ width = window->win_chat_width - line->length_align;
}
return (length % width == 0) ? (length / width) : ((length / width) + 1);
@@ -384,14 +368,14 @@ gui_get_line_num_splits (t_gui_view *view, t_gui_line *line)
*/
void
-gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
+gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
{
int lines_displayed, num_lines, offset, remainder, num_displayed;
t_gui_message *ptr_message;
char saved_char, format_align[32], format_empty[32];
snprintf (format_align, 32, "%%-%ds", line->length_align);
- num_lines = gui_get_line_num_splits (view, line);
+ num_lines = gui_get_line_num_splits (window, line);
ptr_message = line->messages;
offset = 0;
lines_displayed = 0;
@@ -399,31 +383,31 @@ gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
{
/* set text color if beginning of message */
if (offset == 0)
- gui_window_set_color (view->window->win_chat, ptr_message->color);
+ gui_window_set_color (window->win_chat, ptr_message->color);
/* insert spaces for align text under time/nick */
- if ((lines_displayed > 0) && (view->window->win_chat_cursor_x == 0))
+ if ((lines_displayed > 0) && (window->win_chat_cursor_x == 0))
{
if (lines_displayed >= num_lines - count)
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
format_align, " ");
- view->window->win_chat_cursor_x += line->length_align;
+ window->win_chat_cursor_x += line->length_align;
}
remainder = strlen (ptr_message->message + offset);
- if (view->window->win_chat_cursor_x + remainder >
- view->window->win_chat_width - 1)
+ if (window->win_chat_cursor_x + remainder >
+ window->win_chat_width - 1)
{
- num_displayed = view->window->win_chat_width -
- view->window->win_chat_cursor_x;
+ num_displayed = window->win_chat_width -
+ window->win_chat_cursor_x;
saved_char = ptr_message->message[offset + num_displayed];
ptr_message->message[offset + num_displayed] = '\0';
if (lines_displayed >= num_lines - count)
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
ptr_message->message[offset + num_displayed] = saved_char;
offset += num_displayed;
@@ -432,28 +416,28 @@ gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
{
num_displayed = remainder;
if (lines_displayed >= num_lines - count)
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
ptr_message = ptr_message->next_message;
offset = 0;
}
- view->window->win_chat_cursor_x += num_displayed;
+ window->win_chat_cursor_x += num_displayed;
if (!ptr_message ||
- (view->window->win_chat_cursor_x > (view->window->win_chat_width - 1)))
+ (window->win_chat_cursor_x > (window->win_chat_width - 1)))
{
if (lines_displayed >= num_lines - count)
{
- if (view->window->win_chat_cursor_x <= view->window->win_chat_width - 1)
+ if (window->win_chat_cursor_x <= window->win_chat_width - 1)
{
snprintf (format_empty, 32, "%%-%ds",
- view->window->win_chat_width - view->window->win_chat_cursor_x);
- wprintw (view->window->win_chat, format_empty, " ");
+ window->win_chat_width - window->win_chat_cursor_x);
+ wprintw (window->win_chat, format_empty, " ");
}
- view->window->win_chat_cursor_y++;
+ window->win_chat_cursor_y++;
}
- view->window->win_chat_cursor_x = 0;
+ window->win_chat_cursor_x = 0;
lines_displayed++;
}
}
@@ -468,7 +452,7 @@ gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
*/
int
-gui_display_line (t_gui_view *view, t_gui_line *line, int stop_at_end)
+gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
{
int offset, remainder, num_displayed;
t_gui_message *ptr_message;
@@ -480,46 +464,46 @@ gui_display_line (t_gui_view *view, t_gui_line *line, int stop_at_end)
while (ptr_message)
{
/* cursor is below end line of chat window */
- if (view->window->win_chat_cursor_y > view->window->win_chat_height - 1)
+ if (window->win_chat_cursor_y > window->win_chat_height - 1)
{
/*if (!stop_at_end)
- wscrl (view->window->win_chat, +1);*/
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = view->window->win_chat_height - 1;
+ wscrl (buffer->window->win_chat, +1);*/
+ window->win_chat_cursor_x = 0;
+ window->win_chat_cursor_y = window->win_chat_height - 1;
if (stop_at_end)
return 0;
- view->first_line_displayed = 0;
+ window->first_line_displayed = 0;
}
/* set text color if beginning of message */
if (offset == 0)
- gui_window_set_color (view->window->win_chat, ptr_message->color);
+ gui_window_set_color (window->win_chat, ptr_message->color);
/* insert spaces for align text under time/nick */
- if ((view->window->win_chat_cursor_x == 0) &&
+ if ((window->win_chat_cursor_x == 0) &&
(ptr_message->type != MSG_TYPE_TIME) &&
(ptr_message->type != MSG_TYPE_NICK) &&
(line->length_align > 0) &&
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
- (line->length_align < (view->window->win_chat_width - 5)))
+ (line->length_align < (window->win_chat_width - 5)))
{
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
format_align, " ");
- view->window->win_chat_cursor_x += line->length_align;
+ window->win_chat_cursor_x += line->length_align;
}
remainder = strlen (ptr_message->message + offset);
- if (view->window->win_chat_cursor_x + remainder > view->window->win_chat_width)
+ if (window->win_chat_cursor_x + remainder > window->win_chat_width)
{
- num_displayed = view->window->win_chat_width -
- view->window->win_chat_cursor_x;
+ num_displayed = window->win_chat_width -
+ window->win_chat_cursor_x;
saved_char = ptr_message->message[offset + num_displayed];
ptr_message->message[offset + num_displayed] = '\0';
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
ptr_message->message[offset + num_displayed] = saved_char;
offset += num_displayed;
@@ -527,515 +511,475 @@ gui_display_line (t_gui_view *view, t_gui_line *line, int stop_at_end)
else
{
num_displayed = remainder;
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
offset = 0;
ptr_message = ptr_message->next_message;
}
- view->window->win_chat_cursor_x += num_displayed;
+ window->win_chat_cursor_x += num_displayed;
if (!ptr_message ||
- (view->window->win_chat_cursor_x > (view->window->win_chat_width - 1)))
+ (window->win_chat_cursor_x > (window->win_chat_width - 1)))
{
if (!ptr_message ||
- ((view->window->win_chat_cursor_y <= view->window->win_chat_height - 1) &&
- (view->window->win_chat_cursor_x > view->window->win_chat_width - 1)))
+ ((window->win_chat_cursor_y <= window->win_chat_height - 1) &&
+ (window->win_chat_cursor_x > window->win_chat_width - 1)))
{
- if (view->window->win_chat_cursor_x <= view->window->win_chat_width - 1)
+ if (window->win_chat_cursor_x <= window->win_chat_width - 1)
{
snprintf (format_empty, 32, "%%-%ds",
- view->window->win_chat_width - view->window->win_chat_cursor_x);
- wprintw (view->window->win_chat, format_empty, " ");
+ window->win_chat_width - window->win_chat_cursor_x);
+ wprintw (window->win_chat, format_empty, " ");
}
- view->window->win_chat_cursor_y++;
+ window->win_chat_cursor_y++;
}
- view->window->win_chat_cursor_x = 0;
+ window->win_chat_cursor_x = 0;
}
}
return 1;
}
/*
- * gui_draw_view_chat: draw chat window for a view
+ * gui_draw_buffer_chat: draw chat window for a buffer
*/
void
-gui_draw_view_chat (t_gui_view *view)
+gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
t_gui_line *ptr_line;
- int lines_used;
-
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- gui_window_set_color (view->window->win_chat, COLOR_WIN_CHAT);
+ char format_empty[32];
+ int i, lines_used;
- ptr_line = view->last_line;
- lines_used = 0;
- while (ptr_line
- && (lines_used < (view->window->win_chat_height + view->sub_lines)))
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- lines_used += gui_get_line_num_splits (view, ptr_line);
- ptr_line = ptr_line->prev_line;
- }
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = 0;
- if (lines_used > (view->window->win_chat_height + view->sub_lines))
- {
- /* screen will be full (we'll display only end of 1st line) */
- ptr_line = (ptr_line) ? ptr_line->next_line : view->lines;
- gui_display_end_of_line (view, ptr_line,
- gui_get_line_num_splits (view, ptr_line) -
- (lines_used - (view->window->win_chat_height + view->sub_lines)));
- ptr_line = ptr_line->next_line;
- view->first_line_displayed = 0;
- }
- else
- {
- /* all lines are displayed */
- if (!ptr_line)
+ if (ptr_win->buffer == buffer)
{
- view->first_line_displayed = 1;
- ptr_line = view->lines;
- }
- else
- {
- view->first_line_displayed = 0;
- ptr_line = ptr_line->next_line;
+ if (erase)
+ {
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
+
+ snprintf (format_empty, 32, "%%-%ds", ptr_win->win_chat_width);
+ for (i = 0; i < ptr_win->win_chat_height; i++)
+ {
+ mvwprintw (ptr_win->win_chat, i, 0, format_empty, " ");
+ }
+ }
+
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
+
+ ptr_line = buffer->last_line;
+ lines_used = 0;
+ while (ptr_line
+ && (lines_used < (ptr_win->win_chat_height + ptr_win->sub_lines)))
+ {
+ lines_used += gui_get_line_num_splits (ptr_win, ptr_line);
+ ptr_line = ptr_line->prev_line;
+ }
+ ptr_win->win_chat_cursor_x = 0;
+ ptr_win->win_chat_cursor_y = 0;
+ if (lines_used > (ptr_win->win_chat_height + ptr_win->sub_lines))
+ {
+ /* screen will be full (we'll display only end of 1st line) */
+ ptr_line = (ptr_line) ? ptr_line->next_line : buffer->lines;
+ gui_display_end_of_line (ptr_win, ptr_line,
+ gui_get_line_num_splits (ptr_win, ptr_line) -
+ (lines_used - (ptr_win->win_chat_height + ptr_win->sub_lines)));
+ ptr_line = ptr_line->next_line;
+ ptr_win->first_line_displayed = 0;
+ }
+ else
+ {
+ /* all lines are displayed */
+ if (!ptr_line)
+ {
+ ptr_win->first_line_displayed = 1;
+ ptr_line = buffer->lines;
+ }
+ else
+ {
+ ptr_win->first_line_displayed = 0;
+ ptr_line = ptr_line->next_line;
+ }
+ }
+ while (ptr_line)
+ {
+ if (!gui_display_line (ptr_win, ptr_line, 1))
+ break;
+
+ ptr_line = ptr_line->next_line;
+ }
+ /*if (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1)
+ buffer->sub_lines = 0;*/
+ wrefresh (ptr_win->win_chat);
+ refresh ();
}
}
- while (ptr_line)
- {
- if (!gui_display_line (view, ptr_line, 1))
- break;
-
- ptr_line = ptr_line->next_line;
- }
- /*if (view->window->win_chat_cursor_y <= view->window->win_chat_height - 1)
- view->sub_lines = 0;*/
- wrefresh (view->window->win_chat);
- refresh ();
-}
-
-/*
- * gui_redraw_view_chat: redraw chat window for a view
- */
-
-void
-gui_redraw_view_chat (t_gui_view *view)
-{
- char format_empty[32];
- int i;
-
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- gui_window_set_color (view->window->win_chat, COLOR_WIN_CHAT);
-
- snprintf (format_empty, 32, "%%-%ds", view->window->win_chat_width);
- for (i = 0; i < view->window->win_chat_height; i++)
- {
- mvwprintw (view->window->win_chat, i, 0, format_empty, " ");
- }
-
- gui_draw_view_chat (view);
}
/*
- * gui_draw_view_nick: draw nick window for a view
+ * gui_draw_buffer_nick: draw nick window for a buffer
*/
void
-gui_draw_view_nick (t_gui_view *view)
+gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
int i, x, y, column, max_length;
char format[32], format_empty[32];
t_irc_nick *ptr_nick;
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (CHANNEL(view) && CHANNEL(view)->nicks)
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- max_length = nick_get_max_length (CHANNEL(view));
- if ((view == gui_current_view) &&
- ((max_length + 2) != view->window->win_nick_width))
+ if (ptr_win->buffer == buffer)
{
- gui_calculate_pos_size (view);
- delwin (view->window->win_chat);
- delwin (view->window->win_nick);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- view->window->win_nick = newwin (view->window->win_nick_height,
- view->window->win_nick_width,
- view->window->win_nick_y,
- view->window->win_nick_x);
- gui_redraw_view_chat (view);
-
- if (has_colors ())
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
-
- snprintf (format_empty, 32, "%%-%ds", view->window->win_nick_width);
- for (i = 0; i < view->window->win_nick_height; i++)
+ if (erase)
{
- mvwprintw (view->window->win_nick, i, 0, format_empty, " ");
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+
+ snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
+ for (i = 0; i < ptr_win->win_nick_height; i++)
+ {
+ mvwprintw (ptr_win->win_nick, i, 0, format_empty, " ");
+ }
}
- }
- snprintf (format, 32, "%%-%ds", max_length);
- if (has_colors ())
- {
- switch (cfg_look_nicklist_position)
- {
- case CFG_LOOK_NICKLIST_LEFT:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_SEP);
- for (i = 0; i < view->window->win_chat_height; i++)
- mvwprintw (view->window->win_nick,
- i, view->window->win_nick_width - 1, " ");
- break;
- case CFG_LOOK_NICKLIST_RIGHT:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_SEP);
- for (i = 0; i < view->window->win_chat_height; i++)
- mvwprintw (view->window->win_nick,
- i, 0, " ");
- break;
- case CFG_LOOK_NICKLIST_TOP:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- for (i = 0; i < view->window->win_chat_width; i += 2)
- mvwprintw (view->window->win_nick,
- view->window->win_nick_height - 1, i, "-");
- break;
- case CFG_LOOK_NICKLIST_BOTTOM:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- for (i = 0; i < view->window->win_chat_width; i += 2)
- mvwprintw (view->window->win_nick,
- 0, i, "-");
- break;
- }
- }
-
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- x = 0;
- y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0;
- column = 0;
- for (ptr_nick = CHANNEL(view)->nicks; ptr_nick;
- ptr_nick = ptr_nick->next_nick)
- {
- switch (cfg_look_nicklist_position)
+ if (CHANNEL(buffer) && CHANNEL(buffer)->nicks)
{
- case CFG_LOOK_NICKLIST_LEFT:
- x = 0;
- break;
- case CFG_LOOK_NICKLIST_RIGHT:
- x = 1;
- break;
- case CFG_LOOK_NICKLIST_TOP:
- case CFG_LOOK_NICKLIST_BOTTOM:
- x = column;
- break;
- }
- if (ptr_nick->is_op)
- {
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_OP);
- mvwprintw (view->window->win_nick, y, x, "@");
- x++;
- }
- else
- {
- if (ptr_nick->is_halfop)
+ max_length = nick_get_max_length (CHANNEL(buffer));
+ if ((buffer == gui_current_window->buffer) &&
+ ((max_length + 2) != ptr_win->win_nick_width))
{
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_HALFOP);
- mvwprintw (view->window->win_nick, y, x, "%%");
- x++;
+ gui_calculate_pos_size (ptr_win);
+ delwin (ptr_win->win_chat);
+ delwin (ptr_win->win_nick);
+ ptr_win->win_chat = newwin (ptr_win->win_chat_height,
+ ptr_win->win_chat_width,
+ ptr_win->win_chat_y,
+ ptr_win->win_chat_x);
+ ptr_win->win_nick = newwin (ptr_win->win_nick_height,
+ ptr_win->win_nick_width,
+ ptr_win->win_nick_y,
+ ptr_win->win_nick_x);
+ gui_draw_buffer_chat (buffer, 1);
+
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+
+ snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
+ for (i = 0; i < ptr_win->win_nick_height; i++)
+ {
+ mvwprintw (ptr_win->win_nick, i, 0, format_empty, " ");
+ }
}
- else
+ snprintf (format, 32, "%%-%ds", max_length);
+
+ if (has_colors ())
{
- if (ptr_nick->has_voice)
+ switch (cfg_look_nicklist_position)
{
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_VOICE);
- mvwprintw (view->window->win_nick, y, x, "+");
+ case CFG_LOOK_NICKLIST_LEFT:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
+ for (i = 0; i < ptr_win->win_chat_height; i++)
+ mvwprintw (ptr_win->win_nick,
+ i, ptr_win->win_nick_width - 1, " ");
+ break;
+ case CFG_LOOK_NICKLIST_RIGHT:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
+ for (i = 0; i < ptr_win->win_chat_height; i++)
+ mvwprintw (ptr_win->win_nick,
+ i, 0, " ");
+ break;
+ case CFG_LOOK_NICKLIST_TOP:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ for (i = 0; i < ptr_win->win_chat_width; i += 2)
+ mvwprintw (ptr_win->win_nick,
+ ptr_win->win_nick_height - 1, i, "-");
+ break;
+ case CFG_LOOK_NICKLIST_BOTTOM:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ for (i = 0; i < ptr_win->win_chat_width; i += 2)
+ mvwprintw (ptr_win->win_nick,
+ 0, i, "-");
+ break;
+ }
+ }
+
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ x = 0;
+ y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0;
+ column = 0;
+ for (ptr_nick = CHANNEL(buffer)->nicks; ptr_nick;
+ ptr_nick = ptr_nick->next_nick)
+ {
+ switch (cfg_look_nicklist_position)
+ {
+ case CFG_LOOK_NICKLIST_LEFT:
+ x = 0;
+ break;
+ case CFG_LOOK_NICKLIST_RIGHT:
+ x = 1;
+ break;
+ case CFG_LOOK_NICKLIST_TOP:
+ case CFG_LOOK_NICKLIST_BOTTOM:
+ x = column;
+ break;
+ }
+ if (ptr_nick->is_op)
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_OP);
+ mvwprintw (ptr_win->win_nick, y, x, "@");
x++;
}
else
{
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- mvwprintw (view->window->win_nick, y, x, " ");
- x++;
+ if (ptr_nick->is_halfop)
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_HALFOP);
+ mvwprintw (ptr_win->win_nick, y, x, "%%");
+ x++;
+ }
+ else
+ {
+ if (ptr_nick->has_voice)
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_VOICE);
+ mvwprintw (ptr_win->win_nick, y, x, "+");
+ x++;
+ }
+ else
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ mvwprintw (ptr_win->win_nick, y, x, " ");
+ x++;
+ }
+ }
+ }
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ mvwprintw (ptr_win->win_nick, y, x, format, ptr_nick->nick);
+ y++;
+ if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
+ (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
+ {
+ if (y - ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0) >= ptr_win->win_nick_height - 1)
+ {
+ column += max_length + 2;
+ y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ?
+ 0 : 1;
+ }
}
}
}
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- mvwprintw (view->window->win_nick, y, x, format, ptr_nick->nick);
- y++;
- if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
- (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
- {
- if (y - ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0) >= view->window->win_nick_height - 1)
- {
- column += max_length + 2;
- y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ?
- 0 : 1;
- }
- }
+ wrefresh (ptr_win->win_nick);
+ refresh ();
}
}
- wrefresh (view->window->win_nick);
- refresh ();
}
/*
- * gui_redraw_view_nick: redraw nick window for a view
+ * gui_draw_buffer_status: draw status window for a buffer
*/
void
-gui_redraw_view_nick (t_gui_view *view)
+gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
{
- char format_empty[32];
- int i;
-
- /* TODO: manage splitted windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
-
- snprintf (format_empty, 32, "%%-%ds", view->window->win_nick_width);
- for (i = 0; i < view->window->win_nick_height; i++)
- {
- mvwprintw (view->window->win_nick, i, 0, format_empty, " ");
- }
-
- gui_draw_view_nick (view);
-}
-
-/*
- * gui_draw_view_status: draw status window for a view
- */
-
-void
-gui_draw_view_status (t_gui_view *view)
-{
- t_gui_view *ptr_view;
+ t_gui_window *ptr_win;
+ t_gui_buffer *ptr_buffer;
char format_more[32];
int i, first_mode;
- /* TODO: manage splitted windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- {
- gui_window_set_color (view->window->win_status, COLOR_WIN_STATUS);
- wborder (view->window->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_status);
- }
- wmove (view->window->win_status, 0, 0);
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- if (SERVER(ptr_view) && !CHANNEL(ptr_view))
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_status);
+
+ if (has_colors ())
{
- if (gui_current_view == SERVER(ptr_view)->view)
+ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
+ wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_status);
+ }
+ wmove (ptr_win->win_status, 0, 0);
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if (SERVER(ptr_buffer) && !CHANNEL(ptr_buffer))
{
- if (ptr_view->unread_data)
+ if (ptr_win->buffer == SERVER(ptr_buffer)->buffer)
{
- if (ptr_view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if (ptr_buffer->unread_data)
+ {
+ if (ptr_buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_ACTIVE);
}
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_ACTIVE);
- }
- else
- {
- if (SERVER(ptr_view)->view &&
- ((SERVER(ptr_view)->view)->unread_data))
{
- if (SERVER(ptr_view)->view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if (SERVER(ptr_buffer)->buffer &&
+ ((SERVER(ptr_buffer)->buffer)->unread_data))
+ {
+ if (SERVER(ptr_buffer)->buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS);
}
+ if (SERVER(ptr_buffer)->is_connected)
+ wprintw (ptr_win->win_status, "[%s] ",
+ SERVER(ptr_buffer)->name);
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS);
+ wprintw (ptr_win->win_status, "(%s) ",
+ SERVER(ptr_buffer)->name);
}
- if (SERVER(ptr_view)->is_connected)
- wprintw (view->window->win_status, "[%s] ",
- SERVER(ptr_view)->name);
- else
- wprintw (view->window->win_status, "(%s) ",
- SERVER(ptr_view)->name);
- }
- if (SERVER(ptr_view) && CHANNEL(ptr_view))
- {
- if (gui_current_view == CHANNEL(ptr_view)->view)
+ if (SERVER(ptr_buffer) && CHANNEL(ptr_buffer))
{
- if ((CHANNEL(ptr_view)->view) &&
- (CHANNEL(ptr_view)->view->unread_data))
+ if (ptr_win->buffer == CHANNEL(ptr_buffer)->buffer)
{
- if (CHANNEL(ptr_view)->view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if ((CHANNEL(ptr_buffer)->buffer) &&
+ (CHANNEL(ptr_buffer)->buffer->unread_data))
+ {
+ if (CHANNEL(ptr_buffer)->buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_ACTIVE);
}
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_ACTIVE);
- }
- else
- {
- if ((CHANNEL(ptr_view)->view) &&
- (CHANNEL(ptr_view)->view->unread_data))
{
- if (CHANNEL(ptr_view)->view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if ((CHANNEL(ptr_buffer)->buffer) &&
+ (CHANNEL(ptr_buffer)->buffer->unread_data))
+ {
+ if (CHANNEL(ptr_buffer)->buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS);
}
- else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS);
- }
- wprintw (view->window->win_status, "%s", CHANNEL(ptr_view)->name);
- if (gui_current_view == CHANNEL(ptr_view)->view)
- {
- /* display channel modes */
- wprintw (view->window->win_status, "(");
- i = 0;
- first_mode = 1;
- while (CHANNEL(ptr_view)->modes[i])
+ wprintw (ptr_win->win_status, "%s", CHANNEL(ptr_buffer)->name);
+ if (ptr_win->buffer == CHANNEL(ptr_buffer)->buffer)
{
- if (CHANNEL(ptr_view)->modes[i] != ' ')
+ /* display channel modes */
+ wprintw (ptr_win->win_status, "(");
+ i = 0;
+ first_mode = 1;
+ while (CHANNEL(ptr_buffer)->modes[i])
{
- if (first_mode)
+ if (CHANNEL(ptr_buffer)->modes[i] != ' ')
{
- wprintw (view->window->win_status, "+");
- first_mode = 0;
+ if (first_mode)
+ {
+ wprintw (ptr_win->win_status, "+");
+ first_mode = 0;
+ }
+ wprintw (ptr_win->win_status, "%c",
+ CHANNEL(ptr_buffer)->modes[i]);
}
- wprintw (view->window->win_status, "%c",
- CHANNEL(ptr_view)->modes[i]);
+ i++;
}
- i++;
+ if (CHANNEL(ptr_buffer)->modes[CHANNEL_MODE_KEY] != ' ')
+ wprintw (ptr_win->win_status, ",%s",
+ CHANNEL(ptr_buffer)->key);
+ if (CHANNEL(ptr_buffer)->modes[CHANNEL_MODE_LIMIT] != ' ')
+ wprintw (ptr_win->win_status, ",%d",
+ CHANNEL(ptr_buffer)->limit);
+ wprintw (ptr_win->win_status, ")");
}
- if (CHANNEL(ptr_view)->modes[CHANNEL_MODE_KEY] != ' ')
- wprintw (view->window->win_status, ",%s",
- CHANNEL(ptr_view)->key);
- if (CHANNEL(ptr_view)->modes[CHANNEL_MODE_LIMIT] != ' ')
- wprintw (view->window->win_status, ",%d",
- CHANNEL(ptr_view)->limit);
- wprintw (view->window->win_status, ")");
+ wprintw (ptr_win->win_status, " ");
+ }
+ if (!SERVER(ptr_buffer))
+ {
+ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
+ wprintw (ptr_win->win_status, _("[not connected] "));
}
- wprintw (view->window->win_status, " ");
}
- if (!SERVER(ptr_view))
+
+ /* display "-MORE-" if last line is not displayed */
+ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE);
+ if (ptr_win->sub_lines > 0)
+ mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
+ _("-MORE-"));
+ else
{
- gui_window_set_color (view->window->win_status, COLOR_WIN_STATUS);
- wprintw (view->window->win_status, _("[not connected] "));
+ snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
+ mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
+ format_more, " ");
}
+
+ wrefresh (ptr_win->win_status);
+ refresh ();
}
-
- /* display "-MORE-" if last line is not displayed */
- gui_window_set_color (view->window->win_status, COLOR_WIN_STATUS_MORE);
- if (view->sub_lines > 0)
- mvwprintw (view->window->win_status, 0, COLS - 7, _("-MORE-"));
- else
- {
- snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
- mvwprintw (view->window->win_status, 0, COLS - 7, format_more, " ");
- }
-
- wrefresh (view->window->win_status);
- refresh ();
-}
-
-/*
- * gui_redraw_view_status: redraw status window for a view
- */
-
-void
-gui_redraw_view_status (t_gui_view *view)
-{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- gui_curses_window_clear (view->window->win_status);
- gui_draw_view_status (view);
}
/*
- * gui_draw_view_infobar: draw infobar window for a view
+ * gui_draw_buffer_infobar: draw infobar window for a buffer
*/
void
-gui_draw_view_infobar (t_gui_view *view)
+gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
time_t time_seconds;
struct tm *local_time;
char text[1024 + 1];
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- gui_window_set_color (view->window->win_infobar, COLOR_WIN_INFOBAR);
- wborder (view->window->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_infobar);
- }
- wmove (view->window->win_infobar, 0, 0);
+ if (ptr_win->buffer == buffer)
+ {
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_infobar);
- time_seconds = time (NULL);
- local_time = localtime (&time_seconds);
- if (local_time)
- {
- strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
- gui_window_set_color (view->window->win_infobar, COLOR_WIN_INFOBAR);
- wprintw (view->window->win_infobar, "%s", text);
- }
- if (gui_infobar)
- {
- gui_window_set_color (view->window->win_infobar, gui_infobar->color);
- wprintw (view->window->win_infobar, " | %s", gui_infobar->text);
+ if (has_colors ())
+ {
+ gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
+ wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_infobar);
+ }
+ wmove (ptr_win->win_infobar, 0, 0);
+
+ time_seconds = time (NULL);
+ local_time = localtime (&time_seconds);
+ if (local_time)
+ {
+ strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
+ gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
+ wprintw (ptr_win->win_infobar, "%s", text);
+ }
+ if (gui_infobar)
+ {
+ gui_window_set_color (ptr_win->win_infobar, gui_infobar->color);
+ wprintw (ptr_win->win_infobar, " | %s", gui_infobar->text);
+ }
+
+ wrefresh (ptr_win->win_infobar);
+ refresh ();
+ }
}
-
- wrefresh (view->window->win_infobar);
- refresh ();
-}
-
-/*
- * gui_redraw_view_infobar: redraw infobar window for a view
- */
-
-void
-gui_redraw_view_infobar (t_gui_view *view)
-{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- gui_curses_window_clear (view->window->win_infobar);
- gui_draw_view_infobar (view);
}
/*
@@ -1043,337 +987,342 @@ gui_redraw_view_infobar (t_gui_view *view)
*/
int
-gui_get_input_width (t_gui_view *view)
+gui_get_input_width (t_gui_window *window)
{
- if (CHANNEL(view))
- return (COLS - strlen (CHANNEL(view)->name) -
- strlen (SERVER(view)->nick) - 3);
+ if (CHANNEL(window->buffer))
+ return (window->win_width - strlen (CHANNEL(window->buffer)->name) -
+ strlen (SERVER(window->buffer)->nick) - 3);
else
{
- if (SERVER(view) && (SERVER(view)->is_connected))
- return (COLS - strlen (SERVER(view)->nick) - 2);
+ if (SERVER(window->buffer) && (SERVER(window->buffer)->is_connected))
+ return (window->win_width - strlen (SERVER(window->buffer)->nick) - 2);
else
- return (COLS - strlen (cfg_look_no_nickname) - 2);
+ return (window->win_width - strlen (cfg_look_no_nickname) - 2);
}
}
/*
- * gui_draw_view_input: draw input window for a view
+ * gui_draw_buffer_input: draw input window for a buffer
*/
void
-gui_draw_view_input (t_gui_view *view)
+gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
char format[32];
char *ptr_nickname;
int input_width;
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- {
- gui_window_set_color (view->window->win_input, COLOR_WIN_INPUT);
- wborder (view->window->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_input);
- }
-
- if (view->input_buffer_size == 0)
- view->input_buffer[0] = '\0';
-
- input_width = gui_get_input_width (view);
-
- if (view->input_buffer_pos - view->input_buffer_1st_display + 1 >
- input_width)
- view->input_buffer_1st_display = view->input_buffer_pos -
- input_width + 1;
- else
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- if (view->input_buffer_pos < view->input_buffer_1st_display)
- view->input_buffer_1st_display = view->input_buffer_pos;
- else
+ if (ptr_win->buffer == buffer)
{
- if ((view->input_buffer_1st_display > 0) &&
- (view->input_buffer_pos -
- view->input_buffer_1st_display + 1) < input_width)
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_input);
+
+ if (has_colors ())
{
- view->input_buffer_1st_display =
- view->input_buffer_pos - input_width + 1;
- if (view->input_buffer_1st_display < 0)
- view->input_buffer_1st_display = 0;
+ gui_window_set_color (ptr_win->win_input, COLOR_WIN_INPUT);
+ wborder (ptr_win->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_input);
}
- }
- }
- if (CHANNEL(view))
- {
- snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
- mvwprintw (view->window->win_input, 0, 0, format,
- CHANNEL(view)->name,
- SERVER(view)->nick,
- view->input_buffer + view->input_buffer_1st_display);
- wclrtoeol (view->window->win_input);
- move (LINES - 1, strlen (CHANNEL(view)->name) +
- strlen (SERVER(view)->nick) + 3 +
- (view->input_buffer_pos - view->input_buffer_1st_display));
- }
- else
- {
- if (SERVER(view))
- {
- snprintf (format, 32, "%%s> %%-%ds", input_width);
- if (SERVER(view) && (SERVER(view)->is_connected))
- ptr_nickname = SERVER(view)->nick;
+
+ if (buffer->input_buffer_size == 0)
+ buffer->input_buffer[0] = '\0';
+
+ input_width = gui_get_input_width (ptr_win);
+
+ if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
+ input_width)
+ buffer->input_buffer_1st_display = buffer->input_buffer_pos -
+ input_width + 1;
else
- ptr_nickname = cfg_look_no_nickname;
- mvwprintw (view->window->win_input, 0, 0, format,
- ptr_nickname,
- view->input_buffer + view->input_buffer_1st_display);
- wclrtoeol (view->window->win_input);
- move (LINES - 1, strlen (ptr_nickname) + 2 +
- (view->input_buffer_pos - view->input_buffer_1st_display));
- }
- else
- {
- snprintf (format, 32, "%%s> %%-%ds", input_width);
- if (SERVER(view) && (SERVER(view)->is_connected))
- ptr_nickname = SERVER(view)->nick;
+ {
+ if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
+ buffer->input_buffer_1st_display = buffer->input_buffer_pos;
+ else
+ {
+ if ((buffer->input_buffer_1st_display > 0) &&
+ (buffer->input_buffer_pos -
+ buffer->input_buffer_1st_display + 1) < input_width)
+ {
+ buffer->input_buffer_1st_display =
+ buffer->input_buffer_pos - input_width + 1;
+ if (buffer->input_buffer_1st_display < 0)
+ buffer->input_buffer_1st_display = 0;
+ }
+ }
+ }
+ if (CHANNEL(buffer))
+ {
+ snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
+ if (ptr_win == gui_current_window)
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ CHANNEL(buffer)->name,
+ SERVER(buffer)->nick,
+ buffer->input_buffer + buffer->input_buffer_1st_display);
+ else
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ CHANNEL(buffer)->name,
+ SERVER(buffer)->nick,
+ "");
+ wclrtoeol (ptr_win->win_input);
+ if (ptr_win == gui_current_window)
+ move (ptr_win->win_y + ptr_win->win_height - 1,
+ ptr_win->win_x + strlen (CHANNEL(buffer)->name) +
+ strlen (SERVER(buffer)->nick) + 3 +
+ (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
+ }
else
- ptr_nickname = cfg_look_no_nickname;
- mvwprintw (view->window->win_input, 0, 0, format,
- ptr_nickname,
- view->input_buffer + view->input_buffer_1st_display);
- wclrtoeol (view->window->win_input);
- move (LINES - 1, strlen (ptr_nickname) + 2 +
- (view->input_buffer_pos - view->input_buffer_1st_display));
+ {
+ if (SERVER(buffer))
+ {
+ snprintf (format, 32, "%%s> %%-%ds", input_width);
+ if (SERVER(buffer) && (SERVER(buffer)->is_connected))
+ ptr_nickname = SERVER(buffer)->nick;
+ else
+ ptr_nickname = cfg_look_no_nickname;
+ if (ptr_win == gui_current_window)
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ buffer->input_buffer + buffer->input_buffer_1st_display);
+ else
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ "");
+ wclrtoeol (ptr_win->win_input);
+ if (ptr_win == gui_current_window)
+ move (ptr_win->win_y + ptr_win->win_height - 1,
+ ptr_win->win_x + strlen (ptr_nickname) + 2 +
+ (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
+ }
+ else
+ {
+ snprintf (format, 32, "%%s> %%-%ds", input_width);
+ if (SERVER(buffer) && (SERVER(buffer)->is_connected))
+ ptr_nickname = SERVER(buffer)->nick;
+ else
+ ptr_nickname = cfg_look_no_nickname;
+ if (ptr_win == gui_current_window)
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ buffer->input_buffer + buffer->input_buffer_1st_display);
+ else
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ "");
+ wclrtoeol (ptr_win->win_input);
+ if (ptr_win == gui_current_window)
+ move (ptr_win->win_y + ptr_win->win_height - 1,
+ ptr_win->win_x + strlen (ptr_nickname) + 2 +
+ (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
+ }
+ }
+
+ wrefresh (ptr_win->win_input);
+ refresh ();
}
}
-
- wrefresh (view->window->win_input);
- refresh ();
}
/*
- * gui_redraw_view_input: redraw input window for a view
+ * gui_redraw_buffer: redraw a buffer
*/
void
-gui_redraw_view_input (t_gui_view *view)
+gui_redraw_buffer (t_gui_buffer *buffer)
{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
+ t_gui_window *ptr_win;
- gui_curses_window_clear (view->window->win_input);
- gui_draw_view_input (view);
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ {
+ if (ptr_win->buffer == buffer)
+ {
+ gui_draw_buffer_title (buffer, 1);
+ gui_draw_buffer_chat (buffer, 1);
+ if (ptr_win->win_nick)
+ gui_draw_buffer_nick (buffer, 1);
+ gui_draw_buffer_status (buffer, 1);
+ if (cfg_look_infobar)
+ gui_draw_buffer_infobar (buffer, 1);
+ gui_draw_buffer_input (buffer, 1);
+ }
+ }
}
/*
- * gui_redraw_view: redraw a view
+ * gui_switch_to_buffer: switch to another buffer
*/
void
-gui_redraw_view (t_gui_view *view)
+gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
+ if (gui_current_window->buffer->num_displayed > 0)
+ gui_current_window->buffer->num_displayed--;
- gui_redraw_view_title (view);
- gui_redraw_view_chat (view);
- if (view->window->win_nick)
- gui_redraw_view_nick (view);
- gui_redraw_view_status (view);
- if (cfg_look_infobar)
- gui_redraw_view_infobar (view);
- gui_redraw_view_input (view);
-}
-
-/*
- * gui_switch_to_view: switch to another view
- */
-
-void
-gui_switch_to_view (t_gui_view *view)
-{
- int another_view;
- t_gui_view *ptr_view;
+ window->buffer = buffer;
+ gui_calculate_pos_size (window);
- another_view = 0;
- /*for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ /* destroy Curses windows */
+ if (window->win_title)
{
- if (ptr_view->is_displayed)
- {*/
- /* TODO: manage splited windows */
- /*another_view = 1;
- view->window->win_title = ptr_view->window->win_title;
- view->window->win_chat = ptr_view->window->win_chat;
- view->window->win_nick = ptr_view->window->win_nick;
- view->window->win_status = ptr_view->window->win_status;
- view->window->win_infobar = ptr_view->window->win_infobar;
- view->window->win_input = ptr_view->window->win_input;
- if (ptr_view != view)
- {
- ptr_view->window->win_title = NULL;
- ptr_view->window->win_chat = NULL;
- ptr_view->window->win_nick = NULL;
- ptr_view->window->win_status = NULL;
- ptr_view->window->win_infobar = NULL;
- ptr_view->window->win_input = NULL;
- ptr_view->is_displayed = 0;
- }
- break;
- }
- }*/
-
- gui_calculate_pos_size (view);
-
- /* first time creation for views */
- if (!another_view)
+ delwin (window->win_title);
+ window->win_title = NULL;
+ }
+ if (window->win_nick)
{
- /* create new views */
- view->window->win_title = newwin (1, COLS, 0, 0);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- if (cfg_look_nicklist && CHANNEL(view))
- view->window->win_nick = newwin (view->window->win_nick_height,
- view->window->win_nick_width,
- view->window->win_nick_y,
- view->window->win_nick_x);
- else
- view->window->win_nick = NULL;
- view->window->win_input = newwin (1, COLS, LINES - 1, 0);
+ delwin (window->win_nick);
+ window->win_nick = NULL;
}
- else
+ if (window->win_status)
{
- /* remove some views */
- if (view->window->win_nick)
- {
- delwin (view->window->win_nick);
- view->window->win_nick = NULL;
- }
- if (view->window->win_status)
- {
- delwin (view->window->win_status);
- view->window->win_status = NULL;
- }
- if (view->window->win_infobar)
- {
- delwin (view->window->win_infobar);
- view->window->win_infobar = NULL;
- }
+ delwin (window->win_status);
+ window->win_status = NULL;
+ }
+ if (window->win_infobar)
+ {
+ delwin (window->win_infobar);
+ window->win_infobar = NULL;
+ }
+ if (window->win_input)
+ {
+ delwin (window->win_input);
+ window->win_input = NULL;
+ }
- /* create views */
- if (VIEW_IS_CHANNEL(view))
- {
- delwin (view->window->win_chat);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- if (cfg_look_nicklist)
- view->window->win_nick = newwin (view->window->win_nick_height,
- view->window->win_nick_width,
- view->window->win_nick_y,
- view->window->win_nick_x);
- else
- view->window->win_nick = NULL;
- }
- if (!(VIEW_IS_CHANNEL(view)))
- {
- delwin (view->window->win_chat);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- }
+ /* create Curses windows */
+ window->win_title = newwin (1,
+ window->win_width,
+ window->win_y,
+ window->win_x);
+ window->win_input = newwin (1,
+ window->win_width,
+ window->win_y + window->win_height - 1,
+ window->win_x);
+ if (BUFFER_IS_CHANNEL(buffer))
+ {
+ if (window->win_chat)
+ delwin (window->win_chat);
+ window->win_chat = newwin (window->win_chat_height,
+ window->win_chat_width,
+ window->win_chat_y,
+ window->win_chat_x);
+ if (cfg_look_nicklist)
+ window->win_nick = newwin (window->win_nick_height,
+ window->win_nick_width,
+ window->win_nick_y,
+ window->win_nick_x);
+ else
+ window->win_nick = NULL;
+ }
+ if (!(BUFFER_IS_CHANNEL(buffer)))
+ {
+ if (window->win_chat)
+ delwin (window->win_chat);
+ window->win_chat = newwin (window->win_chat_height,
+ window->win_chat_width,
+ window->win_chat_y,
+ window->win_chat_x);
}
/* create status/infobar windows */
if (cfg_look_infobar)
{
- view->window->win_infobar = newwin (1, COLS, LINES - 2, 0);
- view->window->win_status = newwin (1, COLS, LINES - 3, 0);
+ window->win_infobar = newwin (1, window->win_width, window->win_y + window->win_height - 2, window->win_x);
+ window->win_status = newwin (1, window->win_width, window->win_y + window->win_height - 3, window->win_x);
}
else
- view->window->win_status = newwin (1, COLS, LINES - 2, 0);
-
- /* change current view to the new view */
- gui_current_view = view;
+ window->win_status = newwin (1, window->win_width, window->win_y + window->win_height - 2, window->win_x);
- view->is_displayed = 1;
- view->unread_data = 0;
+ buffer->num_displayed++;
+ buffer->unread_data = 0;
}
/*
- * gui_switch_to_previous_view: switch to previous view
+ * gui_switch_to_previous_buffer: switch to previous buffer
*/
void
-gui_switch_to_previous_view ()
+gui_switch_to_previous_buffer (t_gui_window *window)
{
- /* if only one view then return */
- if (gui_views == last_gui_view)
+ /* if only one buffer then return */
+ if (gui_buffers == last_gui_buffer)
return;
- if (gui_current_view->prev_view)
- gui_switch_to_view (gui_current_view->prev_view);
+ if (window->buffer->prev_buffer)
+ gui_switch_to_buffer (window, window->buffer->prev_buffer);
else
- gui_switch_to_view (last_gui_view);
- gui_redraw_view (gui_current_view);
+ gui_switch_to_buffer (window, last_gui_buffer);
+
+ gui_redraw_buffer (window->buffer);
}
/*
- * gui_switch_to_next_view: switch to next view
+ * gui_switch_to_next_buffer: switch to next buffer
*/
void
-gui_switch_to_next_view ()
+gui_switch_to_next_buffer (t_gui_window *window)
{
- /* if only one view then return */
- if (gui_views == last_gui_view)
+ /* if only one buffer then return */
+ if (gui_buffers == last_gui_buffer)
return;
- if (gui_current_view->next_view)
- gui_switch_to_view (gui_current_view->next_view);
+ if (window->buffer->next_buffer)
+ gui_switch_to_buffer (window, window->buffer->next_buffer);
else
- gui_switch_to_view (gui_views);
- gui_redraw_view (gui_current_view);
+ gui_switch_to_buffer (window, gui_buffers);
+
+ gui_redraw_buffer (window->buffer);
}
/*
- * gui_move_page_up: display previous page on view
+ * gui_switch_to_next_window: switch to next window
*/
void
-gui_move_page_up ()
+gui_switch_to_next_window (t_gui_window *window)
{
- if (!gui_current_view->first_line_displayed)
+ /* if only one window then return */
+ if (gui_windows == last_gui_window)
+ return;
+
+ gui_current_window = (window->next_window) ? window->next_window : gui_windows;
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
+}
+
+/*
+ * gui_move_page_up: display previous page on buffer
+ */
+
+void
+gui_move_page_up (t_gui_window *window)
+{
+ if (!window->first_line_displayed)
{
- gui_current_view->sub_lines += gui_current_view->window->win_chat_height - 1;
- gui_draw_view_chat (gui_current_view);
- gui_draw_view_status (gui_current_view);
+ window->sub_lines += window->win_chat_height - 1;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
}
}
/*
- * gui_move_page_down: display next page on view
+ * gui_move_page_down: display next page on buffer
*/
void
-gui_move_page_down ()
+gui_move_page_down (t_gui_window *window)
{
- if (gui_current_view->sub_lines > 0)
+ if (window->sub_lines > 0)
{
- gui_current_view->sub_lines -= gui_current_view->window->win_chat_height - 1;
- if (gui_current_view->sub_lines < 0)
- gui_current_view->sub_lines = 0;
- if (gui_current_view->sub_lines == 0)
- gui_current_view->unread_data = 0;
- gui_draw_view_chat (gui_current_view);
- gui_draw_view_status (gui_current_view);
+ window->sub_lines -= window->win_chat_height - 1;
+ if (window->sub_lines < 0)
+ window->sub_lines = 0;
+ if (window->sub_lines == 0)
+ window->buffer->unread_data = 0;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
}
}
@@ -1384,41 +1333,32 @@ gui_move_page_down ()
void
gui_curses_resize_handler ()
{
- t_gui_view *ptr_view;
- int width, height;
+ t_gui_window *ptr_win, *old_current_window;
+ int old_width, old_height;
+ int new_width, new_height;
+
+ getmaxyx (stdscr, old_height, old_width);
endwin ();
refresh ();
- getmaxyx (stdscr, height, width);
+ getmaxyx (stdscr, new_height, new_width);
+
+ old_current_window = gui_current_window;
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ /* TODO: manage when some windows are outside new term size */
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- // TODO: manage splited windows!
- if (ptr_view->window->win_title)
- {
- ptr_view->is_displayed = 0;
- if (ptr_view->window->win_title)
- delwin (ptr_view->window->win_title);
- if (ptr_view->window->win_chat)
- delwin (ptr_view->window->win_chat);
- if (ptr_view->window->win_nick)
- delwin (ptr_view->window->win_nick);
- if (ptr_view->window->win_status)
- delwin (ptr_view->window->win_status);
- if (ptr_view->window->win_infobar)
- delwin (ptr_view->window->win_infobar);
- if (ptr_view->window->win_input)
- delwin (ptr_view->window->win_input);
- ptr_view->window->win_title = NULL;
- ptr_view->window->win_chat = NULL;
- ptr_view->window->win_nick = NULL;
- ptr_view->window->win_status = NULL;
- ptr_view->window->win_infobar = NULL;
- ptr_view->window->win_input = NULL;
- gui_switch_to_view (ptr_view);
- }
+ wee_log_printf ("win_x = %d, win_width = %d, old_width = %d\n", ptr_win->win_x, ptr_win->win_width, old_width);
+ if (ptr_win->win_x + ptr_win->win_width == old_width)
+ ptr_win->win_width = new_width - ptr_win->win_x;
+ if (ptr_win->win_y + ptr_win->win_height == old_height)
+ ptr_win->win_height = new_height - ptr_win->win_y;
+ gui_switch_to_buffer (ptr_win, ptr_win->buffer);
}
+
+ gui_current_window = old_current_window;
+ gui_draw_buffer_input (gui_current_window->buffer, 1);
}
/*
@@ -1426,14 +1366,83 @@ gui_curses_resize_handler ()
*/
void
-gui_view_init_subviews (t_gui_view *view)
+gui_window_init_subwindows (t_gui_window *window)
+{
+ window->win_title = NULL;
+ window->win_chat = NULL;
+ window->win_nick = NULL;
+ window->win_status = NULL;
+ window->win_infobar = NULL;
+ window->win_input = NULL;
+}
+
+/*
+ * gui_window_split_horiz: split a window horizontally
+ */
+
+void
+gui_window_split_horiz (t_gui_window *window)
+{
+ t_gui_window *new_window;
+ int height1, height2;
+
+ height1 = window->win_height / 2;
+ height2 = window->win_height - height1;
+ if ((new_window = gui_window_new (window->win_x, window->win_y,
+ window->win_width, height1)))
+ {
+ /* reduce old window height (bottom window) */
+ window->win_y = new_window->win_y + new_window->win_height;
+ window->win_height = height2;
+
+ /* assign same buffer for new window (top window) */
+ new_window->buffer = window->buffer;
+
+ gui_switch_to_buffer (window, window->buffer);
+
+ gui_current_window = new_window;
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
+ }
+}
+
+/*
+ * gui_window_split_vertic: split a window vertically
+ */
+
+void
+gui_window_split_vertic (t_gui_window *window)
{
- view->window->win_title = NULL;
- view->window->win_chat = NULL;
- view->window->win_nick = NULL;
- view->window->win_status = NULL;
- view->window->win_infobar = NULL;
- view->window->win_input = NULL;
+ t_gui_window *new_window;
+ int width1, width2;
+
+ width1 = window->win_width / 2;
+ width2 = window->win_width - width1 - 1;
+ if ((new_window = gui_window_new (window->win_x + width1 + 1, window->win_y,
+ width2, window->win_height)))
+ {
+ /* reduce old window height (left window) */
+ window->win_width = width1;
+
+ /* assign same buffer for new window (right window) */
+ new_window->buffer = window->buffer;
+
+ gui_switch_to_buffer (window, window->buffer);
+
+ gui_current_window = new_window;
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
+
+ /* create & draw separator if window is not on the left */
+ gui_current_window->win_separator = newwin (gui_current_window->win_height,
+ 1,
+ gui_current_window->win_y,
+ gui_current_window->win_x - 1);
+ gui_window_set_color (gui_current_window->win_separator, COLOR_WIN_TITLE);
+ wborder (gui_current_window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (gui_current_window->win_separator);
+ refresh ();
+ }
}
/*
@@ -1592,10 +1601,11 @@ gui_init ()
gui_infobar = NULL;
- /* create a new view */
- if ((gui_windows = gui_window_new (0, 0, COLS, LINES)))
+ /* create a new buffer */
+ if (gui_window_new (0, 0, COLS, LINES))
{
- gui_current_view = gui_view_new (gui_windows, NULL, NULL, 1 /*0, 0, COLS, LINES*/);
+ gui_current_window = gui_windows;
+ gui_buffer_new (gui_windows, NULL, NULL, 1);
signal (SIGWINCH, gui_curses_resize_handler);
@@ -1613,23 +1623,23 @@ gui_init ()
void
gui_end ()
{
- t_gui_view *ptr_view;
+ t_gui_window *ptr_win;
- /* delete all views */
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ /* delete all windows */
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- if (ptr_view->window->win_title)
- delwin (ptr_view->window->win_title);
- if (ptr_view->window->win_chat)
- delwin (ptr_view->window->win_chat);
- if (ptr_view->window->win_nick)
- delwin (ptr_view->window->win_nick);
- if (ptr_view->window->win_status)
- delwin (ptr_view->window->win_status);
- if (ptr_view->window->win_infobar)
- delwin (ptr_view->window->win_infobar);
- if (ptr_view->window->win_input)
- delwin (ptr_view->window->win_input);
+ if (ptr_win->win_title)
+ delwin (ptr_win->win_title);
+ if (ptr_win->win_chat)
+ delwin (ptr_win->win_chat);
+ if (ptr_win->win_nick)
+ delwin (ptr_win->win_nick);
+ if (ptr_win->win_status)
+ delwin (ptr_win->win_status);
+ if (ptr_win->win_infobar)
+ delwin (ptr_win->win_infobar);
+ if (ptr_win->win_input)
+ delwin (ptr_win->win_input);
/* TODO: free input buffer, lines, messages, completion */
}
@@ -1639,99 +1649,99 @@ gui_end ()
}
/*
- * gui_add_message: add a message to a view
+ * gui_add_message: add a message to a buffer
*/
void
-gui_add_message (t_gui_view *view, int type, int color, char *message)
+gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
{
char *pos;
int length;
/* create new line if previous was ending by '\n' (or if 1st line) */
- if (view->line_complete)
+ if (buffer->line_complete)
{
- view->line_complete = 0;
- if (!gui_new_line (view))
+ buffer->line_complete = 0;
+ if (!gui_new_line (buffer))
return;
}
- if (!gui_new_message (view))
+ if (!gui_new_message (buffer))
return;
- view->last_line->last_message->type = type;
- view->last_line->last_message->color = color;
+ buffer->last_line->last_message->type = type;
+ buffer->last_line->last_message->color = color;
pos = strchr (message, '\n');
if (pos)
{
pos[0] = '\0';
- view->line_complete = 1;
+ buffer->line_complete = 1;
}
- view->last_line->last_message->message = strdup (message);
+ buffer->last_line->last_message->message = strdup (message);
length = strlen (message);
- view->last_line->length += length;
+ buffer->last_line->length += length;
if (type == MSG_TYPE_MSG)
- view->last_line->line_with_message = 1;
+ buffer->last_line->line_with_message = 1;
if ((type == MSG_TYPE_TIME) || (type == MSG_TYPE_NICK))
- view->last_line->length_align += length;
+ buffer->last_line->length_align += length;
if (pos)
{
pos[0] = '\n';
- if ((view == gui_current_view) && (view->sub_lines == 0))
+ if ((buffer->num_displayed > 0) && (gui_current_window->sub_lines == 0))
{
- if ((view->window->win_chat_cursor_y
- + gui_get_line_num_splits (view, view->last_line)) >
- (view->window->win_chat_height - 1))
- gui_draw_view_chat (view);
- else
- gui_display_line (view, view->last_line, 1);
+ /*if ((buffer->window->win_chat_cursor_y
+ + gui_get_line_num_splits (buffer, buffer->last_line)) >
+ (buffer->window->win_chat_height - 1))*/
+ gui_draw_buffer_chat (buffer, 0);
+ /*else
+ gui_display_line (buffer, buffer->last_line, 1);*/
}
- if ((view != gui_current_view) || (view->sub_lines > 0))
+ if ((buffer->num_displayed == 0) || (gui_current_window->sub_lines > 0))
{
- if (view->unread_data < 1 + view->last_line->line_with_message)
+ if (buffer->unread_data < 1 + buffer->last_line->line_with_message)
{
- view->unread_data = 1 + view->last_line->line_with_message;
- gui_redraw_view_status (gui_current_view);
+ buffer->unread_data = 1 + buffer->last_line->line_with_message;
+ gui_draw_buffer_status (buffer, 1);
}
}
}
}
/*
- * gui_printf_color_type: display a message in a view
+ * gui_printf_color_type: display a message in a buffer
*/
void
-gui_printf_color_type (t_gui_view *view, int type, int color, char *message, ...)
+gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message, ...)
{
- static char buffer[8192];
+ static char buf[8192];
char timestamp[16];
char *pos;
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
-
+
if (gui_ready)
{
if (color == -1)
color = COLOR_WIN_CHAT;
- if (view == NULL)
+ if (buffer == NULL)
{
- if (SERVER(gui_current_view))
- view = SERVER(gui_current_view)->view;
+ if (SERVER(gui_current_window->buffer))
+ buffer = SERVER(gui_current_window->buffer)->buffer;
else
- view = gui_current_view;
+ buffer = gui_current_window->buffer;
}
- if (view == NULL)
+ if (buffer == NULL)
{
- wee_log_printf ("gui_printf without view! this is a bug, please send to developers - thanks\n");
+ wee_log_printf ("gui_printf without buffer! this is a bug, please send to developers - thanks\n");
return;
}
}
va_start (argptr, message);
- vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
+ vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
if (gui_ready)
@@ -1739,32 +1749,32 @@ gui_printf_color_type (t_gui_view *view, int type, int color, char *message, ...
seconds = time (NULL);
date_tmp = localtime (&seconds);
- pos = buffer - 1;
+ pos = buf - 1;
while (pos)
{
/* TODO: read timestamp format from config! */
- if ((!view->last_line) || (view->line_complete))
+ if ((!buffer->last_line) || (buffer->line_complete))
{
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
snprintf (timestamp, 16, "%02d", date_tmp->tm_hour);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
snprintf (timestamp, 16, "%02d", date_tmp->tm_min);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
snprintf (timestamp, 16, "%02d", date_tmp->tm_sec);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
- gui_add_message (view, type, color, pos + 1);
+ gui_add_message (buffer, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
- wrefresh (view->window->win_chat);
- refresh ();
+ /*wrefresh (buffer->window->win_chat);
+ refresh ();*/
}
else
- printf ("%s", buffer);
+ printf ("%s", buf);
}
diff --git a/src/gui/curses/gui-input.c b/src/gui/curses/gui-input.c
index be601dfa8..3e98619a1 100644
--- a/src/gui/curses/gui-input.c
+++ b/src/gui/curses/gui-input.c
@@ -49,7 +49,7 @@ void
gui_read_keyb ()
{
int key, i;
- t_gui_view *ptr_view;
+ t_gui_buffer *ptr_buffer;
char new_char[2];
key = getch ();
@@ -59,16 +59,20 @@ gui_read_keyb ()
{
/* resize event */
case KEY_RESIZE:
- gui_calculate_pos_size (gui_current_view);
- gui_redraw_view (gui_current_view);
+ gui_calculate_pos_size (gui_current_window);
+ gui_redraw_buffer (gui_current_window->buffer);
break;
- /* previous view */
+ /* previous buffer in window */
case KEY_F(6):
- gui_switch_to_previous_view ();
+ gui_switch_to_previous_buffer (gui_current_window);
break;
- /* next view */
+ /* next buffer in window */
case KEY_F(7):
- gui_switch_to_next_view ();
+ gui_switch_to_next_buffer (gui_current_window);
+ break;
+ /* next window */
+ case KEY_F(8):
+ gui_switch_to_next_window (gui_current_window);
break;
/* remove last infobar message */
case KEY_F(10):
@@ -76,205 +80,208 @@ gui_read_keyb ()
break;
/* cursor up */
case KEY_UP:
- if (gui_current_view->ptr_history)
+ if (gui_current_window->buffer->ptr_history)
{
- gui_current_view->ptr_history =
- gui_current_view->ptr_history->next_history;
- if (!gui_current_view->ptr_history)
- gui_current_view->ptr_history =
- gui_current_view->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_view->ptr_history =
- gui_current_view->history;
- if (gui_current_view->ptr_history)
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->history;
+ if (gui_current_window->buffer->ptr_history)
{
- gui_current_view->input_buffer_size =
- strlen (gui_current_view->ptr_history->text);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
- strcpy (gui_current_view->input_buffer,
- gui_current_view->ptr_history->text);
- gui_draw_view_input (gui_current_view);
+ 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_view->ptr_history)
+ if (gui_current_window->buffer->ptr_history)
{
- gui_current_view->ptr_history =
- gui_current_view->ptr_history->prev_history;
- if (gui_current_view->ptr_history)
- gui_current_view->input_buffer_size =
- strlen (gui_current_view->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_view->input_buffer_size = 0;
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
- if (gui_current_view->ptr_history)
- strcpy (gui_current_view->input_buffer,
- gui_current_view->ptr_history->text);
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos > 0)
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- gui_current_view->input_buffer_pos--;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos <
- gui_current_view->input_buffer_size)
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- gui_current_view->input_buffer_pos++;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos > 0)
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- gui_current_view->input_buffer_pos = 0;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos <
- gui_current_view->input_buffer_size)
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos > 0)
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- i = gui_current_view->input_buffer_pos-1;
- while (gui_current_view->input_buffer[i])
+ i = gui_current_window->buffer->input_buffer_pos-1;
+ while (gui_current_window->buffer->input_buffer[i])
{
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i+1];
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
i++;
}
- gui_current_view->input_buffer_size--;
- gui_current_view->input_buffer_pos--;
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- gui_draw_view_input (gui_current_view);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->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_view->input_buffer_pos <
- gui_current_view->input_buffer_size)
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- i = gui_current_view->input_buffer_pos;
- while (gui_current_view->input_buffer[i])
+ i = gui_current_window->buffer->input_buffer_pos;
+ while (gui_current_window->buffer->input_buffer[i])
{
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i+1];
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
i++;
}
- gui_current_view->input_buffer_size--;
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- gui_draw_view_input (gui_current_view);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->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_view->completion),
- CHANNEL(gui_current_view),
- gui_current_view->input_buffer,
- gui_current_view->input_buffer_size,
- gui_current_view->input_buffer_pos);
- if (gui_current_view->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_view->input_buffer_size +=
- gui_current_view->completion.diff_size;
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer[gui_current_view->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_view->completion.diff_size > 0)
+ if (gui_current_window->buffer->completion.diff_size > 0)
{
- for (i = gui_current_view->input_buffer_size - 1;
- i >= gui_current_view->completion.position_replace +
- (int)strlen (gui_current_view->completion.word_found); i--)
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i -
- gui_current_view->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_view->completion.position_replace +
- strlen (gui_current_view->completion.word_found);
- i < gui_current_view->input_buffer_size; i++)
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i -
- gui_current_view->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_view->input_buffer + gui_current_view->completion.position_replace,
- gui_current_view->completion.word_found,
- strlen (gui_current_view->completion.word_found));
- gui_current_view->input_buffer_pos =
- gui_current_view->completion.position_replace +
- strlen (gui_current_view->completion.word_found);
- gui_current_view->completion.position =
- gui_current_view->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_view->completion.base_word[0] == '/')
+ if (gui_current_window->buffer->completion.base_word[0] == '/')
{
- if (gui_current_view->input_buffer[gui_current_view->input_buffer_pos] != ' ')
- gui_buffer_insert_string (" ",
- gui_current_view->input_buffer_pos);
- gui_current_view->completion.position++;
- gui_current_view->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_view->completion.base_word_pos == 0)
+ if (gui_current_window->buffer->completion.base_word_pos == 0)
{
- if (strncmp (gui_current_view->input_buffer + gui_current_view->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_view->input_buffer_pos);
- gui_current_view->completion.position += strlen (cfg_look_completor);
- gui_current_view->input_buffer_pos += strlen (cfg_look_completor);
- if (gui_current_view->input_buffer[gui_current_view->input_buffer_pos] != ' ')
- gui_buffer_insert_string (" ",
- gui_current_view->input_buffer_pos);
- gui_current_view->completion.position++;
- gui_current_view->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_view_input (gui_current_view);
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
}
break;
/* escape code (for control-key) */
@@ -284,10 +291,10 @@ gui_read_keyb ()
switch (key)
{
case KEY_LEFT:
- gui_switch_to_previous_view ();
+ gui_switch_to_previous_buffer (gui_current_window);
break;
case KEY_RIGHT:
- gui_switch_to_next_view ();
+ gui_switch_to_next_buffer (gui_current_window);
break;
case 79:
/* TODO: replace 79 by constant name! */
@@ -299,11 +306,11 @@ 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;
}
}
@@ -314,35 +321,36 @@ gui_read_keyb ()
break;
/* send command/message */
case '\n':
- if (gui_current_view->input_buffer_size > 0)
+ if (gui_current_window->buffer->input_buffer_size > 0)
{
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- history_add (gui_current_view, gui_current_view->input_buffer);
- gui_current_view->input_buffer_size = 0;
- gui_current_view->input_buffer_pos = 0;
- gui_current_view->input_buffer_1st_display = 0;
- gui_current_view->completion.position = -1;
- gui_current_view->ptr_history = NULL;
- ptr_view = gui_current_view;
- user_command (SERVER(gui_current_view),
- gui_current_view->input_buffer);
- if (ptr_view == gui_current_view)
- gui_draw_view_input (ptr_view);
- if (ptr_view)
- ptr_view->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_view,
+ /*gui_printf (gui_current_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_view->input_buffer_pos);
- gui_current_view->input_buffer_pos++;
- gui_draw_view_input (gui_current_view);
- gui_current_view->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;
}
}
@@ -374,14 +382,13 @@ gui_main_loop ()
if (local_time->tm_min != old_min)
{
old_min = local_time->tm_min;
- gui_redraw_view_infobar (gui_current_view);
+ 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 splited windows! */
if (gui_infobar && gui_infobar->remaining_time > 0)
{
gui_infobar->remaining_time--;
diff --git a/src/gui/gui-common.c b/src/gui/gui-common.c
index ce7d53d94..19fa076e0 100644
--- a/src/gui/gui-common.c
+++ b/src/gui/gui-common.c
@@ -41,10 +41,11 @@
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_view *gui_views = NULL; /* pointer to first view */
-t_gui_view *last_gui_view = NULL; /* pointer to last view */
-t_gui_view *gui_current_view = NULL; /* pointer to current view */
+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 */
@@ -55,186 +56,217 @@ t_gui_infobar *gui_infobar; /* pointer to infobar content */
t_gui_window *
gui_window_new (int x, int y, int width, int height)
{
- t_gui_window *window;
+ t_gui_window *new_window;
- if ((window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
+ #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)))))
{
- window->win_x = x;
- window->win_y = y;
- window->win_width = width;
- window->win_height = height;
+ new_window->win_x = x;
+ new_window->win_y = y;
+ new_window->win_width = width;
+ new_window->win_height = height;
- window->win_chat_x = 0;
- window->win_chat_y = 0;
- window->win_chat_width = 0;
- window->win_chat_height = 0;
- window->win_chat_cursor_x = 0;
- window->win_chat_cursor_y = 0;
+ 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;
- window->win_nick_x = 0;
- window->win_nick_y = 0;
- window->win_nick_width = 0;
- window->win_nick_height = 0;
+ new_window->win_nick_x = 0;
+ new_window->win_nick_y = 0;
+ new_window->win_nick_width = 0;
+ new_window->win_nick_height = 0;
- window->win_title = NULL;
- window->win_chat = NULL;
- window->win_nick = NULL;
- window->win_status = NULL;
- window->win_infobar = NULL;
- window->win_input = NULL;
- window->textview_chat = NULL;
- window->textbuffer_chat = NULL;
- window->texttag_chat = NULL;
- window->textview_nicklist = NULL;
- window->textbuffer_nicklist = NULL;
+ 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;
+
+ 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;
+
+ /* add window to windows queue */
+ new_window->prev_window = last_gui_window;
+ if (gui_windows)
+ last_gui_window->next_window = new_window;
+ else
+ gui_windows = new_window;
+ last_gui_window = new_window;
+ new_window->next_window = NULL;
}
else
return NULL;
- return window;
+ return new_window;
}
/*
- * gui_view_new: create a new view in current window
+ * gui_buffer_new: create a new buffer in current window
*/
-t_gui_view *
-gui_view_new (t_gui_window *window, void *server, void *channel, int switch_to_view)
+t_gui_buffer *
+gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to_buffer)
{
- t_gui_view *new_view;
+ t_gui_buffer *new_buffer;
- if (gui_views)
+ #ifdef DEBUG
+ wee_log_printf ("creating new buffer\n");
+ #endif
+ if (gui_buffers)
{
- /* use first view if no server was assigned to this view */
- if (!SERVER(gui_views))
+ /* use first buffer if no server was assigned to this buffer */
+ if (!SERVER(gui_buffers))
{
if (server)
- ((t_irc_server *)(server))->view = gui_views;
+ ((t_irc_server *)(server))->buffer = gui_buffers;
if (channel)
- ((t_irc_channel *)(channel))->view = gui_views;
- SERVER(gui_views) = server;
- CHANNEL(gui_views) = channel;
- return gui_views;
+ ((t_irc_channel *)(channel))->buffer = gui_buffers;
+ SERVER(gui_buffers) = server;
+ CHANNEL(gui_buffers) = channel;
+ return gui_buffers;
}
}
- if ((new_view = (t_gui_view *)(malloc (sizeof (t_gui_view)))))
+ if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
{
- new_view->is_displayed = 0;
+ new_buffer->num_displayed = 0;
- /* assign server and channel to view */
- SERVER(new_view) = server;
- CHANNEL(new_view) = channel;
- /* assign view to server and channel */
+ /* 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_view)->view = new_view;
+ SERVER(new_buffer)->buffer = new_buffer;
if (channel)
- CHANNEL(new_view)->view = new_view;
+ CHANNEL(new_buffer)->buffer = new_buffer;
- new_view->window = window;
+ if (!window->buffer)
+ window->buffer = new_buffer;
+ window->first_line_displayed = 1;
+ window->sub_lines = 0;
- gui_calculate_pos_size (new_view);
+ gui_calculate_pos_size (window);
- /* init views */
- gui_view_init_subviews(new_view);
+ /* init buffers */
+ gui_window_init_subwindows (window);
/* init lines */
- new_view->lines = NULL;
- new_view->last_line = NULL;
- new_view->num_lines = 0;
- new_view->first_line_displayed = 1;
- new_view->sub_lines = 0;
- new_view->line_complete = 1;
- new_view->unread_data = 0;
+ new_buffer->lines = NULL;
+ new_buffer->last_line = NULL;
+ new_buffer->num_lines = 0;
+ new_buffer->line_complete = 1;
+ new_buffer->unread_data = 0;
/* init input buffer */
- new_view->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
- new_view->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
- new_view->input_buffer[0] = '\0';
- new_view->input_buffer_size = 0;
- new_view->input_buffer_pos = 0;
- new_view->input_buffer_1st_display = 0;
+ 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_view->completion));
+ completion_init (&(new_buffer->completion));
/* init history */
- new_view->history = NULL;
- new_view->last_history = NULL;
- new_view->ptr_history = NULL;
- new_view->num_history = 0;
-
- /* switch to new view */
- if (switch_to_view)
- gui_switch_to_view (new_view);
+ new_buffer->history = NULL;
+ new_buffer->last_history = NULL;
+ new_buffer->ptr_history = NULL;
+ new_buffer->num_history = 0;
- /* add view to views queue */
- new_view->prev_view = last_gui_view;
- if (gui_views)
- last_gui_view->next_view = new_view;
+ /* add buffer to buffers queue */
+ new_buffer->prev_buffer = last_gui_buffer;
+ if (gui_buffers)
+ last_gui_buffer->next_buffer = new_buffer;
else
- gui_views = new_view;
- last_gui_view = new_view;
- new_view->next_view = NULL;
+ 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 whole screen */
- /* TODO: manage splited windows */
- gui_redraw_view (gui_current_view);
+ /* redraw buffer */
+ gui_redraw_buffer (new_buffer);
}
else
return NULL;
- return new_view;
+ return new_buffer;
}
/*
- * gui_view_clear: clear view content
+ * gui_buffer_clear: clear buffer content
*/
void
-gui_view_clear (t_gui_view *view)
+gui_buffer_clear (t_gui_buffer *buffer)
{
+ t_gui_window *ptr_win;
t_gui_line *ptr_line;
t_gui_message *ptr_message;
- while (view->lines)
+ while (buffer->lines)
{
- ptr_line = view->lines->next_line;
- while (view->lines->messages)
+ ptr_line = buffer->lines->next_line;
+ while (buffer->lines->messages)
{
- ptr_message = view->lines->messages->next_message;
- if (view->lines->messages->message)
- free (view->lines->messages->message);
- free (view->lines->messages);
- view->lines->messages = ptr_message;
+ 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 (view->lines);
- view->lines = ptr_line;
+ free (buffer->lines);
+ buffer->lines = ptr_line;
}
- view->lines = NULL;
- view->last_line = NULL;
- view->num_lines = 0;
- view->first_line_displayed = 1;
- view->sub_lines = 0;
- view->line_complete = 1;
- view->unread_data = 0;
+ buffer->lines = NULL;
+ buffer->last_line = NULL;
+ buffer->num_lines = 0;
+ buffer->line_complete = 1;
+ buffer->unread_data = 0;
- if (view == gui_current_view)
- gui_redraw_view_chat (view);
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ {
+ 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_view_clear_all: clear all views content
+ * gui_buffer_clear_all: clear all buffers content
*/
void
-gui_view_clear_all ()
+gui_buffer_clear_all ()
{
- t_gui_view *ptr_view;
+ t_gui_buffer *ptr_buffer;
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
- gui_view_clear (ptr_view);
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ gui_buffer_clear (ptr_buffer);
}
/*
@@ -264,8 +296,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 splited windows! */
- gui_redraw_view_infobar (gui_current_view);
+ gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
else
wee_log_printf (_("%s not enough memory for infobar message\n"),
@@ -288,13 +319,12 @@ gui_infobar_remove ()
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
- /* TODO: manage splited windows! */
- gui_redraw_view_infobar (gui_current_view);
+ gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
}
/*
- * gui_line_free: delete a line from a view
+ * gui_line_free: delete a line from a buffer
*/
void
@@ -314,57 +344,60 @@ gui_line_free (t_gui_line *line)
}
/*
- * gui_view_free: delete a view
+ * gui_buffer_free: delete a buffer
*/
void
-gui_view_free (t_gui_view *view)
+gui_buffer_free (t_gui_buffer *buffer)
{
+ t_gui_window *ptr_win;
t_gui_line *ptr_line;
int create_new;
- create_new = (view->server || view->channel);
+ create_new = (buffer->server || buffer->channel);
- /* TODO: manage splited windows! */
- if ((view == gui_current_view) &&
- ((view->next_view) || (view->prev_view)))
- gui_switch_to_previous_view ();
+ 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);
+ }
/* free lines and messages */
- while (view->lines)
+ while (buffer->lines)
{
- ptr_line = view->lines->next_line;
- gui_line_free (view->lines);
- view->lines = ptr_line;
+ ptr_line = buffer->lines->next_line;
+ gui_line_free (buffer->lines);
+ buffer->lines = ptr_line;
}
- if (view->input_buffer)
- free (view->input_buffer);
-
- completion_free (&(view->completion));
-
- /* remove view from views list */
- if (view->prev_view)
- view->prev_view->next_view = view->next_view;
- if (view->next_view)
- view->next_view->prev_view = view->prev_view;
- if (gui_views == view)
- gui_views = view->next_view;
- if (last_gui_view == view)
- last_gui_view = view->prev_view;
-
- free (view);
-
- /* always at least one view */
- if (!gui_views && create_new)
- (void) gui_view_new (gui_windows, NULL, NULL, 1);
+ 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)
+ (void) gui_buffer_new (gui_windows, NULL, NULL, 1);
}
/*
- * gui_new_line: create new line for a view
+ * gui_new_line: create new line for a buffer
*/
t_gui_line *
-gui_new_line (t_gui_view *view)
+gui_new_line (t_gui_buffer *buffer)
{
t_gui_line *new_line, *ptr_line;
@@ -375,14 +408,14 @@ gui_new_line (t_gui_view *view)
new_line->line_with_message = 0;
new_line->messages = NULL;
new_line->last_message = NULL;
- if (!view->lines)
- view->lines = new_line;
+ if (!buffer->lines)
+ buffer->lines = new_line;
else
- view->last_line->next_line = new_line;
- new_line->prev_line = view->last_line;
+ buffer->last_line->next_line = new_line;
+ new_line->prev_line = buffer->last_line;
new_line->next_line = NULL;
- view->last_line = new_line;
- view->num_lines++;
+ buffer->last_line = new_line;
+ buffer->num_lines++;
}
else
{
@@ -392,40 +425,40 @@ gui_new_line (t_gui_view *view)
/* remove one line if necessary */
if ((cfg_history_max_lines > 0)
- && (view->num_lines > cfg_history_max_lines))
+ && (buffer->num_lines > cfg_history_max_lines))
{
- if (view->last_line == view->lines)
- view->last_line = NULL;
- ptr_line = view->lines->next_line;
- gui_line_free (view->lines);
- view->lines = ptr_line;
+ 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;
- view->num_lines--;
- if (view->first_line_displayed)
- gui_redraw_view_chat (view);
+ 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 a view
+ * gui_new_message: create a new message for last line of a buffer
*/
t_gui_message *
-gui_new_message (t_gui_view *view)
+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 (!view->last_line->messages)
- view->last_line->messages = new_message;
+ if (!buffer->last_line->messages)
+ buffer->last_line->messages = new_message;
else
- view->last_line->last_message->next_message = new_message;
- new_message->prev_message = view->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;
- view->last_line->last_message = new_message;
+ buffer->last_line->last_message = new_message;
}
else
{
@@ -441,16 +474,16 @@ gui_new_message (t_gui_view *view)
*/
void
-gui_optimize_input_buffer_size (t_gui_view *view)
+gui_optimize_input_buffer_size (t_gui_buffer *buffer)
{
int optimal_size;
- optimal_size = ((view->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 (view->input_buffer_alloc != optimal_size)
+ if (buffer->input_buffer_alloc != optimal_size)
{
- view->input_buffer_alloc = optimal_size;
- view->input_buffer = realloc (view->input_buffer, optimal_size);
+ buffer->input_buffer_alloc = optimal_size;
+ buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
}
}
@@ -459,25 +492,25 @@ gui_optimize_input_buffer_size (t_gui_view *view)
*/
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_view->input_buffer_pos > 0)
+ if (buffer->input_buffer_pos > 0)
{
- i = gui_current_view->input_buffer_pos - 1;
+ i = buffer->input_buffer_pos - 1;
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] == ' '))
+ (buffer->input_buffer[i] == ' '))
i--;
if (i >= 0)
{
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] != ' '))
+ (buffer->input_buffer[i] != ' '))
i--;
if (i >= 0)
{
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] == ' '))
+ (buffer->input_buffer[i] == ' '))
i--;
}
}
@@ -485,20 +518,20 @@ gui_delete_previous_word ()
if (i >= 0)
i++;
i++;
- num_char_deleted = gui_current_view->input_buffer_pos - i;
- num_char_end = gui_current_view->input_buffer_size -
- gui_current_view->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_view->input_buffer[i + j] =
- gui_current_view->input_buffer[gui_current_view->input_buffer_pos + j];
+ buffer->input_buffer[i + j] =
+ buffer->input_buffer[buffer->input_buffer_pos + j];
- gui_current_view->input_buffer_size -= num_char_deleted;
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- gui_current_view->input_buffer_pos = i;
- gui_draw_view_input (gui_current_view);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->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;
}
}
@@ -507,26 +540,26 @@ gui_delete_previous_word ()
*/
void
-gui_move_previous_word ()
+gui_move_previous_word (t_gui_buffer *buffer)
{
int i;
- if (gui_current_view->input_buffer_pos > 0)
+ if (buffer->input_buffer_pos > 0)
{
- i = gui_current_view->input_buffer_pos - 1;
+ i = buffer->input_buffer_pos - 1;
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] == ' '))
+ (buffer->input_buffer[i] == ' '))
i--;
if (i < 0)
- gui_current_view->input_buffer_pos = 0;
+ buffer->input_buffer_pos = 0;
else
{
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] != ' '))
+ (buffer->input_buffer[i] != ' '))
i--;
- gui_current_view->input_buffer_pos = i + 1;
+ buffer->input_buffer_pos = i + 1;
}
- gui_draw_view_input (gui_current_view);
+ gui_draw_buffer_input (buffer, 0);
}
}
@@ -535,32 +568,32 @@ gui_move_previous_word ()
*/
void
-gui_move_next_word ()
+gui_move_next_word (t_gui_buffer *buffer)
{
int i;
- if (gui_current_view->input_buffer_pos <
- gui_current_view->input_buffer_size + 1)
+ if (buffer->input_buffer_pos <
+ buffer->input_buffer_size + 1)
{
- i = gui_current_view->input_buffer_pos;
- while ((i <= gui_current_view->input_buffer_size) &&
- (gui_current_view->input_buffer[i] == ' '))
+ i = buffer->input_buffer_pos;
+ while ((i <= buffer->input_buffer_size) &&
+ (buffer->input_buffer[i] == ' '))
i++;
- if (i > gui_current_view->input_buffer_size)
- gui_current_view->input_buffer_pos = i - 1;
+ if (i > buffer->input_buffer_size)
+ buffer->input_buffer_pos = i - 1;
else
{
- while ((i <= gui_current_view->input_buffer_size) &&
- (gui_current_view->input_buffer[i] != ' '))
+ while ((i <= buffer->input_buffer_size) &&
+ (buffer->input_buffer[i] != ' '))
i++;
- if (i > gui_current_view->input_buffer_size)
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
+ if (i > buffer->input_buffer_size)
+ buffer->input_buffer_pos =
+ buffer->input_buffer_size;
else
- gui_current_view->input_buffer_pos = i;
+ buffer->input_buffer_pos = i;
}
- gui_draw_view_input (gui_current_view);
+ gui_draw_buffer_input (buffer, 0);
}
}
@@ -569,24 +602,24 @@ 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_view->input_buffer_size += length;
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer[gui_current_view->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_view->input_buffer_size - 1;
+ end = buffer->input_buffer_size - 1;
for (i = end; i >= start; i--)
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i - length];
+ buffer->input_buffer[i] =
+ buffer->input_buffer[i - length];
/* insert new string */
- strncpy (gui_current_view->input_buffer + pos, string, length);
+ strncpy (buffer->input_buffer + pos, string, length);
}
diff --git a/src/gui/gui.h b/src/gui/gui.h
index df14e3af5..b7d45930e 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -59,23 +59,23 @@
#define COLOR_WIN_NICK_LAST 38
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
-#define SERVER(view) ((t_irc_server *)(view->server))
-#define CHANNEL(view) ((t_irc_channel *)(view->channel))
+#define SERVER(buffer) ((t_irc_server *)(buffer->server))
+#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
-#define VIEW_IS_SERVER(view) (SERVER(view) && !CHANNEL(view))
-#define VIEW_IS_CHANNEL(view) (CHANNEL(view) && (CHANNEL(view)->type == CHAT_CHANNEL))
-#define VIEW_IS_PRIVATE(view) (CHANNEL(view) && (CHANNEL(view)->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 gui_printf_color(view, color, fmt, argz...) \
- gui_printf_color_type(view, 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(view, fmt, argz...) \
- gui_printf_color_type(view, 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;
@@ -121,6 +121,44 @@ 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 */
+
+ /* 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) */
+ 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 *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
@@ -148,6 +186,7 @@ struct t_gui_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 */
@@ -159,109 +198,70 @@ struct t_gui_window
/* windows for Qt GUI */
/* TODO: declare Qt window */
- t_gui_window *prev_window; /* link to previous window */
- t_gui_window *next_window; /* link to next window */
-};
-
-typedef struct t_gui_view t_gui_view;
-
-struct t_gui_view
-{
- int is_displayed; /* = 1 if view is displayed */
+ t_gui_buffer *buffer; /* buffer currently displayed in window */
- /* server/channel */
- void *server; /* view's server */
- void *channel; /* view's channel */
-
- t_gui_window *window; /* Curses or Gtk 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 */
- int num_lines; /* number of lines in the 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 *last_history; /* last command in history */
- t_history *ptr_history; /* current command in history */
- int num_history; /* number of commands in history */
-
- /* link to next window */
- t_gui_view *prev_view; /* link to previous view */
- t_gui_view *next_view; /* link to next view */
+ t_gui_window *prev_window; /* link to previous window */
+ t_gui_window *next_window; /* link to next window */
};
/* variables */
extern int gui_ready;
extern t_gui_window *gui_windows;
-extern t_gui_view *gui_views;
-extern t_gui_view *last_gui_view;
-extern t_gui_view *gui_current_view;
+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 (int, int, int, int);
-extern t_gui_view *gui_view_new (t_gui_window *, void *, void *, int);
-extern void gui_view_clear (t_gui_view *);
-extern void gui_view_clear_all ();
+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_view *);
-extern t_gui_message *gui_new_message (t_gui_view *);
-extern void gui_optimize_input_buffer_size (t_gui_view *);
-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 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);
/* 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_view_has_nicklist (t_gui_view *);
-extern void gui_calculate_pos_size (t_gui_view *);
-extern void gui_draw_view_title (t_gui_view *);
-extern void gui_redraw_view_title (t_gui_view *);
-extern void gui_draw_view_chat (t_gui_view *);
-extern void gui_redraw_view_chat (t_gui_view *);
-extern void gui_draw_view_nick (t_gui_view *);
-extern void gui_redraw_view_nick (t_gui_view *);
-extern void gui_draw_view_status (t_gui_view *);
-extern void gui_redraw_view_status (t_gui_view *);
-extern void gui_draw_view_infobar (t_gui_view *);
-extern void gui_redraw_view_infobar (t_gui_view *);
-extern void gui_draw_view_input (t_gui_view *);
-extern void gui_redraw_view_input (t_gui_view *);
-extern void gui_redraw_view (t_gui_view *);
-extern void gui_switch_to_view (t_gui_view *);
-extern void gui_switch_to_previous_view ();
-extern void gui_switch_to_next_view ();
+extern int gui_buffer_has_nicklist (t_gui_buffer *);
+extern void gui_calculate_pos_size (t_gui_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_view_init_subviews (t_gui_view *);
+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_view_free (t_gui_view *);
+extern void gui_buffer_free (t_gui_buffer *);
extern void gui_end ();
-extern void gui_printf_color_type (/*@null@*/ t_gui_view *, int, int, char *, ...);
+extern void gui_printf_color_type (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
extern void gui_main_loop ();
#endif /* gui.h */
diff --git a/src/irc/irc-channel.c b/src/irc/irc-channel.c
index 12dfb8abd..b5e93038b 100644
--- a/src/irc/irc-channel.c
+++ b/src/irc/irc-channel.c
@@ -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_view)
+ 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_view_new (gui_current_view->window, server, new_channel, switch_to_view);
+ gui_buffer_new (gui_current_window, server, new_channel, switch_to_buffer);
/* all is ok, return address of new channel */
return new_channel;
diff --git a/src/irc/irc-display.c b/src/irc/irc-display.c
index 2ad66bda6..d8bdc4942 100644
--- a/src/irc/irc-display.c
+++ b/src/irc/irc-display.c
@@ -41,16 +41,16 @@
*/
void
-irc_display_prefix (t_gui_view *view, char *prefix)
+irc_display_prefix (t_gui_buffer *buffer, char *prefix)
{
if (prefix[0] == prefix[2])
{
- gui_printf_color (view, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
- gui_printf_color (view, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
- gui_printf_color (view, 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 (view, 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_view *view, char *prefix)
*/
void
-irc_display_nick (t_gui_view *view, 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 (view,
+ gui_printf_color_type (buffer,
message_type, COLOR_WIN_CHAT_DARK, "<");
if (cfg_look_nickmode)
{
if (nick->is_op)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_OP, "@");
else
{
if (nick->is_halfop)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_HALFOP, "%%");
else
{
if (nick->has_voice)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_VOICE, "+");
else
if (cfg_look_nickmode_empty && !no_nickmode)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_CHAT, " ");
}
}
}
if (color_nick < 0)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", nick->nick);
else
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
(color_nick) ?
((cfg_look_color_nicks) ?
@@ -106,7 +106,7 @@ irc_display_nick (t_gui_view *view, t_irc_nick *nick, int message_type,
"%s", nick->nick);
if (display_around)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type, COLOR_WIN_CHAT_DARK, "> ");
}
@@ -115,21 +115,21 @@ irc_display_nick (t_gui_view *view, t_irc_nick *nick, int message_type,
*/
void
-irc_display_mode (t_gui_view *view, 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 (view, PREFIX_INFO);
- gui_printf_color (view, COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (view, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
- gui_printf_color (view, COLOR_WIN_CHAT, "/");
- gui_printf_color (view, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
- gui_printf_color (view, COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (view, 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 (view, COLOR_WIN_CHAT, " %s ", message);
- gui_printf_color (view, 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 (view, COLOR_WIN_CHAT, " %s\n", message);
+ gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
}
diff --git a/src/irc/irc-nick.c b/src/irc/irc-nick.c
index 5488dd51f..b553b7904 100644
--- a/src/irc/irc-nick.c
+++ b/src/irc/irc-nick.c
@@ -182,7 +182,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->view,
+ gui_printf (channel->buffer,
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
return NULL;
}
@@ -192,7 +192,7 @@ 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->view)->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);
diff --git a/src/irc/irc-recv.c b/src/irc/irc-recv.c
index 54a9745a7..99817174a 100644
--- a/src/irc/irc-recv.c
+++ b/src/irc/irc-recv.c
@@ -114,7 +114,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_ERROR);
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
first = 1;
while (pos && pos[0])
@@ -124,7 +124,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
{
if (pos[0] == ':')
pos++;
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s%s\n", (first) ? "" : ": ", pos);
pos = NULL;
@@ -132,7 +132,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
else
{
pos2[0] = '\0';
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s%s",
(first) ? "" : " ", pos);
@@ -159,7 +159,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_new (server, CHAT_CHANNEL, arguments, 1);
if (!ptr_channel)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create new channel \"%s\"\n"),
WEECHAT_ERROR, arguments);
return -1;
@@ -170,21 +170,21 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
if (pos)
pos[0] = '\0';
- irc_display_prefix (ptr_channel->view, PREFIX_JOIN);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_NICK,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_JOIN);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
"%s ", host);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
"(");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_HOST,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_HOST,
"%s", pos + 1);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
")");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_(" has joined "));
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s\n", arguments);
(void) nick_new (ptr_channel, host, 0, 0, 0);
- gui_redraw_view_nick (gui_current_view);
+ gui_draw_buffer_nick (gui_current_window->buffer, 1);
return 0;
}
@@ -225,39 +225,39 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "kick");
return -1;
}
- irc_display_prefix (ptr_channel->view, PREFIX_PART);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_NICK,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
"%s", host);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_(" has kicked "));
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_NICK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
"%s", pos_nick);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_(" from "));
if (pos_comment)
{
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s ", arguments);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
"(");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
"%s", pos_comment);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
")\n");
}
else
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s\n", arguments);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "kick");
return -1;
@@ -266,7 +266,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
if (ptr_nick)
{
nick_free (ptr_channel, ptr_nick);
- gui_redraw_view_nick (gui_current_view);
+ gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
return 0;
}
@@ -301,7 +301,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "b", nick_host,
(set_flag == '+') ?
_("sets ban on") :
@@ -319,7 +319,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'i':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "i", nick_host,
(set_flag == '+') ?
_("sets invite-only channel flag") :
@@ -337,7 +337,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "k", nick_host,
(set_flag == '+') ?
_("sets channel key to") :
@@ -369,7 +369,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "l", nick_host,
(set_flag == '+') ?
_("sets the user limit to") :
@@ -392,7 +392,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'm':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "m", nick_host,
(set_flag == '+') ?
_("sets moderated channel flag") :
@@ -403,7 +403,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'n':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "n", nick_host,
(set_flag == '+') ?
_("sets messages from channel only flag") :
@@ -421,7 +421,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "o", nick_host,
(set_flag == '+') ?
_("gives channel operator status to") :
@@ -434,7 +434,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
{
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
- gui_redraw_view_nick (ptr_channel->view);
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -449,7 +449,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'p':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "p", nick_host,
(set_flag == '+') ?
_("sets private channel flag") :
@@ -460,7 +460,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 's':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "s", nick_host,
(set_flag == '+') ?
_("sets secret channel flag") :
@@ -471,7 +471,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 't':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "t", nick_host,
(set_flag == '+') ?
_("sets topic protection") :
@@ -489,7 +489,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "v", nick_host,
(set_flag == '+') ?
_("gives voice to") :
@@ -503,7 +503,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
{
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
- gui_redraw_view_nick (ptr_channel->view);
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -534,7 +534,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "mode");
return -1;
@@ -548,7 +548,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
pos = strchr (arguments, ' ');
if (!pos)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without channel or nickname\n"),
WEECHAT_ERROR, "mode");
return -1;
@@ -573,11 +573,11 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
if (ptr_channel)
{
irc_get_channel_modes (ptr_channel, arguments, host, pos, pos_parm);
- gui_draw_view_status (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 0);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "mode");
return -1;
@@ -586,7 +586,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
else
{
/* nickname modes */
- gui_printf (server->view, "(TODO!) nickname modes: channel=%s, args=%s\n", arguments, pos);
+ gui_printf (server->buffer, "(TODO!) nickname modes: channel=%s, args=%s\n", arguments, pos);
}
return 0;
}
@@ -602,12 +602,12 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
int nick_is_me;
- t_gui_view *ptr_view;
+ t_gui_buffer *ptr_buffer;
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "nick");
return -1;
@@ -625,16 +625,16 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
if (ptr_nick)
{
/* change nickname in any opened private window */
- for (ptr_view = gui_views; ptr_view;
- ptr_view = ptr_view->next_view)
+ for (ptr_buffer = gui_buffers; ptr_buffer;
+ ptr_buffer = ptr_buffer->next_buffer)
{
- if ((SERVER(ptr_view) == server) && VIEW_IS_PRIVATE(ptr_view))
+ if ((SERVER(ptr_buffer) == server) && BUFFER_IS_PRIVATE(ptr_buffer))
{
- if ((CHANNEL(ptr_view)->name)
- && (strcmp (ptr_nick->nick, CHANNEL(ptr_view)->name) == 0))
+ if ((CHANNEL(ptr_buffer)->name)
+ && (strcmp (ptr_nick->nick, CHANNEL(ptr_buffer)->name) == 0))
{
- free (CHANNEL(ptr_view)->name);
- CHANNEL(ptr_view)->name = strdup (arguments);
+ free (CHANNEL(ptr_buffer)->name);
+ CHANNEL(ptr_buffer)->name = strdup (arguments);
}
}
}
@@ -642,28 +642,28 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
/* change nickname on channel */
nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0;
nick_change (ptr_channel, ptr_nick, arguments);
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
if (nick_is_me)
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
_("You are "));
else
{
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK,
"%s", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _(" is "));
}
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
_("now known as "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK,
"%s\n",
arguments);
- if (gui_view_has_nicklist (ptr_channel->view))
- gui_redraw_view_nick (ptr_channel->view);
+ if (gui_buffer_has_nicklist (ptr_channel->buffer))
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -672,8 +672,8 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
free (server->nick);
server->nick = strdup (arguments);
}
- gui_redraw_view_status (gui_current_view);
- gui_redraw_view_input (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ gui_draw_buffer_input (gui_current_window->buffer, 1);
return 0;
}
@@ -709,7 +709,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s nickname not found for \"%s\" command\n"),
WEECHAT_ERROR, "notice");
return -1;
@@ -720,12 +720,12 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->view, COLOR_WIN_CHAT_CHANNEL, "VERSION ");
- gui_printf_color (server->view, COLOR_WIN_CHAT, _("reply from"));
- gui_printf_color (server->view, COLOR_WIN_CHAT_NICK, " %s", host);
- gui_printf_color (server->view, COLOR_WIN_CHAT, ": %s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "VERSION ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", host);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
}
else
{
@@ -752,12 +752,12 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
difftime = ((sec2 * 1000000) + usec2) - ((sec1 * 1000000) + usec1);
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->view, COLOR_WIN_CHAT_CHANNEL, "PING ");
- gui_printf_color (server->view, COLOR_WIN_CHAT, _("reply from"));
- gui_printf_color (server->view, COLOR_WIN_CHAT_NICK, " %s", host);
- gui_printf_color (server->view, COLOR_WIN_CHAT,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "PING ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", host);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT,
_(": %ld.%ld seconds\n"),
difftime / 1000000,
(difftime % 1000000) / 1000);
@@ -766,8 +766,8 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
}
else
{
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", pos);
}
}
return 0;
@@ -787,7 +787,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (!host || !arguments)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host or channel\n"),
WEECHAT_ERROR, "part");
return -1;
@@ -818,50 +818,50 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
if (strcmp (ptr_nick->nick, server->nick) == 0)
{
/* part request was issued by local client */
- gui_view_free (ptr_channel->view);
+ gui_buffer_free (ptr_channel->buffer);
channel_free (server, ptr_channel);
- gui_redraw_view_status (gui_current_view);
- gui_redraw_view_input (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ gui_draw_buffer_input (gui_current_window->buffer, 1);
}
else
{
/* remove nick from nick list and display message */
nick_free (ptr_channel, ptr_nick);
- irc_display_prefix (ptr_channel->view, PREFIX_PART);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s ", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HOST, "%s", pos+1);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _(" has left "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s", ptr_channel->name);
if (pos_args && pos_args[0])
{
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "%s", pos_args);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")");
}
- gui_printf (ptr_channel->view, "\n");
+ gui_printf (ptr_channel->buffer, "\n");
- /* redraw nick list if this is current view */
- if (gui_view_has_nicklist (ptr_channel->view))
- gui_redraw_view_nick (ptr_channel->view);
+ /* redraw nick list if this is current buffer */
+ if (gui_buffer_has_nicklist (ptr_channel->buffer))
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "part");
return -1;
@@ -903,7 +903,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -941,13 +941,13 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
- irc_display_prefix (ptr_channel->view, PREFIX_ACTION_ME);
+ irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
{
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->view != gui_current_view) )
+ && (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: * %s %s"),
@@ -955,9 +955,9 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
host, pos);
}
else
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n", pos);
}
else
@@ -967,10 +967,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
{
if (strstr (pos, server->nick))
{
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, -1, 0);
if ( (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->view != gui_current_view) )
+ && (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
@@ -978,15 +978,15 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
host, pos);
}
else
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -995,7 +995,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1039,14 +1039,14 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
" compiled on %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
"\01\r\n");
- irc_display_prefix (server->view, PREFIX_INFO);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_INFO);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Received a "));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, _("CTCP VERSION "));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("from"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
@@ -1079,7 +1079,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (!pos2)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1093,7 +1093,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1108,7 +1108,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1123,7 +1123,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1147,7 +1147,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR, host);
return -1;
@@ -1156,40 +1156,40 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (!ptr_channel->topic)
{
ptr_channel->topic = strdup (host2);
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
{
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->view != gui_current_view) )
+ && (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1212,7 +1212,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "quit");
return -1;
@@ -1235,27 +1235,27 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
{
if (ptr_nick)
nick_free (ptr_channel, ptr_nick);
- irc_display_prefix (ptr_channel->view, PREFIX_QUIT);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_QUIT);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s ", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HOST, "%s", pos + 1);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ") ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("has quit"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "%s",
arguments);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")\n");
- if ((ptr_channel->view == gui_current_view) &&
- (gui_view_has_nicklist (ptr_channel->view)))
- gui_redraw_view_nick (ptr_channel->view);
+ if ((ptr_channel->buffer == gui_current_window->buffer) &&
+ (gui_buffer_has_nicklist (ptr_channel->buffer)))
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -1284,8 +1284,8 @@ irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *arguments)
arguments++;
/* display server message */
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "%s\n", arguments);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", arguments);
return 0;
}
@@ -1314,7 +1314,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_ERROR);
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
first = 1;
while (pos && pos[0])
@@ -1324,7 +1324,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
{
if (pos[0] == ':')
pos++;
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s%s\n", (first) ? "" : ": ", pos);
pos = NULL;
@@ -1332,7 +1332,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
else
{
pos2[0] = '\0';
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s%s",
(first) ? "" : " ", pos);
@@ -1352,7 +1352,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
- t_gui_view *view;
+ t_gui_buffer *buffer;
/* make gcc happy */
(void) host;
@@ -1364,7 +1364,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
if (!string_is_channel (arguments))
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without channel\n"),
WEECHAT_ERROR, "topic");
return -1;
@@ -1384,28 +1384,28 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
}
ptr_channel = channel_search (server, arguments);
- view = (ptr_channel) ? ptr_channel->view : server->view;
+ buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
- irc_display_prefix (view, PREFIX_INFO);
- gui_printf_color (view,
+ irc_display_prefix (buffer, PREFIX_INFO);
+ gui_printf_color (buffer,
COLOR_WIN_CHAT_NICK, "%s",
host);
if (pos)
{
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT, _(" has changed topic for "));
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT_CHANNEL, "%s",
arguments);
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT, _(" to: \"%s\"\n"),
pos);
}
else
{
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT, _(" has unset topic for "));
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT_CHANNEL, "%s\n",
arguments);
}
@@ -1418,7 +1418,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
ptr_channel->topic = strdup (pos);
else
ptr_channel->topic = strdup ("");
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
return 0;
@@ -1449,8 +1449,8 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
/* connection to IRC server is ok! */
server->is_connected = 1;
- gui_redraw_view_status (server->view);
- gui_redraw_view_input (server->view);
+ gui_draw_buffer_status (server->buffer, 1);
+ gui_draw_buffer_input (server->buffer, 1);
/* execute command once connected */
if (server->command && server->command[0])
@@ -1491,10 +1491,10 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (gui_current_view, PREFIX_INFO);
- gui_printf_color (gui_current_view,
+ irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT, _(" is away: %s\n"), pos_message);
}
}
@@ -1537,12 +1537,12 @@ irc_cmd_recv_302 (t_irc_server *server, char *host, char *arguments)
ptr_next++;
}
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", arguments);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "=");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST, "%s\n", pos_host);
}
else
@@ -1567,8 +1567,8 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Users online: "));
arguments = strchr (arguments, ' ');
@@ -1588,14 +1588,14 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *arguments)
while (ptr_next[0] == ' ')
ptr_next++;
}
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s ", arguments);
arguments = ptr_next;
if (arguments && !arguments[0])
arguments = NULL;
}
}
- gui_printf (server->view, "\n");
+ gui_printf (server->buffer, "\n");
return 0;
}
@@ -1616,8 +1616,8 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *arguments)
arguments++;
if (arguments[0] == ':')
arguments++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", arguments);
}
server->is_away = 0;
@@ -1641,8 +1641,8 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *arguments)
arguments++;
if (arguments[0] == ':')
arguments++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", arguments);
}
server->is_away = 1;
@@ -1694,19 +1694,19 @@ irc_cmd_recv_311 (t_irc_server *server, char *host, char *arguments)
if (pos_realname[0] == ':')
pos_realname++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] (");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST, "%s@%s",
pos_user, pos_host);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, ": %s\n", pos_realname);
}
}
@@ -1749,20 +1749,20 @@ irc_cmd_recv_312 (t_irc_server *server, char *host, char *arguments)
if (pos_serverinfo[0] == ':')
pos_serverinfo++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s ", pos_server);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s", pos_serverinfo);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, ")\n");
}
}
@@ -1797,14 +1797,14 @@ irc_cmd_recv_313 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", pos_message);
}
}
@@ -1859,17 +1859,17 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *arguments)
if (pos_realname[0] == ':')
pos_realname++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST,
"%s@%s", pos_user, pos_host);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
" was %s\n", pos_realname);
}
@@ -1924,52 +1924,52 @@ irc_cmd_recv_317 (t_irc_server *server, char *host, char *arguments)
min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("idle: "));
if (day > 0)
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", day);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(day > 1) ? _("days") : _("day"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
", ");
}
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%02d ", hour);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(hour > 1) ? _("hours") : _("hour"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
" %02d ", min);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(min > 1) ? _("minutes") : _("minute"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
" %02d ", sec);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(sec > 1) ? _("seconds") : _("second"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("signon at: "));
datetime = (time_t)(atol (pos_signon));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s", ctime (&datetime));
}
@@ -2006,14 +2006,14 @@ irc_cmd_recv_318 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", pos_message);
}
}
@@ -2047,21 +2047,21 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
if (pos_channel[0] == ':')
pos_channel++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Channels: "));
while (pos_channel && pos_channel[0])
{
if (pos_channel[0] == '@')
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_NICK_OP, "@");
pos_channel++;
}
@@ -2069,14 +2069,14 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
{
if (pos_channel[0] == '%')
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_NICK_HALFOP, "%");
pos_channel++;
}
else
if (pos_channel[0] == '+')
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_NICK_VOICE, "+");
pos_channel++;
}
@@ -2089,7 +2089,7 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
while (pos[0] == ' ')
pos++;
}
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s%s",
pos_channel,
@@ -2128,14 +2128,14 @@ irc_cmd_recv_320 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", pos_message);
}
}
@@ -2165,8 +2165,8 @@ irc_cmd_recv_321 (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf (server->view, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2193,8 +2193,8 @@ irc_cmd_recv_322 (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf (server->view, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2221,8 +2221,8 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf (server->view, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2267,7 +2267,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
if (ptr_channel)
{
irc_get_channel_modes (ptr_channel, NULL, NULL, pos, pos_parm);
- gui_draw_view_status (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 0);
}
}
}
@@ -2305,9 +2305,9 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *arguments)
pos = strchr (arguments, ' ');
if (pos)
pos[0] = '\0';
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT, _("No topic set for "));
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s\n", arguments);
return 0;
}
@@ -2346,19 +2346,19 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
free (ptr_channel->topic);
ptr_channel->topic = strdup (pos2);
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Topic for "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s", pos);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _(" is: \"%s\"\n"), pos2);
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "332");
return -1;
@@ -2367,7 +2367,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify channel for \"%s\" command\n"),
WEECHAT_ERROR, "332");
return -1;
@@ -2412,18 +2412,18 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, pos_channel);
if (ptr_channel)
{
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Topic set by "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
datetime = (time_t)(atol (pos_date));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, ", %s", ctime (&datetime));
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2431,7 +2431,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify date/time for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2439,7 +2439,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify nickname for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2447,7 +2447,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify channel for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2484,11 +2484,11 @@ irc_cmd_recv_351 (t_irc_server *server, char *host, char *arguments)
pos2 += 2;
}
- irc_display_prefix (server->view, PREFIX_SERVER);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
if (pos2)
- gui_printf (server->view, "%s %s\n", pos, pos2);
+ gui_printf (server->buffer, "%s %s\n", pos, pos2);
else
- gui_printf (server->view, "%s\n", pos);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2562,32 +2562,32 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
while (pos_realname[0] == ' ')
pos_realname++;
- irc_display_prefix (server->view,
+ irc_display_prefix (server->buffer,
PREFIX_SERVER);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK,
"%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
_(" on "));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s ", pos_channel);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s %s ",
pos_attr, pos_hopcount);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST,
"%s@%s",
pos_user, pos_host);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK,
" (");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s", pos_realname);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK,
")\n");
}
@@ -2644,7 +2644,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
pos++;
if (pos[0] != ':')
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "353");
return -1;
@@ -2675,16 +2675,16 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
pos++;
}
if (!nick_new (ptr_channel, pos_nick, is_op, is_halfop, has_voice))
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create nick \"%s\" for channel \"%s\"\n"),
WEECHAT_ERROR, pos_nick, ptr_channel->name);
}
}
- gui_redraw_view_nick (ptr_channel->view);
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "353");
return -1;
@@ -2727,85 +2727,85 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
{
/* display users on channel */
- irc_display_prefix (ptr_channel->view, PREFIX_SERVER);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_("Nicks "));
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s", ptr_channel->name);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT, ": ");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, ": ");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "[");
for (ptr_nick = ptr_channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_INFO, 0, 0, 1);
if (ptr_nick != ptr_channel->last_nick)
- gui_printf (ptr_channel->view, " ");
+ gui_printf (ptr_channel->buffer, " ");
}
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK, "]\n");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "]\n");
/* display number of nicks, ops, halfops & voices on the channel */
nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice,
&num_normal);
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Channel "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s", ptr_channel->name);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, ": ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_nicks);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_nicks > 1) ? _("nicks") : _("nick"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_op);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_op > 1) ? _("ops") : _("op"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_halfop);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_halfop > 1) ? _("halfops") : _("halfop"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_voice);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_voice > 1) ? _("voices") : _("voice"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_normal);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
_("normal"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")\n");
irc_cmd_send_mode (server, ptr_channel->name);
}
else
{
- irc_display_prefix (gui_current_view, PREFIX_INFO);
- gui_printf_color (gui_current_view,
+ irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT_CHANNEL, pos);
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
return 0;
}
@@ -2827,7 +2827,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
{
if (strcmp (server->nick, server->nick1) == 0)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s: nickname \"%s\" is already in use, "
"trying 2nd nickname \"%s\"\n"),
PACKAGE_NAME, server->nick, server->nick2);
@@ -2838,7 +2838,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
{
if (strcmp (server->nick, server->nick2) == 0)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s: nickname \"%s\" is already in use, "
"trying 3rd nickname \"%s\"\n"),
PACKAGE_NAME, server->nick, server->nick3);
@@ -2847,7 +2847,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s: all declared nicknames are already in use, "
"closing connection with server!\n"),
PACKAGE_NAME);
diff --git a/src/irc/irc-send.c b/src/irc/irc-send.c
index 535cca1f0..d31ae8f62 100644
--- a/src/irc/irc-send.c
+++ b/src/irc/irc-send.c
@@ -56,7 +56,7 @@ irc_login (t_irc_server *server)
hostname[sizeof (hostname) - 1] = '\0';
if (!hostname[0])
strcpy (hostname, _("unknown"));
- gui_printf (server->view,
+ 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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
- gui_printf (server->view,
+ 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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
{
- gui_printf (server->view,
+ 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 (VIEW_IS_CHANNEL (gui_current_view))
+ if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
{
server_sendf (server,
"KICK %s %s\r\n",
- CHANNEL(gui_current_view)->name, arguments);
+ CHANNEL(gui_current_window->buffer)->name, arguments);
}
else
{
- gui_printf (server->view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->name, arguments);
- irc_display_prefix (gui_current_view, PREFIX_ACTION_ME);
- gui_printf_color (gui_current_view,
+ 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_view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view);
+ ptr_channel = CHANNEL(gui_current_window->buffer);
ptr_nick = nick_search (ptr_channel, server->nick);
if (ptr_nick)
{
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
- gui_printf (server->view,
+ 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->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (ptr_channel->view,
+ 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->view,
+ 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 (!VIEW_IS_CHANNEL(gui_current_view))
+ if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
{
- gui_printf (server->view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->name;
+ channel_name = CHANNEL(gui_current_window->buffer)->name;
pos_args = arguments;
}
}
else
{
- if (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "part");
return -1;
}
- if (VIEW_IS_PRIVATE(gui_current_view))
+ if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
{
- ptr_channel = CHANNEL(gui_current_view);
- gui_view_free (ptr_channel->view);
+ ptr_channel = CHANNEL(gui_current_window->buffer);
+ gui_buffer_free (ptr_channel->buffer);
channel_free (server, ptr_channel);
- gui_redraw_view_status (gui_current_view);
- gui_redraw_view_input (gui_current_view);
+ 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_view)->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->view,
+ gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
/* display text if given */
if (pos)
{
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (ptr_channel->view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->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 (VIEW_IS_CHANNEL(gui_current_view) &&
- nick_search (CHANNEL(gui_current_view), 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->view, PREFIX_INFO);
- gui_printf (server->view, _("%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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "voice");
return -1;
diff --git a/src/irc/irc-server.c b/src/irc/irc-server.c
index 06d823902..1d37b023a 100644
--- a/src/irc/irc-server.c
+++ b/src/irc/irc-server.c
@@ -78,7 +78,7 @@ server_init (t_irc_server *server)
server->is_away = 0;
server->server_read = -1;
server->server_write = -1;
- server->view = NULL;
+ server->buffer = NULL;
server->channels = NULL;
server->last_channel = NULL;
}
@@ -270,8 +270,8 @@ server_free (t_irc_server *server)
(server->next_server)->prev_server = server->prev_server;
server_destroy (server);
- if (server->view)
- gui_view_free (server->view);
+ if (server->buffer)
+ gui_buffer_free (server->buffer);
free (server);
irc_servers = new_irc_servers;
}
@@ -377,11 +377,11 @@ server_sendf (t_irc_server * server, char *fmt, ...)
size_buf = strlen (buffer);
buffer[size_buf - 2] = '\0';
#ifdef DEBUG
- gui_printf (server->view, "[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->view, _("%s error sending data to IRC server\n"),
+ gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
WEECHAT_ERROR);
}
@@ -397,7 +397,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->view,
+ gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
return;
@@ -408,7 +408,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->view,
+ gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
@@ -462,14 +462,14 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
(char *) realloc (unterminated_message,
strlen (buffer) + 1);
if (!unterminated_message)
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
strcpy (unterminated_message, buffer);
return;
}
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s unable to explode received buffer\n"),
WEECHAT_ERROR);
}
@@ -493,7 +493,7 @@ server_msgq_flush ()
if (recv_msgq->data)
{
#ifdef DEBUG
- gui_printf (gui_current_view, "[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 +542,15 @@ server_msgq_flush ()
command, args))
{
case -1:
- gui_printf (recv_msgq->server->view,
+ gui_printf (recv_msgq->server->buffer,
_("Command '%s' failed!\n"), command);
break;
case -2:
- gui_printf (recv_msgq->server->view,
+ gui_printf (recv_msgq->server->buffer,
_("No command to execute!\n"));
break;
case -3:
- gui_printf (recv_msgq->server->view,
+ gui_printf (recv_msgq->server->buffer,
_("Unknown command: cmd=%s, args=%s\n"),
command, args);
break;
@@ -602,7 +602,7 @@ server_connect (t_irc_server *server)
int error;
int server_pipe[2];
- gui_printf (server->view,
+ 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 +612,7 @@ server_connect (t_irc_server *server)
/* create pipe */
if (pipe (server_pipe) < 0)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create pipe\n"), WEECHAT_ERROR);
server_free (server);
return 0;
@@ -626,14 +626,14 @@ server_connect (t_irc_server *server)
if (setsockopt
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
sizeof (set)) == -1)
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
WEECHAT_ERROR);
@@ -641,7 +641,7 @@ server_connect (t_irc_server *server)
ip4_hostent = gethostbyname (server->address);
if (!ip4_hostent)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s address \"%s\" not found\n"),
WEECHAT_ERROR, server->address);
close (server->server_read);
@@ -657,14 +657,14 @@ server_connect (t_irc_server *server)
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
if (error != 0)
{
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s IP address not found\n"), WEECHAT_ERROR);
close (server->server_read);
close (server->server_write);
@@ -674,13 +674,13 @@ server_connect (t_irc_server *server)
}
/* connection to server */
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
close (server->server_read);
close (server->server_write);
@@ -708,7 +708,7 @@ server_auto_connect (int command_line)
if ( ((command_line) && (ptr_server->command_line))
|| ((!command_line) && (ptr_server->autoconnect)) )
{
- (void) gui_view_new (gui_current_view->window, 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 +726,12 @@ server_disconnect (t_irc_server *server)
if (server->is_connected)
{
- /* write disconnection message on each channel/private view */
+ /* 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->view, PREFIX_INFO);
- gui_printf (ptr_channel->view, _("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 */
diff --git a/src/irc/irc.h b/src/irc/irc.h
index c34816a34..d194cfda7 100644
--- a/src/irc/irc.h
+++ b/src/irc/irc.h
@@ -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_view *view; /* GUI view 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_view *view; /* GUI view 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_view *, char *);
-extern void irc_display_nick (t_gui_view *, t_irc_nick *, int, int, int, int);
-extern void irc_display_mode (t_gui_view *, 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) */
diff --git a/src/plugins/perl/wee-perl.c b/src/plugins/perl/wee-perl.c
index 08f687d07..12c0051c2 100644
--- a/src/plugins/perl/wee-perl.c
+++ b/src/plugins/perl/wee-perl.c
@@ -120,7 +120,7 @@ static XS (XS_IRC_register)
}
/*
- * IRC::print: print message to current view
+ * 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_view, PREFIX_PLUGIN);
- gui_printf (gui_current_view, "%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_view *ptr_view;
+ 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 view for printing message */
+ /* look for buffer for printing message */
channel = SvPV (ST (1), integer);
- ptr_view = 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_view = ptr_channel->view;
+ ptr_buffer = ptr_channel->buffer;
break;
}
}
}
- if (ptr_view)
+ if (ptr_buffer)
break;
}
- /* view found => display message & return 1 */
- if (ptr_view)
+ /* buffer found => display message & return 1 */
+ if (ptr_buffer)
{
message = SvPV (ST (0), integer);
- irc_display_prefix (ptr_view, PREFIX_PLUGIN);
- gui_printf (ptr_view, "%s", message);
+ irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
+ gui_printf (ptr_buffer, "%s", message);
XSRETURN_YES;
}
- /* no view 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 (VIEW_IS_CHANNEL (gui_current_view))
- info = CHANNEL (gui_current_view)->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) )
{
diff --git a/weechat/BUGS b/weechat/BUGS
index 7e0afaf75..07613ec97 100644
--- a/weechat/BUGS
+++ b/weechat/BUGS
@@ -1,12 +1,13 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-WeeChat known bugs, 2004-06-05
+WeeChat known bugs, 2004-07-01
- ./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
diff --git a/weechat/ChangeLog b/weechat/ChangeLog
index b116d26cb..2bc0d6b0c 100644
--- a/weechat/ChangeLog
+++ b/weechat/ChangeLog
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-ChangeLog - 2004-06-23
+ChangeLog - 2004-07-01
Version 0.0.7 (under dev!):
diff --git a/weechat/TODO b/weechat/TODO
index cc9f133ca..4975cb845 100644
--- a/weechat/TODO
+++ b/weechat/TODO
@@ -1,7 +1,7 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
-TODO - 2004-06-23
+TODO - 2004-07-01
Legend:
# done
diff --git a/weechat/configure.in b/weechat/configure.in
index 19ed4637e..9b2abeea1 100644
--- a/weechat/configure.in
+++ b/weechat/configure.in
@@ -110,10 +110,11 @@ AC_SUBST(PLUGINS_LIBS)
if test "x$enable_debug" = "xyes" ; then
AC_DEFINE(DEBUG)
+ CFLAGS="-Wall -W -pipe -O2 -g"
+else
+ CFLAGS="-Wall -W -pipe -O2"
fi
-CFLAGS="-Wall -W -pipe -O2"
-
AC_OUTPUT([Makefile
src/Makefile
src/common/Makefile
diff --git a/weechat/po/fr.po b/weechat/po/fr.po
index 2c9f5c616..9d728f7d6 100644
--- a/weechat/po/fr.po
+++ b/weechat/po/fr.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.0.7-pre2\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2004-06-05 10:52+0200\n"
+"POT-Creation-Date: 2004-06-27 15:36+0200\n"
"PO-Revision-Date: 2004-06-05 10:52+0200\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -1172,7 +1172,7 @@ msgstr "%s utilisateur non trouvé pour la commande \"%s\"\n"
msgid "%s cannot create new private window \"%s\"\n"
msgstr "%s impossible de créer la fenêtre privée \"%s\"\n"
-#: src/irc/irc-send.c:547 src/common/command.c:1118
+#: src/irc/irc-send.c:547 src/common/command.c:1126
#, c-format
msgid "%s wrong argument count for \"%s\" command\n"
msgstr "%s nombre de paramètres erroné pour la commande \"%s\"\n"
@@ -1618,11 +1618,11 @@ msgstr ""
"%s impossible d'ajouter la fonction pour le message \"%s\" (mémoire "
"insuffisante)\n"
-#: src/gui/curses/gui-display.c:952
+#: src/gui/curses/gui-display.c:919
msgid "[not connected] "
msgstr "[non connecté] "
-#: src/gui/curses/gui-display.c:959 src/gui/curses/gui-display.c:962
+#: src/gui/curses/gui-display.c:927 src/gui/curses/gui-display.c:930
msgid "-MORE-"
msgstr "-PLUS-"
@@ -1630,17 +1630,17 @@ msgstr "-PLUS-"
msgid "server"
msgstr "serveur"
-#: src/gui/gui-common.c:217
+#: src/gui/gui-common.c:303
#, c-format
msgid "%s not enough memory for infobar message\n"
msgstr "%s pas assez de mémoire pour un message de la barre d'infos\n"
-#: src/gui/gui-common.c:323
+#: src/gui/gui-common.c:421
#, c-format
msgid "%s not enough memory for new line!\n"
msgstr "%s pas assez de mémoire pour une nouvelle ligne !\n"
-#: src/gui/gui-common.c:350
+#: src/gui/gui-common.c:464
msgid "not enough memory!\n"
msgstr "pas assez de mémoire !\n"
@@ -1798,29 +1798,52 @@ msgstr "nom_alias"
msgid "alias_name: name of alias to remove"
msgstr "nom_alias: nom de l'alias à supprimer"
-#: src/common/command.c:340
+#: src/common/command.c:91
+msgid "manage windows"
+msgstr "gestion des fenêtres"
+
+#: src/common/command.c:92
+msgid "[action]"
+msgstr "[action]"
+
+#: src/common/command.c:93
+msgid ""
+"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"
+msgstr ""
+"action: action à effectuer:\n"
+" close ferme la fenêtre courante (en développement !)\n"
+" list liste toutes les fenêtres ouvertes (pas de paramètre affiche cette "
+"liste)\n"
+" splith éclate la fenêtre en deux horizontalement\n"
+" splitv éclate la fenêtre en deux verticalement"
+
+#: src/common/command.c:348
#, c-format
msgid "%s alias or command \"%s\" already exists!\n"
msgstr "%s l'alias ou la commande \"%s\" existe déjà !\n"
-#: src/common/command.c:349
+#: src/common/command.c:357
#, c-format
msgid "%s alias cannot run another alias!\n"
msgstr "%s l'alias ne peux pas lancer un autre alias !\n"
-#: src/common/command.c:355
+#: src/common/command.c:363
#, c-format
msgid "%s target command \"%s\" does not exist!\n"
msgstr "%s la commande cible \"%s\" n'existe pas !\n"
-#: src/common/command.c:541
+#: src/common/command.c:549
#, c-format
msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n"
msgstr ""
"%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: %d "
"paramètre%s)\n"
-#: src/common/command.c:550
+#: src/common/command.c:558
#, c-format
msgid ""
"%s wrong argument count for %s command \"%s\" (expected: between %d and %d "
@@ -1829,19 +1852,19 @@ msgstr ""
"%s nombre de paramètres incorrect pour la commande %s \"%s\" (attendu: entre "
"%d et %d paramètre%s)\n"
-#: src/common/command.c:569
+#: src/common/command.c:577
#, c-format
msgid "%s %s command \"%s\" failed\n"
msgstr "%s %s la commande \"%s\" a échoué\n"
-#: src/common/command.c:594
+#: src/common/command.c:602
#, c-format
msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n"
msgstr ""
"%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: %d "
"paramètre%s)\n"
-#: src/common/command.c:603
+#: src/common/command.c:611
#, c-format
msgid ""
"%s wrong argument count for IRC command \"%s\" (expected: between %d and %d "
@@ -1850,134 +1873,134 @@ msgstr ""
"%s nombre de paramètres incorrect pour la commande IRC \"%s\" (attendu: "
"entre %d et %d paramètre%s)\n"
-#: src/common/command.c:616
+#: src/common/command.c:624
#, c-format
msgid "%s command \"%s\" needs a server connection!\n"
msgstr "%s la commande \"%s\" nécessite une connexion au serveur !\n"
-#: src/common/command.c:628
+#: src/common/command.c:636
#, c-format
msgid "%s IRC command \"%s\" failed\n"
msgstr "%s la commande IRC \"%s\" a échoué\n"
-#: src/common/command.c:675
+#: src/common/command.c:683
#, c-format
msgid "%s unknown command \"%s\" (type /help for help)\n"
msgstr "%s commande \"%s\" inconnue (tapez /help pour l'aide)\n"
-#: src/common/command.c:744
+#: src/common/command.c:752
#, c-format
msgid "%s cannot find nick for sending message\n"
msgstr "%s impossible de trouver le pseudo pour envoyer le message\n"
-#: src/common/command.c:750
+#: src/common/command.c:758
msgid "This window is not a channel!\n"
msgstr "Cette fenêtre n'est pas un canal !\n"
-#: src/common/command.c:776 src/common/command.c:788
+#: src/common/command.c:784 src/common/command.c:796
#, c-format
msgid "%s missing arguments for \"%s\" command\n"
msgstr "%s paramètres manquants pour la commande \"%s\"\n"
-#: src/common/command.c:783
+#: src/common/command.c:791
#, c-format
msgid "Alias \"%s\" => \"%s\" created\n"
msgstr "Alias \"%s\" => \"%s\" créé\n"
-#: src/common/command.c:798
+#: src/common/command.c:806
msgid "List of aliases:\n"
msgstr "Liste des alias:\n"
-#: src/common/command.c:808
+#: src/common/command.c:816
msgid "No alias defined.\n"
msgstr "Aucun alias défini.\n"
-#: src/common/command.c:827
+#: src/common/command.c:835
#, c-format
msgid "unknown parameter \"%s\" for \"%s\" command\n"
msgstr "paramètre inconnu \"%s\" pour la commande \"%s\"\n"
-#: src/common/command.c:856
+#: src/common/command.c:864
#, c-format
msgid "%s already connected to server \"%s\"!\n"
msgstr "%s déjà connecté au serveur \"%s\" !\n"
-#: src/common/command.c:879 src/common/command.c:914
+#: src/common/command.c:887 src/common/command.c:922
#, c-format
msgid "%s server \"%s\" not found\n"
msgstr "%s serveur \"%s\" non trouvé\n"
-#: src/common/command.c:904
+#: src/common/command.c:912
#, c-format
msgid "%s not connected to server \"%s\"!\n"
msgstr "%s non connecté au serveur \"%s\" !\n"
-#: src/common/command.c:933
+#: src/common/command.c:941
#, c-format
msgid "> List of %s internal commands:\n"
msgstr "> Liste des commandes internes %s:\n"
-#: src/common/command.c:938
+#: src/common/command.c:946
msgid "> List of IRC commands:\n"
msgstr "> Liste des commandes IRC:\n"
-#: src/common/command.c:953
+#: src/common/command.c:961
#, c-format
msgid "> Help on %s internal command \"%s\":\n"
msgstr "> Aide sur la commande interne %s \"%s\":\n"
-#: src/common/command.c:956 src/common/command.c:977
+#: src/common/command.c:964 src/common/command.c:985
#, c-format
msgid "Syntax: /%s %s\n"
msgstr "Syntaxe: /%s %s\n"
-#: src/common/command.c:975
+#: src/common/command.c:983
#, c-format
msgid "> Help on IRC command \"%s\":\n"
msgstr "> Aide sur la commande IRC \"%s\":\n"
-#: src/common/command.c:991
+#: src/common/command.c:999
#, c-format
msgid "No help available, \"%s\" is an unknown command\n"
msgstr "Pas d'aide disponible, la commande \"%s\" est inconnue\n"
-#: src/common/command.c:1016
+#: src/common/command.c:1024
msgid "Registered Perl scripts:\n"
msgstr "Scripts Perl enregistrés :\n"
-#: src/common/command.c:1033 src/common/command.c:1055
-#: src/common/command.c:1077
+#: src/common/command.c:1041 src/common/command.c:1063
+#: src/common/command.c:1085
msgid " (none)\n"
msgstr " (aucun)\n"
-#: src/common/command.c:1038
+#: src/common/command.c:1046
msgid "Perl message handlers:\n"
msgstr "Fonctions Perl pour messages :\n"
-#: src/common/command.c:1047
+#: src/common/command.c:1055
#, c-format
msgid " IRC(%s) => Perl(%s)\n"
msgstr " IRC(%s) => Perl(%s)\n"
-#: src/common/command.c:1060
+#: src/common/command.c:1068
msgid "Perl command handlers:\n"
msgstr "Commandes Perl :\n"
-#: src/common/command.c:1069
+#: src/common/command.c:1077
#, c-format
msgid " Command /%s => Perl(%s)\n"
msgstr " Commande /%s => Perl(%s)\n"
-#: src/common/command.c:1087
+#: src/common/command.c:1095
msgid "Perl scripts unloaded\n"
msgstr "Scripts Perl déchargés\n"
-#: src/common/command.c:1112
+#: src/common/command.c:1120
#, c-format
msgid "%s unknown option for \"%s\" command\n"
msgstr "%s option inconnue pour la commande \"%s\"\n"
-#: src/common/command.c:1123
+#: src/common/command.c:1131
msgid ""
"WeeChat was build without Perl support.\n"
"Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n"
@@ -1986,193 +2009,194 @@ msgstr ""
"Merci de reconstruire WeeChat avec l'option \"--enable-perl\" pour le "
"script ./configure\n"
-#: src/common/command.c:1167
+#: src/common/command.c:1175
msgid "Server: "
msgstr "Serveur: "
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "connected"
msgstr "connecté"
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "not connected"
msgstr "non connecté"
-#: src/common/command.c:1185
+#: src/common/command.c:1193
#, c-format
msgid " Autoconnect: %s%s\n"
msgstr " Autoconnect: %s%s\n"
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "yes"
msgstr "oui"
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "no"
msgstr "non"
-#: src/common/command.c:1188
+#: src/common/command.c:1196
msgid " (temporary server, will not be saved)"
msgstr " (serveur temporaire, ne sera pas sauvé)"
-#: src/common/command.c:1193
+#: src/common/command.c:1201
#, c-format
msgid " Hostname : %s\n"
msgstr " Nom/IP : %s\n"
-#: src/common/command.c:1198
+#: src/common/command.c:1206
#, c-format
msgid " Port : %d\n"
msgstr " Port : %d\n"
-#: src/common/command.c:1204
+#: src/common/command.c:1212
msgid " Password : (hidden)\n"
msgstr " Mot passe : (caché)\n"
-#: src/common/command.c:1208
+#: src/common/command.c:1216
msgid " Password : (none)\n"
msgstr " Mot passe : (aucun)\n"
-#: src/common/command.c:1212
+#: src/common/command.c:1220
#, c-format
msgid " Nicks : %s"
msgstr " Pseudos : %s"
-#: src/common/command.c:1229
+#: src/common/command.c:1237
#, c-format
msgid " Username : %s\n"
msgstr " Nom utilis.: %s\n"
-#: src/common/command.c:1234
+#: src/common/command.c:1242
#, c-format
msgid " Realname : %s\n"
msgstr " Nom réel : %s\n"
-#: src/common/command.c:1240
+#: src/common/command.c:1248
#, c-format
msgid " Command : %s\n"
msgstr " Commande : %s\n"
-#: src/common/command.c:1245
+#: src/common/command.c:1253
msgid " Command : (none)\n"
msgstr " Commande : (aucune)\n"
-#: src/common/command.c:1250
+#: src/common/command.c:1258
#, c-format
msgid " Auto-join : %s\n"
msgstr " Auto-join : %s\n"
-#: src/common/command.c:1255
+#: src/common/command.c:1263
msgid " Auto-join : (none)\n"
msgstr " Auto-join : (aucun)\n"
-#: src/common/command.c:1259
+#: src/common/command.c:1267
msgid "No server.\n"
msgstr "Pas de serveur.\n"
-#: src/common/command.c:1268
+#: src/common/command.c:1276
#, c-format
msgid "%s missing servername for \"%s\" command\n"
msgstr "%s il manque le nom du serveur pour la commande \"%s\"\n"
-#: src/common/command.c:1274
+#: src/common/command.c:1282
#, c-format
msgid "%s too much arguments for \"%s\" command, ignoring arguments\n"
msgstr "%s trop de paramètres pour la commande \"%s\", paramètres ignorés\n"
-#: src/common/command.c:1291
+#: src/common/command.c:1299
#, c-format
msgid "%s server \"%s\" not found for \"%s\" command\n"
msgstr "%s le serveur \"%s\" n'existe pas pour la commande \"%s\"\n"
-#: src/common/command.c:1297 src/common/command.c:1428
+#: src/common/command.c:1305 src/common/command.c:1436
msgid "Server"
msgstr "Serveur"
-#: src/common/command.c:1300
+#: src/common/command.c:1308
msgid "has been deleted\n"
msgstr "a été supprimé\n"
-#: src/common/command.c:1314
+#: src/common/command.c:1322
#, c-format
msgid "%s missing parameters for \"%s\" command\n"
msgstr "%s paramètres manquants pour la commande \"%s\"\n"
-#: src/common/command.c:1323
+#: src/common/command.c:1331
#, c-format
msgid "%s server \"%s\" already exists, can't create it!\n"
msgstr "%s le serveur \"%s\" existe déjà, impossible de le créer !\n"
-#: src/common/command.c:1347 src/common/command.c:1373
-#: src/common/command.c:1385 src/common/command.c:1409
+#: src/common/command.c:1355 src/common/command.c:1381
+#: src/common/command.c:1393 src/common/command.c:1417
#, c-format
msgid "%s missing password for \"%s\" parameter\n"
msgstr "%s mot de passe manquant pour le paramètre \"%s\"\n"
-#: src/common/command.c:1359
+#: src/common/command.c:1367
#, c-format
msgid "%s missing nick(s) for \"%s\" parameter\n"
msgstr "%s pseudo(s) manquant(s) pour le paramètre \"%s\"\n"
-#: src/common/command.c:1397
+#: src/common/command.c:1405
#, c-format
msgid "%s missing command for \"%s\" parameter\n"
msgstr "%s commande manquante pour le paramètre \"%s\"\n"
-#: src/common/command.c:1431
+#: src/common/command.c:1439
msgid "created\n"
msgstr "créé\n"
-#: src/common/command.c:1436
+#: src/common/command.c:1444
#, c-format
msgid "%s unable to create server\n"
msgstr "%s impossible de créer le serveur\n"
-#: src/common/command.c:1490
+#: src/common/command.c:1498
#, c-format
msgid "%s option '%s' can not be changed while WeeChat is running\n"
msgstr "%s l'option '%s' ne peut pas être changée lorsque WeeChat tourne\n"
-#: src/common/command.c:1502
+#: src/common/command.c:1510
#, c-format
msgid "%s incorrect value for option '%s'\n"
msgstr "%s valeur incorrecte pour l'option '%s'\n"
-#: src/common/command.c:1508
+#: src/common/command.c:1516
#, c-format
msgid "%s config option '%s' not found\n"
msgstr "%s option de configuration '%s' non trouvée\n"
-#: src/common/command.c:1558
+#: src/common/command.c:1566
msgid "(unknown)"
msgstr "(inconnu)"
-#: src/common/command.c:1578 src/common/command.c:1581
+#: src/common/command.c:1586 src/common/command.c:1589
#, c-format
msgid "No config option found with '%s'\n"
msgstr "Aucune option de configuration trouvée avec '%s'\n"
-#: src/common/command.c:1586
+#: src/common/command.c:1594
#, c-format
msgid "%d config option(s) found with '%s'\n"
msgstr "%d option(s) de configuration trouvées avec '%s'\n"
-#: src/common/command.c:1589
+#: src/common/command.c:1597
#, c-format
msgid "%d config option(s) found\n"
msgstr "%d option(s) de configuration trouvées\n"
-#: src/common/command.c:1609
+#: src/common/command.c:1617
#, c-format
msgid "%s alias or command \"%s\" not found\n"
msgstr "%s alias ou commande \"%s\" non trouvé\n"
-#: src/common/command.c:1618
+#: src/common/command.c:1626
#, c-format
msgid "Alias \"%s\" removed\n"
msgstr "Alias \"%s\" supprimé\n"
#: src/common/weechat.c:118
+#, c-format
msgid ""
"WeeChat configuration options (~/.weechat/weechat.rc):\n"
"\n"
@@ -2181,6 +2205,7 @@ msgstr ""
"\n"
#: src/common/weechat.c:131
+#, c-format
msgid " . type boolean (values: 'on' or 'off')\n"
msgstr " . type booléen (valeurs: 'on' ou 'off')\n"
@@ -2201,6 +2226,7 @@ msgid " . default value: %d\n"
msgstr " . valeur par défaut: %d\n"
#: src/common/weechat.c:144
+#, c-format
msgid " . type string (values: "
msgstr " . type chaîne (valeurs: "
@@ -2209,10 +2235,12 @@ msgid "empty"
msgstr "vide"
#: src/common/weechat.c:160
+#, c-format
msgid " . type color (Curses or Gtk color, look at WeeChat doc)\n"
msgstr " . type couleur (couleur Curses ou Gtk, voir la doc WeeChat)\n"
#: src/common/weechat.c:166
+#, c-format
msgid " . type string (any string)\n"
msgstr " . type chaîne (toute chaîne)\n"
@@ -2226,6 +2254,7 @@ msgstr ""
"\n"
#: src/common/weechat.c:178
+#, c-format
msgid ""
"Moreover, you can define aliases in [alias] section, by adding lines like:\n"
msgstr ""
@@ -2233,6 +2262,7 @@ msgstr ""
"des lignes comme :\n"
#: src/common/weechat.c:180
+#, c-format
msgid ""
"where 'j' is alias name, and 'join' associated command.\n"
"\n"
diff --git a/weechat/po/weechat.pot b/weechat/po/weechat.pot
index ca0bcecf8..162d02377 100644
--- a/weechat/po/weechat.pot
+++ b/weechat/po/weechat.pot
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2004-06-05 10:52+0200\n"
+"POT-Creation-Date: 2004-06-27 15:36+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -1078,7 +1078,7 @@ msgstr ""
msgid "%s cannot create new private window \"%s\"\n"
msgstr ""
-#: src/irc/irc-send.c:547 src/common/command.c:1118
+#: src/irc/irc-send.c:547 src/common/command.c:1126
#, c-format
msgid "%s wrong argument count for \"%s\" command\n"
msgstr ""
@@ -1511,11 +1511,11 @@ msgstr ""
msgid "%s unable to add handler for \"%s\" message (not enough memory)\n"
msgstr ""
-#: src/gui/curses/gui-display.c:952
+#: src/gui/curses/gui-display.c:919
msgid "[not connected] "
msgstr ""
-#: src/gui/curses/gui-display.c:959 src/gui/curses/gui-display.c:962
+#: src/gui/curses/gui-display.c:927 src/gui/curses/gui-display.c:930
msgid "-MORE-"
msgstr ""
@@ -1523,17 +1523,17 @@ msgstr ""
msgid "server"
msgstr ""
-#: src/gui/gui-common.c:217
+#: src/gui/gui-common.c:303
#, c-format
msgid "%s not enough memory for infobar message\n"
msgstr ""
-#: src/gui/gui-common.c:323
+#: src/gui/gui-common.c:421
#, c-format
msgid "%s not enough memory for new line!\n"
msgstr ""
-#: src/gui/gui-common.c:350
+#: src/gui/gui-common.c:464
msgid "not enough memory!\n"
msgstr ""
@@ -1672,376 +1672,395 @@ msgstr ""
msgid "alias_name: name of alias to remove"
msgstr ""
-#: src/common/command.c:340
+#: src/common/command.c:91
+msgid "manage windows"
+msgstr ""
+
+#: src/common/command.c:92
+msgid "[action]"
+msgstr ""
+
+#: src/common/command.c:93
+msgid ""
+"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"
+msgstr ""
+
+#: src/common/command.c:348
#, c-format
msgid "%s alias or command \"%s\" already exists!\n"
msgstr ""
-#: src/common/command.c:349
+#: src/common/command.c:357
#, c-format
msgid "%s alias cannot run another alias!\n"
msgstr ""
-#: src/common/command.c:355
+#: src/common/command.c:363
#, c-format
msgid "%s target command \"%s\" does not exist!\n"
msgstr ""
-#: src/common/command.c:541
+#: src/common/command.c:549
#, c-format
msgid "%s wrong argument count for %s command \"%s\" (expected: %d arg%s)\n"
msgstr ""
-#: src/common/command.c:550
+#: src/common/command.c:558
#, c-format
msgid ""
"%s wrong argument count for %s command \"%s\" (expected: between %d and %d "
"arg%s)\n"
msgstr ""
-#: src/common/command.c:569
+#: src/common/command.c:577
#, c-format
msgid "%s %s command \"%s\" failed\n"
msgstr ""
-#: src/common/command.c:594
+#: src/common/command.c:602
#, c-format
msgid "%s wrong argument count for IRC command \"%s\" (expected: %d arg%s)\n"
msgstr ""
-#: src/common/command.c:603
+#: src/common/command.c:611
#, c-format
msgid ""
"%s wrong argument count for IRC command \"%s\" (expected: between %d and %d "
"arg%s)\n"
msgstr ""
-#: src/common/command.c:616
+#: src/common/command.c:624
#, c-format
msgid "%s command \"%s\" needs a server connection!\n"
msgstr ""
-#: src/common/command.c:628
+#: src/common/command.c:636
#, c-format
msgid "%s IRC command \"%s\" failed\n"
msgstr ""
-#: src/common/command.c:675
+#: src/common/command.c:683
#, c-format
msgid "%s unknown command \"%s\" (type /help for help)\n"
msgstr ""
-#: src/common/command.c:744
+#: src/common/command.c:752
#, c-format
msgid "%s cannot find nick for sending message\n"
msgstr ""
-#: src/common/command.c:750
+#: src/common/command.c:758
msgid "This window is not a channel!\n"
msgstr ""
-#: src/common/command.c:776 src/common/command.c:788
+#: src/common/command.c:784 src/common/command.c:796
#, c-format
msgid "%s missing arguments for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:783
+#: src/common/command.c:791
#, c-format
msgid "Alias \"%s\" => \"%s\" created\n"
msgstr ""
-#: src/common/command.c:798
+#: src/common/command.c:806
msgid "List of aliases:\n"
msgstr ""
-#: src/common/command.c:808
+#: src/common/command.c:816
msgid "No alias defined.\n"
msgstr ""
-#: src/common/command.c:827
+#: src/common/command.c:835
#, c-format
msgid "unknown parameter \"%s\" for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:856
+#: src/common/command.c:864
#, c-format
msgid "%s already connected to server \"%s\"!\n"
msgstr ""
-#: src/common/command.c:879 src/common/command.c:914
+#: src/common/command.c:887 src/common/command.c:922
#, c-format
msgid "%s server \"%s\" not found\n"
msgstr ""
-#: src/common/command.c:904
+#: src/common/command.c:912
#, c-format
msgid "%s not connected to server \"%s\"!\n"
msgstr ""
-#: src/common/command.c:933
+#: src/common/command.c:941
#, c-format
msgid "> List of %s internal commands:\n"
msgstr ""
-#: src/common/command.c:938
+#: src/common/command.c:946
msgid "> List of IRC commands:\n"
msgstr ""
-#: src/common/command.c:953
+#: src/common/command.c:961
#, c-format
msgid "> Help on %s internal command \"%s\":\n"
msgstr ""
-#: src/common/command.c:956 src/common/command.c:977
+#: src/common/command.c:964 src/common/command.c:985
#, c-format
msgid "Syntax: /%s %s\n"
msgstr ""
-#: src/common/command.c:975
+#: src/common/command.c:983
#, c-format
msgid "> Help on IRC command \"%s\":\n"
msgstr ""
-#: src/common/command.c:991
+#: src/common/command.c:999
#, c-format
msgid "No help available, \"%s\" is an unknown command\n"
msgstr ""
-#: src/common/command.c:1016
+#: src/common/command.c:1024
msgid "Registered Perl scripts:\n"
msgstr ""
-#: src/common/command.c:1033 src/common/command.c:1055
-#: src/common/command.c:1077
+#: src/common/command.c:1041 src/common/command.c:1063
+#: src/common/command.c:1085
msgid " (none)\n"
msgstr ""
-#: src/common/command.c:1038
+#: src/common/command.c:1046
msgid "Perl message handlers:\n"
msgstr ""
-#: src/common/command.c:1047
+#: src/common/command.c:1055
#, c-format
msgid " IRC(%s) => Perl(%s)\n"
msgstr ""
-#: src/common/command.c:1060
+#: src/common/command.c:1068
msgid "Perl command handlers:\n"
msgstr ""
-#: src/common/command.c:1069
+#: src/common/command.c:1077
#, c-format
msgid " Command /%s => Perl(%s)\n"
msgstr ""
-#: src/common/command.c:1087
+#: src/common/command.c:1095
msgid "Perl scripts unloaded\n"
msgstr ""
-#: src/common/command.c:1112
+#: src/common/command.c:1120
#, c-format
msgid "%s unknown option for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1123
+#: src/common/command.c:1131
msgid ""
"WeeChat was build without Perl support.\n"
"Please rebuild WeeChat with \"--enable-perl\" option for ./configure script\n"
msgstr ""
-#: src/common/command.c:1167
+#: src/common/command.c:1175
msgid "Server: "
msgstr ""
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "connected"
msgstr ""
-#: src/common/command.c:1178
+#: src/common/command.c:1186
msgid "not connected"
msgstr ""
-#: src/common/command.c:1185
+#: src/common/command.c:1193
#, c-format
msgid " Autoconnect: %s%s\n"
msgstr ""
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "yes"
msgstr ""
-#: src/common/command.c:1186
+#: src/common/command.c:1194
msgid "no"
msgstr ""
-#: src/common/command.c:1188
+#: src/common/command.c:1196
msgid " (temporary server, will not be saved)"
msgstr ""
-#: src/common/command.c:1193
+#: src/common/command.c:1201
#, c-format
msgid " Hostname : %s\n"
msgstr ""
-#: src/common/command.c:1198
+#: src/common/command.c:1206
#, c-format
msgid " Port : %d\n"
msgstr ""
-#: src/common/command.c:1204
+#: src/common/command.c:1212
msgid " Password : (hidden)\n"
msgstr ""
-#: src/common/command.c:1208
+#: src/common/command.c:1216
msgid " Password : (none)\n"
msgstr ""
-#: src/common/command.c:1212
+#: src/common/command.c:1220
#, c-format
msgid " Nicks : %s"
msgstr ""
-#: src/common/command.c:1229
+#: src/common/command.c:1237
#, c-format
msgid " Username : %s\n"
msgstr ""
-#: src/common/command.c:1234
+#: src/common/command.c:1242
#, c-format
msgid " Realname : %s\n"
msgstr ""
-#: src/common/command.c:1240
+#: src/common/command.c:1248
#, c-format
msgid " Command : %s\n"
msgstr ""
-#: src/common/command.c:1245
+#: src/common/command.c:1253
msgid " Command : (none)\n"
msgstr ""
-#: src/common/command.c:1250
+#: src/common/command.c:1258
#, c-format
msgid " Auto-join : %s\n"
msgstr ""
-#: src/common/command.c:1255
+#: src/common/command.c:1263
msgid " Auto-join : (none)\n"
msgstr ""
-#: src/common/command.c:1259
+#: src/common/command.c:1267
msgid "No server.\n"
msgstr ""
-#: src/common/command.c:1268
+#: src/common/command.c:1276
#, c-format
msgid "%s missing servername for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1274
+#: src/common/command.c:1282
#, c-format
msgid "%s too much arguments for \"%s\" command, ignoring arguments\n"
msgstr ""
-#: src/common/command.c:1291
+#: src/common/command.c:1299
#, c-format
msgid "%s server \"%s\" not found for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1297 src/common/command.c:1428
+#: src/common/command.c:1305 src/common/command.c:1436
msgid "Server"
msgstr ""
-#: src/common/command.c:1300
+#: src/common/command.c:1308
msgid "has been deleted\n"
msgstr ""
-#: src/common/command.c:1314
+#: src/common/command.c:1322
#, c-format
msgid "%s missing parameters for \"%s\" command\n"
msgstr ""
-#: src/common/command.c:1323
+#: src/common/command.c:1331
#, c-format
msgid "%s server \"%s\" already exists, can't create it!\n"
msgstr ""
-#: src/common/command.c:1347 src/common/command.c:1373
-#: src/common/command.c:1385 src/common/command.c:1409
+#: src/common/command.c:1355 src/common/command.c:1381
+#: src/common/command.c:1393 src/common/command.c:1417
#, c-format
msgid "%s missing password for \"%s\" parameter\n"
msgstr ""
-#: src/common/command.c:1359
+#: src/common/command.c:1367
#, c-format
msgid "%s missing nick(s) for \"%s\" parameter\n"
msgstr ""
-#: src/common/command.c:1397
+#: src/common/command.c:1405
#, c-format
msgid "%s missing command for \"%s\" parameter\n"
msgstr ""
-#: src/common/command.c:1431
+#: src/common/command.c:1439
msgid "created\n"
msgstr ""
-#: src/common/command.c:1436
+#: src/common/command.c:1444
#, c-format
msgid "%s unable to create server\n"
msgstr ""
-#: src/common/command.c:1490
+#: src/common/command.c:1498
#, c-format
msgid "%s option '%s' can not be changed while WeeChat is running\n"
msgstr ""
-#: src/common/command.c:1502
+#: src/common/command.c:1510
#, c-format
msgid "%s incorrect value for option '%s'\n"
msgstr ""
-#: src/common/command.c:1508
+#: src/common/command.c:1516
#, c-format
msgid "%s config option '%s' not found\n"
msgstr ""
-#: src/common/command.c:1558
+#: src/common/command.c:1566
msgid "(unknown)"
msgstr ""
-#: src/common/command.c:1578 src/common/command.c:1581
+#: src/common/command.c:1586 src/common/command.c:1589
#, c-format
msgid "No config option found with '%s'\n"
msgstr ""
-#: src/common/command.c:1586
+#: src/common/command.c:1594
#, c-format
msgid "%d config option(s) found with '%s'\n"
msgstr ""
-#: src/common/command.c:1589
+#: src/common/command.c:1597
#, c-format
msgid "%d config option(s) found\n"
msgstr ""
-#: src/common/command.c:1609
+#: src/common/command.c:1617
#, c-format
msgid "%s alias or command \"%s\" not found\n"
msgstr ""
-#: src/common/command.c:1618
+#: src/common/command.c:1626
#, c-format
msgid "Alias \"%s\" removed\n"
msgstr ""
#: src/common/weechat.c:118
+#, c-format
msgid ""
"WeeChat configuration options (~/.weechat/weechat.rc):\n"
"\n"
msgstr ""
#: src/common/weechat.c:131
+#, c-format
msgid " . type boolean (values: 'on' or 'off')\n"
msgstr ""
@@ -2062,6 +2081,7 @@ msgid " . default value: %d\n"
msgstr ""
#: src/common/weechat.c:144
+#, c-format
msgid " . type string (values: "
msgstr ""
@@ -2070,10 +2090,12 @@ msgid "empty"
msgstr ""
#: src/common/weechat.c:160
+#, c-format
msgid " . type color (Curses or Gtk color, look at WeeChat doc)\n"
msgstr ""
#: src/common/weechat.c:166
+#, c-format
msgid " . type string (any string)\n"
msgstr ""
@@ -2085,11 +2107,13 @@ msgid ""
msgstr ""
#: src/common/weechat.c:178
+#, c-format
msgid ""
"Moreover, you can define aliases in [alias] section, by adding lines like:\n"
msgstr ""
#: src/common/weechat.c:180
+#, c-format
msgid ""
"where 'j' is alias name, and 'join' associated command.\n"
"\n"
diff --git a/weechat/src/common/command.c b/weechat/src/common/command.c
index 44bc3e89d..873adeff8 100644
--- a/weechat/src/common/command.c
+++ b/weechat/src/common/command.c
@@ -91,7 +91,7 @@ t_weechat_command weechat_commands[] =
{ "window", N_("manage windows"),
N_("[action]"),
N_("action: action to do:\n"
- " close close current window\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"),
@@ -715,46 +715,46 @@ user_command (t_irc_server *server, char *command)
{
if ((command[0] == '/') && (command[1] == '/'))
command++;
- if (server && (!VIEW_IS_SERVER(gui_current_view)))
+ if (server && (!BUFFER_IS_SERVER(gui_current_window->buffer)))
{
server_sendf (server, "PRIVMSG %s :%s\r\n",
- CHANNEL(gui_current_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
command);
- if (VIEW_IS_PRIVATE(gui_current_view))
+ if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
{
- gui_printf_color_type (CHANNEL(gui_current_view)->view,
+ gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
- gui_printf_color_type (CHANNEL(gui_current_view)->view,
+ 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_view)->view,
+ gui_printf_color_type (CHANNEL(gui_current_window->buffer)->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (CHANNEL(gui_current_view)->view,
+ 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_view), server->nick);
+ ptr_nick = nick_search (CHANNEL(gui_current_window->buffer), server->nick);
if (ptr_nick)
{
- irc_display_nick (CHANNEL(gui_current_view)->view, 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_view)->view,
+ gui_printf_color (CHANNEL(gui_current_window->buffer)->buffer,
COLOR_WIN_CHAT, "%s\n", command);
}
else
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot find nick for sending message\n"),
WEECHAT_ERROR);
}
}
else
- gui_printf ((server) ? server->view : NULL,
+ gui_printf ((server) ? server->buffer : NULL,
_("This window is not a channel!\n"));
}
}
@@ -828,7 +828,7 @@ weechat_cmd_clear (int argc, char **argv)
if (argc == 1)
{
if (strcmp (argv[0], "-all") == 0)
- gui_view_clear_all ();
+ gui_buffer_clear_all ();
else
{
gui_printf (NULL,
@@ -838,7 +838,7 @@ weechat_cmd_clear (int argc, char **argv)
}
}
else
- gui_view_clear (gui_current_view);
+ gui_buffer_clear (gui_current_window->buffer);
return 0;
}
@@ -865,9 +865,9 @@ weechat_cmd_connect (int argc, char **argv)
WEECHAT_ERROR, argv[0]);
return -1;
}
- if (!ptr_server->view)
+ if (!ptr_server->buffer)
{
- if (!gui_view_new (gui_current_view->window, ptr_server, NULL, 1))
+ if (!gui_buffer_new (gui_current_window, ptr_server, NULL, 1))
return -1;
}
if (server_connect (ptr_server))
@@ -914,7 +914,7 @@ weechat_cmd_disconnect (int argc, char **argv)
return -1;
}
server_disconnect (ptr_server);
- gui_redraw_view_status (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
}
else
{
@@ -1308,7 +1308,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_view (gui_current_view);
+ gui_redraw_buffer (gui_current_window->buffer);
return 0;
}
@@ -1449,7 +1449,7 @@ weechat_cmd_server (int argc, char **argv)
if (new_server->autoconnect)
{
- (void) gui_view_new (gui_current_view->window, new_server, NULL, 1);
+ (void) gui_buffer_new (gui_current_window, new_server, NULL, 1);
if (server_connect (new_server))
irc_login (new_server);
}
@@ -1648,12 +1648,12 @@ weechat_cmd_window (int argc, char **argv)
if (strcasecmp (argv[0], "splith") == 0)
{
/* split window horizontally */
- gui_printf (NULL, "window splith -- NOT DEVELOPED!\n");
+ gui_window_split_horiz (gui_current_window);
}
else if (strcasecmp (argv[0], "splitv") == 0)
{
/* split window vertically */
- gui_printf (NULL, "window splitv -- NOT DEVELOPED!\n");
+ gui_window_split_vertic (gui_current_window);
}
else
return -1;
diff --git a/weechat/src/common/history.c b/weechat/src/common/history.c
index e4c4269b9..6724662c1 100644
--- a/weechat/src/common/history.c
+++ b/weechat/src/common/history.c
@@ -44,7 +44,7 @@ int num_history_general = 0;
*/
void
-history_add (void *view, char *string)
+history_add (void *buffer, char *string)
{
t_history *new_history, *ptr_history;
@@ -83,26 +83,26 @@ history_add (void *view, char *string)
{
new_history->text = strdup (string);
- if (((t_gui_view *)(view))->history)
- ((t_gui_view *)(view))->history->prev_history = new_history;
+ if (((t_gui_buffer *)(buffer))->history)
+ ((t_gui_buffer *)(buffer))->history->prev_history = new_history;
else
- ((t_gui_view *)(view))->last_history = new_history;
- new_history->next_history = ((t_gui_view *)(view))->history;
+ ((t_gui_buffer *)(buffer))->last_history = new_history;
+ new_history->next_history = ((t_gui_buffer *)(buffer))->history;
new_history->prev_history = NULL;
- ((t_gui_view *)view)->history = new_history;
- ((t_gui_view *)(view))->num_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_view *)(view))->num_history > cfg_history_max_commands))
+ && (((t_gui_buffer *)(buffer))->num_history > cfg_history_max_commands))
{
- ptr_history = ((t_gui_view *)view)->last_history->prev_history;
- ((t_gui_view *)view)->last_history->prev_history->next_history = NULL;
- if (((t_gui_view *)view)->last_history->text)
- free (((t_gui_view *)view)->last_history->text);
- free (((t_gui_view *)view)->last_history);
- ((t_gui_view *)view)->last_history = ptr_history;
- ((t_gui_view *)(view))->num_history++;
+ 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++;
}
}
}
diff --git a/weechat/src/common/weeconfig.c b/weechat/src/common/weeconfig.c
index 8cfa9d6e1..ccbec9a83 100644
--- a/weechat/src/common/weeconfig.c
+++ b/weechat/src/common/weeconfig.c
@@ -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_views },
+ 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_views },
+ "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_views },
+ 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_views },
+ 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_view_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_views },
+ 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_views },
+ 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_views },
+ 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_view_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)"),
@@ -615,24 +615,24 @@ config_change_title ()
}
/*
- * config_change_views: called when views change (for example nicklist)
+ * config_change_buffers: called when buffers change (for example nicklist)
*/
void
-config_change_views ()
+config_change_buffers ()
{
- gui_switch_to_view (gui_current_view);
- gui_redraw_view (gui_current_view);
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
}
/*
- * config_change_view_content: called when content of a view changes
+ * config_change_buffer_content: called when content of a buffer changes
*/
void
-config_change_view_content ()
+config_change_buffer_content ()
{
- gui_redraw_view (gui_current_view);
+ gui_redraw_buffer (gui_current_window->buffer);
}
/*
diff --git a/weechat/src/common/weeconfig.h b/weechat/src/common/weeconfig.h
index 3fa2c84be..4cba0be79 100644
--- a/weechat/src/common/weeconfig.h
+++ b/weechat/src/common/weeconfig.h
@@ -158,8 +158,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_views ();
-extern void config_change_view_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 *);
diff --git a/weechat/src/gui/curses/gui-display.c b/weechat/src/gui/curses/gui-display.c
index 5d15fdb16..5aadb6c38 100644
--- a/weechat/src/gui/curses/gui-display.c
+++ b/weechat/src/gui/curses/gui-display.c
@@ -153,138 +153,130 @@ gui_window_set_color (WINDOW *window, int num_color)
}
/*
- * gui_view_has_nicklist: returns 1 if view has nicklist
+ * gui_buffer_has_nicklist: returns 1 if buffer has nicklist
*/
int
-gui_view_has_nicklist (t_gui_view *view)
+gui_buffer_has_nicklist (t_gui_buffer *buffer)
{
- return (((CHANNEL(view)) && (CHANNEL(view)->type == CHAT_CHANNEL)) ? 1 : 0);
+ return (((CHANNEL(buffer)) && (CHANNEL(buffer)->type == CHAT_CHANNEL)) ? 1 : 0);
}
/*
- * gui_calculate_pos_size: calculate position and size for a view & subviews
+ * gui_calculate_pos_size: calculate position and size for a buffer & subwindows
*/
void
-gui_calculate_pos_size (t_gui_view *view)
+gui_calculate_pos_size (t_gui_window *window)
{
int max_length, lines;
int num_nicks, num_op, num_halfop, num_voice, num_normal;
- /* global position & size */
- /* TODO: get values from function parameters */
- view->window->win_x = 0;
- view->window->win_y = 0;
- view->window->win_width = COLS;
- view->window->win_height = LINES;
-
/* init chat & nicklist settings */
- /* TODO: calculate values from function parameters */
- if (cfg_look_nicklist && VIEW_IS_CHANNEL(view))
+ if (cfg_look_nicklist && BUFFER_IS_CHANNEL(window->buffer))
{
- max_length = nick_get_max_length (CHANNEL(view));
+ max_length = nick_get_max_length (CHANNEL(window->buffer));
switch (cfg_look_nicklist_position)
{
case CFG_LOOK_NICKLIST_LEFT:
- view->window->win_chat_x = max_length + 2;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS - max_length - 2;
- view->window->win_nick_x = 0;
- view->window->win_nick_y = 1;
- view->window->win_nick_width = max_length + 2;
+ window->win_chat_x = window->win_x + max_length + 2;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width - max_length - 2;
+ window->win_nick_x = window->win_x + 0;
+ window->win_nick_y = window->win_y + 1;
+ window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
- view->window->win_chat_height = LINES - 4;
- view->window->win_nick_height = LINES - 4;
+ window->win_chat_height = window->win_height - 4;
+ window->win_nick_height = window->win_height - 4;
}
else
{
- view->window->win_chat_height = LINES - 3;
- view->window->win_nick_height = LINES - 3;
+ window->win_chat_height = window->win_height - 3;
+ window->win_nick_height = window->win_height - 3;
}
break;
case CFG_LOOK_NICKLIST_RIGHT:
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS - max_length - 2;
- view->window->win_nick_x = COLS - max_length - 2;
- view->window->win_nick_y = 1;
- view->window->win_nick_width = max_length + 2;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width - max_length - 2;
+ window->win_nick_x = window->win_x + window->win_width - max_length - 2;
+ window->win_nick_y = window->win_y + 1;
+ window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
- view->window->win_chat_height = LINES - 4;
- view->window->win_nick_height = LINES - 4;
+ window->win_chat_height = window->win_height - 4;
+ window->win_nick_height = window->win_height - 4;
}
else
{
- view->window->win_chat_height = LINES - 3;
- view->window->win_nick_height = LINES - 3;
+ window->win_chat_height = window->win_height - 3;
+ window->win_nick_height = window->win_height - 3;
}
break;
case CFG_LOOK_NICKLIST_TOP:
- nick_count (CHANNEL(view), &num_nicks, &num_op, &num_halfop,
- &num_voice, &num_normal);
- if (((max_length + 2) * num_nicks) % COLS == 0)
- lines = ((max_length + 2) * num_nicks) / COLS;
+ nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
+ &num_halfop, &num_voice, &num_normal);
+ if (((max_length + 2) * num_nicks) % window->win_width == 0)
+ lines = ((max_length + 2) * num_nicks) / window->win_width;
else
- lines = (((max_length + 2) * num_nicks) / COLS) + 1;
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1 + (lines + 1);
- view->window->win_chat_width = COLS;
+ lines = (((max_length + 2) * num_nicks) / window->win_width) + 1;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1 + (lines + 1);
+ window->win_chat_width = window->win_width;
if (cfg_look_infobar)
- view->window->win_chat_height = LINES - 3 - (lines + 1) - 1;
+ window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
else
- view->window->win_chat_height = LINES - 3 - (lines + 1);
- view->window->win_nick_x = 0;
- view->window->win_nick_y = 1;
- view->window->win_nick_width = COLS;
- view->window->win_nick_height = lines + 1;
+ window->win_chat_height = window->win_height - 3 - (lines + 1);
+ window->win_nick_x = window->win_x;
+ window->win_nick_y = window->win_y + 1;
+ window->win_nick_width = window->win_width;
+ window->win_nick_height = lines + 1;
break;
case CFG_LOOK_NICKLIST_BOTTOM:
- nick_count (CHANNEL(view), &num_nicks, &num_op, &num_halfop,
- &num_voice, &num_normal);
- if (((max_length + 2) * num_nicks) % COLS == 0)
- lines = ((max_length + 2) * num_nicks) / COLS;
+ nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
+ &num_halfop, &num_voice, &num_normal);
+ if (((max_length + 2) * num_nicks) % window->win_width == 0)
+ lines = ((max_length + 2) * num_nicks) / window->win_width;
else
- lines = (((max_length + 2) * num_nicks) / COLS) + 1;
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS;
+ lines = (((max_length + 2) * num_nicks) / window->win_width) + 1;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width;
if (cfg_look_infobar)
- view->window->win_chat_height = LINES - 3 - (lines + 1) - 1;
+ window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
else
- view->window->win_chat_height = LINES - 3 - (lines + 1);
- view->window->win_nick_x = 0;
+ window->win_chat_height = window->win_height - 3 - (lines + 1);
+ window->win_nick_x = window->win_x;
if (cfg_look_infobar)
- view->window->win_nick_y = LINES - 2 - (lines + 1) - 1;
+ window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1) - 1;
else
- view->window->win_nick_y = LINES - 2 - (lines + 1);
- view->window->win_nick_width = COLS;
- view->window->win_nick_height = lines + 1;
+ window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1);
+ window->win_nick_width = window->win_width;
+ window->win_nick_height = lines + 1;
break;
}
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = 0;
+ window->win_chat_cursor_x = window->win_x;
+ window->win_chat_cursor_y = window->win_y;
}
else
{
- view->window->win_chat_x = 0;
- view->window->win_chat_y = 1;
- view->window->win_chat_width = COLS;
+ window->win_chat_x = window->win_x;
+ window->win_chat_y = window->win_y + 1;
+ window->win_chat_width = window->win_width;
if (cfg_look_infobar)
- view->window->win_chat_height = LINES - 4;
+ window->win_chat_height = window->win_height - 4;
else
- view->window->win_chat_height = LINES - 3;
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = 0;
- view->window->win_nick_x = -1;
- view->window->win_nick_y = -1;
- view->window->win_nick_width = -1;
- view->window->win_nick_height = -1;
+ window->win_chat_height = window->win_height - 3;
+ window->win_chat_cursor_x = window->win_x;
+ window->win_chat_cursor_y = window->win_y;
+ window->win_nick_x = -1;
+ window->win_nick_y = -1;
+ window->win_nick_width = -1;
+ window->win_nick_height = -1;
}
}
@@ -300,57 +292,49 @@ gui_curses_window_clear (WINDOW *window)
}
/*
- * gui_draw_view_title: draw title window for a view
+ * gui_draw_buffer_title: draw title window for a buffer
*/
void
-gui_draw_view_title (t_gui_view *view)
+gui_draw_buffer_title (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
char format[32];
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- {
- gui_window_set_color (view->window->win_title, COLOR_WIN_TITLE);
- wborder (view->window->win_title, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_title);
- refresh ();
- }
- if (CHANNEL(view))
- {
- snprintf (format, 32, "%%-%ds", view->window->win_width);
- if (CHANNEL(view)->topic)
- mvwprintw (view->window->win_title, 0, 0, format,
- CHANNEL(view)->topic);
- }
- else
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- /* TODO: change this copyright as title? */
- mvwprintw (view->window->win_title, 0, 0,
- "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
- mvwprintw (view->window->win_title, 0, COLS - strlen (WEECHAT_COPYRIGHT),
- "%s", WEECHAT_COPYRIGHT);
+ if (ptr_win->buffer == buffer)
+ {
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_title);
+
+ if (has_colors ())
+ {
+ gui_window_set_color (ptr_win->win_title, COLOR_WIN_TITLE);
+ wborder (ptr_win->win_title, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_title);
+ refresh ();
+ }
+ if (CHANNEL(buffer))
+ {
+ snprintf (format, 32, "%%-%ds", ptr_win->win_width);
+ if (CHANNEL(buffer)->topic)
+ mvwprintw (ptr_win->win_title, 0, 0, format,
+ CHANNEL(buffer)->topic);
+ }
+ else
+ {
+ /* TODO: change this copyright as title? */
+ mvwprintw (ptr_win->win_title, 0, 0,
+ "%s", PACKAGE_STRING " - " WEECHAT_WEBSITE);
+ mvwprintw (ptr_win->win_title, 0,
+ ptr_win->win_width - strlen (WEECHAT_COPYRIGHT),
+ "%s", WEECHAT_COPYRIGHT);
+ }
+ wrefresh (ptr_win->win_title);
+ refresh ();
+ }
}
- wrefresh (view->window->win_title);
- refresh ();
-}
-
-/*
- * gui_redraw_view_title: redraw title window for a view
- */
-
-void
-gui_redraw_view_title (t_gui_view *view)
-{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- gui_curses_window_clear (view->window->win_title);
- gui_draw_view_title (view);
}
/*
@@ -360,20 +344,20 @@ gui_redraw_view_title (t_gui_view *view)
*/
int
-gui_get_line_num_splits (t_gui_view *view, t_gui_line *line)
+gui_get_line_num_splits (t_gui_window *window, t_gui_line *line)
{
int length, width;
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
- if (line->length_align >= view->window->win_chat_width - 5)
+ if (line->length_align >= window->win_chat_width - 5)
{
length = line->length;
- width = view->window->win_chat_width;
+ width = window->win_chat_width;
}
else
{
length = line->length - line->length_align;
- width = view->window->win_chat_width - line->length_align;
+ width = window->win_chat_width - line->length_align;
}
return (length % width == 0) ? (length / width) : ((length / width) + 1);
@@ -384,14 +368,14 @@ gui_get_line_num_splits (t_gui_view *view, t_gui_line *line)
*/
void
-gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
+gui_display_end_of_line (t_gui_window *window, t_gui_line *line, int count)
{
int lines_displayed, num_lines, offset, remainder, num_displayed;
t_gui_message *ptr_message;
char saved_char, format_align[32], format_empty[32];
snprintf (format_align, 32, "%%-%ds", line->length_align);
- num_lines = gui_get_line_num_splits (view, line);
+ num_lines = gui_get_line_num_splits (window, line);
ptr_message = line->messages;
offset = 0;
lines_displayed = 0;
@@ -399,31 +383,31 @@ gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
{
/* set text color if beginning of message */
if (offset == 0)
- gui_window_set_color (view->window->win_chat, ptr_message->color);
+ gui_window_set_color (window->win_chat, ptr_message->color);
/* insert spaces for align text under time/nick */
- if ((lines_displayed > 0) && (view->window->win_chat_cursor_x == 0))
+ if ((lines_displayed > 0) && (window->win_chat_cursor_x == 0))
{
if (lines_displayed >= num_lines - count)
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
format_align, " ");
- view->window->win_chat_cursor_x += line->length_align;
+ window->win_chat_cursor_x += line->length_align;
}
remainder = strlen (ptr_message->message + offset);
- if (view->window->win_chat_cursor_x + remainder >
- view->window->win_chat_width - 1)
+ if (window->win_chat_cursor_x + remainder >
+ window->win_chat_width - 1)
{
- num_displayed = view->window->win_chat_width -
- view->window->win_chat_cursor_x;
+ num_displayed = window->win_chat_width -
+ window->win_chat_cursor_x;
saved_char = ptr_message->message[offset + num_displayed];
ptr_message->message[offset + num_displayed] = '\0';
if (lines_displayed >= num_lines - count)
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
ptr_message->message[offset + num_displayed] = saved_char;
offset += num_displayed;
@@ -432,28 +416,28 @@ gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
{
num_displayed = remainder;
if (lines_displayed >= num_lines - count)
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
ptr_message = ptr_message->next_message;
offset = 0;
}
- view->window->win_chat_cursor_x += num_displayed;
+ window->win_chat_cursor_x += num_displayed;
if (!ptr_message ||
- (view->window->win_chat_cursor_x > (view->window->win_chat_width - 1)))
+ (window->win_chat_cursor_x > (window->win_chat_width - 1)))
{
if (lines_displayed >= num_lines - count)
{
- if (view->window->win_chat_cursor_x <= view->window->win_chat_width - 1)
+ if (window->win_chat_cursor_x <= window->win_chat_width - 1)
{
snprintf (format_empty, 32, "%%-%ds",
- view->window->win_chat_width - view->window->win_chat_cursor_x);
- wprintw (view->window->win_chat, format_empty, " ");
+ window->win_chat_width - window->win_chat_cursor_x);
+ wprintw (window->win_chat, format_empty, " ");
}
- view->window->win_chat_cursor_y++;
+ window->win_chat_cursor_y++;
}
- view->window->win_chat_cursor_x = 0;
+ window->win_chat_cursor_x = 0;
lines_displayed++;
}
}
@@ -468,7 +452,7 @@ gui_display_end_of_line (t_gui_view *view, t_gui_line *line, int count)
*/
int
-gui_display_line (t_gui_view *view, t_gui_line *line, int stop_at_end)
+gui_display_line (t_gui_window *window, t_gui_line *line, int stop_at_end)
{
int offset, remainder, num_displayed;
t_gui_message *ptr_message;
@@ -480,46 +464,46 @@ gui_display_line (t_gui_view *view, t_gui_line *line, int stop_at_end)
while (ptr_message)
{
/* cursor is below end line of chat window */
- if (view->window->win_chat_cursor_y > view->window->win_chat_height - 1)
+ if (window->win_chat_cursor_y > window->win_chat_height - 1)
{
/*if (!stop_at_end)
- wscrl (view->window->win_chat, +1);*/
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = view->window->win_chat_height - 1;
+ wscrl (buffer->window->win_chat, +1);*/
+ window->win_chat_cursor_x = 0;
+ window->win_chat_cursor_y = window->win_chat_height - 1;
if (stop_at_end)
return 0;
- view->first_line_displayed = 0;
+ window->first_line_displayed = 0;
}
/* set text color if beginning of message */
if (offset == 0)
- gui_window_set_color (view->window->win_chat, ptr_message->color);
+ gui_window_set_color (window->win_chat, ptr_message->color);
/* insert spaces for align text under time/nick */
- if ((view->window->win_chat_cursor_x == 0) &&
+ if ((window->win_chat_cursor_x == 0) &&
(ptr_message->type != MSG_TYPE_TIME) &&
(ptr_message->type != MSG_TYPE_NICK) &&
(line->length_align > 0) &&
/* TODO: modify arbitraty value for non aligning messages on time/nick? */
- (line->length_align < (view->window->win_chat_width - 5)))
+ (line->length_align < (window->win_chat_width - 5)))
{
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
format_align, " ");
- view->window->win_chat_cursor_x += line->length_align;
+ window->win_chat_cursor_x += line->length_align;
}
remainder = strlen (ptr_message->message + offset);
- if (view->window->win_chat_cursor_x + remainder > view->window->win_chat_width)
+ if (window->win_chat_cursor_x + remainder > window->win_chat_width)
{
- num_displayed = view->window->win_chat_width -
- view->window->win_chat_cursor_x;
+ num_displayed = window->win_chat_width -
+ window->win_chat_cursor_x;
saved_char = ptr_message->message[offset + num_displayed];
ptr_message->message[offset + num_displayed] = '\0';
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
ptr_message->message[offset + num_displayed] = saved_char;
offset += num_displayed;
@@ -527,515 +511,475 @@ gui_display_line (t_gui_view *view, t_gui_line *line, int stop_at_end)
else
{
num_displayed = remainder;
- mvwprintw (view->window->win_chat,
- view->window->win_chat_cursor_y,
- view->window->win_chat_cursor_x,
+ mvwprintw (window->win_chat,
+ window->win_chat_cursor_y,
+ window->win_chat_cursor_x,
"%s", ptr_message->message + offset);
offset = 0;
ptr_message = ptr_message->next_message;
}
- view->window->win_chat_cursor_x += num_displayed;
+ window->win_chat_cursor_x += num_displayed;
if (!ptr_message ||
- (view->window->win_chat_cursor_x > (view->window->win_chat_width - 1)))
+ (window->win_chat_cursor_x > (window->win_chat_width - 1)))
{
if (!ptr_message ||
- ((view->window->win_chat_cursor_y <= view->window->win_chat_height - 1) &&
- (view->window->win_chat_cursor_x > view->window->win_chat_width - 1)))
+ ((window->win_chat_cursor_y <= window->win_chat_height - 1) &&
+ (window->win_chat_cursor_x > window->win_chat_width - 1)))
{
- if (view->window->win_chat_cursor_x <= view->window->win_chat_width - 1)
+ if (window->win_chat_cursor_x <= window->win_chat_width - 1)
{
snprintf (format_empty, 32, "%%-%ds",
- view->window->win_chat_width - view->window->win_chat_cursor_x);
- wprintw (view->window->win_chat, format_empty, " ");
+ window->win_chat_width - window->win_chat_cursor_x);
+ wprintw (window->win_chat, format_empty, " ");
}
- view->window->win_chat_cursor_y++;
+ window->win_chat_cursor_y++;
}
- view->window->win_chat_cursor_x = 0;
+ window->win_chat_cursor_x = 0;
}
}
return 1;
}
/*
- * gui_draw_view_chat: draw chat window for a view
+ * gui_draw_buffer_chat: draw chat window for a buffer
*/
void
-gui_draw_view_chat (t_gui_view *view)
+gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
t_gui_line *ptr_line;
- int lines_used;
-
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- gui_window_set_color (view->window->win_chat, COLOR_WIN_CHAT);
+ char format_empty[32];
+ int i, lines_used;
- ptr_line = view->last_line;
- lines_used = 0;
- while (ptr_line
- && (lines_used < (view->window->win_chat_height + view->sub_lines)))
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- lines_used += gui_get_line_num_splits (view, ptr_line);
- ptr_line = ptr_line->prev_line;
- }
- view->window->win_chat_cursor_x = 0;
- view->window->win_chat_cursor_y = 0;
- if (lines_used > (view->window->win_chat_height + view->sub_lines))
- {
- /* screen will be full (we'll display only end of 1st line) */
- ptr_line = (ptr_line) ? ptr_line->next_line : view->lines;
- gui_display_end_of_line (view, ptr_line,
- gui_get_line_num_splits (view, ptr_line) -
- (lines_used - (view->window->win_chat_height + view->sub_lines)));
- ptr_line = ptr_line->next_line;
- view->first_line_displayed = 0;
- }
- else
- {
- /* all lines are displayed */
- if (!ptr_line)
+ if (ptr_win->buffer == buffer)
{
- view->first_line_displayed = 1;
- ptr_line = view->lines;
- }
- else
- {
- view->first_line_displayed = 0;
- ptr_line = ptr_line->next_line;
+ if (erase)
+ {
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
+
+ snprintf (format_empty, 32, "%%-%ds", ptr_win->win_chat_width);
+ for (i = 0; i < ptr_win->win_chat_height; i++)
+ {
+ mvwprintw (ptr_win->win_chat, i, 0, format_empty, " ");
+ }
+ }
+
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
+
+ ptr_line = buffer->last_line;
+ lines_used = 0;
+ while (ptr_line
+ && (lines_used < (ptr_win->win_chat_height + ptr_win->sub_lines)))
+ {
+ lines_used += gui_get_line_num_splits (ptr_win, ptr_line);
+ ptr_line = ptr_line->prev_line;
+ }
+ ptr_win->win_chat_cursor_x = 0;
+ ptr_win->win_chat_cursor_y = 0;
+ if (lines_used > (ptr_win->win_chat_height + ptr_win->sub_lines))
+ {
+ /* screen will be full (we'll display only end of 1st line) */
+ ptr_line = (ptr_line) ? ptr_line->next_line : buffer->lines;
+ gui_display_end_of_line (ptr_win, ptr_line,
+ gui_get_line_num_splits (ptr_win, ptr_line) -
+ (lines_used - (ptr_win->win_chat_height + ptr_win->sub_lines)));
+ ptr_line = ptr_line->next_line;
+ ptr_win->first_line_displayed = 0;
+ }
+ else
+ {
+ /* all lines are displayed */
+ if (!ptr_line)
+ {
+ ptr_win->first_line_displayed = 1;
+ ptr_line = buffer->lines;
+ }
+ else
+ {
+ ptr_win->first_line_displayed = 0;
+ ptr_line = ptr_line->next_line;
+ }
+ }
+ while (ptr_line)
+ {
+ if (!gui_display_line (ptr_win, ptr_line, 1))
+ break;
+
+ ptr_line = ptr_line->next_line;
+ }
+ /*if (ptr_win->win_chat_cursor_y <= ptr_win->win_chat_height - 1)
+ buffer->sub_lines = 0;*/
+ wrefresh (ptr_win->win_chat);
+ refresh ();
}
}
- while (ptr_line)
- {
- if (!gui_display_line (view, ptr_line, 1))
- break;
-
- ptr_line = ptr_line->next_line;
- }
- /*if (view->window->win_chat_cursor_y <= view->window->win_chat_height - 1)
- view->sub_lines = 0;*/
- wrefresh (view->window->win_chat);
- refresh ();
-}
-
-/*
- * gui_redraw_view_chat: redraw chat window for a view
- */
-
-void
-gui_redraw_view_chat (t_gui_view *view)
-{
- char format_empty[32];
- int i;
-
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- gui_window_set_color (view->window->win_chat, COLOR_WIN_CHAT);
-
- snprintf (format_empty, 32, "%%-%ds", view->window->win_chat_width);
- for (i = 0; i < view->window->win_chat_height; i++)
- {
- mvwprintw (view->window->win_chat, i, 0, format_empty, " ");
- }
-
- gui_draw_view_chat (view);
}
/*
- * gui_draw_view_nick: draw nick window for a view
+ * gui_draw_buffer_nick: draw nick window for a buffer
*/
void
-gui_draw_view_nick (t_gui_view *view)
+gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
int i, x, y, column, max_length;
char format[32], format_empty[32];
t_irc_nick *ptr_nick;
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (CHANNEL(view) && CHANNEL(view)->nicks)
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- max_length = nick_get_max_length (CHANNEL(view));
- if ((view == gui_current_view) &&
- ((max_length + 2) != view->window->win_nick_width))
+ if (ptr_win->buffer == buffer)
{
- gui_calculate_pos_size (view);
- delwin (view->window->win_chat);
- delwin (view->window->win_nick);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- view->window->win_nick = newwin (view->window->win_nick_height,
- view->window->win_nick_width,
- view->window->win_nick_y,
- view->window->win_nick_x);
- gui_redraw_view_chat (view);
-
- if (has_colors ())
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
-
- snprintf (format_empty, 32, "%%-%ds", view->window->win_nick_width);
- for (i = 0; i < view->window->win_nick_height; i++)
+ if (erase)
{
- mvwprintw (view->window->win_nick, i, 0, format_empty, " ");
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+
+ snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
+ for (i = 0; i < ptr_win->win_nick_height; i++)
+ {
+ mvwprintw (ptr_win->win_nick, i, 0, format_empty, " ");
+ }
}
- }
- snprintf (format, 32, "%%-%ds", max_length);
- if (has_colors ())
- {
- switch (cfg_look_nicklist_position)
- {
- case CFG_LOOK_NICKLIST_LEFT:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_SEP);
- for (i = 0; i < view->window->win_chat_height; i++)
- mvwprintw (view->window->win_nick,
- i, view->window->win_nick_width - 1, " ");
- break;
- case CFG_LOOK_NICKLIST_RIGHT:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_SEP);
- for (i = 0; i < view->window->win_chat_height; i++)
- mvwprintw (view->window->win_nick,
- i, 0, " ");
- break;
- case CFG_LOOK_NICKLIST_TOP:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- for (i = 0; i < view->window->win_chat_width; i += 2)
- mvwprintw (view->window->win_nick,
- view->window->win_nick_height - 1, i, "-");
- break;
- case CFG_LOOK_NICKLIST_BOTTOM:
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- for (i = 0; i < view->window->win_chat_width; i += 2)
- mvwprintw (view->window->win_nick,
- 0, i, "-");
- break;
- }
- }
-
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- x = 0;
- y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0;
- column = 0;
- for (ptr_nick = CHANNEL(view)->nicks; ptr_nick;
- ptr_nick = ptr_nick->next_nick)
- {
- switch (cfg_look_nicklist_position)
+ if (CHANNEL(buffer) && CHANNEL(buffer)->nicks)
{
- case CFG_LOOK_NICKLIST_LEFT:
- x = 0;
- break;
- case CFG_LOOK_NICKLIST_RIGHT:
- x = 1;
- break;
- case CFG_LOOK_NICKLIST_TOP:
- case CFG_LOOK_NICKLIST_BOTTOM:
- x = column;
- break;
- }
- if (ptr_nick->is_op)
- {
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_OP);
- mvwprintw (view->window->win_nick, y, x, "@");
- x++;
- }
- else
- {
- if (ptr_nick->is_halfop)
+ max_length = nick_get_max_length (CHANNEL(buffer));
+ if ((buffer == gui_current_window->buffer) &&
+ ((max_length + 2) != ptr_win->win_nick_width))
{
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_HALFOP);
- mvwprintw (view->window->win_nick, y, x, "%%");
- x++;
+ gui_calculate_pos_size (ptr_win);
+ delwin (ptr_win->win_chat);
+ delwin (ptr_win->win_nick);
+ ptr_win->win_chat = newwin (ptr_win->win_chat_height,
+ ptr_win->win_chat_width,
+ ptr_win->win_chat_y,
+ ptr_win->win_chat_x);
+ ptr_win->win_nick = newwin (ptr_win->win_nick_height,
+ ptr_win->win_nick_width,
+ ptr_win->win_nick_y,
+ ptr_win->win_nick_x);
+ gui_draw_buffer_chat (buffer, 1);
+
+ if (has_colors ())
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+
+ snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
+ for (i = 0; i < ptr_win->win_nick_height; i++)
+ {
+ mvwprintw (ptr_win->win_nick, i, 0, format_empty, " ");
+ }
}
- else
+ snprintf (format, 32, "%%-%ds", max_length);
+
+ if (has_colors ())
{
- if (ptr_nick->has_voice)
+ switch (cfg_look_nicklist_position)
{
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK_VOICE);
- mvwprintw (view->window->win_nick, y, x, "+");
+ case CFG_LOOK_NICKLIST_LEFT:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
+ for (i = 0; i < ptr_win->win_chat_height; i++)
+ mvwprintw (ptr_win->win_nick,
+ i, ptr_win->win_nick_width - 1, " ");
+ break;
+ case CFG_LOOK_NICKLIST_RIGHT:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_SEP);
+ for (i = 0; i < ptr_win->win_chat_height; i++)
+ mvwprintw (ptr_win->win_nick,
+ i, 0, " ");
+ break;
+ case CFG_LOOK_NICKLIST_TOP:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ for (i = 0; i < ptr_win->win_chat_width; i += 2)
+ mvwprintw (ptr_win->win_nick,
+ ptr_win->win_nick_height - 1, i, "-");
+ break;
+ case CFG_LOOK_NICKLIST_BOTTOM:
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ for (i = 0; i < ptr_win->win_chat_width; i += 2)
+ mvwprintw (ptr_win->win_nick,
+ 0, i, "-");
+ break;
+ }
+ }
+
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ x = 0;
+ y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0;
+ column = 0;
+ for (ptr_nick = CHANNEL(buffer)->nicks; ptr_nick;
+ ptr_nick = ptr_nick->next_nick)
+ {
+ switch (cfg_look_nicklist_position)
+ {
+ case CFG_LOOK_NICKLIST_LEFT:
+ x = 0;
+ break;
+ case CFG_LOOK_NICKLIST_RIGHT:
+ x = 1;
+ break;
+ case CFG_LOOK_NICKLIST_TOP:
+ case CFG_LOOK_NICKLIST_BOTTOM:
+ x = column;
+ break;
+ }
+ if (ptr_nick->is_op)
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_OP);
+ mvwprintw (ptr_win->win_nick, y, x, "@");
x++;
}
else
{
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- mvwprintw (view->window->win_nick, y, x, " ");
- x++;
+ if (ptr_nick->is_halfop)
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_HALFOP);
+ mvwprintw (ptr_win->win_nick, y, x, "%%");
+ x++;
+ }
+ else
+ {
+ if (ptr_nick->has_voice)
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK_VOICE);
+ mvwprintw (ptr_win->win_nick, y, x, "+");
+ x++;
+ }
+ else
+ {
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ mvwprintw (ptr_win->win_nick, y, x, " ");
+ x++;
+ }
+ }
+ }
+ gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
+ mvwprintw (ptr_win->win_nick, y, x, format, ptr_nick->nick);
+ y++;
+ if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
+ (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
+ {
+ if (y - ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0) >= ptr_win->win_nick_height - 1)
+ {
+ column += max_length + 2;
+ y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ?
+ 0 : 1;
+ }
}
}
}
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
- mvwprintw (view->window->win_nick, y, x, format, ptr_nick->nick);
- y++;
- if ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ||
- (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM))
- {
- if (y - ((cfg_look_nicklist_position == CFG_LOOK_NICKLIST_BOTTOM) ? 1 : 0) >= view->window->win_nick_height - 1)
- {
- column += max_length + 2;
- y = (cfg_look_nicklist_position == CFG_LOOK_NICKLIST_TOP) ?
- 0 : 1;
- }
- }
+ wrefresh (ptr_win->win_nick);
+ refresh ();
}
}
- wrefresh (view->window->win_nick);
- refresh ();
}
/*
- * gui_redraw_view_nick: redraw nick window for a view
+ * gui_draw_buffer_status: draw status window for a buffer
*/
void
-gui_redraw_view_nick (t_gui_view *view)
+gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
{
- char format_empty[32];
- int i;
-
- /* TODO: manage splitted windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- gui_window_set_color (view->window->win_nick, COLOR_WIN_NICK);
-
- snprintf (format_empty, 32, "%%-%ds", view->window->win_nick_width);
- for (i = 0; i < view->window->win_nick_height; i++)
- {
- mvwprintw (view->window->win_nick, i, 0, format_empty, " ");
- }
-
- gui_draw_view_nick (view);
-}
-
-/*
- * gui_draw_view_status: draw status window for a view
- */
-
-void
-gui_draw_view_status (t_gui_view *view)
-{
- t_gui_view *ptr_view;
+ t_gui_window *ptr_win;
+ t_gui_buffer *ptr_buffer;
char format_more[32];
int i, first_mode;
- /* TODO: manage splitted windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- {
- gui_window_set_color (view->window->win_status, COLOR_WIN_STATUS);
- wborder (view->window->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_status);
- }
- wmove (view->window->win_status, 0, 0);
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- if (SERVER(ptr_view) && !CHANNEL(ptr_view))
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_status);
+
+ if (has_colors ())
{
- if (gui_current_view == SERVER(ptr_view)->view)
+ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
+ wborder (ptr_win->win_status, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_status);
+ }
+ wmove (ptr_win->win_status, 0, 0);
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ {
+ if (SERVER(ptr_buffer) && !CHANNEL(ptr_buffer))
{
- if (ptr_view->unread_data)
+ if (ptr_win->buffer == SERVER(ptr_buffer)->buffer)
{
- if (ptr_view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if (ptr_buffer->unread_data)
+ {
+ if (ptr_buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_ACTIVE);
}
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_ACTIVE);
- }
- else
- {
- if (SERVER(ptr_view)->view &&
- ((SERVER(ptr_view)->view)->unread_data))
{
- if (SERVER(ptr_view)->view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if (SERVER(ptr_buffer)->buffer &&
+ ((SERVER(ptr_buffer)->buffer)->unread_data))
+ {
+ if (SERVER(ptr_buffer)->buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS);
}
+ if (SERVER(ptr_buffer)->is_connected)
+ wprintw (ptr_win->win_status, "[%s] ",
+ SERVER(ptr_buffer)->name);
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS);
+ wprintw (ptr_win->win_status, "(%s) ",
+ SERVER(ptr_buffer)->name);
}
- if (SERVER(ptr_view)->is_connected)
- wprintw (view->window->win_status, "[%s] ",
- SERVER(ptr_view)->name);
- else
- wprintw (view->window->win_status, "(%s) ",
- SERVER(ptr_view)->name);
- }
- if (SERVER(ptr_view) && CHANNEL(ptr_view))
- {
- if (gui_current_view == CHANNEL(ptr_view)->view)
+ if (SERVER(ptr_buffer) && CHANNEL(ptr_buffer))
{
- if ((CHANNEL(ptr_view)->view) &&
- (CHANNEL(ptr_view)->view->unread_data))
+ if (ptr_win->buffer == CHANNEL(ptr_buffer)->buffer)
{
- if (CHANNEL(ptr_view)->view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if ((CHANNEL(ptr_buffer)->buffer) &&
+ (CHANNEL(ptr_buffer)->buffer->unread_data))
+ {
+ if (CHANNEL(ptr_buffer)->buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_ACTIVE);
}
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_ACTIVE);
- }
- else
- {
- if ((CHANNEL(ptr_view)->view) &&
- (CHANNEL(ptr_view)->view->unread_data))
{
- if (CHANNEL(ptr_view)->view->unread_data > 1)
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_MSG);
+ if ((CHANNEL(ptr_buffer)->buffer) &&
+ (CHANNEL(ptr_buffer)->buffer->unread_data))
+ {
+ if (CHANNEL(ptr_buffer)->buffer->unread_data > 1)
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_MSG);
+ else
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS_DATA_OTHER);
+ }
else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS_DATA_OTHER);
+ gui_window_set_color (ptr_win->win_status,
+ COLOR_WIN_STATUS);
}
- else
- gui_window_set_color (view->window->win_status,
- COLOR_WIN_STATUS);
- }
- wprintw (view->window->win_status, "%s", CHANNEL(ptr_view)->name);
- if (gui_current_view == CHANNEL(ptr_view)->view)
- {
- /* display channel modes */
- wprintw (view->window->win_status, "(");
- i = 0;
- first_mode = 1;
- while (CHANNEL(ptr_view)->modes[i])
+ wprintw (ptr_win->win_status, "%s", CHANNEL(ptr_buffer)->name);
+ if (ptr_win->buffer == CHANNEL(ptr_buffer)->buffer)
{
- if (CHANNEL(ptr_view)->modes[i] != ' ')
+ /* display channel modes */
+ wprintw (ptr_win->win_status, "(");
+ i = 0;
+ first_mode = 1;
+ while (CHANNEL(ptr_buffer)->modes[i])
{
- if (first_mode)
+ if (CHANNEL(ptr_buffer)->modes[i] != ' ')
{
- wprintw (view->window->win_status, "+");
- first_mode = 0;
+ if (first_mode)
+ {
+ wprintw (ptr_win->win_status, "+");
+ first_mode = 0;
+ }
+ wprintw (ptr_win->win_status, "%c",
+ CHANNEL(ptr_buffer)->modes[i]);
}
- wprintw (view->window->win_status, "%c",
- CHANNEL(ptr_view)->modes[i]);
+ i++;
}
- i++;
+ if (CHANNEL(ptr_buffer)->modes[CHANNEL_MODE_KEY] != ' ')
+ wprintw (ptr_win->win_status, ",%s",
+ CHANNEL(ptr_buffer)->key);
+ if (CHANNEL(ptr_buffer)->modes[CHANNEL_MODE_LIMIT] != ' ')
+ wprintw (ptr_win->win_status, ",%d",
+ CHANNEL(ptr_buffer)->limit);
+ wprintw (ptr_win->win_status, ")");
}
- if (CHANNEL(ptr_view)->modes[CHANNEL_MODE_KEY] != ' ')
- wprintw (view->window->win_status, ",%s",
- CHANNEL(ptr_view)->key);
- if (CHANNEL(ptr_view)->modes[CHANNEL_MODE_LIMIT] != ' ')
- wprintw (view->window->win_status, ",%d",
- CHANNEL(ptr_view)->limit);
- wprintw (view->window->win_status, ")");
+ wprintw (ptr_win->win_status, " ");
+ }
+ if (!SERVER(ptr_buffer))
+ {
+ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
+ wprintw (ptr_win->win_status, _("[not connected] "));
}
- wprintw (view->window->win_status, " ");
}
- if (!SERVER(ptr_view))
+
+ /* display "-MORE-" if last line is not displayed */
+ gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE);
+ if (ptr_win->sub_lines > 0)
+ mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
+ _("-MORE-"));
+ else
{
- gui_window_set_color (view->window->win_status, COLOR_WIN_STATUS);
- wprintw (view->window->win_status, _("[not connected] "));
+ snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
+ mvwprintw (ptr_win->win_status, 0, ptr_win->win_width - 7,
+ format_more, " ");
}
+
+ wrefresh (ptr_win->win_status);
+ refresh ();
}
-
- /* display "-MORE-" if last line is not displayed */
- gui_window_set_color (view->window->win_status, COLOR_WIN_STATUS_MORE);
- if (view->sub_lines > 0)
- mvwprintw (view->window->win_status, 0, COLS - 7, _("-MORE-"));
- else
- {
- snprintf (format_more, 32, "%%-%ds", strlen (_("-MORE-")));
- mvwprintw (view->window->win_status, 0, COLS - 7, format_more, " ");
- }
-
- wrefresh (view->window->win_status);
- refresh ();
-}
-
-/*
- * gui_redraw_view_status: redraw status window for a view
- */
-
-void
-gui_redraw_view_status (t_gui_view *view)
-{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- gui_curses_window_clear (view->window->win_status);
- gui_draw_view_status (view);
}
/*
- * gui_draw_view_infobar: draw infobar window for a view
+ * gui_draw_buffer_infobar: draw infobar window for a buffer
*/
void
-gui_draw_view_infobar (t_gui_view *view)
+gui_draw_buffer_infobar (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
time_t time_seconds;
struct tm *local_time;
char text[1024 + 1];
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- gui_window_set_color (view->window->win_infobar, COLOR_WIN_INFOBAR);
- wborder (view->window->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_infobar);
- }
- wmove (view->window->win_infobar, 0, 0);
+ if (ptr_win->buffer == buffer)
+ {
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_infobar);
- time_seconds = time (NULL);
- local_time = localtime (&time_seconds);
- if (local_time)
- {
- strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
- gui_window_set_color (view->window->win_infobar, COLOR_WIN_INFOBAR);
- wprintw (view->window->win_infobar, "%s", text);
- }
- if (gui_infobar)
- {
- gui_window_set_color (view->window->win_infobar, gui_infobar->color);
- wprintw (view->window->win_infobar, " | %s", gui_infobar->text);
+ if (has_colors ())
+ {
+ gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
+ wborder (ptr_win->win_infobar, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_infobar);
+ }
+ wmove (ptr_win->win_infobar, 0, 0);
+
+ time_seconds = time (NULL);
+ local_time = localtime (&time_seconds);
+ if (local_time)
+ {
+ strftime (text, 1024, cfg_look_infobar_timestamp, local_time);
+ gui_window_set_color (ptr_win->win_infobar, COLOR_WIN_INFOBAR);
+ wprintw (ptr_win->win_infobar, "%s", text);
+ }
+ if (gui_infobar)
+ {
+ gui_window_set_color (ptr_win->win_infobar, gui_infobar->color);
+ wprintw (ptr_win->win_infobar, " | %s", gui_infobar->text);
+ }
+
+ wrefresh (ptr_win->win_infobar);
+ refresh ();
+ }
}
-
- wrefresh (view->window->win_infobar);
- refresh ();
-}
-
-/*
- * gui_redraw_view_infobar: redraw infobar window for a view
- */
-
-void
-gui_redraw_view_infobar (t_gui_view *view)
-{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- gui_curses_window_clear (view->window->win_infobar);
- gui_draw_view_infobar (view);
}
/*
@@ -1043,337 +987,342 @@ gui_redraw_view_infobar (t_gui_view *view)
*/
int
-gui_get_input_width (t_gui_view *view)
+gui_get_input_width (t_gui_window *window)
{
- if (CHANNEL(view))
- return (COLS - strlen (CHANNEL(view)->name) -
- strlen (SERVER(view)->nick) - 3);
+ if (CHANNEL(window->buffer))
+ return (window->win_width - strlen (CHANNEL(window->buffer)->name) -
+ strlen (SERVER(window->buffer)->nick) - 3);
else
{
- if (SERVER(view) && (SERVER(view)->is_connected))
- return (COLS - strlen (SERVER(view)->nick) - 2);
+ if (SERVER(window->buffer) && (SERVER(window->buffer)->is_connected))
+ return (window->win_width - strlen (SERVER(window->buffer)->nick) - 2);
else
- return (COLS - strlen (cfg_look_no_nickname) - 2);
+ return (window->win_width - strlen (cfg_look_no_nickname) - 2);
}
}
/*
- * gui_draw_view_input: draw input window for a view
+ * gui_draw_buffer_input: draw input window for a buffer
*/
void
-gui_draw_view_input (t_gui_view *view)
+gui_draw_buffer_input (t_gui_buffer *buffer, int erase)
{
+ t_gui_window *ptr_win;
char format[32];
char *ptr_nickname;
int input_width;
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
-
- if (has_colors ())
- {
- gui_window_set_color (view->window->win_input, COLOR_WIN_INPUT);
- wborder (view->window->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
- wrefresh (view->window->win_input);
- }
-
- if (view->input_buffer_size == 0)
- view->input_buffer[0] = '\0';
-
- input_width = gui_get_input_width (view);
-
- if (view->input_buffer_pos - view->input_buffer_1st_display + 1 >
- input_width)
- view->input_buffer_1st_display = view->input_buffer_pos -
- input_width + 1;
- else
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- if (view->input_buffer_pos < view->input_buffer_1st_display)
- view->input_buffer_1st_display = view->input_buffer_pos;
- else
+ if (ptr_win->buffer == buffer)
{
- if ((view->input_buffer_1st_display > 0) &&
- (view->input_buffer_pos -
- view->input_buffer_1st_display + 1) < input_width)
+ if (erase)
+ gui_curses_window_clear (ptr_win->win_input);
+
+ if (has_colors ())
{
- view->input_buffer_1st_display =
- view->input_buffer_pos - input_width + 1;
- if (view->input_buffer_1st_display < 0)
- view->input_buffer_1st_display = 0;
+ gui_window_set_color (ptr_win->win_input, COLOR_WIN_INPUT);
+ wborder (ptr_win->win_input, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (ptr_win->win_input);
}
- }
- }
- if (CHANNEL(view))
- {
- snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
- mvwprintw (view->window->win_input, 0, 0, format,
- CHANNEL(view)->name,
- SERVER(view)->nick,
- view->input_buffer + view->input_buffer_1st_display);
- wclrtoeol (view->window->win_input);
- move (LINES - 1, strlen (CHANNEL(view)->name) +
- strlen (SERVER(view)->nick) + 3 +
- (view->input_buffer_pos - view->input_buffer_1st_display));
- }
- else
- {
- if (SERVER(view))
- {
- snprintf (format, 32, "%%s> %%-%ds", input_width);
- if (SERVER(view) && (SERVER(view)->is_connected))
- ptr_nickname = SERVER(view)->nick;
+
+ if (buffer->input_buffer_size == 0)
+ buffer->input_buffer[0] = '\0';
+
+ input_width = gui_get_input_width (ptr_win);
+
+ if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
+ input_width)
+ buffer->input_buffer_1st_display = buffer->input_buffer_pos -
+ input_width + 1;
else
- ptr_nickname = cfg_look_no_nickname;
- mvwprintw (view->window->win_input, 0, 0, format,
- ptr_nickname,
- view->input_buffer + view->input_buffer_1st_display);
- wclrtoeol (view->window->win_input);
- move (LINES - 1, strlen (ptr_nickname) + 2 +
- (view->input_buffer_pos - view->input_buffer_1st_display));
- }
- else
- {
- snprintf (format, 32, "%%s> %%-%ds", input_width);
- if (SERVER(view) && (SERVER(view)->is_connected))
- ptr_nickname = SERVER(view)->nick;
+ {
+ if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
+ buffer->input_buffer_1st_display = buffer->input_buffer_pos;
+ else
+ {
+ if ((buffer->input_buffer_1st_display > 0) &&
+ (buffer->input_buffer_pos -
+ buffer->input_buffer_1st_display + 1) < input_width)
+ {
+ buffer->input_buffer_1st_display =
+ buffer->input_buffer_pos - input_width + 1;
+ if (buffer->input_buffer_1st_display < 0)
+ buffer->input_buffer_1st_display = 0;
+ }
+ }
+ }
+ if (CHANNEL(buffer))
+ {
+ snprintf (format, 32, "%%s %%s> %%-%ds", input_width);
+ if (ptr_win == gui_current_window)
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ CHANNEL(buffer)->name,
+ SERVER(buffer)->nick,
+ buffer->input_buffer + buffer->input_buffer_1st_display);
+ else
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ CHANNEL(buffer)->name,
+ SERVER(buffer)->nick,
+ "");
+ wclrtoeol (ptr_win->win_input);
+ if (ptr_win == gui_current_window)
+ move (ptr_win->win_y + ptr_win->win_height - 1,
+ ptr_win->win_x + strlen (CHANNEL(buffer)->name) +
+ strlen (SERVER(buffer)->nick) + 3 +
+ (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
+ }
else
- ptr_nickname = cfg_look_no_nickname;
- mvwprintw (view->window->win_input, 0, 0, format,
- ptr_nickname,
- view->input_buffer + view->input_buffer_1st_display);
- wclrtoeol (view->window->win_input);
- move (LINES - 1, strlen (ptr_nickname) + 2 +
- (view->input_buffer_pos - view->input_buffer_1st_display));
+ {
+ if (SERVER(buffer))
+ {
+ snprintf (format, 32, "%%s> %%-%ds", input_width);
+ if (SERVER(buffer) && (SERVER(buffer)->is_connected))
+ ptr_nickname = SERVER(buffer)->nick;
+ else
+ ptr_nickname = cfg_look_no_nickname;
+ if (ptr_win == gui_current_window)
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ buffer->input_buffer + buffer->input_buffer_1st_display);
+ else
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ "");
+ wclrtoeol (ptr_win->win_input);
+ if (ptr_win == gui_current_window)
+ move (ptr_win->win_y + ptr_win->win_height - 1,
+ ptr_win->win_x + strlen (ptr_nickname) + 2 +
+ (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
+ }
+ else
+ {
+ snprintf (format, 32, "%%s> %%-%ds", input_width);
+ if (SERVER(buffer) && (SERVER(buffer)->is_connected))
+ ptr_nickname = SERVER(buffer)->nick;
+ else
+ ptr_nickname = cfg_look_no_nickname;
+ if (ptr_win == gui_current_window)
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ buffer->input_buffer + buffer->input_buffer_1st_display);
+ else
+ mvwprintw (ptr_win->win_input, 0, 0, format,
+ ptr_nickname,
+ "");
+ wclrtoeol (ptr_win->win_input);
+ if (ptr_win == gui_current_window)
+ move (ptr_win->win_y + ptr_win->win_height - 1,
+ ptr_win->win_x + strlen (ptr_nickname) + 2 +
+ (buffer->input_buffer_pos - buffer->input_buffer_1st_display));
+ }
+ }
+
+ wrefresh (ptr_win->win_input);
+ refresh ();
}
}
-
- wrefresh (view->window->win_input);
- refresh ();
}
/*
- * gui_redraw_view_input: redraw input window for a view
+ * gui_redraw_buffer: redraw a buffer
*/
void
-gui_redraw_view_input (t_gui_view *view)
+gui_redraw_buffer (t_gui_buffer *buffer)
{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
+ t_gui_window *ptr_win;
- gui_curses_window_clear (view->window->win_input);
- gui_draw_view_input (view);
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ {
+ if (ptr_win->buffer == buffer)
+ {
+ gui_draw_buffer_title (buffer, 1);
+ gui_draw_buffer_chat (buffer, 1);
+ if (ptr_win->win_nick)
+ gui_draw_buffer_nick (buffer, 1);
+ gui_draw_buffer_status (buffer, 1);
+ if (cfg_look_infobar)
+ gui_draw_buffer_infobar (buffer, 1);
+ gui_draw_buffer_input (buffer, 1);
+ }
+ }
}
/*
- * gui_redraw_view: redraw a view
+ * gui_switch_to_buffer: switch to another buffer
*/
void
-gui_redraw_view (t_gui_view *view)
+gui_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
{
- /* TODO: manage splited windows! */
- if (view != gui_current_view)
- return;
+ if (gui_current_window->buffer->num_displayed > 0)
+ gui_current_window->buffer->num_displayed--;
- gui_redraw_view_title (view);
- gui_redraw_view_chat (view);
- if (view->window->win_nick)
- gui_redraw_view_nick (view);
- gui_redraw_view_status (view);
- if (cfg_look_infobar)
- gui_redraw_view_infobar (view);
- gui_redraw_view_input (view);
-}
-
-/*
- * gui_switch_to_view: switch to another view
- */
-
-void
-gui_switch_to_view (t_gui_view *view)
-{
- int another_view;
- t_gui_view *ptr_view;
+ window->buffer = buffer;
+ gui_calculate_pos_size (window);
- another_view = 0;
- /*for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ /* destroy Curses windows */
+ if (window->win_title)
{
- if (ptr_view->is_displayed)
- {*/
- /* TODO: manage splited windows */
- /*another_view = 1;
- view->window->win_title = ptr_view->window->win_title;
- view->window->win_chat = ptr_view->window->win_chat;
- view->window->win_nick = ptr_view->window->win_nick;
- view->window->win_status = ptr_view->window->win_status;
- view->window->win_infobar = ptr_view->window->win_infobar;
- view->window->win_input = ptr_view->window->win_input;
- if (ptr_view != view)
- {
- ptr_view->window->win_title = NULL;
- ptr_view->window->win_chat = NULL;
- ptr_view->window->win_nick = NULL;
- ptr_view->window->win_status = NULL;
- ptr_view->window->win_infobar = NULL;
- ptr_view->window->win_input = NULL;
- ptr_view->is_displayed = 0;
- }
- break;
- }
- }*/
-
- gui_calculate_pos_size (view);
-
- /* first time creation for views */
- if (!another_view)
+ delwin (window->win_title);
+ window->win_title = NULL;
+ }
+ if (window->win_nick)
{
- /* create new views */
- view->window->win_title = newwin (1, COLS, 0, 0);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- if (cfg_look_nicklist && CHANNEL(view))
- view->window->win_nick = newwin (view->window->win_nick_height,
- view->window->win_nick_width,
- view->window->win_nick_y,
- view->window->win_nick_x);
- else
- view->window->win_nick = NULL;
- view->window->win_input = newwin (1, COLS, LINES - 1, 0);
+ delwin (window->win_nick);
+ window->win_nick = NULL;
}
- else
+ if (window->win_status)
{
- /* remove some views */
- if (view->window->win_nick)
- {
- delwin (view->window->win_nick);
- view->window->win_nick = NULL;
- }
- if (view->window->win_status)
- {
- delwin (view->window->win_status);
- view->window->win_status = NULL;
- }
- if (view->window->win_infobar)
- {
- delwin (view->window->win_infobar);
- view->window->win_infobar = NULL;
- }
+ delwin (window->win_status);
+ window->win_status = NULL;
+ }
+ if (window->win_infobar)
+ {
+ delwin (window->win_infobar);
+ window->win_infobar = NULL;
+ }
+ if (window->win_input)
+ {
+ delwin (window->win_input);
+ window->win_input = NULL;
+ }
- /* create views */
- if (VIEW_IS_CHANNEL(view))
- {
- delwin (view->window->win_chat);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- if (cfg_look_nicklist)
- view->window->win_nick = newwin (view->window->win_nick_height,
- view->window->win_nick_width,
- view->window->win_nick_y,
- view->window->win_nick_x);
- else
- view->window->win_nick = NULL;
- }
- if (!(VIEW_IS_CHANNEL(view)))
- {
- delwin (view->window->win_chat);
- view->window->win_chat = newwin (view->window->win_chat_height,
- view->window->win_chat_width,
- view->window->win_chat_y,
- view->window->win_chat_x);
- }
+ /* create Curses windows */
+ window->win_title = newwin (1,
+ window->win_width,
+ window->win_y,
+ window->win_x);
+ window->win_input = newwin (1,
+ window->win_width,
+ window->win_y + window->win_height - 1,
+ window->win_x);
+ if (BUFFER_IS_CHANNEL(buffer))
+ {
+ if (window->win_chat)
+ delwin (window->win_chat);
+ window->win_chat = newwin (window->win_chat_height,
+ window->win_chat_width,
+ window->win_chat_y,
+ window->win_chat_x);
+ if (cfg_look_nicklist)
+ window->win_nick = newwin (window->win_nick_height,
+ window->win_nick_width,
+ window->win_nick_y,
+ window->win_nick_x);
+ else
+ window->win_nick = NULL;
+ }
+ if (!(BUFFER_IS_CHANNEL(buffer)))
+ {
+ if (window->win_chat)
+ delwin (window->win_chat);
+ window->win_chat = newwin (window->win_chat_height,
+ window->win_chat_width,
+ window->win_chat_y,
+ window->win_chat_x);
}
/* create status/infobar windows */
if (cfg_look_infobar)
{
- view->window->win_infobar = newwin (1, COLS, LINES - 2, 0);
- view->window->win_status = newwin (1, COLS, LINES - 3, 0);
+ window->win_infobar = newwin (1, window->win_width, window->win_y + window->win_height - 2, window->win_x);
+ window->win_status = newwin (1, window->win_width, window->win_y + window->win_height - 3, window->win_x);
}
else
- view->window->win_status = newwin (1, COLS, LINES - 2, 0);
-
- /* change current view to the new view */
- gui_current_view = view;
+ window->win_status = newwin (1, window->win_width, window->win_y + window->win_height - 2, window->win_x);
- view->is_displayed = 1;
- view->unread_data = 0;
+ buffer->num_displayed++;
+ buffer->unread_data = 0;
}
/*
- * gui_switch_to_previous_view: switch to previous view
+ * gui_switch_to_previous_buffer: switch to previous buffer
*/
void
-gui_switch_to_previous_view ()
+gui_switch_to_previous_buffer (t_gui_window *window)
{
- /* if only one view then return */
- if (gui_views == last_gui_view)
+ /* if only one buffer then return */
+ if (gui_buffers == last_gui_buffer)
return;
- if (gui_current_view->prev_view)
- gui_switch_to_view (gui_current_view->prev_view);
+ if (window->buffer->prev_buffer)
+ gui_switch_to_buffer (window, window->buffer->prev_buffer);
else
- gui_switch_to_view (last_gui_view);
- gui_redraw_view (gui_current_view);
+ gui_switch_to_buffer (window, last_gui_buffer);
+
+ gui_redraw_buffer (window->buffer);
}
/*
- * gui_switch_to_next_view: switch to next view
+ * gui_switch_to_next_buffer: switch to next buffer
*/
void
-gui_switch_to_next_view ()
+gui_switch_to_next_buffer (t_gui_window *window)
{
- /* if only one view then return */
- if (gui_views == last_gui_view)
+ /* if only one buffer then return */
+ if (gui_buffers == last_gui_buffer)
return;
- if (gui_current_view->next_view)
- gui_switch_to_view (gui_current_view->next_view);
+ if (window->buffer->next_buffer)
+ gui_switch_to_buffer (window, window->buffer->next_buffer);
else
- gui_switch_to_view (gui_views);
- gui_redraw_view (gui_current_view);
+ gui_switch_to_buffer (window, gui_buffers);
+
+ gui_redraw_buffer (window->buffer);
}
/*
- * gui_move_page_up: display previous page on view
+ * gui_switch_to_next_window: switch to next window
*/
void
-gui_move_page_up ()
+gui_switch_to_next_window (t_gui_window *window)
{
- if (!gui_current_view->first_line_displayed)
+ /* if only one window then return */
+ if (gui_windows == last_gui_window)
+ return;
+
+ gui_current_window = (window->next_window) ? window->next_window : gui_windows;
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
+}
+
+/*
+ * gui_move_page_up: display previous page on buffer
+ */
+
+void
+gui_move_page_up (t_gui_window *window)
+{
+ if (!window->first_line_displayed)
{
- gui_current_view->sub_lines += gui_current_view->window->win_chat_height - 1;
- gui_draw_view_chat (gui_current_view);
- gui_draw_view_status (gui_current_view);
+ window->sub_lines += window->win_chat_height - 1;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
}
}
/*
- * gui_move_page_down: display next page on view
+ * gui_move_page_down: display next page on buffer
*/
void
-gui_move_page_down ()
+gui_move_page_down (t_gui_window *window)
{
- if (gui_current_view->sub_lines > 0)
+ if (window->sub_lines > 0)
{
- gui_current_view->sub_lines -= gui_current_view->window->win_chat_height - 1;
- if (gui_current_view->sub_lines < 0)
- gui_current_view->sub_lines = 0;
- if (gui_current_view->sub_lines == 0)
- gui_current_view->unread_data = 0;
- gui_draw_view_chat (gui_current_view);
- gui_draw_view_status (gui_current_view);
+ window->sub_lines -= window->win_chat_height - 1;
+ if (window->sub_lines < 0)
+ window->sub_lines = 0;
+ if (window->sub_lines == 0)
+ window->buffer->unread_data = 0;
+ gui_draw_buffer_chat (window->buffer, 0);
+ gui_draw_buffer_status (window->buffer, 0);
}
}
@@ -1384,41 +1333,32 @@ gui_move_page_down ()
void
gui_curses_resize_handler ()
{
- t_gui_view *ptr_view;
- int width, height;
+ t_gui_window *ptr_win, *old_current_window;
+ int old_width, old_height;
+ int new_width, new_height;
+
+ getmaxyx (stdscr, old_height, old_width);
endwin ();
refresh ();
- getmaxyx (stdscr, height, width);
+ getmaxyx (stdscr, new_height, new_width);
+
+ old_current_window = gui_current_window;
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ /* TODO: manage when some windows are outside new term size */
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- // TODO: manage splited windows!
- if (ptr_view->window->win_title)
- {
- ptr_view->is_displayed = 0;
- if (ptr_view->window->win_title)
- delwin (ptr_view->window->win_title);
- if (ptr_view->window->win_chat)
- delwin (ptr_view->window->win_chat);
- if (ptr_view->window->win_nick)
- delwin (ptr_view->window->win_nick);
- if (ptr_view->window->win_status)
- delwin (ptr_view->window->win_status);
- if (ptr_view->window->win_infobar)
- delwin (ptr_view->window->win_infobar);
- if (ptr_view->window->win_input)
- delwin (ptr_view->window->win_input);
- ptr_view->window->win_title = NULL;
- ptr_view->window->win_chat = NULL;
- ptr_view->window->win_nick = NULL;
- ptr_view->window->win_status = NULL;
- ptr_view->window->win_infobar = NULL;
- ptr_view->window->win_input = NULL;
- gui_switch_to_view (ptr_view);
- }
+ wee_log_printf ("win_x = %d, win_width = %d, old_width = %d\n", ptr_win->win_x, ptr_win->win_width, old_width);
+ if (ptr_win->win_x + ptr_win->win_width == old_width)
+ ptr_win->win_width = new_width - ptr_win->win_x;
+ if (ptr_win->win_y + ptr_win->win_height == old_height)
+ ptr_win->win_height = new_height - ptr_win->win_y;
+ gui_switch_to_buffer (ptr_win, ptr_win->buffer);
}
+
+ gui_current_window = old_current_window;
+ gui_draw_buffer_input (gui_current_window->buffer, 1);
}
/*
@@ -1426,14 +1366,83 @@ gui_curses_resize_handler ()
*/
void
-gui_view_init_subviews (t_gui_view *view)
+gui_window_init_subwindows (t_gui_window *window)
+{
+ window->win_title = NULL;
+ window->win_chat = NULL;
+ window->win_nick = NULL;
+ window->win_status = NULL;
+ window->win_infobar = NULL;
+ window->win_input = NULL;
+}
+
+/*
+ * gui_window_split_horiz: split a window horizontally
+ */
+
+void
+gui_window_split_horiz (t_gui_window *window)
+{
+ t_gui_window *new_window;
+ int height1, height2;
+
+ height1 = window->win_height / 2;
+ height2 = window->win_height - height1;
+ if ((new_window = gui_window_new (window->win_x, window->win_y,
+ window->win_width, height1)))
+ {
+ /* reduce old window height (bottom window) */
+ window->win_y = new_window->win_y + new_window->win_height;
+ window->win_height = height2;
+
+ /* assign same buffer for new window (top window) */
+ new_window->buffer = window->buffer;
+
+ gui_switch_to_buffer (window, window->buffer);
+
+ gui_current_window = new_window;
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
+ }
+}
+
+/*
+ * gui_window_split_vertic: split a window vertically
+ */
+
+void
+gui_window_split_vertic (t_gui_window *window)
{
- view->window->win_title = NULL;
- view->window->win_chat = NULL;
- view->window->win_nick = NULL;
- view->window->win_status = NULL;
- view->window->win_infobar = NULL;
- view->window->win_input = NULL;
+ t_gui_window *new_window;
+ int width1, width2;
+
+ width1 = window->win_width / 2;
+ width2 = window->win_width - width1 - 1;
+ if ((new_window = gui_window_new (window->win_x + width1 + 1, window->win_y,
+ width2, window->win_height)))
+ {
+ /* reduce old window height (left window) */
+ window->win_width = width1;
+
+ /* assign same buffer for new window (right window) */
+ new_window->buffer = window->buffer;
+
+ gui_switch_to_buffer (window, window->buffer);
+
+ gui_current_window = new_window;
+ gui_switch_to_buffer (gui_current_window, gui_current_window->buffer);
+ gui_redraw_buffer (gui_current_window->buffer);
+
+ /* create & draw separator if window is not on the left */
+ gui_current_window->win_separator = newwin (gui_current_window->win_height,
+ 1,
+ gui_current_window->win_y,
+ gui_current_window->win_x - 1);
+ gui_window_set_color (gui_current_window->win_separator, COLOR_WIN_TITLE);
+ wborder (gui_current_window->win_separator, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ');
+ wrefresh (gui_current_window->win_separator);
+ refresh ();
+ }
}
/*
@@ -1592,10 +1601,11 @@ gui_init ()
gui_infobar = NULL;
- /* create a new view */
- if ((gui_windows = gui_window_new (0, 0, COLS, LINES)))
+ /* create a new buffer */
+ if (gui_window_new (0, 0, COLS, LINES))
{
- gui_current_view = gui_view_new (gui_windows, NULL, NULL, 1 /*0, 0, COLS, LINES*/);
+ gui_current_window = gui_windows;
+ gui_buffer_new (gui_windows, NULL, NULL, 1);
signal (SIGWINCH, gui_curses_resize_handler);
@@ -1613,23 +1623,23 @@ gui_init ()
void
gui_end ()
{
- t_gui_view *ptr_view;
+ t_gui_window *ptr_win;
- /* delete all views */
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
+ /* delete all windows */
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
- if (ptr_view->window->win_title)
- delwin (ptr_view->window->win_title);
- if (ptr_view->window->win_chat)
- delwin (ptr_view->window->win_chat);
- if (ptr_view->window->win_nick)
- delwin (ptr_view->window->win_nick);
- if (ptr_view->window->win_status)
- delwin (ptr_view->window->win_status);
- if (ptr_view->window->win_infobar)
- delwin (ptr_view->window->win_infobar);
- if (ptr_view->window->win_input)
- delwin (ptr_view->window->win_input);
+ if (ptr_win->win_title)
+ delwin (ptr_win->win_title);
+ if (ptr_win->win_chat)
+ delwin (ptr_win->win_chat);
+ if (ptr_win->win_nick)
+ delwin (ptr_win->win_nick);
+ if (ptr_win->win_status)
+ delwin (ptr_win->win_status);
+ if (ptr_win->win_infobar)
+ delwin (ptr_win->win_infobar);
+ if (ptr_win->win_input)
+ delwin (ptr_win->win_input);
/* TODO: free input buffer, lines, messages, completion */
}
@@ -1639,99 +1649,99 @@ gui_end ()
}
/*
- * gui_add_message: add a message to a view
+ * gui_add_message: add a message to a buffer
*/
void
-gui_add_message (t_gui_view *view, int type, int color, char *message)
+gui_add_message (t_gui_buffer *buffer, int type, int color, char *message)
{
char *pos;
int length;
/* create new line if previous was ending by '\n' (or if 1st line) */
- if (view->line_complete)
+ if (buffer->line_complete)
{
- view->line_complete = 0;
- if (!gui_new_line (view))
+ buffer->line_complete = 0;
+ if (!gui_new_line (buffer))
return;
}
- if (!gui_new_message (view))
+ if (!gui_new_message (buffer))
return;
- view->last_line->last_message->type = type;
- view->last_line->last_message->color = color;
+ buffer->last_line->last_message->type = type;
+ buffer->last_line->last_message->color = color;
pos = strchr (message, '\n');
if (pos)
{
pos[0] = '\0';
- view->line_complete = 1;
+ buffer->line_complete = 1;
}
- view->last_line->last_message->message = strdup (message);
+ buffer->last_line->last_message->message = strdup (message);
length = strlen (message);
- view->last_line->length += length;
+ buffer->last_line->length += length;
if (type == MSG_TYPE_MSG)
- view->last_line->line_with_message = 1;
+ buffer->last_line->line_with_message = 1;
if ((type == MSG_TYPE_TIME) || (type == MSG_TYPE_NICK))
- view->last_line->length_align += length;
+ buffer->last_line->length_align += length;
if (pos)
{
pos[0] = '\n';
- if ((view == gui_current_view) && (view->sub_lines == 0))
+ if ((buffer->num_displayed > 0) && (gui_current_window->sub_lines == 0))
{
- if ((view->window->win_chat_cursor_y
- + gui_get_line_num_splits (view, view->last_line)) >
- (view->window->win_chat_height - 1))
- gui_draw_view_chat (view);
- else
- gui_display_line (view, view->last_line, 1);
+ /*if ((buffer->window->win_chat_cursor_y
+ + gui_get_line_num_splits (buffer, buffer->last_line)) >
+ (buffer->window->win_chat_height - 1))*/
+ gui_draw_buffer_chat (buffer, 0);
+ /*else
+ gui_display_line (buffer, buffer->last_line, 1);*/
}
- if ((view != gui_current_view) || (view->sub_lines > 0))
+ if ((buffer->num_displayed == 0) || (gui_current_window->sub_lines > 0))
{
- if (view->unread_data < 1 + view->last_line->line_with_message)
+ if (buffer->unread_data < 1 + buffer->last_line->line_with_message)
{
- view->unread_data = 1 + view->last_line->line_with_message;
- gui_redraw_view_status (gui_current_view);
+ buffer->unread_data = 1 + buffer->last_line->line_with_message;
+ gui_draw_buffer_status (buffer, 1);
}
}
}
}
/*
- * gui_printf_color_type: display a message in a view
+ * gui_printf_color_type: display a message in a buffer
*/
void
-gui_printf_color_type (t_gui_view *view, int type, int color, char *message, ...)
+gui_printf_color_type (t_gui_buffer *buffer, int type, int color, char *message, ...)
{
- static char buffer[8192];
+ static char buf[8192];
char timestamp[16];
char *pos;
va_list argptr;
static time_t seconds;
struct tm *date_tmp;
-
+
if (gui_ready)
{
if (color == -1)
color = COLOR_WIN_CHAT;
- if (view == NULL)
+ if (buffer == NULL)
{
- if (SERVER(gui_current_view))
- view = SERVER(gui_current_view)->view;
+ if (SERVER(gui_current_window->buffer))
+ buffer = SERVER(gui_current_window->buffer)->buffer;
else
- view = gui_current_view;
+ buffer = gui_current_window->buffer;
}
- if (view == NULL)
+ if (buffer == NULL)
{
- wee_log_printf ("gui_printf without view! this is a bug, please send to developers - thanks\n");
+ wee_log_printf ("gui_printf without buffer! this is a bug, please send to developers - thanks\n");
return;
}
}
va_start (argptr, message);
- vsnprintf (buffer, sizeof (buffer) - 1, message, argptr);
+ vsnprintf (buf, sizeof (buf) - 1, message, argptr);
va_end (argptr);
if (gui_ready)
@@ -1739,32 +1749,32 @@ gui_printf_color_type (t_gui_view *view, int type, int color, char *message, ...
seconds = time (NULL);
date_tmp = localtime (&seconds);
- pos = buffer - 1;
+ pos = buf - 1;
while (pos)
{
/* TODO: read timestamp format from config! */
- if ((!view->last_line) || (view->line_complete))
+ if ((!buffer->last_line) || (buffer->line_complete))
{
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "[");
snprintf (timestamp, 16, "%02d", date_tmp->tm_hour);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
snprintf (timestamp, 16, "%02d", date_tmp->tm_min);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME_SEP, ":");
snprintf (timestamp, 16, "%02d", date_tmp->tm_sec);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
- gui_add_message (view, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_TIME, timestamp);
+ gui_add_message (buffer, MSG_TYPE_TIME, COLOR_WIN_CHAT_DARK, "] ");
}
- gui_add_message (view, type, color, pos + 1);
+ gui_add_message (buffer, type, color, pos + 1);
pos = strchr (pos + 1, '\n');
if (pos && !pos[1])
pos = NULL;
}
- wrefresh (view->window->win_chat);
- refresh ();
+ /*wrefresh (buffer->window->win_chat);
+ refresh ();*/
}
else
- printf ("%s", buffer);
+ printf ("%s", buf);
}
diff --git a/weechat/src/gui/curses/gui-input.c b/weechat/src/gui/curses/gui-input.c
index be601dfa8..3e98619a1 100644
--- a/weechat/src/gui/curses/gui-input.c
+++ b/weechat/src/gui/curses/gui-input.c
@@ -49,7 +49,7 @@ void
gui_read_keyb ()
{
int key, i;
- t_gui_view *ptr_view;
+ t_gui_buffer *ptr_buffer;
char new_char[2];
key = getch ();
@@ -59,16 +59,20 @@ gui_read_keyb ()
{
/* resize event */
case KEY_RESIZE:
- gui_calculate_pos_size (gui_current_view);
- gui_redraw_view (gui_current_view);
+ gui_calculate_pos_size (gui_current_window);
+ gui_redraw_buffer (gui_current_window->buffer);
break;
- /* previous view */
+ /* previous buffer in window */
case KEY_F(6):
- gui_switch_to_previous_view ();
+ gui_switch_to_previous_buffer (gui_current_window);
break;
- /* next view */
+ /* next buffer in window */
case KEY_F(7):
- gui_switch_to_next_view ();
+ gui_switch_to_next_buffer (gui_current_window);
+ break;
+ /* next window */
+ case KEY_F(8):
+ gui_switch_to_next_window (gui_current_window);
break;
/* remove last infobar message */
case KEY_F(10):
@@ -76,205 +80,208 @@ gui_read_keyb ()
break;
/* cursor up */
case KEY_UP:
- if (gui_current_view->ptr_history)
+ if (gui_current_window->buffer->ptr_history)
{
- gui_current_view->ptr_history =
- gui_current_view->ptr_history->next_history;
- if (!gui_current_view->ptr_history)
- gui_current_view->ptr_history =
- gui_current_view->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_view->ptr_history =
- gui_current_view->history;
- if (gui_current_view->ptr_history)
+ gui_current_window->buffer->ptr_history =
+ gui_current_window->buffer->history;
+ if (gui_current_window->buffer->ptr_history)
{
- gui_current_view->input_buffer_size =
- strlen (gui_current_view->ptr_history->text);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
- strcpy (gui_current_view->input_buffer,
- gui_current_view->ptr_history->text);
- gui_draw_view_input (gui_current_view);
+ 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_view->ptr_history)
+ if (gui_current_window->buffer->ptr_history)
{
- gui_current_view->ptr_history =
- gui_current_view->ptr_history->prev_history;
- if (gui_current_view->ptr_history)
- gui_current_view->input_buffer_size =
- strlen (gui_current_view->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_view->input_buffer_size = 0;
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
- if (gui_current_view->ptr_history)
- strcpy (gui_current_view->input_buffer,
- gui_current_view->ptr_history->text);
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos > 0)
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- gui_current_view->input_buffer_pos--;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos <
- gui_current_view->input_buffer_size)
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- gui_current_view->input_buffer_pos++;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos > 0)
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- gui_current_view->input_buffer_pos = 0;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos <
- gui_current_view->input_buffer_size)
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
- gui_draw_view_input (gui_current_view);
+ 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_view->input_buffer_pos > 0)
+ if (gui_current_window->buffer->input_buffer_pos > 0)
{
- i = gui_current_view->input_buffer_pos-1;
- while (gui_current_view->input_buffer[i])
+ i = gui_current_window->buffer->input_buffer_pos-1;
+ while (gui_current_window->buffer->input_buffer[i])
{
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i+1];
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
i++;
}
- gui_current_view->input_buffer_size--;
- gui_current_view->input_buffer_pos--;
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- gui_draw_view_input (gui_current_view);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->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_view->input_buffer_pos <
- gui_current_view->input_buffer_size)
+ if (gui_current_window->buffer->input_buffer_pos <
+ gui_current_window->buffer->input_buffer_size)
{
- i = gui_current_view->input_buffer_pos;
- while (gui_current_view->input_buffer[i])
+ i = gui_current_window->buffer->input_buffer_pos;
+ while (gui_current_window->buffer->input_buffer[i])
{
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i+1];
+ gui_current_window->buffer->input_buffer[i] =
+ gui_current_window->buffer->input_buffer[i+1];
i++;
}
- gui_current_view->input_buffer_size--;
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- gui_draw_view_input (gui_current_view);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->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_view->completion),
- CHANNEL(gui_current_view),
- gui_current_view->input_buffer,
- gui_current_view->input_buffer_size,
- gui_current_view->input_buffer_pos);
- if (gui_current_view->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_view->input_buffer_size +=
- gui_current_view->completion.diff_size;
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer[gui_current_view->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_view->completion.diff_size > 0)
+ if (gui_current_window->buffer->completion.diff_size > 0)
{
- for (i = gui_current_view->input_buffer_size - 1;
- i >= gui_current_view->completion.position_replace +
- (int)strlen (gui_current_view->completion.word_found); i--)
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i -
- gui_current_view->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_view->completion.position_replace +
- strlen (gui_current_view->completion.word_found);
- i < gui_current_view->input_buffer_size; i++)
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i -
- gui_current_view->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_view->input_buffer + gui_current_view->completion.position_replace,
- gui_current_view->completion.word_found,
- strlen (gui_current_view->completion.word_found));
- gui_current_view->input_buffer_pos =
- gui_current_view->completion.position_replace +
- strlen (gui_current_view->completion.word_found);
- gui_current_view->completion.position =
- gui_current_view->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_view->completion.base_word[0] == '/')
+ if (gui_current_window->buffer->completion.base_word[0] == '/')
{
- if (gui_current_view->input_buffer[gui_current_view->input_buffer_pos] != ' ')
- gui_buffer_insert_string (" ",
- gui_current_view->input_buffer_pos);
- gui_current_view->completion.position++;
- gui_current_view->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_view->completion.base_word_pos == 0)
+ if (gui_current_window->buffer->completion.base_word_pos == 0)
{
- if (strncmp (gui_current_view->input_buffer + gui_current_view->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_view->input_buffer_pos);
- gui_current_view->completion.position += strlen (cfg_look_completor);
- gui_current_view->input_buffer_pos += strlen (cfg_look_completor);
- if (gui_current_view->input_buffer[gui_current_view->input_buffer_pos] != ' ')
- gui_buffer_insert_string (" ",
- gui_current_view->input_buffer_pos);
- gui_current_view->completion.position++;
- gui_current_view->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_view_input (gui_current_view);
+ gui_draw_buffer_input (gui_current_window->buffer, 0);
}
break;
/* escape code (for control-key) */
@@ -284,10 +291,10 @@ gui_read_keyb ()
switch (key)
{
case KEY_LEFT:
- gui_switch_to_previous_view ();
+ gui_switch_to_previous_buffer (gui_current_window);
break;
case KEY_RIGHT:
- gui_switch_to_next_view ();
+ gui_switch_to_next_buffer (gui_current_window);
break;
case 79:
/* TODO: replace 79 by constant name! */
@@ -299,11 +306,11 @@ 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;
}
}
@@ -314,35 +321,36 @@ gui_read_keyb ()
break;
/* send command/message */
case '\n':
- if (gui_current_view->input_buffer_size > 0)
+ if (gui_current_window->buffer->input_buffer_size > 0)
{
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- history_add (gui_current_view, gui_current_view->input_buffer);
- gui_current_view->input_buffer_size = 0;
- gui_current_view->input_buffer_pos = 0;
- gui_current_view->input_buffer_1st_display = 0;
- gui_current_view->completion.position = -1;
- gui_current_view->ptr_history = NULL;
- ptr_view = gui_current_view;
- user_command (SERVER(gui_current_view),
- gui_current_view->input_buffer);
- if (ptr_view == gui_current_view)
- gui_draw_view_input (ptr_view);
- if (ptr_view)
- ptr_view->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_view,
+ /*gui_printf (gui_current_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_view->input_buffer_pos);
- gui_current_view->input_buffer_pos++;
- gui_draw_view_input (gui_current_view);
- gui_current_view->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;
}
}
@@ -374,14 +382,13 @@ gui_main_loop ()
if (local_time->tm_min != old_min)
{
old_min = local_time->tm_min;
- gui_redraw_view_infobar (gui_current_view);
+ 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 splited windows! */
if (gui_infobar && gui_infobar->remaining_time > 0)
{
gui_infobar->remaining_time--;
diff --git a/weechat/src/gui/gui-common.c b/weechat/src/gui/gui-common.c
index ce7d53d94..19fa076e0 100644
--- a/weechat/src/gui/gui-common.c
+++ b/weechat/src/gui/gui-common.c
@@ -41,10 +41,11 @@
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_view *gui_views = NULL; /* pointer to first view */
-t_gui_view *last_gui_view = NULL; /* pointer to last view */
-t_gui_view *gui_current_view = NULL; /* pointer to current view */
+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 */
@@ -55,186 +56,217 @@ t_gui_infobar *gui_infobar; /* pointer to infobar content */
t_gui_window *
gui_window_new (int x, int y, int width, int height)
{
- t_gui_window *window;
+ t_gui_window *new_window;
- if ((window = (t_gui_window *)(malloc (sizeof (t_gui_window)))))
+ #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)))))
{
- window->win_x = x;
- window->win_y = y;
- window->win_width = width;
- window->win_height = height;
+ new_window->win_x = x;
+ new_window->win_y = y;
+ new_window->win_width = width;
+ new_window->win_height = height;
- window->win_chat_x = 0;
- window->win_chat_y = 0;
- window->win_chat_width = 0;
- window->win_chat_height = 0;
- window->win_chat_cursor_x = 0;
- window->win_chat_cursor_y = 0;
+ 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;
- window->win_nick_x = 0;
- window->win_nick_y = 0;
- window->win_nick_width = 0;
- window->win_nick_height = 0;
+ new_window->win_nick_x = 0;
+ new_window->win_nick_y = 0;
+ new_window->win_nick_width = 0;
+ new_window->win_nick_height = 0;
- window->win_title = NULL;
- window->win_chat = NULL;
- window->win_nick = NULL;
- window->win_status = NULL;
- window->win_infobar = NULL;
- window->win_input = NULL;
- window->textview_chat = NULL;
- window->textbuffer_chat = NULL;
- window->texttag_chat = NULL;
- window->textview_nicklist = NULL;
- window->textbuffer_nicklist = NULL;
+ 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;
+
+ 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;
+
+ /* add window to windows queue */
+ new_window->prev_window = last_gui_window;
+ if (gui_windows)
+ last_gui_window->next_window = new_window;
+ else
+ gui_windows = new_window;
+ last_gui_window = new_window;
+ new_window->next_window = NULL;
}
else
return NULL;
- return window;
+ return new_window;
}
/*
- * gui_view_new: create a new view in current window
+ * gui_buffer_new: create a new buffer in current window
*/
-t_gui_view *
-gui_view_new (t_gui_window *window, void *server, void *channel, int switch_to_view)
+t_gui_buffer *
+gui_buffer_new (t_gui_window *window, void *server, void *channel, int switch_to_buffer)
{
- t_gui_view *new_view;
+ t_gui_buffer *new_buffer;
- if (gui_views)
+ #ifdef DEBUG
+ wee_log_printf ("creating new buffer\n");
+ #endif
+ if (gui_buffers)
{
- /* use first view if no server was assigned to this view */
- if (!SERVER(gui_views))
+ /* use first buffer if no server was assigned to this buffer */
+ if (!SERVER(gui_buffers))
{
if (server)
- ((t_irc_server *)(server))->view = gui_views;
+ ((t_irc_server *)(server))->buffer = gui_buffers;
if (channel)
- ((t_irc_channel *)(channel))->view = gui_views;
- SERVER(gui_views) = server;
- CHANNEL(gui_views) = channel;
- return gui_views;
+ ((t_irc_channel *)(channel))->buffer = gui_buffers;
+ SERVER(gui_buffers) = server;
+ CHANNEL(gui_buffers) = channel;
+ return gui_buffers;
}
}
- if ((new_view = (t_gui_view *)(malloc (sizeof (t_gui_view)))))
+ if ((new_buffer = (t_gui_buffer *)(malloc (sizeof (t_gui_buffer)))))
{
- new_view->is_displayed = 0;
+ new_buffer->num_displayed = 0;
- /* assign server and channel to view */
- SERVER(new_view) = server;
- CHANNEL(new_view) = channel;
- /* assign view to server and channel */
+ /* 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_view)->view = new_view;
+ SERVER(new_buffer)->buffer = new_buffer;
if (channel)
- CHANNEL(new_view)->view = new_view;
+ CHANNEL(new_buffer)->buffer = new_buffer;
- new_view->window = window;
+ if (!window->buffer)
+ window->buffer = new_buffer;
+ window->first_line_displayed = 1;
+ window->sub_lines = 0;
- gui_calculate_pos_size (new_view);
+ gui_calculate_pos_size (window);
- /* init views */
- gui_view_init_subviews(new_view);
+ /* init buffers */
+ gui_window_init_subwindows (window);
/* init lines */
- new_view->lines = NULL;
- new_view->last_line = NULL;
- new_view->num_lines = 0;
- new_view->first_line_displayed = 1;
- new_view->sub_lines = 0;
- new_view->line_complete = 1;
- new_view->unread_data = 0;
+ new_buffer->lines = NULL;
+ new_buffer->last_line = NULL;
+ new_buffer->num_lines = 0;
+ new_buffer->line_complete = 1;
+ new_buffer->unread_data = 0;
/* init input buffer */
- new_view->input_buffer_alloc = INPUT_BUFFER_BLOCK_SIZE;
- new_view->input_buffer = (char *) malloc (INPUT_BUFFER_BLOCK_SIZE);
- new_view->input_buffer[0] = '\0';
- new_view->input_buffer_size = 0;
- new_view->input_buffer_pos = 0;
- new_view->input_buffer_1st_display = 0;
+ 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_view->completion));
+ completion_init (&(new_buffer->completion));
/* init history */
- new_view->history = NULL;
- new_view->last_history = NULL;
- new_view->ptr_history = NULL;
- new_view->num_history = 0;
-
- /* switch to new view */
- if (switch_to_view)
- gui_switch_to_view (new_view);
+ new_buffer->history = NULL;
+ new_buffer->last_history = NULL;
+ new_buffer->ptr_history = NULL;
+ new_buffer->num_history = 0;
- /* add view to views queue */
- new_view->prev_view = last_gui_view;
- if (gui_views)
- last_gui_view->next_view = new_view;
+ /* add buffer to buffers queue */
+ new_buffer->prev_buffer = last_gui_buffer;
+ if (gui_buffers)
+ last_gui_buffer->next_buffer = new_buffer;
else
- gui_views = new_view;
- last_gui_view = new_view;
- new_view->next_view = NULL;
+ 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 whole screen */
- /* TODO: manage splited windows */
- gui_redraw_view (gui_current_view);
+ /* redraw buffer */
+ gui_redraw_buffer (new_buffer);
}
else
return NULL;
- return new_view;
+ return new_buffer;
}
/*
- * gui_view_clear: clear view content
+ * gui_buffer_clear: clear buffer content
*/
void
-gui_view_clear (t_gui_view *view)
+gui_buffer_clear (t_gui_buffer *buffer)
{
+ t_gui_window *ptr_win;
t_gui_line *ptr_line;
t_gui_message *ptr_message;
- while (view->lines)
+ while (buffer->lines)
{
- ptr_line = view->lines->next_line;
- while (view->lines->messages)
+ ptr_line = buffer->lines->next_line;
+ while (buffer->lines->messages)
{
- ptr_message = view->lines->messages->next_message;
- if (view->lines->messages->message)
- free (view->lines->messages->message);
- free (view->lines->messages);
- view->lines->messages = ptr_message;
+ 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 (view->lines);
- view->lines = ptr_line;
+ free (buffer->lines);
+ buffer->lines = ptr_line;
}
- view->lines = NULL;
- view->last_line = NULL;
- view->num_lines = 0;
- view->first_line_displayed = 1;
- view->sub_lines = 0;
- view->line_complete = 1;
- view->unread_data = 0;
+ buffer->lines = NULL;
+ buffer->last_line = NULL;
+ buffer->num_lines = 0;
+ buffer->line_complete = 1;
+ buffer->unread_data = 0;
- if (view == gui_current_view)
- gui_redraw_view_chat (view);
+ for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+ {
+ 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_view_clear_all: clear all views content
+ * gui_buffer_clear_all: clear all buffers content
*/
void
-gui_view_clear_all ()
+gui_buffer_clear_all ()
{
- t_gui_view *ptr_view;
+ t_gui_buffer *ptr_buffer;
- for (ptr_view = gui_views; ptr_view; ptr_view = ptr_view->next_view)
- gui_view_clear (ptr_view);
+ for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
+ gui_buffer_clear (ptr_buffer);
}
/*
@@ -264,8 +296,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 splited windows! */
- gui_redraw_view_infobar (gui_current_view);
+ gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
else
wee_log_printf (_("%s not enough memory for infobar message\n"),
@@ -288,13 +319,12 @@ gui_infobar_remove ()
free (gui_infobar->text);
free (gui_infobar);
gui_infobar = new_infobar;
- /* TODO: manage splited windows! */
- gui_redraw_view_infobar (gui_current_view);
+ gui_draw_buffer_infobar (gui_current_window->buffer, 1);
}
}
/*
- * gui_line_free: delete a line from a view
+ * gui_line_free: delete a line from a buffer
*/
void
@@ -314,57 +344,60 @@ gui_line_free (t_gui_line *line)
}
/*
- * gui_view_free: delete a view
+ * gui_buffer_free: delete a buffer
*/
void
-gui_view_free (t_gui_view *view)
+gui_buffer_free (t_gui_buffer *buffer)
{
+ t_gui_window *ptr_win;
t_gui_line *ptr_line;
int create_new;
- create_new = (view->server || view->channel);
+ create_new = (buffer->server || buffer->channel);
- /* TODO: manage splited windows! */
- if ((view == gui_current_view) &&
- ((view->next_view) || (view->prev_view)))
- gui_switch_to_previous_view ();
+ 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);
+ }
/* free lines and messages */
- while (view->lines)
+ while (buffer->lines)
{
- ptr_line = view->lines->next_line;
- gui_line_free (view->lines);
- view->lines = ptr_line;
+ ptr_line = buffer->lines->next_line;
+ gui_line_free (buffer->lines);
+ buffer->lines = ptr_line;
}
- if (view->input_buffer)
- free (view->input_buffer);
-
- completion_free (&(view->completion));
-
- /* remove view from views list */
- if (view->prev_view)
- view->prev_view->next_view = view->next_view;
- if (view->next_view)
- view->next_view->prev_view = view->prev_view;
- if (gui_views == view)
- gui_views = view->next_view;
- if (last_gui_view == view)
- last_gui_view = view->prev_view;
-
- free (view);
-
- /* always at least one view */
- if (!gui_views && create_new)
- (void) gui_view_new (gui_windows, NULL, NULL, 1);
+ 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)
+ (void) gui_buffer_new (gui_windows, NULL, NULL, 1);
}
/*
- * gui_new_line: create new line for a view
+ * gui_new_line: create new line for a buffer
*/
t_gui_line *
-gui_new_line (t_gui_view *view)
+gui_new_line (t_gui_buffer *buffer)
{
t_gui_line *new_line, *ptr_line;
@@ -375,14 +408,14 @@ gui_new_line (t_gui_view *view)
new_line->line_with_message = 0;
new_line->messages = NULL;
new_line->last_message = NULL;
- if (!view->lines)
- view->lines = new_line;
+ if (!buffer->lines)
+ buffer->lines = new_line;
else
- view->last_line->next_line = new_line;
- new_line->prev_line = view->last_line;
+ buffer->last_line->next_line = new_line;
+ new_line->prev_line = buffer->last_line;
new_line->next_line = NULL;
- view->last_line = new_line;
- view->num_lines++;
+ buffer->last_line = new_line;
+ buffer->num_lines++;
}
else
{
@@ -392,40 +425,40 @@ gui_new_line (t_gui_view *view)
/* remove one line if necessary */
if ((cfg_history_max_lines > 0)
- && (view->num_lines > cfg_history_max_lines))
+ && (buffer->num_lines > cfg_history_max_lines))
{
- if (view->last_line == view->lines)
- view->last_line = NULL;
- ptr_line = view->lines->next_line;
- gui_line_free (view->lines);
- view->lines = ptr_line;
+ 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;
- view->num_lines--;
- if (view->first_line_displayed)
- gui_redraw_view_chat (view);
+ 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 a view
+ * gui_new_message: create a new message for last line of a buffer
*/
t_gui_message *
-gui_new_message (t_gui_view *view)
+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 (!view->last_line->messages)
- view->last_line->messages = new_message;
+ if (!buffer->last_line->messages)
+ buffer->last_line->messages = new_message;
else
- view->last_line->last_message->next_message = new_message;
- new_message->prev_message = view->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;
- view->last_line->last_message = new_message;
+ buffer->last_line->last_message = new_message;
}
else
{
@@ -441,16 +474,16 @@ gui_new_message (t_gui_view *view)
*/
void
-gui_optimize_input_buffer_size (t_gui_view *view)
+gui_optimize_input_buffer_size (t_gui_buffer *buffer)
{
int optimal_size;
- optimal_size = ((view->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 (view->input_buffer_alloc != optimal_size)
+ if (buffer->input_buffer_alloc != optimal_size)
{
- view->input_buffer_alloc = optimal_size;
- view->input_buffer = realloc (view->input_buffer, optimal_size);
+ buffer->input_buffer_alloc = optimal_size;
+ buffer->input_buffer = realloc (buffer->input_buffer, optimal_size);
}
}
@@ -459,25 +492,25 @@ gui_optimize_input_buffer_size (t_gui_view *view)
*/
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_view->input_buffer_pos > 0)
+ if (buffer->input_buffer_pos > 0)
{
- i = gui_current_view->input_buffer_pos - 1;
+ i = buffer->input_buffer_pos - 1;
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] == ' '))
+ (buffer->input_buffer[i] == ' '))
i--;
if (i >= 0)
{
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] != ' '))
+ (buffer->input_buffer[i] != ' '))
i--;
if (i >= 0)
{
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] == ' '))
+ (buffer->input_buffer[i] == ' '))
i--;
}
}
@@ -485,20 +518,20 @@ gui_delete_previous_word ()
if (i >= 0)
i++;
i++;
- num_char_deleted = gui_current_view->input_buffer_pos - i;
- num_char_end = gui_current_view->input_buffer_size -
- gui_current_view->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_view->input_buffer[i + j] =
- gui_current_view->input_buffer[gui_current_view->input_buffer_pos + j];
+ buffer->input_buffer[i + j] =
+ buffer->input_buffer[buffer->input_buffer_pos + j];
- gui_current_view->input_buffer_size -= num_char_deleted;
- gui_current_view->input_buffer[gui_current_view->input_buffer_size] = '\0';
- gui_current_view->input_buffer_pos = i;
- gui_draw_view_input (gui_current_view);
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->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;
}
}
@@ -507,26 +540,26 @@ gui_delete_previous_word ()
*/
void
-gui_move_previous_word ()
+gui_move_previous_word (t_gui_buffer *buffer)
{
int i;
- if (gui_current_view->input_buffer_pos > 0)
+ if (buffer->input_buffer_pos > 0)
{
- i = gui_current_view->input_buffer_pos - 1;
+ i = buffer->input_buffer_pos - 1;
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] == ' '))
+ (buffer->input_buffer[i] == ' '))
i--;
if (i < 0)
- gui_current_view->input_buffer_pos = 0;
+ buffer->input_buffer_pos = 0;
else
{
while ((i >= 0) &&
- (gui_current_view->input_buffer[i] != ' '))
+ (buffer->input_buffer[i] != ' '))
i--;
- gui_current_view->input_buffer_pos = i + 1;
+ buffer->input_buffer_pos = i + 1;
}
- gui_draw_view_input (gui_current_view);
+ gui_draw_buffer_input (buffer, 0);
}
}
@@ -535,32 +568,32 @@ gui_move_previous_word ()
*/
void
-gui_move_next_word ()
+gui_move_next_word (t_gui_buffer *buffer)
{
int i;
- if (gui_current_view->input_buffer_pos <
- gui_current_view->input_buffer_size + 1)
+ if (buffer->input_buffer_pos <
+ buffer->input_buffer_size + 1)
{
- i = gui_current_view->input_buffer_pos;
- while ((i <= gui_current_view->input_buffer_size) &&
- (gui_current_view->input_buffer[i] == ' '))
+ i = buffer->input_buffer_pos;
+ while ((i <= buffer->input_buffer_size) &&
+ (buffer->input_buffer[i] == ' '))
i++;
- if (i > gui_current_view->input_buffer_size)
- gui_current_view->input_buffer_pos = i - 1;
+ if (i > buffer->input_buffer_size)
+ buffer->input_buffer_pos = i - 1;
else
{
- while ((i <= gui_current_view->input_buffer_size) &&
- (gui_current_view->input_buffer[i] != ' '))
+ while ((i <= buffer->input_buffer_size) &&
+ (buffer->input_buffer[i] != ' '))
i++;
- if (i > gui_current_view->input_buffer_size)
- gui_current_view->input_buffer_pos =
- gui_current_view->input_buffer_size;
+ if (i > buffer->input_buffer_size)
+ buffer->input_buffer_pos =
+ buffer->input_buffer_size;
else
- gui_current_view->input_buffer_pos = i;
+ buffer->input_buffer_pos = i;
}
- gui_draw_view_input (gui_current_view);
+ gui_draw_buffer_input (buffer, 0);
}
}
@@ -569,24 +602,24 @@ 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_view->input_buffer_size += length;
- gui_optimize_input_buffer_size (gui_current_view);
- gui_current_view->input_buffer[gui_current_view->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_view->input_buffer_size - 1;
+ end = buffer->input_buffer_size - 1;
for (i = end; i >= start; i--)
- gui_current_view->input_buffer[i] =
- gui_current_view->input_buffer[i - length];
+ buffer->input_buffer[i] =
+ buffer->input_buffer[i - length];
/* insert new string */
- strncpy (gui_current_view->input_buffer + pos, string, length);
+ strncpy (buffer->input_buffer + pos, string, length);
}
diff --git a/weechat/src/gui/gui.h b/weechat/src/gui/gui.h
index df14e3af5..b7d45930e 100644
--- a/weechat/src/gui/gui.h
+++ b/weechat/src/gui/gui.h
@@ -59,23 +59,23 @@
#define COLOR_WIN_NICK_LAST 38
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
-#define SERVER(view) ((t_irc_server *)(view->server))
-#define CHANNEL(view) ((t_irc_channel *)(view->channel))
+#define SERVER(buffer) ((t_irc_server *)(buffer->server))
+#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
-#define VIEW_IS_SERVER(view) (SERVER(view) && !CHANNEL(view))
-#define VIEW_IS_CHANNEL(view) (CHANNEL(view) && (CHANNEL(view)->type == CHAT_CHANNEL))
-#define VIEW_IS_PRIVATE(view) (CHANNEL(view) && (CHANNEL(view)->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 gui_printf_color(view, color, fmt, argz...) \
- gui_printf_color_type(view, 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(view, fmt, argz...) \
- gui_printf_color_type(view, 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;
@@ -121,6 +121,44 @@ 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 */
+
+ /* 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) */
+ 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 *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
@@ -148,6 +186,7 @@ struct t_gui_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 */
@@ -159,109 +198,70 @@ struct t_gui_window
/* windows for Qt GUI */
/* TODO: declare Qt window */
- t_gui_window *prev_window; /* link to previous window */
- t_gui_window *next_window; /* link to next window */
-};
-
-typedef struct t_gui_view t_gui_view;
-
-struct t_gui_view
-{
- int is_displayed; /* = 1 if view is displayed */
+ t_gui_buffer *buffer; /* buffer currently displayed in window */
- /* server/channel */
- void *server; /* view's server */
- void *channel; /* view's channel */
-
- t_gui_window *window; /* Curses or Gtk 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 */
- int num_lines; /* number of lines in the 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 *last_history; /* last command in history */
- t_history *ptr_history; /* current command in history */
- int num_history; /* number of commands in history */
-
- /* link to next window */
- t_gui_view *prev_view; /* link to previous view */
- t_gui_view *next_view; /* link to next view */
+ t_gui_window *prev_window; /* link to previous window */
+ t_gui_window *next_window; /* link to next window */
};
/* variables */
extern int gui_ready;
extern t_gui_window *gui_windows;
-extern t_gui_view *gui_views;
-extern t_gui_view *last_gui_view;
-extern t_gui_view *gui_current_view;
+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 (int, int, int, int);
-extern t_gui_view *gui_view_new (t_gui_window *, void *, void *, int);
-extern void gui_view_clear (t_gui_view *);
-extern void gui_view_clear_all ();
+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_view *);
-extern t_gui_message *gui_new_message (t_gui_view *);
-extern void gui_optimize_input_buffer_size (t_gui_view *);
-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 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);
/* 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_view_has_nicklist (t_gui_view *);
-extern void gui_calculate_pos_size (t_gui_view *);
-extern void gui_draw_view_title (t_gui_view *);
-extern void gui_redraw_view_title (t_gui_view *);
-extern void gui_draw_view_chat (t_gui_view *);
-extern void gui_redraw_view_chat (t_gui_view *);
-extern void gui_draw_view_nick (t_gui_view *);
-extern void gui_redraw_view_nick (t_gui_view *);
-extern void gui_draw_view_status (t_gui_view *);
-extern void gui_redraw_view_status (t_gui_view *);
-extern void gui_draw_view_infobar (t_gui_view *);
-extern void gui_redraw_view_infobar (t_gui_view *);
-extern void gui_draw_view_input (t_gui_view *);
-extern void gui_redraw_view_input (t_gui_view *);
-extern void gui_redraw_view (t_gui_view *);
-extern void gui_switch_to_view (t_gui_view *);
-extern void gui_switch_to_previous_view ();
-extern void gui_switch_to_next_view ();
+extern int gui_buffer_has_nicklist (t_gui_buffer *);
+extern void gui_calculate_pos_size (t_gui_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_view_init_subviews (t_gui_view *);
+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_view_free (t_gui_view *);
+extern void gui_buffer_free (t_gui_buffer *);
extern void gui_end ();
-extern void gui_printf_color_type (/*@null@*/ t_gui_view *, int, int, char *, ...);
+extern void gui_printf_color_type (/*@null@*/ t_gui_buffer *, int, int, char *, ...);
extern void gui_main_loop ();
#endif /* gui.h */
diff --git a/weechat/src/irc/irc-channel.c b/weechat/src/irc/irc-channel.c
index 12dfb8abd..b5e93038b 100644
--- a/weechat/src/irc/irc-channel.c
+++ b/weechat/src/irc/irc-channel.c
@@ -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_view)
+ 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_view_new (gui_current_view->window, server, new_channel, switch_to_view);
+ gui_buffer_new (gui_current_window, server, new_channel, switch_to_buffer);
/* all is ok, return address of new channel */
return new_channel;
diff --git a/weechat/src/irc/irc-display.c b/weechat/src/irc/irc-display.c
index 2ad66bda6..d8bdc4942 100644
--- a/weechat/src/irc/irc-display.c
+++ b/weechat/src/irc/irc-display.c
@@ -41,16 +41,16 @@
*/
void
-irc_display_prefix (t_gui_view *view, char *prefix)
+irc_display_prefix (t_gui_buffer *buffer, char *prefix)
{
if (prefix[0] == prefix[2])
{
- gui_printf_color (view, COLOR_WIN_CHAT_PREFIX1, "%c", prefix[0]);
- gui_printf_color (view, COLOR_WIN_CHAT_PREFIX2, "%c", prefix[1]);
- gui_printf_color (view, 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 (view, 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_view *view, char *prefix)
*/
void
-irc_display_nick (t_gui_view *view, 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 (view,
+ gui_printf_color_type (buffer,
message_type, COLOR_WIN_CHAT_DARK, "<");
if (cfg_look_nickmode)
{
if (nick->is_op)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_OP, "@");
else
{
if (nick->is_halfop)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_HALFOP, "%%");
else
{
if (nick->has_voice)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_NICK_VOICE, "+");
else
if (cfg_look_nickmode_empty && !no_nickmode)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_CHAT, " ");
}
}
}
if (color_nick < 0)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", nick->nick);
else
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type,
(color_nick) ?
((cfg_look_color_nicks) ?
@@ -106,7 +106,7 @@ irc_display_nick (t_gui_view *view, t_irc_nick *nick, int message_type,
"%s", nick->nick);
if (display_around)
- gui_printf_color_type (view,
+ gui_printf_color_type (buffer,
message_type, COLOR_WIN_CHAT_DARK, "> ");
}
@@ -115,21 +115,21 @@ irc_display_nick (t_gui_view *view, t_irc_nick *nick, int message_type,
*/
void
-irc_display_mode (t_gui_view *view, 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 (view, PREFIX_INFO);
- gui_printf_color (view, COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (view, COLOR_WIN_CHAT_CHANNEL, "%s", channel_name);
- gui_printf_color (view, COLOR_WIN_CHAT, "/");
- gui_printf_color (view, COLOR_WIN_CHAT_CHANNEL, "%c%s", set_flag, symbol);
- gui_printf_color (view, COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (view, 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 (view, COLOR_WIN_CHAT, " %s ", message);
- gui_printf_color (view, 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 (view, COLOR_WIN_CHAT, " %s\n", message);
+ gui_printf_color (buffer, COLOR_WIN_CHAT, " %s\n", message);
}
diff --git a/weechat/src/irc/irc-nick.c b/weechat/src/irc/irc-nick.c
index 5488dd51f..b553b7904 100644
--- a/weechat/src/irc/irc-nick.c
+++ b/weechat/src/irc/irc-nick.c
@@ -182,7 +182,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->view,
+ gui_printf (channel->buffer,
_("%s cannot allocate new nick\n"), WEECHAT_ERROR);
return NULL;
}
@@ -192,7 +192,7 @@ 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->view)->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);
diff --git a/weechat/src/irc/irc-recv.c b/weechat/src/irc/irc-recv.c
index 54a9745a7..99817174a 100644
--- a/weechat/src/irc/irc-recv.c
+++ b/weechat/src/irc/irc-recv.c
@@ -114,7 +114,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_ERROR);
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
first = 1;
while (pos && pos[0])
@@ -124,7 +124,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
{
if (pos[0] == ':')
pos++;
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s%s\n", (first) ? "" : ": ", pos);
pos = NULL;
@@ -132,7 +132,7 @@ irc_cmd_recv_error (t_irc_server *server, char *host, char *arguments)
else
{
pos2[0] = '\0';
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s%s",
(first) ? "" : " ", pos);
@@ -159,7 +159,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_new (server, CHAT_CHANNEL, arguments, 1);
if (!ptr_channel)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create new channel \"%s\"\n"),
WEECHAT_ERROR, arguments);
return -1;
@@ -170,21 +170,21 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *arguments)
if (pos)
pos[0] = '\0';
- irc_display_prefix (ptr_channel->view, PREFIX_JOIN);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_NICK,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_JOIN);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
"%s ", host);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
"(");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_HOST,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_HOST,
"%s", pos + 1);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
")");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_(" has joined "));
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s\n", arguments);
(void) nick_new (ptr_channel, host, 0, 0, 0);
- gui_redraw_view_nick (gui_current_view);
+ gui_draw_buffer_nick (gui_current_window->buffer, 1);
return 0;
}
@@ -225,39 +225,39 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, arguments);
if (!ptr_channel)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "kick");
return -1;
}
- irc_display_prefix (ptr_channel->view, PREFIX_PART);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_NICK,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
"%s", host);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_(" has kicked "));
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_NICK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_NICK,
"%s", pos_nick);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_(" from "));
if (pos_comment)
{
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s ", arguments);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
"(");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
"%s", pos_comment);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK,
")\n");
}
else
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s\n", arguments);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "kick");
return -1;
@@ -266,7 +266,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *arguments)
if (ptr_nick)
{
nick_free (ptr_channel, ptr_nick);
- gui_redraw_view_nick (gui_current_view);
+ gui_draw_buffer_nick (gui_current_window->buffer, 1);
}
return 0;
}
@@ -301,7 +301,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "b", nick_host,
(set_flag == '+') ?
_("sets ban on") :
@@ -319,7 +319,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'i':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "i", nick_host,
(set_flag == '+') ?
_("sets invite-only channel flag") :
@@ -337,7 +337,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "k", nick_host,
(set_flag == '+') ?
_("sets channel key to") :
@@ -369,7 +369,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "l", nick_host,
(set_flag == '+') ?
_("sets the user limit to") :
@@ -392,7 +392,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'm':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "m", nick_host,
(set_flag == '+') ?
_("sets moderated channel flag") :
@@ -403,7 +403,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'n':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "n", nick_host,
(set_flag == '+') ?
_("sets messages from channel only flag") :
@@ -421,7 +421,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "o", nick_host,
(set_flag == '+') ?
_("gives channel operator status to") :
@@ -434,7 +434,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
{
ptr_nick->is_op = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
- gui_redraw_view_nick (ptr_channel->view);
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -449,7 +449,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 'p':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "p", nick_host,
(set_flag == '+') ?
_("sets private channel flag") :
@@ -460,7 +460,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 's':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "s", nick_host,
(set_flag == '+') ?
_("sets secret channel flag") :
@@ -471,7 +471,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
break;
case 't':
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "t", nick_host,
(set_flag == '+') ?
_("sets topic protection") :
@@ -489,7 +489,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
pos[0] = '\0';
}
if (nick_host)
- irc_display_mode (ptr_channel->view,
+ irc_display_mode (ptr_channel->buffer,
channel_name, set_flag, "v", nick_host,
(set_flag == '+') ?
_("gives voice to") :
@@ -503,7 +503,7 @@ void irc_get_channel_modes (t_irc_channel *ptr_channel, char *channel_name,
{
ptr_nick->has_voice = (set_flag == '+') ? 1 : 0;
nick_resort (ptr_channel, ptr_nick);
- gui_redraw_view_nick (ptr_channel->view);
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -534,7 +534,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "mode");
return -1;
@@ -548,7 +548,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
pos = strchr (arguments, ' ');
if (!pos)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without channel or nickname\n"),
WEECHAT_ERROR, "mode");
return -1;
@@ -573,11 +573,11 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
if (ptr_channel)
{
irc_get_channel_modes (ptr_channel, arguments, host, pos, pos_parm);
- gui_draw_view_status (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 0);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "mode");
return -1;
@@ -586,7 +586,7 @@ irc_cmd_recv_mode (t_irc_server *server, char *host, char *arguments)
else
{
/* nickname modes */
- gui_printf (server->view, "(TODO!) nickname modes: channel=%s, args=%s\n", arguments, pos);
+ gui_printf (server->buffer, "(TODO!) nickname modes: channel=%s, args=%s\n", arguments, pos);
}
return 0;
}
@@ -602,12 +602,12 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
int nick_is_me;
- t_gui_view *ptr_view;
+ t_gui_buffer *ptr_buffer;
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "nick");
return -1;
@@ -625,16 +625,16 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
if (ptr_nick)
{
/* change nickname in any opened private window */
- for (ptr_view = gui_views; ptr_view;
- ptr_view = ptr_view->next_view)
+ for (ptr_buffer = gui_buffers; ptr_buffer;
+ ptr_buffer = ptr_buffer->next_buffer)
{
- if ((SERVER(ptr_view) == server) && VIEW_IS_PRIVATE(ptr_view))
+ if ((SERVER(ptr_buffer) == server) && BUFFER_IS_PRIVATE(ptr_buffer))
{
- if ((CHANNEL(ptr_view)->name)
- && (strcmp (ptr_nick->nick, CHANNEL(ptr_view)->name) == 0))
+ if ((CHANNEL(ptr_buffer)->name)
+ && (strcmp (ptr_nick->nick, CHANNEL(ptr_buffer)->name) == 0))
{
- free (CHANNEL(ptr_view)->name);
- CHANNEL(ptr_view)->name = strdup (arguments);
+ free (CHANNEL(ptr_buffer)->name);
+ CHANNEL(ptr_buffer)->name = strdup (arguments);
}
}
}
@@ -642,28 +642,28 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
/* change nickname on channel */
nick_is_me = (strcmp (ptr_nick->nick, server->nick) == 0) ? 1 : 0;
nick_change (ptr_channel, ptr_nick, arguments);
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
if (nick_is_me)
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
_("You are "));
else
{
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK,
"%s", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _(" is "));
}
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
_("now known as "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK,
"%s\n",
arguments);
- if (gui_view_has_nicklist (ptr_channel->view))
- gui_redraw_view_nick (ptr_channel->view);
+ if (gui_buffer_has_nicklist (ptr_channel->buffer))
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -672,8 +672,8 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *arguments)
free (server->nick);
server->nick = strdup (arguments);
}
- gui_redraw_view_status (gui_current_view);
- gui_redraw_view_input (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ gui_draw_buffer_input (gui_current_window->buffer, 1);
return 0;
}
@@ -709,7 +709,7 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s nickname not found for \"%s\" command\n"),
WEECHAT_ERROR, "notice");
return -1;
@@ -720,12 +720,12 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->view, COLOR_WIN_CHAT_CHANNEL, "VERSION ");
- gui_printf_color (server->view, COLOR_WIN_CHAT, _("reply from"));
- gui_printf_color (server->view, COLOR_WIN_CHAT_NICK, " %s", host);
- gui_printf_color (server->view, COLOR_WIN_CHAT, ": %s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "VERSION ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", host);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, ": %s\n", pos);
}
else
{
@@ -752,12 +752,12 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
difftime = ((sec2 * 1000000) + usec2) - ((sec1 * 1000000) + usec1);
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "CTCP ");
- gui_printf_color (server->view, COLOR_WIN_CHAT_CHANNEL, "PING ");
- gui_printf_color (server->view, COLOR_WIN_CHAT, _("reply from"));
- gui_printf_color (server->view, COLOR_WIN_CHAT_NICK, " %s", host);
- gui_printf_color (server->view, COLOR_WIN_CHAT,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "CTCP ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_CHANNEL, "PING ");
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, _("reply from"));
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT_NICK, " %s", host);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT,
_(": %ld.%ld seconds\n"),
difftime / 1000000,
(difftime % 1000000) / 1000);
@@ -766,8 +766,8 @@ irc_cmd_recv_notice (t_irc_server *server, char *host, char *arguments)
}
else
{
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", pos);
}
}
return 0;
@@ -787,7 +787,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (!host || !arguments)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host or channel\n"),
WEECHAT_ERROR, "part");
return -1;
@@ -818,50 +818,50 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *arguments)
if (strcmp (ptr_nick->nick, server->nick) == 0)
{
/* part request was issued by local client */
- gui_view_free (ptr_channel->view);
+ gui_buffer_free (ptr_channel->buffer);
channel_free (server, ptr_channel);
- gui_redraw_view_status (gui_current_view);
- gui_redraw_view_input (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 1);
+ gui_draw_buffer_input (gui_current_window->buffer, 1);
}
else
{
/* remove nick from nick list and display message */
nick_free (ptr_channel, ptr_nick);
- irc_display_prefix (ptr_channel->view, PREFIX_PART);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_PART);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s ", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HOST, "%s", pos+1);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _(" has left "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s", ptr_channel->name);
if (pos_args && pos_args[0])
{
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "%s", pos_args);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")");
}
- gui_printf (ptr_channel->view, "\n");
+ gui_printf (ptr_channel->buffer, "\n");
- /* redraw nick list if this is current view */
- if (gui_view_has_nicklist (ptr_channel->view))
- gui_redraw_view_nick (ptr_channel->view);
+ /* redraw nick list if this is current buffer */
+ if (gui_buffer_has_nicklist (ptr_channel->buffer))
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "part");
return -1;
@@ -903,7 +903,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -941,13 +941,13 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (pos2)
pos2[0] = '\0';
- irc_display_prefix (ptr_channel->view, PREFIX_ACTION_ME);
+ irc_display_prefix (ptr_channel->buffer, PREFIX_ACTION_ME);
if (strstr (pos, server->nick))
{
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HIGHLIGHT, "%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->view != gui_current_view) )
+ && (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: * %s %s"),
@@ -955,9 +955,9 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
host, pos);
}
else
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, " %s\n", pos);
}
else
@@ -967,10 +967,10 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
{
if (strstr (pos, server->nick))
{
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, -1, 0);
if ( (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->view != gui_current_view) )
+ && (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("On %s: %s> %s"),
@@ -978,15 +978,15 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
host, pos);
}
else
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s nick not found for \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -995,7 +995,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1039,14 +1039,14 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
" compiled on %s%s",
host, "\01", PACKAGE_NAME, PACKAGE_VERSION, __DATE__,
"\01\r\n");
- irc_display_prefix (server->view, PREFIX_INFO);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_INFO);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Received a "));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL, _("CTCP VERSION "));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("from"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, " %s\n", host);
return 0;
}
@@ -1079,7 +1079,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos2 = strchr (pos, '\01');
if (!pos2)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1093,7 +1093,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_size = strrchr (pos_file, ' ');
if (!pos_size)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1108,7 +1108,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_port = strrchr (pos_file, ' ');
if (!pos_port)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1123,7 +1123,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
pos_addr = strrchr (pos_file, ' ');
if (!pos_addr)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1147,7 +1147,7 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_new (server, CHAT_PRIVATE, host, 0);
if (!ptr_channel)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR, host);
return -1;
@@ -1156,40 +1156,40 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
if (!ptr_channel->topic)
{
ptr_channel->topic = strdup (host2);
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
if (strstr (pos, server->nick))
{
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_HIGHLIGHT,
"%s", host);
if ( (cfg_look_infobar_delay_highlight > 0)
- && (ptr_channel->view != gui_current_view) )
+ && (ptr_channel->buffer != gui_current_window->buffer) )
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
host, pos);
}
else
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_PRIVATE,
"%s", host);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "privmsg");
return -1;
@@ -1212,7 +1212,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
/* no host => we can't identify sender of message! */
if (host == NULL)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without host\n"),
WEECHAT_ERROR, "quit");
return -1;
@@ -1235,27 +1235,27 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *arguments)
{
if (ptr_nick)
nick_free (ptr_channel, ptr_nick);
- irc_display_prefix (ptr_channel->view, PREFIX_QUIT);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_QUIT);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s ", host);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_HOST, "%s", pos + 1);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ") ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("has quit"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, "%s",
arguments);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")\n");
- if ((ptr_channel->view == gui_current_view) &&
- (gui_view_has_nicklist (ptr_channel->view)))
- gui_redraw_view_nick (ptr_channel->view);
+ if ((ptr_channel->buffer == gui_current_window->buffer) &&
+ (gui_buffer_has_nicklist (ptr_channel->buffer)))
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
}
@@ -1284,8 +1284,8 @@ irc_cmd_recv_server_msg (t_irc_server *server, char *host, char *arguments)
arguments++;
/* display server message */
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view, COLOR_WIN_CHAT, "%s\n", arguments);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer, COLOR_WIN_CHAT, "%s\n", arguments);
return 0;
}
@@ -1314,7 +1314,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_ERROR);
+ irc_display_prefix (server->buffer, PREFIX_ERROR);
first = 1;
while (pos && pos[0])
@@ -1324,7 +1324,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
{
if (pos[0] == ':')
pos++;
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s%s\n", (first) ? "" : ": ", pos);
pos = NULL;
@@ -1332,7 +1332,7 @@ irc_cmd_recv_server_reply (t_irc_server *server, char *host, char *arguments)
else
{
pos2[0] = '\0';
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s%s",
(first) ? "" : " ", pos);
@@ -1352,7 +1352,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
{
char *pos;
t_irc_channel *ptr_channel;
- t_gui_view *view;
+ t_gui_buffer *buffer;
/* make gcc happy */
(void) host;
@@ -1364,7 +1364,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
if (!string_is_channel (arguments))
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command received without channel\n"),
WEECHAT_ERROR, "topic");
return -1;
@@ -1384,28 +1384,28 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
}
ptr_channel = channel_search (server, arguments);
- view = (ptr_channel) ? ptr_channel->view : server->view;
+ buffer = (ptr_channel) ? ptr_channel->buffer : server->buffer;
- irc_display_prefix (view, PREFIX_INFO);
- gui_printf_color (view,
+ irc_display_prefix (buffer, PREFIX_INFO);
+ gui_printf_color (buffer,
COLOR_WIN_CHAT_NICK, "%s",
host);
if (pos)
{
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT, _(" has changed topic for "));
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT_CHANNEL, "%s",
arguments);
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT, _(" to: \"%s\"\n"),
pos);
}
else
{
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT, _(" has unset topic for "));
- gui_printf_color (view,
+ gui_printf_color (buffer,
COLOR_WIN_CHAT_CHANNEL, "%s\n",
arguments);
}
@@ -1418,7 +1418,7 @@ irc_cmd_recv_topic (t_irc_server *server, char *host, char *arguments)
ptr_channel->topic = strdup (pos);
else
ptr_channel->topic = strdup ("");
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
return 0;
@@ -1449,8 +1449,8 @@ irc_cmd_recv_004 (t_irc_server *server, char *host, char *arguments)
/* connection to IRC server is ok! */
server->is_connected = 1;
- gui_redraw_view_status (server->view);
- gui_redraw_view_input (server->view);
+ gui_draw_buffer_status (server->buffer, 1);
+ gui_draw_buffer_input (server->buffer, 1);
/* execute command once connected */
if (server->command && server->command[0])
@@ -1491,10 +1491,10 @@ irc_cmd_recv_301 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (gui_current_view, PREFIX_INFO);
- gui_printf_color (gui_current_view,
+ irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT, _(" is away: %s\n"), pos_message);
}
}
@@ -1537,12 +1537,12 @@ irc_cmd_recv_302 (t_irc_server *server, char *host, char *arguments)
ptr_next++;
}
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", arguments);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "=");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST, "%s\n", pos_host);
}
else
@@ -1567,8 +1567,8 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *arguments)
/* make gcc happy */
(void) host;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Users online: "));
arguments = strchr (arguments, ' ');
@@ -1588,14 +1588,14 @@ irc_cmd_recv_303 (t_irc_server *server, char *host, char *arguments)
while (ptr_next[0] == ' ')
ptr_next++;
}
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s ", arguments);
arguments = ptr_next;
if (arguments && !arguments[0])
arguments = NULL;
}
}
- gui_printf (server->view, "\n");
+ gui_printf (server->buffer, "\n");
return 0;
}
@@ -1616,8 +1616,8 @@ irc_cmd_recv_305 (t_irc_server *server, char *host, char *arguments)
arguments++;
if (arguments[0] == ':')
arguments++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", arguments);
}
server->is_away = 0;
@@ -1641,8 +1641,8 @@ irc_cmd_recv_306 (t_irc_server *server, char *host, char *arguments)
arguments++;
if (arguments[0] == ':')
arguments++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", arguments);
}
server->is_away = 1;
@@ -1694,19 +1694,19 @@ irc_cmd_recv_311 (t_irc_server *server, char *host, char *arguments)
if (pos_realname[0] == ':')
pos_realname++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] (");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST, "%s@%s",
pos_user, pos_host);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, ": %s\n", pos_realname);
}
}
@@ -1749,20 +1749,20 @@ irc_cmd_recv_312 (t_irc_server *server, char *host, char *arguments)
if (pos_serverinfo[0] == ':')
pos_serverinfo++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s ", pos_server);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "(");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s", pos_serverinfo);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, ")\n");
}
}
@@ -1797,14 +1797,14 @@ irc_cmd_recv_313 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", pos_message);
}
}
@@ -1859,17 +1859,17 @@ irc_cmd_recv_314 (t_irc_server *server, char *host, char *arguments)
if (pos_realname[0] == ':')
pos_realname++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST,
"%s@%s", pos_user, pos_host);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, ")");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
" was %s\n", pos_realname);
}
@@ -1924,52 +1924,52 @@ irc_cmd_recv_317 (t_irc_server *server, char *host, char *arguments)
min = ((idle_time % (60 * 60 * 24)) % (60 * 60)) / 60;
sec = ((idle_time % (60 * 60 * 24)) % (60 * 60)) % 60;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("idle: "));
if (day > 0)
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", day);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(day > 1) ? _("days") : _("day"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
", ");
}
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%02d ", hour);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(hour > 1) ? _("hours") : _("hour"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
" %02d ", min);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(min > 1) ? _("minutes") : _("minute"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
" %02d ", sec);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
(sec > 1) ? _("seconds") : _("second"));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("signon at: "));
datetime = (time_t)(atol (pos_signon));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s", ctime (&datetime));
}
@@ -2006,14 +2006,14 @@ irc_cmd_recv_318 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", pos_message);
}
}
@@ -2047,21 +2047,21 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
if (pos_channel[0] == ':')
pos_channel++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, _("Channels: "));
while (pos_channel && pos_channel[0])
{
if (pos_channel[0] == '@')
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_NICK_OP, "@");
pos_channel++;
}
@@ -2069,14 +2069,14 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
{
if (pos_channel[0] == '%')
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_NICK_HALFOP, "%");
pos_channel++;
}
else
if (pos_channel[0] == '+')
{
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_NICK_VOICE, "+");
pos_channel++;
}
@@ -2089,7 +2089,7 @@ irc_cmd_recv_319 (t_irc_server *server, char *host, char *arguments)
while (pos[0] == ' ')
pos++;
}
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s%s",
pos_channel,
@@ -2128,14 +2128,14 @@ irc_cmd_recv_320 (t_irc_server *server, char *host, char *arguments)
if (pos_message[0] == ':')
pos_message++;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf_color (server->view,
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "[");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK, "] ");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT, "%s\n", pos_message);
}
}
@@ -2165,8 +2165,8 @@ irc_cmd_recv_321 (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf (server->view, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2193,8 +2193,8 @@ irc_cmd_recv_322 (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf (server->view, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2221,8 +2221,8 @@ irc_cmd_recv_323 (t_irc_server *server, char *host, char *arguments)
else
pos = arguments;
- irc_display_prefix (server->view, PREFIX_SERVER);
- gui_printf (server->view, "%s\n", pos);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2267,7 +2267,7 @@ irc_cmd_recv_324 (t_irc_server *server, char *host, char *arguments)
if (ptr_channel)
{
irc_get_channel_modes (ptr_channel, NULL, NULL, pos, pos_parm);
- gui_draw_view_status (gui_current_view);
+ gui_draw_buffer_status (gui_current_window->buffer, 0);
}
}
}
@@ -2305,9 +2305,9 @@ irc_cmd_recv_331 (t_irc_server *server, char *host, char *arguments)
pos = strchr (arguments, ' ');
if (pos)
pos[0] = '\0';
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT, _("No topic set for "));
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s\n", arguments);
return 0;
}
@@ -2346,19 +2346,19 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
free (ptr_channel->topic);
ptr_channel->topic = strdup (pos2);
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Topic for "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL, "%s", pos);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _(" is: \"%s\"\n"), pos2);
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "332");
return -1;
@@ -2367,7 +2367,7 @@ irc_cmd_recv_332 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify channel for \"%s\" command\n"),
WEECHAT_ERROR, "332");
return -1;
@@ -2412,18 +2412,18 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
ptr_channel = channel_search (server, pos_channel);
if (ptr_channel)
{
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Topic set by "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_NICK, "%s", pos_nick);
datetime = (time_t)(atol (pos_date));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, ", %s", ctime (&datetime));
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s channel not found for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2431,7 +2431,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify date/time for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2439,7 +2439,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify nickname for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2447,7 +2447,7 @@ irc_cmd_recv_333 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot identify channel for \"%s\" command\n"),
WEECHAT_ERROR, "333");
return -1;
@@ -2484,11 +2484,11 @@ irc_cmd_recv_351 (t_irc_server *server, char *host, char *arguments)
pos2 += 2;
}
- irc_display_prefix (server->view, PREFIX_SERVER);
+ irc_display_prefix (server->buffer, PREFIX_SERVER);
if (pos2)
- gui_printf (server->view, "%s %s\n", pos, pos2);
+ gui_printf (server->buffer, "%s %s\n", pos, pos2);
else
- gui_printf (server->view, "%s\n", pos);
+ gui_printf (server->buffer, "%s\n", pos);
return 0;
}
@@ -2562,32 +2562,32 @@ irc_cmd_recv_352 (t_irc_server *server, char *host, char *arguments)
while (pos_realname[0] == ' ')
pos_realname++;
- irc_display_prefix (server->view,
+ irc_display_prefix (server->buffer,
PREFIX_SERVER);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_NICK,
"%s", pos_nick);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
_(" on "));
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s ", pos_channel);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s %s ",
pos_attr, pos_hopcount);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_HOST,
"%s@%s",
pos_user, pos_host);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK,
" (");
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT,
"%s", pos_realname);
- gui_printf_color (server->view,
+ gui_printf_color (server->buffer,
COLOR_WIN_CHAT_DARK,
")\n");
}
@@ -2644,7 +2644,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
pos++;
if (pos[0] != ':')
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "353");
return -1;
@@ -2675,16 +2675,16 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *arguments)
pos++;
}
if (!nick_new (ptr_channel, pos_nick, is_op, is_halfop, has_voice))
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create nick \"%s\" for channel \"%s\"\n"),
WEECHAT_ERROR, pos_nick, ptr_channel->name);
}
}
- gui_redraw_view_nick (ptr_channel->view);
+ gui_draw_buffer_nick (ptr_channel->buffer, 1);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot parse \"%s\" command\n"),
WEECHAT_ERROR, "353");
return -1;
@@ -2727,85 +2727,85 @@ irc_cmd_recv_366 (t_irc_server *server, char *host, char *arguments)
{
/* display users on channel */
- irc_display_prefix (ptr_channel->view, PREFIX_SERVER);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_SERVER);
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT,
_("Nicks "));
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_CHANNEL,
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_CHANNEL,
"%s", ptr_channel->name);
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT, ": ");
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK, "[");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT, ": ");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "[");
for (ptr_nick = ptr_channel->nicks; ptr_nick; ptr_nick = ptr_nick->next_nick)
{
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_INFO, 0, 0, 1);
if (ptr_nick != ptr_channel->last_nick)
- gui_printf (ptr_channel->view, " ");
+ gui_printf (ptr_channel->buffer, " ");
}
- gui_printf_color (ptr_channel->view, COLOR_WIN_CHAT_DARK, "]\n");
+ gui_printf_color (ptr_channel->buffer, COLOR_WIN_CHAT_DARK, "]\n");
/* display number of nicks, ops, halfops & voices on the channel */
nick_count (ptr_channel, &num_nicks, &num_op, &num_halfop, &num_voice,
&num_normal);
- irc_display_prefix (ptr_channel->view, PREFIX_INFO);
- gui_printf_color (ptr_channel->view,
+ irc_display_prefix (ptr_channel->buffer, PREFIX_INFO);
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, _("Channel "));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%s", ptr_channel->name);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT, ": ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_nicks);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_nicks > 1) ? _("nicks") : _("nick"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, " (");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_op);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_op > 1) ? _("ops") : _("op"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_halfop);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_halfop > 1) ? _("halfops") : _("halfop"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_voice);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
(num_voice > 1) ? _("voices") : _("voice"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
", ");
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_CHANNEL,
"%d ", num_normal);
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT,
_("normal"));
- gui_printf_color (ptr_channel->view,
+ gui_printf_color (ptr_channel->buffer,
COLOR_WIN_CHAT_DARK, ")\n");
irc_cmd_send_mode (server, ptr_channel->name);
}
else
{
- irc_display_prefix (gui_current_view, PREFIX_INFO);
- gui_printf_color (gui_current_view,
+ irc_display_prefix (gui_current_window->buffer, PREFIX_INFO);
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT_CHANNEL, pos);
- gui_printf_color (gui_current_view,
+ gui_printf_color (gui_current_window->buffer,
COLOR_WIN_CHAT, ": %s\n", pos2);
return 0;
}
@@ -2827,7 +2827,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
{
if (strcmp (server->nick, server->nick1) == 0)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s: nickname \"%s\" is already in use, "
"trying 2nd nickname \"%s\"\n"),
PACKAGE_NAME, server->nick, server->nick2);
@@ -2838,7 +2838,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
{
if (strcmp (server->nick, server->nick2) == 0)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s: nickname \"%s\" is already in use, "
"trying 3rd nickname \"%s\"\n"),
PACKAGE_NAME, server->nick, server->nick3);
@@ -2847,7 +2847,7 @@ irc_cmd_recv_433 (t_irc_server *server, char *host, char *arguments)
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s: all declared nicknames are already in use, "
"closing connection with server!\n"),
PACKAGE_NAME);
diff --git a/weechat/src/irc/irc-send.c b/weechat/src/irc/irc-send.c
index 535cca1f0..d31ae8f62 100644
--- a/weechat/src/irc/irc-send.c
+++ b/weechat/src/irc/irc-send.c
@@ -56,7 +56,7 @@ irc_login (t_irc_server *server)
hostname[sizeof (hostname) - 1] = '\0';
if (!hostname[0])
strcpy (hostname, _("unknown"));
- gui_printf (server->view,
+ 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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
- gui_printf (server->view,
+ 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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
{
- gui_printf (server->view,
+ 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 (VIEW_IS_CHANNEL (gui_current_view))
+ if (BUFFER_IS_CHANNEL (gui_current_window->buffer))
{
server_sendf (server,
"KICK %s %s\r\n",
- CHANNEL(gui_current_view)->name, arguments);
+ CHANNEL(gui_current_window->buffer)->name, arguments);
}
else
{
- gui_printf (server->view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->name, arguments);
- irc_display_prefix (gui_current_view, PREFIX_ACTION_ME);
- gui_printf_color (gui_current_view,
+ 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_view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view);
+ ptr_channel = CHANNEL(gui_current_window->buffer);
ptr_nick = nick_search (ptr_channel, server->nick);
if (ptr_nick)
{
- irc_display_nick (ptr_channel->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
- gui_printf (server->view,
+ 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->view, ptr_nick,
+ irc_display_nick (ptr_channel->buffer, ptr_nick,
MSG_TYPE_NICK, 1, 1, 0);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_MSG,
COLOR_WIN_CHAT, "%s\n", pos);
}
else
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (ptr_channel->view,
+ 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->view,
+ 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 (!VIEW_IS_CHANNEL(gui_current_view))
+ if (!BUFFER_IS_CHANNEL(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
{
- gui_printf (server->view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->name;
+ channel_name = CHANNEL(gui_current_window->buffer)->name;
pos_args = arguments;
}
}
else
{
- if (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command can not be executed on a server window\n"),
WEECHAT_ERROR, "part");
return -1;
}
- if (VIEW_IS_PRIVATE(gui_current_view))
+ if (BUFFER_IS_PRIVATE(gui_current_window->buffer))
{
- ptr_channel = CHANNEL(gui_current_view);
- gui_view_free (ptr_channel->view);
+ ptr_channel = CHANNEL(gui_current_window->buffer);
+ gui_buffer_free (ptr_channel->buffer);
channel_free (server, ptr_channel);
- gui_redraw_view_status (gui_current_view);
- gui_redraw_view_input (gui_current_view);
+ 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_view)->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->view,
+ gui_printf (server->buffer,
_("%s cannot create new private window \"%s\"\n"),
WEECHAT_ERROR,
arguments);
return -1;
}
- gui_redraw_view_title (ptr_channel->view);
+ gui_draw_buffer_title (ptr_channel->buffer, 1);
}
/* display text if given */
if (pos)
{
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "<");
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_NICK_SELF,
"%s", server->nick);
- gui_printf_color_type (ptr_channel->view,
+ gui_printf_color_type (ptr_channel->buffer,
MSG_TYPE_NICK,
COLOR_WIN_CHAT_DARK, "> ");
- gui_printf_color_type (ptr_channel->view,
+ 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 (VIEW_IS_SERVER(gui_current_view))
+ if (BUFFER_IS_SERVER(gui_current_window->buffer))
{
- gui_printf (server->view,
+ 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_view)->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 (VIEW_IS_CHANNEL(gui_current_view) &&
- nick_search (CHANNEL(gui_current_view), 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->view, PREFIX_INFO);
- gui_printf (server->view, _("%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 (VIEW_IS_CHANNEL(gui_current_view))
+ 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_view)->name,
+ CHANNEL(gui_current_window->buffer)->name,
argv[i]);
}
else
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s \"%s\" command can only be executed in a channel window\n"),
WEECHAT_ERROR, "voice");
return -1;
diff --git a/weechat/src/irc/irc-server.c b/weechat/src/irc/irc-server.c
index 06d823902..1d37b023a 100644
--- a/weechat/src/irc/irc-server.c
+++ b/weechat/src/irc/irc-server.c
@@ -78,7 +78,7 @@ server_init (t_irc_server *server)
server->is_away = 0;
server->server_read = -1;
server->server_write = -1;
- server->view = NULL;
+ server->buffer = NULL;
server->channels = NULL;
server->last_channel = NULL;
}
@@ -270,8 +270,8 @@ server_free (t_irc_server *server)
(server->next_server)->prev_server = server->prev_server;
server_destroy (server);
- if (server->view)
- gui_view_free (server->view);
+ if (server->buffer)
+ gui_buffer_free (server->buffer);
free (server);
irc_servers = new_irc_servers;
}
@@ -377,11 +377,11 @@ server_sendf (t_irc_server * server, char *fmt, ...)
size_buf = strlen (buffer);
buffer[size_buf - 2] = '\0';
#ifdef DEBUG
- gui_printf (server->view, "[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->view, _("%s error sending data to IRC server\n"),
+ gui_printf (server->buffer, _("%s error sending data to IRC server\n"),
WEECHAT_ERROR);
}
@@ -397,7 +397,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->view,
+ gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
return;
@@ -408,7 +408,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->view,
+ gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
@@ -462,14 +462,14 @@ server_msgq_add_buffer (t_irc_server * server, char *buffer)
(char *) realloc (unterminated_message,
strlen (buffer) + 1);
if (!unterminated_message)
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s not enough memory for received IRC message\n"),
WEECHAT_ERROR);
else
strcpy (unterminated_message, buffer);
return;
}
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s unable to explode received buffer\n"),
WEECHAT_ERROR);
}
@@ -493,7 +493,7 @@ server_msgq_flush ()
if (recv_msgq->data)
{
#ifdef DEBUG
- gui_printf (gui_current_view, "[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 +542,15 @@ server_msgq_flush ()
command, args))
{
case -1:
- gui_printf (recv_msgq->server->view,
+ gui_printf (recv_msgq->server->buffer,
_("Command '%s' failed!\n"), command);
break;
case -2:
- gui_printf (recv_msgq->server->view,
+ gui_printf (recv_msgq->server->buffer,
_("No command to execute!\n"));
break;
case -3:
- gui_printf (recv_msgq->server->view,
+ gui_printf (recv_msgq->server->buffer,
_("Unknown command: cmd=%s, args=%s\n"),
command, args);
break;
@@ -602,7 +602,7 @@ server_connect (t_irc_server *server)
int error;
int server_pipe[2];
- gui_printf (server->view,
+ 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 +612,7 @@ server_connect (t_irc_server *server)
/* create pipe */
if (pipe (server_pipe) < 0)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s cannot create pipe\n"), WEECHAT_ERROR);
server_free (server);
return 0;
@@ -626,14 +626,14 @@ server_connect (t_irc_server *server)
if (setsockopt
(server->sock4, SOL_SOCKET, SO_REUSEADDR, (char *) &set,
sizeof (set)) == -1)
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s cannot set socket option \"SO_KEEPALIVE\"\n"),
WEECHAT_ERROR);
@@ -641,7 +641,7 @@ server_connect (t_irc_server *server)
ip4_hostent = gethostbyname (server->address);
if (!ip4_hostent)
{
- gui_printf (server->view,
+ gui_printf (server->buffer,
_("%s address \"%s\" not found\n"),
WEECHAT_ERROR, server->address);
close (server->server_read);
@@ -657,14 +657,14 @@ server_connect (t_irc_server *server)
/*error = bind(server->sock4, (struct sockaddr *)(&addr), sizeof(addr));
if (error != 0)
{
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s IP address not found\n"), WEECHAT_ERROR);
close (server->server_read);
close (server->server_write);
@@ -674,13 +674,13 @@ server_connect (t_irc_server *server)
}
/* connection to server */
- gui_printf (server->view,
+ 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->view,
+ gui_printf (server->buffer,
_("%s cannot connect to irc server\n"), WEECHAT_ERROR);
close (server->server_read);
close (server->server_write);
@@ -708,7 +708,7 @@ server_auto_connect (int command_line)
if ( ((command_line) && (ptr_server->command_line))
|| ((!command_line) && (ptr_server->autoconnect)) )
{
- (void) gui_view_new (gui_current_view->window, 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 +726,12 @@ server_disconnect (t_irc_server *server)
if (server->is_connected)
{
- /* write disconnection message on each channel/private view */
+ /* 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->view, PREFIX_INFO);
- gui_printf (ptr_channel->view, _("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 */
diff --git a/weechat/src/irc/irc.h b/weechat/src/irc/irc.h
index c34816a34..d194cfda7 100644
--- a/weechat/src/irc/irc.h
+++ b/weechat/src/irc/irc.h
@@ -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_view *view; /* GUI view 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_view *view; /* GUI view 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_view *, char *);
-extern void irc_display_nick (t_gui_view *, t_irc_nick *, int, int, int, int);
-extern void irc_display_mode (t_gui_view *, 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) */
diff --git a/weechat/src/plugins/perl/wee-perl.c b/weechat/src/plugins/perl/wee-perl.c
index 08f687d07..12c0051c2 100644
--- a/weechat/src/plugins/perl/wee-perl.c
+++ b/weechat/src/plugins/perl/wee-perl.c
@@ -120,7 +120,7 @@ static XS (XS_IRC_register)
}
/*
- * IRC::print: print message to current view
+ * 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_view, PREFIX_PLUGIN);
- gui_printf (gui_current_view, "%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_view *ptr_view;
+ 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 view for printing message */
+ /* look for buffer for printing message */
channel = SvPV (ST (1), integer);
- ptr_view = 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_view = ptr_channel->view;
+ ptr_buffer = ptr_channel->buffer;
break;
}
}
}
- if (ptr_view)
+ if (ptr_buffer)
break;
}
- /* view found => display message & return 1 */
- if (ptr_view)
+ /* buffer found => display message & return 1 */
+ if (ptr_buffer)
{
message = SvPV (ST (0), integer);
- irc_display_prefix (ptr_view, PREFIX_PLUGIN);
- gui_printf (ptr_view, "%s", message);
+ irc_display_prefix (ptr_buffer, PREFIX_PLUGIN);
+ gui_printf (ptr_buffer, "%s", message);
XSRETURN_YES;
}
- /* no view 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 (VIEW_IS_CHANNEL (gui_current_view))
- info = CHANNEL (gui_current_view)->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) )
{