1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-06 09:43:13 +02:00

Fixed bugs with IRC color in messages, now color codes are inserted in command line with ^Cc,^Cb,.. instead of %C,%B,.. (bug #20222, task #7060)

This commit is contained in:
Sebastien Helleu
2007-07-12 15:00:45 +00:00
parent 9d5ef17bd6
commit 241f70f869
80 changed files with 5702 additions and 4642 deletions
+3 -1
View File
@@ -1,10 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2007-07-09
ChangeLog - 2007-07-12
Version 0.2.6 (under dev!):
* fixed bugs with IRC color in messages, now color codes are inserted in
command line with ^Cc,^Cb,.. instead of %C,%B,.. (bug #20222, task #7060)
* fixed bug with smart nick completion (last speakers first) when a nick
is changed
* fixed charset bug with channel names in status bar (bug #20400)
+1 -1
View File
@@ -955,7 +955,7 @@
<entry>Boolean</entry>
<entry>eine beliebige Zeichenfolge</entry>
<entry>'on'</entry>
<entry>Erlaube Benutzern, spezielle Codes zu versenden (%B=fett, %Cxx,yy=Farbe, %U=unterstrichen, %R=reverse/umgekehrt)</entry>
<entry>Allow user to send colors with special codes (^Cb=bold, ^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, ^Cr=reverse)</entry>
</row>
<row>
<entry><option>irc_send_unknown_commands</option></entry>
+147 -15
View File
@@ -810,7 +810,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<para>
Wenn die Option IRC-Farben ("<literal>irc_colors_send</literal>") senden
angeschaltet ist, können sie Farbcodierung und Attribute wiefolgt verwenden:
angeschaltet ist, können sie Farbcodierung und Attribute wiefolgt verwenden
<!-- TRANSLATION NEEDED -->
(press Ctrl-C then following letter, with optional value):
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -821,20 +823,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</thead>
<tbody>
<row>
<entry>%B</entry>
<entry>^Cb</entry>
<entry>
Fett (bold)
</entry>
</row>
<row>
<entry>%Cxx</entry>
<entry>^Ccxx</entry>
<entry>
Textfarbe "<literal>xx</literal>" (color)
(siehe Farbtabelle)
</entry>
</row>
<row>
<entry>%Cxx,yy</entry>
<entry>^Ccxx,yy</entry>
<entry>
Textfarbe "<literal>xx</literal>"
und Hintergrund "<literal>yy</literal>"
@@ -842,29 +844,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</entry>
</row>
<row>
<entry>%O</entry>
<entry>^Co</entry>
<entry>
Schalte Farben und Attribute ab
</entry>
</row>
<row>
<entry>%R</entry>
<entry>^Cr</entry>
<entry>
umgedrehte Farben (tausche Textfarbe mit Hintergrundfarbe)
</entry>
</row>
<row>
<entry>%U</entry>
<entry>^Cu</entry>
<entry>
Unterstreiche Text
</entry>
</row>
<row>
<entry>%%</entry>
<entry>
Schreibe ein einzelnes "<literal>%</literal>"
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
@@ -873,7 +869,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</para>
<para>
Farbcodes für %C:
Farbcodes für ^Cc:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -956,7 +952,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Beispiel: Anzeige von "<literal>hello everybody!</literal>" mit
"<literal>hello</literal>" fett in hellem Blau, und
"<literal>everybody</literal>" unterstrichen in hellem Rot:
<screen><userinput>%C12%Bhello%B%C04%U everybody%U%C!</userinput></screen>
<screen><userinput>^Cc12^Cbhello^Cb^Cc04^Cu everybody^Cu^Cc!</userinput></screen>
</para>
</section>
@@ -1851,6 +1847,63 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
</listitem>
</itemizedlist>
</para>
<!-- TRANSLATION NEEDED -->
<para>
To display colored text, there are following codes:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
<row>
<entry>Code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>0x02</entry>
<entry>
bold text
</entry>
</row>
<row>
<entry>0x03 + "xx"</entry>
<entry>
text color "<literal>xx</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x03 + "xx,yy"</entry>
<entry>
text color "<literal>xx</literal>"
and background "<literal>yy</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x0F</entry>
<entry>
disable color and attributes
</entry>
</row>
<row>
<entry>0x12</entry>
<entry>
reverse video (revert text color with background)
</entry>
</row>
<row>
<entry>0x1F</entry>
<entry>
underlined text
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Note: the same code (without number for 0x03) may be used to stop
the attribute.
</para>
<para>
Rückgabewert: keiner.
</para>
@@ -1860,6 +1913,10 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
plugin->print (plugin, NULL, NULL, "hello");
plugin->print (plugin, NULL, "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, NULL, NULL,
"Test: \x02 Fett \x0F\x03%02d Blau \x03%02d Grün",
plugin->get_irc_color (plugin, "blue"),
plugin->get_irc_color (plugin, "green"));
</screen>
</para>
</section>
@@ -1892,6 +1949,10 @@ plugin->print (plugin, "freenode", "#weechat", "hello");
</listitem>
</itemizedlist>
</para>
<para>
<!-- TRANSLATION NEEDED -->
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Rückgabewert: keiner.
</para>
@@ -5220,6 +5281,10 @@ weechat.set_charset("ISO-8859-1")
</listitem>
</itemizedlist>
</para>
<para>
<!-- TRANSLATION NEEDED -->
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist
</para>
@@ -5230,6 +5295,7 @@ weechat.set_charset("ISO-8859-1")
weechat::print("message");
weechat::print("message", "#weechat");
weechat::print("message", "#weechat", "freenode");
weechat::print("test: \x0305 rot \x0F normal");
# python
weechat.prnt("message")
@@ -5249,6 +5315,72 @@ weechat.print("message", "#weechat", "freenode")
</para>
</section>
<!-- TRANSLATION NEEDED -->
<section id="secScript_print_server">
<title>print_server</title>
<para>
Perl prototype:
<command>
weechat::print_server(message)
</command>
</para>
<para>
Python prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Ruby prototype:
<command>
Weechat.print_server(message)
</command>
</para>
<para>
Lua prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Display a message on server buffer.
</para>
<para>
Arguments:
<itemizedlist>
<listitem>
<para>
<option>message</option>: message
</para>
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: 1 if success, 0 if an error occurred.
</para>
<para>
Examples:
<screen>
# perl
weechat::print_server("message");
weechat::print_server("test: \x0305 rot \x0F normal");
# python
weechat.print_server("message")
# ruby
Weechat.print_server("message")
-- lua
weechat.print_server("message")
</screen>
</para>
</section>
<section id="secScript_print_infobar">
<title>print_infobar</title>
+22 -9
View File
@@ -22,15 +22,28 @@ Argumente: Argumente f
<programlisting>
Puffer verwalten
Aktion: Pufferaktion:
move: Puffer in der Liste bewegen (kann auch relativ sein, wie -1)
close: Puffer schließen (eine Part-Message kann optional angegeben werden)
list: alle offenen Puffer auflisten (Standardaktion)
notify: Notify-Level für Puffer festlegen (0=nie, 1=bei hervorgehobenen Nachrichten, 2=1+persönliche Nachricht, 3=2+join/part)
(wenn der Befehl in einem Server Puffer ausgeführt wird, setzt er den Default-Notify-Level für den ganzen Server)
Server
Channel: gehe zum Puffer mit Servernamen oder Channelnamen
Nummer: gehe zu Puffer mit dieser Nummer
action: action to do:
move: move buffer in the list (may be relative, for example -1)
close: close buffer (optional arg is part message, for a channel)
list: list open buffers (no parameter implies this list)
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)
(when executed on server buffer, this sets default notify level for whole server)
scroll: scroll in history (may be relative, and may end by a letter: s=sec, m=min, h=hour, d=day, M=month, y=year); if there is only letter, then scroll to beginning of this item
number: jump to buffer by number
server,
channel: jump to buffer by server and/or channel name
Examples:
move buffer: /buffer move 5
close buffer: /buffer close this is part msg
set notify: /buffer notify 2
scroll 1 day up: /buffer scroll 1d == /buffer scroll -1d == /buffer scroll -24h
scroll to beginning
of this day: /buffer scroll d
scroll 15 min down: /buffer scroll +15m
scroll 20 msgs up: /buffer scroll -20
jump to #weechat: /buffer #weechat
</programlisting>
<command>builtin Befehl</command>
+1 -1
View File
@@ -955,7 +955,7 @@
<entry>boolean</entry>
<entry>'on' or 'off'</entry>
<entry>'on'</entry>
<entry>Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)</entry>
<entry>Allow user to send colors with special codes (^Cb=bold, ^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, ^Cr=reverse)</entry>
</row>
<row>
<entry><option>irc_send_unknown_commands</option></entry>
+143 -16
View File
@@ -804,7 +804,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<para>
If option for sending IRC colors ("<literal>irc_colors_send</literal>")
is enabled, you can use color codes and attributes, as follow:
is enabled, you can use color codes and attributes, as follow (press
Ctrl-C then following letter, with optional value):
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -815,20 +816,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</thead>
<tbody>
<row>
<entry>%B</entry>
<entry>^Cb</entry>
<entry>
bold text
</entry>
</row>
<row>
<entry>%Cxx</entry>
<entry>^Ccxx</entry>
<entry>
text color "<literal>xx</literal>"
(see colors table below)
</entry>
</row>
<row>
<entry>%Cxx,yy</entry>
<entry>^Ccxx,yy</entry>
<entry>
text color "<literal>xx</literal>"
and background "<literal>yy</literal>"
@@ -836,38 +837,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</entry>
</row>
<row>
<entry>%O</entry>
<entry>^Co</entry>
<entry>
disable color and attributes
</entry>
</row>
<row>
<entry>%R</entry>
<entry>^Cr</entry>
<entry>
reverse video (revert text color with background)
</entry>
</row>
<row>
<entry>%U</entry>
<entry>^Cu</entry>
<entry>
underlined text
</entry>
</row>
<row>
<entry>%%</entry>
<entry>
display one "<literal>%</literal>"
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Note: the same code (without number for %C) may be used to stop the
Note: the same code (without number for ^Cc) may be used to stop the
attribute.
</para>
<para>
Color codes for %C are:
Color codes for ^Cc are:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -950,7 +945,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Example: display of "<literal>hello everybody!</literal>" with
"<literal>hello</literal>" in light blue bold, and
"<literal>everybody</literal>" in light red underlined:
<screen><userinput>%C12%Bhello%B%C04%U everybody%U%C!</userinput></screen>
<screen><userinput>^Cc12^Cbhello^Cb^Cc04^Cu everybody^Cu^Cc!</userinput></screen>
</para>
</section>
@@ -1850,6 +1845,62 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, there are following codes:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
<row>
<entry>Code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>0x02</entry>
<entry>
bold text
</entry>
</row>
<row>
<entry>0x03 + "xx"</entry>
<entry>
text color "<literal>xx</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x03 + "xx,yy"</entry>
<entry>
text color "<literal>xx</literal>"
and background "<literal>yy</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x0F</entry>
<entry>
disable color and attributes
</entry>
</row>
<row>
<entry>0x12</entry>
<entry>
reverse video (revert text color with background)
</entry>
</row>
<row>
<entry>0x1F</entry>
<entry>
underlined text
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Note: the same code (without number for 0x03) may be used to stop
the attribute.
</para>
<para>
Return value: none.
</para>
@@ -1859,6 +1910,10 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
plugin->print (plugin, NULL, NULL, "hello");
plugin->print (plugin, NULL, "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, NULL, NULL,
"test: \x02 bold \x0F\x03%02d blue \x03%02d green",
plugin->get_irc_color (plugin, "blue"),
plugin->get_irc_color (plugin, "green"));
</screen>
</para>
</section>
@@ -1891,6 +1946,9 @@ plugin->print (plugin, "freenode", "#weechat", "hello");
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: none.
</para>
@@ -5253,6 +5311,9 @@ weechat.set_charset("ISO-8859-1")
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: 1 if success, 0 if an error occurred.
</para>
@@ -5263,6 +5324,7 @@ weechat.set_charset("ISO-8859-1")
weechat::print("message");
weechat::print("message", "#weechat");
weechat::print("message", "#weechat", "freenode");
weechat::print("test: \x0305 red \x0F normal");
# python
weechat.prnt("message")
@@ -5282,6 +5344,71 @@ weechat.print("message", "#weechat", "freenode")
</para>
</section>
<section id="secScript_print_server">
<title>print_server</title>
<para>
Perl prototype:
<command>
weechat::print_server(message)
</command>
</para>
<para>
Python prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Ruby prototype:
<command>
Weechat.print_server(message)
</command>
</para>
<para>
Lua prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Display a message on server buffer.
</para>
<para>
Arguments:
<itemizedlist>
<listitem>
<para>
<option>message</option>: message
</para>
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: 1 if success, 0 if an error occurred.
</para>
<para>
Examples:
<screen>
# perl
weechat::print_server("message");
weechat::print_server("test: \x0305 red \x0F normal");
# python
weechat.print_server("message")
# ruby
Weechat.print_server("message")
-- lua
weechat.print_server("message")
</screen>
</para>
</section>
<section id="secScript_print_infobar">
<title>print_infobar</title>
+14 -1
View File
@@ -28,9 +28,22 @@ manage buffers
list: list open buffers (no parameter implies this list)
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)
(when executed on server buffer, this sets default notify level for whole server)
scroll: scroll in history (may be relative, and may end by a letter: s=sec, m=min, h=hour, d=day, M=month, y=year); if there is only letter, then scroll to beginning of this item
number: jump to buffer by number
server,
channel: jump to buffer by server and/or channel name
number: jump to buffer by number
Examples:
move buffer: /buffer move 5
close buffer: /buffer close this is part msg
set notify: /buffer notify 2
scroll 1 day up: /buffer scroll 1d == /buffer scroll -1d == /buffer scroll -24h
scroll to beginning
of this day: /buffer scroll d
scroll 15 min down: /buffer scroll +15m
scroll 20 msgs up: /buffer scroll -20
jump to #weechat: /buffer #weechat
</programlisting>
<command>builtin command</command>
+1 -1
View File
@@ -955,7 +955,7 @@
<entry>booléen</entry>
<entry>'on' ou 'off'</entry>
<entry>'on'</entry>
<entry>Autorise l'utilisateur à envoyer des couleurs avec des codes spéciaux (%B=gras, %Cxx,yy=couleur, %U=souligné, %R=inversé)</entry>
<entry>Autorise l'utilisateur à envoyer des couleurs avec des codes spéciaux (^Cb=gras, ^Cxx=couleur, ^Ccxx,yy=couleur+fond, ^Cu=souligné, ^Cr=inversé)</entry>
</row>
<row>
<entry><option>irc_send_unknown_commands</option></entry>
+150 -16
View File
@@ -818,7 +818,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<para>
Si l'option d'envoi des couleurs IRC
("<literal>irc_colors_send</literal>") est activée, il est possible
d'utiliser des codes couleur et attributs comme suit :
d'utiliser des codes couleur et attributs comme suit (appuyer sur Ctrl-C
puis la lettre qui suit et éventuellement une valeur) :
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -829,20 +830,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</thead>
<tbody>
<row>
<entry>%B</entry>
<entry>^Cb</entry>
<entry>
texte gras
</entry>
</row>
<row>
<entry>%Cxx</entry>
<entry>^Ccxx</entry>
<entry>
couleur du texte "<literal>xx</literal>"
(voir le tableau des couleurs ci-dessous)
</entry>
</row>
<row>
<entry>%Cxx,yy</entry>
<entry>^Ccxx,yy</entry>
<entry>
couleur du texte "<literal>xx</literal>"
et du fond "<literal>yy</literal>"
@@ -850,38 +851,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</entry>
</row>
<row>
<entry>%O</entry>
<entry>^Co</entry>
<entry>
désactiver la couleur et tous les attributs
</entry>
</row>
<row>
<entry>%R</entry>
<entry>^Cr</entry>
<entry>
vidéo inverse (inversion de la couleur d'écriture et du fond)
</entry>
</row>
<row>
<entry>%U</entry>
<entry>^Cu</entry>
<entry>
texte souligné
</entry>
</row>
<row>
<entry>%%</entry>
<entry>
afficher un seul "<literal>%</literal>"
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
NB: le même code (sans le numéro pour %C) peut être utilisé pour stopper
NB: le même code (sans le numéro pour ^Cc) peut être utilisé pour stopper
l'attribut défini.
</para>
<para>
Les codes couleur pour %C sont :
Les codes couleur pour ^Cc sont :
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -964,7 +959,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Exemple : affichage de "<literal>bonjour tout le monde !</literal>"
avec "<literal>bonjour</literal>" en bleu clair gras, et
"<literal>tout le monde</literal>" en rouge clair souligné :
<screen><userinput>%C12%Bbonjour%B%C04%U tout le monde%U%C !</userinput></screen>
<screen><userinput>^Cc12^Cbbonjour^Cb^Cc04^Cu tout le monde^Cu^Cc !</userinput></screen>
</para>
</section>
@@ -1897,6 +1892,65 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, il faut utiliser les codes
suivants :
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
<row>
<entry>Code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>0x02</entry>
<entry>
texte gras
</entry>
</row>
<row>
<entry>0x03 + "xx"</entry>
<entry>
couleur du texte "<literal>xx</literal>"
(voir <xref linkend="secAPI_get_irc_color" /> pour les
couleurs)
</entry>
</row>
<row>
<entry>0x03 + "xx,yy"</entry>
<entry>
couleur du texte "<literal>xx</literal>"
et du fond "<literal>yy</literal>"
(voir <xref linkend="secAPI_get_irc_color" /> pour les
couleurs)
</entry>
</row>
<row>
<entry>0x0F</entry>
<entry>
désactiver la couleur et tous les attributs
</entry>
</row>
<row>
<entry>0x12</entry>
<entry>
vidéo inverse (inversion de la couleur d'écriture et du fond)
</entry>
</row>
<row>
<entry>0x1F</entry>
<entry>
texte souligné
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
NB: le même code (sans le numéro pour 0x03) peut être utilisé pour stopper
l'attribut défini.
</para>
<para>
Valeur renvoyée : aucune.
</para>
@@ -1906,6 +1960,11 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
plugin->print (plugin, NULL, NULL, "hello");
plugin->print (plugin, NULL, "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, NULL, NULL,
"test: \x02 gras \x0F\x03%02d bleu \x03%02d vert",
plugin->get_irc_color (plugin, "blue"),
plugin->get_irc_color (plugin, "green"));
</screen>
</para>
</section>
@@ -1939,6 +1998,10 @@ plugin->print (plugin, "freenode", "#weechat", "hello");
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, voir
<xref linkend="secAPI_print" />.
</para>
<para>
Valeur renvoyée : aucune.
</para>
@@ -5388,6 +5451,10 @@ weechat.set_charset("ISO-8859-1")
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, voir
<xref linkend="secAPI_print" />.
</para>
<para>
Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
</para>
@@ -5398,6 +5465,7 @@ weechat.set_charset("ISO-8859-1")
weechat::print("message");
weechat::print("message", "#weechat");
weechat::print("message", "#weechat", "freenode");
weechat::print("test: \x0305 rouge \x0F normal");
# python
weechat.prnt("message")
@@ -5417,6 +5485,72 @@ weechat.print("message", "#weechat", "freenode")
</para>
</section>
<section id="secScript_print_server">
<title>print_server</title>
<para>
Prototype Perl :
<command>
weechat::print_server(message)
</command>
</para>
<para>
Prototype Python :
<command>
weechat.print_server(message)
</command>
</para>
<para>
Prototype Ruby :
<command>
Weechat.print_server(message)
</command>
</para>
<para>
Prototype Lua :
<command>
weechat.print_server(message)
</command>
</para>
<para>
Affiche un message sur le tampon serveur.
</para>
<para>
Paramètres :
<itemizedlist>
<listitem>
<para>
<option>message</option> : message à afficher
</para>
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, voir
<xref linkend="secAPI_print" />.
</para>
<para>
Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
</para>
<para>
Exemples :
<screen>
# perl
weechat::print_server("message");
weechat::print_server("test: \x0305 rouge \x0F normal");
# python
weechat.print_server("message")
# ruby
Weechat.print_server("message")
-- lua
weechat.print_server("message")
</screen>
</para>
</section>
<section id="secScript_print_infobar">
<title>print_infobar</title>
+14 -1
View File
@@ -28,9 +28,22 @@ gestion des tampons
list: liste les tampons ouverts (pas de paramètre affiche cette liste)
notify: fixe le niveau de notification (0=jamais, 1=highlight, 2=1+msg, 3=2+join/part)
(quand exécuté sur un tampon serveur, cela fixe le niveau de notification par défaut pour le serveur entier)
scroll: fait défiler l'historique (peut être relatif, et peut se terminer par une lettre: s=sec, m=min, h=heure, d=jour, M=mois, y=année); s'il y a seulement une lettre, alors fait défiler jusqu'au début de cet élément
nombre: saute au tampon qui a ce numéro
serveur,
canal: saute au tampon par serveur et/ou nom de canal
nombre: saute au tampon qui a ce numéro
Exemples :
déplacer tampon: /buffer move 5
fermer tampon: /buffer close c'est le message de départ
niveau de notif.: /buffer notify 2
défiler 1 jour haut: /buffer scroll 1d == /buffer scroll -1d == /buffer scroll -24h
défiler au début
de ce jour: /buffer scroll d
défiler 15 min bas: /buffer scroll +15m
défiler 20 msgs haut: /buffer scroll -20
aller sur #weechat: /buffer #weechat
</programlisting>
<command>builtin commande</command>
+286 -285
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+288 -288
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+285 -285
View File
File diff suppressed because it is too large Load Diff
+10 -18
View File
@@ -558,10 +558,9 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
}
else
{
ptr_args2 = (weechat_commands[i].conversion
&& cfg_irc_colors_send
&& ptr_args) ?
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
ptr_args2 = (ptr_args) ? (char *)gui_color_encode ((unsigned char *)ptr_args,
(weechat_commands[i].conversion
&& cfg_irc_colors_send)) : NULL;
if (weechat_commands[i].cmd_function_args)
{
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
@@ -647,10 +646,9 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
free (command);
return 0;
}
ptr_args2 = (irc_commands[i].conversion
&& cfg_irc_colors_send
&& ptr_args) ?
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
ptr_args2 = (ptr_args) ? (char *)gui_color_encode ((unsigned char *)ptr_args,
(irc_commands[i].conversion
&& cfg_irc_colors_send)) : NULL;
if (irc_commands[i].cmd_function_args)
{
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
@@ -722,11 +720,8 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
void
user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
{
char *decoded_text;
t_irc_nick *ptr_nick;
decoded_text = (char *)gui_color_decode ((unsigned char *)text, 1);
if ((CHANNEL(buffer)->type == CHANNEL_TYPE_PRIVATE)
|| (CHANNEL(buffer)->type == CHANNEL_TYPE_DCC_CHAT))
{
@@ -736,7 +731,7 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(decoded_text) ? decoded_text : text);
text);
}
else
{
@@ -749,7 +744,7 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(decoded_text) ? decoded_text : text);
text);
}
else
{
@@ -759,9 +754,6 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
WEECHAT_ERROR);
}
}
if (decoded_text)
free (decoded_text);
}
/*
@@ -892,8 +884,8 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
if (server && (!BUFFER_IS_SERVER(buffer)))
{
command_with_colors = (cfg_irc_colors_send) ?
(char *)gui_color_encode ((unsigned char *)ptr_cmd) : NULL;
command_with_colors = (char *)gui_color_encode ((unsigned char *)ptr_cmd,
cfg_irc_colors_send);
if (CHANNEL(buffer)->dcc_chat)
{
+1 -1
View File
@@ -853,7 +853,7 @@ completion_list_add_topic (t_completion *completion)
if (cfg_irc_colors_send)
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)(completion->channel))->topic);
else
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0);
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0, 0);
completion_list_add (completion,
(string) ?
string : ((t_irc_channel *)(completion->channel))->topic,
+72
View File
@@ -27,6 +27,7 @@
#include <errno.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_ICONV
#include <iconv.h>
@@ -441,6 +442,77 @@ weechat_strreplace (char *string, char *search, char *replace)
return new_string;
}
/*
* weechat_convert_hex_chars: convert hex chars (\x??) to value
*/
char *
weechat_convert_hex_chars (char *string)
{
char *output, hex_str[8], *error;
int pos_output;
long number;
output = (char *)malloc (strlen (string) + 1);
if (output)
{
pos_output = 0;
while (string && string[0])
{
if (string[0] == '\\')
{
string++;
switch (string[0])
{
case '\\':
output[pos_output++] = '\\';
string++;
break;
case 'x':
case 'X':
if (isxdigit (string[1])
&& isxdigit (string[2]))
{
snprintf (hex_str, sizeof (hex_str),
"0x%c%c", string[1], string[2]);
number = strtol (hex_str, &error, 16);
if ((error) && (error[0] == '\0'))
{
output[pos_output++] = number;
string += 3;
}
else
{
output[pos_output++] = '\\';
output[pos_output++] = string[0];
string++;
}
}
else
{
output[pos_output++] = string[0];
string++;
}
break;
default:
output[pos_output++] = '\\';
output[pos_output++] = string[0];
string++;
break;
}
}
else
{
output[pos_output++] = string[0];
string++;
}
}
output[pos_output] = '\0';
}
return output;
}
/*
* get_timeval_diff: calculates difference between two times (return in milliseconds)
*/
+1
View File
@@ -33,6 +33,7 @@ extern char *weechat_iconv_to_internal (char *, char *);
extern char *weechat_iconv_from_internal (char *, char *);
extern void weechat_iconv_fprintf (FILE *, char *, ...);
extern char *weechat_strreplace (char *, char *, char *);
extern char *weechat_convert_hex_chars (char *);
extern long get_timeval_diff (struct timeval *, struct timeval *);
extern char **explode_string (char *, char *, int, int *);
extern void free_exploded_string (char **);
+2 -2
View File
@@ -805,8 +805,8 @@ t_config_option weechat_options_irc[] =
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_receive, NULL, config_change_noop },
{ "irc_colors_send", N_("allow user to send colors"),
N_("allow user to send colors with special codes (%B=bold, %Cxx,yy=color, "
"%U=underline, %R=reverse)"),
N_("allow user to send colors with special codes (^Cb=bold, ^Ccxx=color, "
"^Ccxx,yy=color+background, ^Cu=underline, ^Cr=reverse)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_send, NULL, config_change_noop },
{ "irc_send_unknown_commands", N_("send unknown commands to IRC server"),
+2 -1
View File
@@ -186,7 +186,7 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
{
if (CHANNEL(buffer)->topic)
{
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0);
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0, 0);
ptr_topic = utf8_add_offset ((buf) ? buf : CHANNEL(buffer)->topic,
ptr_win->win_title_start);
if (!ptr_topic || !ptr_topic[0])
@@ -365,6 +365,7 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string,
}
break;
case GUI_ATTR_RESET_CHAR:
case GUI_ATTR_WEECHAT_RESET_CHAR:
string++;
if (apply_style)
gui_chat_reset_style (window);
+74 -80
View File
@@ -112,16 +112,14 @@ gui_color_get_name (int num_color)
/*
* gui_color_decode: parses a message (coming from IRC server),
* and according:
* - remove any color/style in message
* or:
* - change colors by codes to be compatible with
* other IRC clients
* if keep_colors == 0: remove any color/style in message
* otherwise change colors by internal WeeChat color codes
* if wkeep_eechat_attr == 0: remove any weechat color/style attribute
* After use, string returned has to be free()
*/
unsigned char *
gui_color_decode (unsigned char *string, int keep_colors)
gui_color_decode (unsigned char *string, int keep_irc_colors, int keep_weechat_attr)
{
unsigned char *out;
int out_length, out_pos;
@@ -134,7 +132,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
@@ -145,7 +143,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
case GUI_ATTR_REVERSE2_CHAR:
case GUI_ATTR_ITALIC_CHAR:
case GUI_ATTR_UNDERLINE_CHAR:
if (keep_colors)
if (keep_irc_colors)
out[out_pos++] = string[0];
string++;
break;
@@ -181,7 +179,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
}
}
if (keep_colors)
if (keep_irc_colors)
{
if (!str_fg[0] && !str_bg[0])
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
@@ -226,10 +224,12 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
break;
case GUI_ATTR_WEECHAT_COLOR_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]) && isdigit (string[1]))
{
if (keep_colors)
if (keep_weechat_attr)
{
out[out_pos++] = string[0];
out[out_pos++] = string[1];
@@ -239,17 +239,21 @@ gui_color_decode (unsigned char *string, int keep_colors)
break;
case GUI_ATTR_WEECHAT_SET_CHAR:
case GUI_ATTR_WEECHAT_REMOVE_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (string[0])
{
if (keep_colors)
{
out[out_pos++] = *(string - 1);
if (keep_weechat_attr)
out[out_pos++] = string[0];
}
string++;
}
break;
case GUI_ATTR_WEECHAT_RESET_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
break;
default:
out[out_pos++] = string[0];
string++;
@@ -261,7 +265,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
/*
* gui_color_decode_for_user_entry: parses a message (coming from IRC server),
* and replaces colors/bold/.. by %C, %B, ..
* and replaces colors/bold/.. by ^C, ^B, ..
* After use, string returned has to be free()
*/
@@ -277,40 +281,35 @@ gui_color_decode_for_user_entry (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case GUI_ATTR_BOLD_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'B';
out[out_pos++] = 0x02; /* ^B */
string++;
break;
case GUI_ATTR_FIXED_CHAR:
string++;
break;
case GUI_ATTR_RESET_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'O';
out[out_pos++] = 0x0F; /* ^O */
string++;
break;
case GUI_ATTR_REVERSE_CHAR:
case GUI_ATTR_REVERSE2_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x12; /* ^R */
string++;
break;
case GUI_ATTR_ITALIC_CHAR:
string++;
break;
case GUI_ATTR_UNDERLINE_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x15; /* ^U */
string++;
break;
case GUI_ATTR_COLOR_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'C';
out[out_pos++] = 0x03; /* ^C */
string++;
break;
default:
@@ -324,12 +323,14 @@ gui_color_decode_for_user_entry (unsigned char *string)
/*
* gui_color_encode: parses a message (entered by user), and
* encode special chars (%B, %C, ..) in IRC colors
* encode special chars (^Cb, ^Cc, ..) in IRC colors
* if keep_colors == 0: remove any color/style in message
* otherwise: keep colors
* After use, string returned has to be free()
*/
unsigned char *
gui_color_encode (unsigned char *string)
gui_color_encode (unsigned char *string, int keep_colors)
{
unsigned char *out;
int out_length, out_pos;
@@ -340,72 +341,65 @@ gui_color_encode (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case '%':
case 0x02: /* ^B */
if (keep_colors)
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
switch (string[0])
break;
case 0x03: /* ^C */
if (keep_colors)
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
string++;
if (isdigit (string[0]))
{
case '\0':
out[out_pos++] = '%';
break;
case '%': /* double '%' replaced by single '%' */
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
break;
case 'B': /* bold */
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
break;
case 'C': /* color */
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
}
}
if (string[0] == ',')
{
if (keep_colors)
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
if (string[0] == ',')
{
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
}
break;
case 'O': /* reset */
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 'R': /* reverse */
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 'U': /* underline */
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = '%';
out[out_pos++] = string[0];
string++;
}
}
break;
case 0x0F: /* ^O */
if (keep_colors)
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 0x12: /* ^R */
if (keep_colors)
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 0x15: /* ^U */
if (keep_colors)
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = string[0];
string++;
+27 -7
View File
@@ -273,7 +273,7 @@ gui_input_draw_prompt (t_gui_window *window, char *nick)
int
gui_input_draw_text (t_gui_window *window, int input_width)
{
char *ptr_start, *ptr_next, saved_char, *output;
char *ptr_start, *ptr_next, saved_char, *output, *ptr_string;
int pos_mask, size, last_color, color, count_cursor, offset_cursor;
ptr_start = utf8_add_offset (window->buffer->input_buffer,
@@ -316,14 +316,34 @@ gui_input_draw_text (t_gui_window *window, int input_width)
last_color = color;
}
output = weechat_iconv_from_internal (NULL, ptr_start);
wprintw (GUI_CURSES(window)->win_input, "%s", (output) ? output : ptr_start);
ptr_string = (output) ? output : ptr_start;
if ((((unsigned char)ptr_string[0]) < 32) && (!ptr_string[1]))
{
wattron (GUI_CURSES(window)->win_input, A_REVERSE);
wprintw (GUI_CURSES(window)->win_input, "%c",
'A' + ((unsigned char)ptr_string[0]) - 1);
wattroff (GUI_CURSES(window)->win_input, A_REVERSE);
if (count_cursor > 0)
{
offset_cursor++;
count_cursor--;
}
}
else
{
wprintw (GUI_CURSES(window)->win_input, "%s", ptr_string);
if (count_cursor > 0)
{
offset_cursor += utf8_width_screen (ptr_start);
count_cursor--;
}
}
if (output)
free (output);
if (count_cursor > 0)
{
offset_cursor += utf8_width_screen (ptr_start);
count_cursor--;
}
ptr_next[0] = saved_char;
ptr_start = ptr_next;
pos_mask += size;
+5
View File
@@ -105,6 +105,11 @@ gui_keyboard_default_bindings ()
gui_keyboard_bind ( /* m-s */ "meta-s", "switch_server");
gui_keyboard_bind ( /* m-u */ "meta-u", "scroll_unread");
gui_keyboard_bind ( /* ^R */ "ctrl-R", "search_text");
gui_keyboard_bind ( /* ^Cb */ "ctrl-Cb", "insert \\x02");
gui_keyboard_bind ( /* ^Cc */ "ctrl-Cc", "insert \\x03");
gui_keyboard_bind ( /* ^Co */ "ctrl-Co", "insert \\x0F");
gui_keyboard_bind ( /* ^Cr */ "ctrl-Cr", "insert \\x12");
gui_keyboard_bind ( /* ^Cu */ "ctrl-Cu", "insert \\x15");
/* keys bound with commands */
gui_keyboard_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
+2 -1
View File
@@ -323,7 +323,8 @@ gui_main_init ()
curs_set (1);
noecho ();
nodelay (stdscr, TRUE);
raw ();
gui_color_init ();
gui_infobar = NULL;
+2 -1
View File
@@ -263,6 +263,7 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string,
}
break;
case GUI_ATTR_RESET_CHAR:
case GUI_ATTR_WEECHAT_RESET_CHAR:
string++;
if (apply_style)
gui_chat_reset_style (window);
@@ -628,7 +629,7 @@ gui_chat_draw_line (t_gui_buffer *buffer, t_gui_line *line)
ptr_win = gui_buffer_find_window (buffer);
if (ptr_win)
{
text_without_color = gui_color_decode ((unsigned char *)(line->data), 0);
text_without_color = gui_color_decode ((unsigned char *)(line->data), 0, 0);
if (text_without_color)
{
gtk_text_buffer_insert_at_cursor (GUI_GTK(ptr_win)->textbuffer_chat,
+76 -82
View File
@@ -112,16 +112,14 @@ gui_color_get_name (int num_color)
/*
* gui_color_decode: parses a message (coming from IRC server),
* and according:
* - remove any color/style in message
* or:
* - change colors by codes to be compatible with
* other IRC clients
* if keep_colors == 0: remove any color/style in message
* otherwise change colors by internal WeeChat color codes
* if wkeep_eechat_attr == 0: remove any weechat color/style attribute
* After use, string returned has to be free()
*/
unsigned char *
gui_color_decode (unsigned char *string, int keep_colors)
gui_color_decode (unsigned char *string, int keep_irc_colors, int keep_weechat_attr)
{
unsigned char *out;
int out_length, out_pos;
@@ -134,7 +132,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
@@ -145,7 +143,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
case GUI_ATTR_REVERSE2_CHAR:
case GUI_ATTR_ITALIC_CHAR:
case GUI_ATTR_UNDERLINE_CHAR:
if (keep_colors)
if (keep_irc_colors)
out[out_pos++] = string[0];
string++;
break;
@@ -181,7 +179,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
}
}
if (keep_colors)
if (keep_irc_colors)
{
if (!str_fg[0] && !str_bg[0])
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
@@ -191,13 +189,13 @@ gui_color_decode (unsigned char *string, int keep_colors)
if (str_fg[0])
{
sscanf (str_fg, "%d", &fg);
fg %= 16;
fg %= GUI_NUM_IRC_COLORS;
attr |= gui_irc_colors[fg][1];
}
if (str_bg[0])
{
sscanf (str_bg, "%d", &bg);
bg %= 16;
bg %= GUI_NUM_IRC_COLORS;
attr |= gui_irc_colors[bg][1];
}
if (attr & A_BOLD)
@@ -226,10 +224,12 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
break;
case GUI_ATTR_WEECHAT_COLOR_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]) && isdigit (string[1]))
{
if (keep_colors)
if (keep_weechat_attr)
{
out[out_pos++] = string[0];
out[out_pos++] = string[1];
@@ -239,17 +239,21 @@ gui_color_decode (unsigned char *string, int keep_colors)
break;
case GUI_ATTR_WEECHAT_SET_CHAR:
case GUI_ATTR_WEECHAT_REMOVE_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (string[0])
{
if (keep_colors)
{
out[out_pos++] = *(string - 1);
if (keep_weechat_attr)
out[out_pos++] = string[0];
}
string++;
}
break;
case GUI_ATTR_WEECHAT_RESET_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
break;
default:
out[out_pos++] = string[0];
string++;
@@ -261,7 +265,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
/*
* gui_color_decode_for_user_entry: parses a message (coming from IRC server),
* and replaces colors/bold/.. by %C, %B, ..
* and replaces colors/bold/.. by ^C, ^B, ..
* After use, string returned has to be free()
*/
@@ -277,40 +281,35 @@ gui_color_decode_for_user_entry (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case GUI_ATTR_BOLD_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'B';
out[out_pos++] = 0x02; /* ^B */
string++;
break;
case GUI_ATTR_FIXED_CHAR:
string++;
break;
case GUI_ATTR_RESET_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'O';
out[out_pos++] = 0x0F; /* ^O */
string++;
break;
case GUI_ATTR_REVERSE_CHAR:
case GUI_ATTR_REVERSE2_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x12; /* ^R */
string++;
break;
case GUI_ATTR_ITALIC_CHAR:
string++;
break;
case GUI_ATTR_UNDERLINE_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x15; /* ^U */
string++;
break;
case GUI_ATTR_COLOR_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'C';
out[out_pos++] = 0x03; /* ^C */
string++;
break;
default:
@@ -324,12 +323,14 @@ gui_color_decode_for_user_entry (unsigned char *string)
/*
* gui_color_encode: parses a message (entered by user), and
* encode special chars (%B, %C, ..) in IRC colors
* encode special chars (^Cb, ^Cc, ..) in IRC colors
* if keep_colors == 0: remove any color/style in message
* otherwise: keep colors
* After use, string returned has to be free()
*/
unsigned char *
gui_color_encode (unsigned char *string)
gui_color_encode (unsigned char *string, int keep_colors)
{
unsigned char *out;
int out_length, out_pos;
@@ -340,72 +341,65 @@ gui_color_encode (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case '%':
case 0x02: /* ^B */
if (keep_colors)
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
switch (string[0])
break;
case 0x03: /* ^C */
if (keep_colors)
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
string++;
if (isdigit (string[0]))
{
case '\0':
out[out_pos++] = '%';
break;
case '%': /* double '%' replaced by single '%' */
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
break;
case 'B': /* bold */
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
break;
case 'C': /* color */
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
}
}
if (string[0] == ',')
{
if (keep_colors)
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
if (string[0] == ',')
{
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
}
break;
case 'O': /* reset */
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 'R': /* reverse */
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 'U': /* underline */
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = '%';
out[out_pos++] = string[0];
string++;
}
}
break;
case 0x0F: /* ^O */
if (keep_colors)
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 0x12: /* ^R */
if (keep_colors)
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 0x15: /* ^U */
if (keep_colors)
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = string[0];
string++;
+8 -1
View File
@@ -39,6 +39,7 @@
#include "../common/hotlist.h"
#include "../common/log.h"
#include "../common/utf8.h"
#include "../common/util.h"
#include "../irc/irc.h"
@@ -1446,10 +1447,16 @@ gui_action_grab_key (t_gui_window *window, char *args)
void
gui_action_insert_string (t_gui_window *window, char *args)
{
char *args2;
if (args)
{
gui_insert_string_input (window, args, -1);
args2 = weechat_convert_hex_chars (args);
gui_insert_string_input (window,
(args2) ? args2 : args, -1);
gui_input_draw (window->buffer, 0);
if (args2)
free (args2);
}
}
+1 -1
View File
@@ -735,7 +735,7 @@ gui_buffer_line_search (t_gui_line *line, char *text, int case_sensitive)
return 0;
rc = 0;
data = (char *)gui_color_decode ((unsigned char *)line->data, 0);
data = (char *)gui_color_decode ((unsigned char *)line->data, 0, 0);
if (data)
{
if ((case_sensitive && (strstr (data, text)))
+3 -1
View File
@@ -122,9 +122,11 @@ enum t_weechat_color
#define GUI_ATTR_WEECHAT_SET_STR "\x1A"
#define GUI_ATTR_WEECHAT_REMOVE_CHAR '\x1B'
#define GUI_ATTR_WEECHAT_REMOVE_STR "\x1B"
#define GUI_ATTR_WEECHAT_RESET_CHAR '\x1C'
#define GUI_ATTR_WEECHAT_RESET_STR "\x1C"
#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
#define GUI_NO_COLOR GUI_ATTR_RESET_STR
#define GUI_NO_COLOR GUI_ATTR_WEECHAT_RESET_STR
/* color structure */
+20 -8
View File
@@ -220,11 +220,12 @@ gui_add_to_line (t_gui_buffer *buffer, int type, time_t date, char *nick, char *
*/
void
gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nick, char *message, ...)
gui_printf_internal (t_gui_buffer *buffer, int display_time, int type,
int keep_irc_colors, char *nick, char *message, ...)
{
static char buf[8192];
char text_time[1024];
char text_time_char[2];
char *buf2;
char text_time[1024], text_time_char[2];
time_t date;
struct tm *local_time;
int time_first_digit, time_last_digit;
@@ -267,12 +268,20 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
if (!buf[0])
return;
utf8_normalize (buf, '?');
buf2 = (char *)gui_color_decode ((unsigned char *)buf,
(keep_irc_colors >= 0) ?
keep_irc_colors : cfg_irc_colors_receive,
1);
if (!buf2)
return;
utf8_normalize (buf2, '?');
if (gui_init_ok)
{
pos = buf;
pos = buf2;
while (pos)
{
date = time (NULL);
@@ -356,7 +365,10 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
}
}
else
weechat_iconv_fprintf (stdout, buf);
weechat_iconv_fprintf (stdout, buf2);
if (buf2)
free (buf2);
}
/*
@@ -417,7 +429,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0);
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0, 0);
ptr_buf = (buf2) ? buf2 : buf;
ptr_infobar->color = color;
+13 -7
View File
@@ -469,7 +469,7 @@ gui_keyboard_bind (char *key, char *command)
{
t_gui_key_func *ptr_function;
t_gui_key *new_key;
char *ptr_args;
char *command2, *ptr_args;
if (!key || !command)
{
@@ -480,18 +480,24 @@ gui_keyboard_bind (char *key, char *command)
ptr_function = NULL;
ptr_args = NULL;
if (command[0] != '/')
{
ptr_args = strchr (command, ' ');
if (ptr_args)
ptr_args[0] = '\0';
ptr_function = gui_keyboard_function_search_by_name (command);
if (ptr_args)
command2 = strndup (command, ptr_args - command);
else
command2 = strdup (command);
if (command2)
{
ptr_args[0] = ' ';
ptr_args++;
while (ptr_args[0] == ' ')
ptr_function = gui_keyboard_function_search_by_name (command2);
if (ptr_args)
{
ptr_args++;
while (ptr_args[0] == ' ')
ptr_args++;
}
free (command2);
}
if (!ptr_function)
{
+2 -2
View File
@@ -69,7 +69,7 @@ gui_log_write_line (t_gui_buffer *buffer, char *message)
if (buffer->log_file)
{
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0, 0);
weechat_iconv_fprintf (buffer->log_file,
"%s\n", (msg_no_color) ? msg_no_color : message);
fflush (buffer->log_file);
@@ -89,7 +89,7 @@ gui_log_write (t_gui_buffer *buffer, char *message)
if (buffer->log_file)
{
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0, 0);
weechat_iconv_fprintf (buffer->log_file,
"%s", (msg_no_color) ? msg_no_color : message);
fflush (buffer->log_file);
+11 -8
View File
@@ -28,19 +28,22 @@
#define gui_printf(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, NULL, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, -1, NULL, fmt, ##argz)
#define gui_printf_keep_colors(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, 1, NULL, fmt, ##argz)
#define gui_printf_type(buffer, type, fmt, argz...) \
gui_printf_internal(buffer, 1, type, NULL, fmt, ##argz)
gui_printf_internal(buffer, 1, type, -1, NULL, fmt, ##argz)
#define gui_printf_type_nick(buffer, type, nick, fmt, argz...) \
gui_printf_internal(buffer, 1, type, nick, fmt, ##argz)
gui_printf_internal(buffer, 1, type, -1, nick, fmt, ##argz)
#define gui_printf_nolog(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, NULL, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, NULL, fmt, ##argz)
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, NULL, fmt, ##argz)
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, -1, NULL, fmt, ##argz)
typedef struct t_gui_infobar t_gui_infobar;
@@ -191,7 +194,7 @@ extern void gui_log_end (t_gui_buffer *);
/* other */
extern int gui_word_strlen (t_gui_window *, char *);
extern int gui_word_real_pos (t_gui_window *, char *, int);
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, char *, ...);
extern void gui_printf_internal (t_gui_buffer *, int, int, int, char *, char *, ...);
extern void gui_printf_raw_data (void *, int, int, char *);
extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_printf_from_buffer (t_gui_buffer *, int, int, char *, char *, ...);
@@ -210,9 +213,9 @@ extern int gui_insert_string_input (t_gui_window *, char *, int);
/* color */
extern int gui_color_assign (int *, char *);
extern char *gui_color_get_name (int);
extern unsigned char *gui_color_decode (unsigned char *, int);
extern unsigned char *gui_color_decode (unsigned char *, int, int);
extern unsigned char *gui_color_decode_for_user_entry (unsigned char *);
extern unsigned char *gui_color_encode (unsigned char *);
extern unsigned char *gui_color_encode (unsigned char *, int);
extern void gui_color_init_pairs ();
extern void gui_color_rebuild_weechat();
+2 -9
View File
@@ -1241,7 +1241,6 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
static struct timeval timeout;
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
char *ptr_buf_color;
int num_read;
FD_ZERO (&read_fd);
@@ -1305,9 +1304,6 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
if (ptr_buf)
{
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
cfg_irc_colors_receive);
if (irc_recv_is_highlight (ptr_buf, ptr_dcc->server->nick))
{
irc_display_nick (ptr_dcc->channel->buffer, NULL, ptr_dcc->nick,
@@ -1319,8 +1315,7 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
ptr_dcc->nick,
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
ptr_dcc->nick, ptr_buf);
}
}
else
@@ -1329,9 +1324,7 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
if (ptr_buf_color)
free (ptr_buf_color);
ptr_buf);
}
ptr_buf = next_ptr_buf;
+3 -8
View File
@@ -228,7 +228,7 @@ irc_recv_command (t_irc_server *server, char *entire_line,
char *host, char *command, char *arguments)
{
int i, cmd_found, return_code;
char *pos, *nick, *args_after_color;
char *pos, *nick;
char *dup_entire_line, *dup_host, *dup_arguments;
t_irc_recv_func *cmd_recv_func;
char *cmd_name;
@@ -294,16 +294,11 @@ irc_recv_command (t_irc_server *server, char *entire_line,
nick = (dup_host) ? strdup (dup_host) : NULL;
if (pos)
pos[0] = '!';
args_after_color = (char *)gui_color_decode ((unsigned char *)dup_arguments,
cfg_irc_colors_receive);
irc_last_command_received = strdup (dup_entire_line);
return_code = (int) (cmd_recv_func) (server, dup_host, nick,
(args_after_color) ?
args_after_color : dup_arguments);
dup_arguments);
if (irc_last_command_received)
free (irc_last_command_received);
if (args_after_color)
free (args_after_color);
if (nick)
free (nick);
if (dup_entire_line)
@@ -3728,7 +3723,7 @@ irc_recv_cmd_332 (t_irc_server *server, char *host, char *nick, char *arguments)
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
pos,
GUI_COLOR(COLOR_WIN_CHAT));
gui_printf (ptr_buffer, "\"%s\"\n", pos2);
gui_printf (ptr_buffer, "\"%s%s\"\n", pos2, GUI_NO_COLOR);
}
if (ptr_channel)
+10 -10
View File
@@ -96,7 +96,7 @@ irc_send_me (t_irc_server *server, t_irc_channel *channel,
(arguments && arguments[0]) ? arguments : "");
irc_display_prefix (NULL, channel->buffer, PREFIX_ACTION_ME);
string = (arguments && arguments[0]) ?
(char *)gui_color_decode ((unsigned char *)arguments, 1) : NULL;
(char *)gui_color_decode ((unsigned char *)arguments, 1, 0) : NULL;
gui_printf (channel->buffer, "%s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
server->nick,
@@ -195,7 +195,7 @@ irc_send_cmd_amsg (t_irc_server *server, t_irc_channel *channel,
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, -1, 0);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1, 0);
gui_printf (ptr_channel->buffer, "%s\n", (string) ? string : arguments);
if (string)
free (string);
@@ -248,7 +248,7 @@ irc_send_away (t_irc_server *server, char *arguments)
irc_server_sendf (server, "AWAY :%s", arguments);
if (cfg_irc_display_away != CFG_IRC_DISPLAY_AWAY_OFF)
{
string = (char *)gui_color_decode ((unsigned char *)arguments, 1);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1, 0);
if (cfg_irc_display_away == CFG_IRC_DISPLAY_AWAY_LOCAL)
irc_display_away (server, "away", (string) ? string : arguments);
else
@@ -272,7 +272,7 @@ irc_send_away (t_irc_server *server, char *arguments)
{
/* server not connected, store away for future usage
(when connecting to server) */
string = (char *)gui_color_decode ((unsigned char *)arguments, 1);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1, 0);
irc_display_prefix (NULL, server->buffer, PREFIX_INFO);
gui_printf_nolog (server->buffer,
_("Future away on %s%s%s: %s\n"),
@@ -1246,7 +1246,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
irc_display_nick (buffer, ptr_nick,
(ptr_nick) ? NULL : server->nick,
MSG_TYPE_NICK, 1, -1, 0);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf_type (buffer, MSG_TYPE_MSG, "%s\n",
(string) ? string : "");
if (string)
@@ -1266,7 +1266,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, -1, 0);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n",
(string) ? string : "");
if (string)
@@ -1297,7 +1297,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
string = (char *)gui_color_decode ((unsigned char *)msg_pwd_hidden, 1);
string = (char *)gui_color_decode ((unsigned char *)msg_pwd_hidden, 1, 0);
gui_printf (server->buffer, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(string) ? string : "");
@@ -1308,7 +1308,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
return 0;
}
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
ptr_channel = irc_channel_search (server, arguments);
if (ptr_channel)
{
@@ -1466,7 +1466,7 @@ irc_send_cmd_notice (t_irc_server *server, t_irc_channel *channel,
while (pos[0] == ' ')
pos++;
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf (server->buffer, "notice%s(%s%s%s)%s: %s\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
@@ -1712,7 +1712,7 @@ irc_send_cmd_query (t_irc_server *server, t_irc_channel *channel,
{
irc_display_nick (ptr_channel->buffer, NULL, server->nick,
MSG_TYPE_NICK, 1, COLOR_WIN_NICK_SELF, 0);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
+5 -13
View File
@@ -165,7 +165,7 @@ weechat_plugin_print (t_weechat_plugin *plugin,
t_gui_buffer *ptr_buffer;
va_list argptr;
static char buf[8192];
char *buf2, *buf3;
char *buf2;
if (!plugin || !message)
return;
@@ -176,14 +176,10 @@ weechat_plugin_print (t_weechat_plugin *plugin,
va_end (argptr);
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
buf3 = (char *)gui_color_decode ((unsigned char *)((buf2) ? buf2 : buf),
cfg_irc_colors_receive);
irc_display_prefix (NULL, ptr_buffer, PREFIX_PLUGIN);
gui_printf (ptr_buffer, "%s\n", (buf3) ? buf3 : ((buf2) ? buf2 : buf));
gui_printf_keep_colors (ptr_buffer, "%s\n", (buf2) ? buf2 : buf);
if (buf2)
free (buf2);
if (buf3)
free (buf3);
}
/*
@@ -195,7 +191,7 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
{
va_list argptr;
static char buf[8192];
char *buf2, *buf3;
char *buf2;
if (!plugin || !message)
return;
@@ -205,14 +201,10 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
va_end (argptr);
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
buf3 = (char *)gui_color_decode ((unsigned char *)((buf2) ? buf2 : buf),
cfg_irc_colors_receive);
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
gui_printf (NULL, "%s\n", (buf3) ? buf3 : ((buf2) ? buf2 : buf));
gui_printf_keep_colors (NULL, "%s\n", (buf2) ? buf2 : buf);
if (buf2)
free (buf2);
if (buf3)
free (buf3);
}
/*
@@ -1420,7 +1412,7 @@ weechat_plugin_get_buffer_data (t_weechat_plugin *plugin, char *server, char *ch
new_buffer_line->nick = (ptr_line->nick) ? strdup (ptr_line->nick) : NULL;
if (ptr_line->data)
{
data1 = (char *) gui_color_decode ((unsigned char *)(ptr_line->data + ptr_line->ofs_start_message), 0);
data1 = (char *) gui_color_decode ((unsigned char *)(ptr_line->data + ptr_line->ofs_start_message), 0, 0);
data2 = (data1) ? weechat_iconv_from_internal (plugin->charset, data1) : NULL;
if (data2)
new_buffer_line->data = data2;
+3 -1
View File
@@ -1,10 +1,12 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2007-07-09
ChangeLog - 2007-07-12
Version 0.2.6 (under dev!):
* fixed bugs with IRC color in messages, now color codes are inserted in
command line with ^Cc,^Cb,.. instead of %C,%B,.. (bug #20222, task #7060)
* fixed bug with smart nick completion (last speakers first) when a nick
is changed
* fixed charset bug with channel names in status bar (bug #20400)
+1 -1
View File
@@ -955,7 +955,7 @@
<entry>Boolean</entry>
<entry>eine beliebige Zeichenfolge</entry>
<entry>'on'</entry>
<entry>Erlaube Benutzern, spezielle Codes zu versenden (%B=fett, %Cxx,yy=Farbe, %U=unterstrichen, %R=reverse/umgekehrt)</entry>
<entry>Allow user to send colors with special codes (^Cb=bold, ^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, ^Cr=reverse)</entry>
</row>
<row>
<entry><option>irc_send_unknown_commands</option></entry>
+147 -15
View File
@@ -810,7 +810,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<para>
Wenn die Option IRC-Farben ("<literal>irc_colors_send</literal>") senden
angeschaltet ist, können sie Farbcodierung und Attribute wiefolgt verwenden:
angeschaltet ist, können sie Farbcodierung und Attribute wiefolgt verwenden
<!-- TRANSLATION NEEDED -->
(press Ctrl-C then following letter, with optional value):
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -821,20 +823,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</thead>
<tbody>
<row>
<entry>%B</entry>
<entry>^Cb</entry>
<entry>
Fett (bold)
</entry>
</row>
<row>
<entry>%Cxx</entry>
<entry>^Ccxx</entry>
<entry>
Textfarbe "<literal>xx</literal>" (color)
(siehe Farbtabelle)
</entry>
</row>
<row>
<entry>%Cxx,yy</entry>
<entry>^Ccxx,yy</entry>
<entry>
Textfarbe "<literal>xx</literal>"
und Hintergrund "<literal>yy</literal>"
@@ -842,29 +844,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</entry>
</row>
<row>
<entry>%O</entry>
<entry>^Co</entry>
<entry>
Schalte Farben und Attribute ab
</entry>
</row>
<row>
<entry>%R</entry>
<entry>^Cr</entry>
<entry>
umgedrehte Farben (tausche Textfarbe mit Hintergrundfarbe)
</entry>
</row>
<row>
<entry>%U</entry>
<entry>^Cu</entry>
<entry>
Unterstreiche Text
</entry>
</row>
<row>
<entry>%%</entry>
<entry>
Schreibe ein einzelnes "<literal>%</literal>"
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
@@ -873,7 +869,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</para>
<para>
Farbcodes für %C:
Farbcodes für ^Cc:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -956,7 +952,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Beispiel: Anzeige von "<literal>hello everybody!</literal>" mit
"<literal>hello</literal>" fett in hellem Blau, und
"<literal>everybody</literal>" unterstrichen in hellem Rot:
<screen><userinput>%C12%Bhello%B%C04%U everybody%U%C!</userinput></screen>
<screen><userinput>^Cc12^Cbhello^Cb^Cc04^Cu everybody^Cu^Cc!</userinput></screen>
</para>
</section>
@@ -1851,6 +1847,63 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
</listitem>
</itemizedlist>
</para>
<!-- TRANSLATION NEEDED -->
<para>
To display colored text, there are following codes:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
<row>
<entry>Code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>0x02</entry>
<entry>
bold text
</entry>
</row>
<row>
<entry>0x03 + "xx"</entry>
<entry>
text color "<literal>xx</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x03 + "xx,yy"</entry>
<entry>
text color "<literal>xx</literal>"
and background "<literal>yy</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x0F</entry>
<entry>
disable color and attributes
</entry>
</row>
<row>
<entry>0x12</entry>
<entry>
reverse video (revert text color with background)
</entry>
</row>
<row>
<entry>0x1F</entry>
<entry>
underlined text
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Note: the same code (without number for 0x03) may be used to stop
the attribute.
</para>
<para>
Rückgabewert: keiner.
</para>
@@ -1860,6 +1913,10 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
plugin->print (plugin, NULL, NULL, "hello");
plugin->print (plugin, NULL, "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, NULL, NULL,
"Test: \x02 Fett \x0F\x03%02d Blau \x03%02d Grün",
plugin->get_irc_color (plugin, "blue"),
plugin->get_irc_color (plugin, "green"));
</screen>
</para>
</section>
@@ -1892,6 +1949,10 @@ plugin->print (plugin, "freenode", "#weechat", "hello");
</listitem>
</itemizedlist>
</para>
<para>
<!-- TRANSLATION NEEDED -->
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Rückgabewert: keiner.
</para>
@@ -5220,6 +5281,10 @@ weechat.set_charset("ISO-8859-1")
</listitem>
</itemizedlist>
</para>
<para>
<!-- TRANSLATION NEEDED -->
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Rückgabewert: 1 bei Erfolg, 0 wenn ein Fehler aufgetreten ist
</para>
@@ -5230,6 +5295,7 @@ weechat.set_charset("ISO-8859-1")
weechat::print("message");
weechat::print("message", "#weechat");
weechat::print("message", "#weechat", "freenode");
weechat::print("test: \x0305 rot \x0F normal");
# python
weechat.prnt("message")
@@ -5249,6 +5315,72 @@ weechat.print("message", "#weechat", "freenode")
</para>
</section>
<!-- TRANSLATION NEEDED -->
<section id="secScript_print_server">
<title>print_server</title>
<para>
Perl prototype:
<command>
weechat::print_server(message)
</command>
</para>
<para>
Python prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Ruby prototype:
<command>
Weechat.print_server(message)
</command>
</para>
<para>
Lua prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Display a message on server buffer.
</para>
<para>
Arguments:
<itemizedlist>
<listitem>
<para>
<option>message</option>: message
</para>
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: 1 if success, 0 if an error occurred.
</para>
<para>
Examples:
<screen>
# perl
weechat::print_server("message");
weechat::print_server("test: \x0305 rot \x0F normal");
# python
weechat.print_server("message")
# ruby
Weechat.print_server("message")
-- lua
weechat.print_server("message")
</screen>
</para>
</section>
<section id="secScript_print_infobar">
<title>print_infobar</title>
+22 -9
View File
@@ -22,15 +22,28 @@ Argumente: Argumente f
<programlisting>
Puffer verwalten
Aktion: Pufferaktion:
move: Puffer in der Liste bewegen (kann auch relativ sein, wie -1)
close: Puffer schließen (eine Part-Message kann optional angegeben werden)
list: alle offenen Puffer auflisten (Standardaktion)
notify: Notify-Level für Puffer festlegen (0=nie, 1=bei hervorgehobenen Nachrichten, 2=1+persönliche Nachricht, 3=2+join/part)
(wenn der Befehl in einem Server Puffer ausgeführt wird, setzt er den Default-Notify-Level für den ganzen Server)
Server
Channel: gehe zum Puffer mit Servernamen oder Channelnamen
Nummer: gehe zu Puffer mit dieser Nummer
action: action to do:
move: move buffer in the list (may be relative, for example -1)
close: close buffer (optional arg is part message, for a channel)
list: list open buffers (no parameter implies this list)
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)
(when executed on server buffer, this sets default notify level for whole server)
scroll: scroll in history (may be relative, and may end by a letter: s=sec, m=min, h=hour, d=day, M=month, y=year); if there is only letter, then scroll to beginning of this item
number: jump to buffer by number
server,
channel: jump to buffer by server and/or channel name
Examples:
move buffer: /buffer move 5
close buffer: /buffer close this is part msg
set notify: /buffer notify 2
scroll 1 day up: /buffer scroll 1d == /buffer scroll -1d == /buffer scroll -24h
scroll to beginning
of this day: /buffer scroll d
scroll 15 min down: /buffer scroll +15m
scroll 20 msgs up: /buffer scroll -20
jump to #weechat: /buffer #weechat
</programlisting>
<command>builtin Befehl</command>
+1 -1
View File
@@ -955,7 +955,7 @@
<entry>boolean</entry>
<entry>'on' or 'off'</entry>
<entry>'on'</entry>
<entry>Allow user to send colors with special codes (%B=bold, %Cxx,yy=color, %U=underline, %R=reverse)</entry>
<entry>Allow user to send colors with special codes (^Cb=bold, ^Ccxx=color, ^Ccxx,yy=color+background, ^Cu=underline, ^Cr=reverse)</entry>
</row>
<row>
<entry><option>irc_send_unknown_commands</option></entry>
+143 -16
View File
@@ -804,7 +804,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<para>
If option for sending IRC colors ("<literal>irc_colors_send</literal>")
is enabled, you can use color codes and attributes, as follow:
is enabled, you can use color codes and attributes, as follow (press
Ctrl-C then following letter, with optional value):
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -815,20 +816,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</thead>
<tbody>
<row>
<entry>%B</entry>
<entry>^Cb</entry>
<entry>
bold text
</entry>
</row>
<row>
<entry>%Cxx</entry>
<entry>^Ccxx</entry>
<entry>
text color "<literal>xx</literal>"
(see colors table below)
</entry>
</row>
<row>
<entry>%Cxx,yy</entry>
<entry>^Ccxx,yy</entry>
<entry>
text color "<literal>xx</literal>"
and background "<literal>yy</literal>"
@@ -836,38 +837,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</entry>
</row>
<row>
<entry>%O</entry>
<entry>^Co</entry>
<entry>
disable color and attributes
</entry>
</row>
<row>
<entry>%R</entry>
<entry>^Cr</entry>
<entry>
reverse video (revert text color with background)
</entry>
</row>
<row>
<entry>%U</entry>
<entry>^Cu</entry>
<entry>
underlined text
</entry>
</row>
<row>
<entry>%%</entry>
<entry>
display one "<literal>%</literal>"
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Note: the same code (without number for %C) may be used to stop the
Note: the same code (without number for ^Cc) may be used to stop the
attribute.
</para>
<para>
Color codes for %C are:
Color codes for ^Cc are:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -950,7 +945,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Example: display of "<literal>hello everybody!</literal>" with
"<literal>hello</literal>" in light blue bold, and
"<literal>everybody</literal>" in light red underlined:
<screen><userinput>%C12%Bhello%B%C04%U everybody%U%C!</userinput></screen>
<screen><userinput>^Cc12^Cbhello^Cb^Cc04^Cu everybody^Cu^Cc!</userinput></screen>
</para>
</section>
@@ -1850,6 +1845,62 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, there are following codes:
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
<row>
<entry>Code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>0x02</entry>
<entry>
bold text
</entry>
</row>
<row>
<entry>0x03 + "xx"</entry>
<entry>
text color "<literal>xx</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x03 + "xx,yy"</entry>
<entry>
text color "<literal>xx</literal>"
and background "<literal>yy</literal>"
(see <xref linkend="secAPI_get_irc_color" /> for colors)
</entry>
</row>
<row>
<entry>0x0F</entry>
<entry>
disable color and attributes
</entry>
</row>
<row>
<entry>0x12</entry>
<entry>
reverse video (revert text color with background)
</entry>
</row>
<row>
<entry>0x1F</entry>
<entry>
underlined text
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
Note: the same code (without number for 0x03) may be used to stop
the attribute.
</para>
<para>
Return value: none.
</para>
@@ -1859,6 +1910,10 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
plugin->print (plugin, NULL, NULL, "hello");
plugin->print (plugin, NULL, "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, NULL, NULL,
"test: \x02 bold \x0F\x03%02d blue \x03%02d green",
plugin->get_irc_color (plugin, "blue"),
plugin->get_irc_color (plugin, "green"));
</screen>
</para>
</section>
@@ -1891,6 +1946,9 @@ plugin->print (plugin, "freenode", "#weechat", "hello");
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: none.
</para>
@@ -5253,6 +5311,9 @@ weechat.set_charset("ISO-8859-1")
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: 1 if success, 0 if an error occurred.
</para>
@@ -5263,6 +5324,7 @@ weechat.set_charset("ISO-8859-1")
weechat::print("message");
weechat::print("message", "#weechat");
weechat::print("message", "#weechat", "freenode");
weechat::print("test: \x0305 red \x0F normal");
# python
weechat.prnt("message")
@@ -5282,6 +5344,71 @@ weechat.print("message", "#weechat", "freenode")
</para>
</section>
<section id="secScript_print_server">
<title>print_server</title>
<para>
Perl prototype:
<command>
weechat::print_server(message)
</command>
</para>
<para>
Python prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Ruby prototype:
<command>
Weechat.print_server(message)
</command>
</para>
<para>
Lua prototype:
<command>
weechat.print_server(message)
</command>
</para>
<para>
Display a message on server buffer.
</para>
<para>
Arguments:
<itemizedlist>
<listitem>
<para>
<option>message</option>: message
</para>
</listitem>
</itemizedlist>
</para>
<para>
To display colored text, see <xref linkend="secAPI_print" />.
</para>
<para>
Return value: 1 if success, 0 if an error occurred.
</para>
<para>
Examples:
<screen>
# perl
weechat::print_server("message");
weechat::print_server("test: \x0305 red \x0F normal");
# python
weechat.print_server("message")
# ruby
Weechat.print_server("message")
-- lua
weechat.print_server("message")
</screen>
</para>
</section>
<section id="secScript_print_infobar">
<title>print_infobar</title>
+14 -1
View File
@@ -28,9 +28,22 @@ manage buffers
list: list open buffers (no parameter implies this list)
notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)
(when executed on server buffer, this sets default notify level for whole server)
scroll: scroll in history (may be relative, and may end by a letter: s=sec, m=min, h=hour, d=day, M=month, y=year); if there is only letter, then scroll to beginning of this item
number: jump to buffer by number
server,
channel: jump to buffer by server and/or channel name
number: jump to buffer by number
Examples:
move buffer: /buffer move 5
close buffer: /buffer close this is part msg
set notify: /buffer notify 2
scroll 1 day up: /buffer scroll 1d == /buffer scroll -1d == /buffer scroll -24h
scroll to beginning
of this day: /buffer scroll d
scroll 15 min down: /buffer scroll +15m
scroll 20 msgs up: /buffer scroll -20
jump to #weechat: /buffer #weechat
</programlisting>
<command>builtin command</command>
+1 -1
View File
@@ -955,7 +955,7 @@
<entry>booléen</entry>
<entry>'on' ou 'off'</entry>
<entry>'on'</entry>
<entry>Autorise l'utilisateur à envoyer des couleurs avec des codes spéciaux (%B=gras, %Cxx,yy=couleur, %U=souligné, %R=inversé)</entry>
<entry>Autorise l'utilisateur à envoyer des couleurs avec des codes spéciaux (^Cb=gras, ^Cxx=couleur, ^Ccxx,yy=couleur+fond, ^Cu=souligné, ^Cr=inversé)</entry>
</row>
<row>
<entry><option>irc_send_unknown_commands</option></entry>
+150 -16
View File
@@ -818,7 +818,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<para>
Si l'option d'envoi des couleurs IRC
("<literal>irc_colors_send</literal>") est activée, il est possible
d'utiliser des codes couleur et attributs comme suit :
d'utiliser des codes couleur et attributs comme suit (appuyer sur Ctrl-C
puis la lettre qui suit et éventuellement une valeur) :
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -829,20 +830,20 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</thead>
<tbody>
<row>
<entry>%B</entry>
<entry>^Cb</entry>
<entry>
texte gras
</entry>
</row>
<row>
<entry>%Cxx</entry>
<entry>^Ccxx</entry>
<entry>
couleur du texte "<literal>xx</literal>"
(voir le tableau des couleurs ci-dessous)
</entry>
</row>
<row>
<entry>%Cxx,yy</entry>
<entry>^Ccxx,yy</entry>
<entry>
couleur du texte "<literal>xx</literal>"
et du fond "<literal>yy</literal>"
@@ -850,38 +851,32 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</entry>
</row>
<row>
<entry>%O</entry>
<entry>^Co</entry>
<entry>
désactiver la couleur et tous les attributs
</entry>
</row>
<row>
<entry>%R</entry>
<entry>^Cr</entry>
<entry>
vidéo inverse (inversion de la couleur d'écriture et du fond)
</entry>
</row>
<row>
<entry>%U</entry>
<entry>^Cu</entry>
<entry>
texte souligné
</entry>
</row>
<row>
<entry>%%</entry>
<entry>
afficher un seul "<literal>%</literal>"
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
NB: le même code (sans le numéro pour %C) peut être utilisé pour stopper
NB: le même code (sans le numéro pour ^Cc) peut être utilisé pour stopper
l'attribut défini.
</para>
<para>
Les codes couleur pour %C sont :
Les codes couleur pour ^Cc sont :
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
@@ -964,7 +959,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
Exemple : affichage de "<literal>bonjour tout le monde !</literal>"
avec "<literal>bonjour</literal>" en bleu clair gras, et
"<literal>tout le monde</literal>" en rouge clair souligné :
<screen><userinput>%C12%Bbonjour%B%C04%U tout le monde%U%C !</userinput></screen>
<screen><userinput>^Cc12^Cbbonjour^Cb^Cc04^Cu tout le monde^Cu^Cc !</userinput></screen>
</para>
</section>
@@ -1897,6 +1892,65 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, il faut utiliser les codes
suivants :
<informaltable colsep="0" frame="none">
<tgroup cols="2">
<thead>
<row>
<entry>Code</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>0x02</entry>
<entry>
texte gras
</entry>
</row>
<row>
<entry>0x03 + "xx"</entry>
<entry>
couleur du texte "<literal>xx</literal>"
(voir <xref linkend="secAPI_get_irc_color" /> pour les
couleurs)
</entry>
</row>
<row>
<entry>0x03 + "xx,yy"</entry>
<entry>
couleur du texte "<literal>xx</literal>"
et du fond "<literal>yy</literal>"
(voir <xref linkend="secAPI_get_irc_color" /> pour les
couleurs)
</entry>
</row>
<row>
<entry>0x0F</entry>
<entry>
désactiver la couleur et tous les attributs
</entry>
</row>
<row>
<entry>0x12</entry>
<entry>
vidéo inverse (inversion de la couleur d'écriture et du fond)
</entry>
</row>
<row>
<entry>0x1F</entry>
<entry>
texte souligné
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
NB: le même code (sans le numéro pour 0x03) peut être utilisé pour stopper
l'attribut défini.
</para>
<para>
Valeur renvoyée : aucune.
</para>
@@ -1906,6 +1960,11 @@ plugin->exec_on_files (plugin, "/tmp", &amp;callback);
plugin->print (plugin, NULL, NULL, "hello");
plugin->print (plugin, NULL, "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, "freenode", "#weechat", "hello");
plugin->print (plugin, NULL, NULL,
"test: \x02 gras \x0F\x03%02d bleu \x03%02d vert",
plugin->get_irc_color (plugin, "blue"),
plugin->get_irc_color (plugin, "green"));
</screen>
</para>
</section>
@@ -1939,6 +1998,10 @@ plugin->print (plugin, "freenode", "#weechat", "hello");
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, voir
<xref linkend="secAPI_print" />.
</para>
<para>
Valeur renvoyée : aucune.
</para>
@@ -5388,6 +5451,10 @@ weechat.set_charset("ISO-8859-1")
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, voir
<xref linkend="secAPI_print" />.
</para>
<para>
Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
</para>
@@ -5398,6 +5465,7 @@ weechat.set_charset("ISO-8859-1")
weechat::print("message");
weechat::print("message", "#weechat");
weechat::print("message", "#weechat", "freenode");
weechat::print("test: \x0305 rouge \x0F normal");
# python
weechat.prnt("message")
@@ -5417,6 +5485,72 @@ weechat.print("message", "#weechat", "freenode")
</para>
</section>
<section id="secScript_print_server">
<title>print_server</title>
<para>
Prototype Perl :
<command>
weechat::print_server(message)
</command>
</para>
<para>
Prototype Python :
<command>
weechat.print_server(message)
</command>
</para>
<para>
Prototype Ruby :
<command>
Weechat.print_server(message)
</command>
</para>
<para>
Prototype Lua :
<command>
weechat.print_server(message)
</command>
</para>
<para>
Affiche un message sur le tampon serveur.
</para>
<para>
Paramètres :
<itemizedlist>
<listitem>
<para>
<option>message</option> : message à afficher
</para>
</listitem>
</itemizedlist>
</para>
<para>
Pour afficher du texte en couleur, voir
<xref linkend="secAPI_print" />.
</para>
<para>
Valeur renvoyée : 1 si succès, 0 si une erreur s'est produite.
</para>
<para>
Exemples :
<screen>
# perl
weechat::print_server("message");
weechat::print_server("test: \x0305 rouge \x0F normal");
# python
weechat.print_server("message")
# ruby
Weechat.print_server("message")
-- lua
weechat.print_server("message")
</screen>
</para>
</section>
<section id="secScript_print_infobar">
<title>print_infobar</title>
+14 -1
View File
@@ -28,9 +28,22 @@ gestion des tampons
list: liste les tampons ouverts (pas de paramètre affiche cette liste)
notify: fixe le niveau de notification (0=jamais, 1=highlight, 2=1+msg, 3=2+join/part)
(quand exécuté sur un tampon serveur, cela fixe le niveau de notification par défaut pour le serveur entier)
scroll: fait défiler l'historique (peut être relatif, et peut se terminer par une lettre: s=sec, m=min, h=heure, d=jour, M=mois, y=année); s'il y a seulement une lettre, alors fait défiler jusqu'au début de cet élément
nombre: saute au tampon qui a ce numéro
serveur,
canal: saute au tampon par serveur et/ou nom de canal
nombre: saute au tampon qui a ce numéro
Exemples :
déplacer tampon: /buffer move 5
fermer tampon: /buffer close c'est le message de départ
niveau de notif.: /buffer notify 2
défiler 1 jour haut: /buffer scroll 1d == /buffer scroll -1d == /buffer scroll -24h
défiler au début
de ce jour: /buffer scroll d
défiler 15 min bas: /buffer scroll +15m
défiler 20 msgs haut: /buffer scroll -20
aller sur #weechat: /buffer #weechat
</programlisting>
<command>builtin commande</command>
+286 -285
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+288 -288
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+286 -285
View File
File diff suppressed because it is too large Load Diff
+285 -285
View File
File diff suppressed because it is too large Load Diff
+10 -18
View File
@@ -558,10 +558,9 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
}
else
{
ptr_args2 = (weechat_commands[i].conversion
&& cfg_irc_colors_send
&& ptr_args) ?
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
ptr_args2 = (ptr_args) ? (char *)gui_color_encode ((unsigned char *)ptr_args,
(weechat_commands[i].conversion
&& cfg_irc_colors_send)) : NULL;
if (weechat_commands[i].cmd_function_args)
{
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
@@ -647,10 +646,9 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
free (command);
return 0;
}
ptr_args2 = (irc_commands[i].conversion
&& cfg_irc_colors_send
&& ptr_args) ?
(char *)gui_color_encode ((unsigned char *)ptr_args) : NULL;
ptr_args2 = (ptr_args) ? (char *)gui_color_encode ((unsigned char *)ptr_args,
(irc_commands[i].conversion
&& cfg_irc_colors_send)) : NULL;
if (irc_commands[i].cmd_function_args)
{
argv2 = explode_string ((ptr_args2) ? ptr_args2 : ptr_args,
@@ -722,11 +720,8 @@ exec_weechat_command (t_irc_server *server, t_irc_channel *channel, char *string
void
user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
{
char *decoded_text;
t_irc_nick *ptr_nick;
decoded_text = (char *)gui_color_decode ((unsigned char *)text, 1);
if ((CHANNEL(buffer)->type == CHANNEL_TYPE_PRIVATE)
|| (CHANNEL(buffer)->type == CHANNEL_TYPE_DCC_CHAT))
{
@@ -736,7 +731,7 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(decoded_text) ? decoded_text : text);
text);
}
else
{
@@ -749,7 +744,7 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(decoded_text) ? decoded_text : text);
text);
}
else
{
@@ -759,9 +754,6 @@ user_message_display (t_irc_server *server, t_gui_buffer *buffer, char *text)
WEECHAT_ERROR);
}
}
if (decoded_text)
free (decoded_text);
}
/*
@@ -892,8 +884,8 @@ user_command (t_irc_server *server, t_irc_channel *channel, char *command, int o
if (server && (!BUFFER_IS_SERVER(buffer)))
{
command_with_colors = (cfg_irc_colors_send) ?
(char *)gui_color_encode ((unsigned char *)ptr_cmd) : NULL;
command_with_colors = (char *)gui_color_encode ((unsigned char *)ptr_cmd,
cfg_irc_colors_send);
if (CHANNEL(buffer)->dcc_chat)
{
+1 -1
View File
@@ -853,7 +853,7 @@ completion_list_add_topic (t_completion *completion)
if (cfg_irc_colors_send)
string = (char *)gui_color_decode_for_user_entry ((unsigned char *)((t_irc_channel *)(completion->channel))->topic);
else
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0);
string = (char *)gui_color_decode ((unsigned char *)((t_irc_channel *)(completion->channel))->topic, 0, 0);
completion_list_add (completion,
(string) ?
string : ((t_irc_channel *)(completion->channel))->topic,
+72
View File
@@ -27,6 +27,7 @@
#include <errno.h>
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#ifdef HAVE_ICONV
#include <iconv.h>
@@ -441,6 +442,77 @@ weechat_strreplace (char *string, char *search, char *replace)
return new_string;
}
/*
* weechat_convert_hex_chars: convert hex chars (\x??) to value
*/
char *
weechat_convert_hex_chars (char *string)
{
char *output, hex_str[8], *error;
int pos_output;
long number;
output = (char *)malloc (strlen (string) + 1);
if (output)
{
pos_output = 0;
while (string && string[0])
{
if (string[0] == '\\')
{
string++;
switch (string[0])
{
case '\\':
output[pos_output++] = '\\';
string++;
break;
case 'x':
case 'X':
if (isxdigit (string[1])
&& isxdigit (string[2]))
{
snprintf (hex_str, sizeof (hex_str),
"0x%c%c", string[1], string[2]);
number = strtol (hex_str, &error, 16);
if ((error) && (error[0] == '\0'))
{
output[pos_output++] = number;
string += 3;
}
else
{
output[pos_output++] = '\\';
output[pos_output++] = string[0];
string++;
}
}
else
{
output[pos_output++] = string[0];
string++;
}
break;
default:
output[pos_output++] = '\\';
output[pos_output++] = string[0];
string++;
break;
}
}
else
{
output[pos_output++] = string[0];
string++;
}
}
output[pos_output] = '\0';
}
return output;
}
/*
* get_timeval_diff: calculates difference between two times (return in milliseconds)
*/
+1
View File
@@ -33,6 +33,7 @@ extern char *weechat_iconv_to_internal (char *, char *);
extern char *weechat_iconv_from_internal (char *, char *);
extern void weechat_iconv_fprintf (FILE *, char *, ...);
extern char *weechat_strreplace (char *, char *, char *);
extern char *weechat_convert_hex_chars (char *);
extern long get_timeval_diff (struct timeval *, struct timeval *);
extern char **explode_string (char *, char *, int, int *);
extern void free_exploded_string (char **);
+2 -2
View File
@@ -805,8 +805,8 @@ t_config_option weechat_options_irc[] =
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_receive, NULL, config_change_noop },
{ "irc_colors_send", N_("allow user to send colors"),
N_("allow user to send colors with special codes (%B=bold, %Cxx,yy=color, "
"%U=underline, %R=reverse)"),
N_("allow user to send colors with special codes (^Cb=bold, ^Ccxx=color, "
"^Ccxx,yy=color+background, ^Cu=underline, ^Cr=reverse)"),
OPTION_TYPE_BOOLEAN, BOOL_FALSE, BOOL_TRUE, BOOL_TRUE,
NULL, NULL, &cfg_irc_colors_send, NULL, config_change_noop },
{ "irc_send_unknown_commands", N_("send unknown commands to IRC server"),
+2 -1
View File
@@ -186,7 +186,7 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
{
if (CHANNEL(buffer)->topic)
{
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0);
buf = (char *)gui_color_decode ((unsigned char *)(CHANNEL(buffer)->topic), 0, 0);
ptr_topic = utf8_add_offset ((buf) ? buf : CHANNEL(buffer)->topic,
ptr_win->win_title_start);
if (!ptr_topic || !ptr_topic[0])
@@ -365,6 +365,7 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string,
}
break;
case GUI_ATTR_RESET_CHAR:
case GUI_ATTR_WEECHAT_RESET_CHAR:
string++;
if (apply_style)
gui_chat_reset_style (window);
+74 -80
View File
@@ -112,16 +112,14 @@ gui_color_get_name (int num_color)
/*
* gui_color_decode: parses a message (coming from IRC server),
* and according:
* - remove any color/style in message
* or:
* - change colors by codes to be compatible with
* other IRC clients
* if keep_colors == 0: remove any color/style in message
* otherwise change colors by internal WeeChat color codes
* if wkeep_eechat_attr == 0: remove any weechat color/style attribute
* After use, string returned has to be free()
*/
unsigned char *
gui_color_decode (unsigned char *string, int keep_colors)
gui_color_decode (unsigned char *string, int keep_irc_colors, int keep_weechat_attr)
{
unsigned char *out;
int out_length, out_pos;
@@ -134,7 +132,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
@@ -145,7 +143,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
case GUI_ATTR_REVERSE2_CHAR:
case GUI_ATTR_ITALIC_CHAR:
case GUI_ATTR_UNDERLINE_CHAR:
if (keep_colors)
if (keep_irc_colors)
out[out_pos++] = string[0];
string++;
break;
@@ -181,7 +179,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
}
}
if (keep_colors)
if (keep_irc_colors)
{
if (!str_fg[0] && !str_bg[0])
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
@@ -226,10 +224,12 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
break;
case GUI_ATTR_WEECHAT_COLOR_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]) && isdigit (string[1]))
{
if (keep_colors)
if (keep_weechat_attr)
{
out[out_pos++] = string[0];
out[out_pos++] = string[1];
@@ -239,17 +239,21 @@ gui_color_decode (unsigned char *string, int keep_colors)
break;
case GUI_ATTR_WEECHAT_SET_CHAR:
case GUI_ATTR_WEECHAT_REMOVE_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (string[0])
{
if (keep_colors)
{
out[out_pos++] = *(string - 1);
if (keep_weechat_attr)
out[out_pos++] = string[0];
}
string++;
}
break;
case GUI_ATTR_WEECHAT_RESET_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
break;
default:
out[out_pos++] = string[0];
string++;
@@ -261,7 +265,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
/*
* gui_color_decode_for_user_entry: parses a message (coming from IRC server),
* and replaces colors/bold/.. by %C, %B, ..
* and replaces colors/bold/.. by ^C, ^B, ..
* After use, string returned has to be free()
*/
@@ -277,40 +281,35 @@ gui_color_decode_for_user_entry (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case GUI_ATTR_BOLD_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'B';
out[out_pos++] = 0x02; /* ^B */
string++;
break;
case GUI_ATTR_FIXED_CHAR:
string++;
break;
case GUI_ATTR_RESET_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'O';
out[out_pos++] = 0x0F; /* ^O */
string++;
break;
case GUI_ATTR_REVERSE_CHAR:
case GUI_ATTR_REVERSE2_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x12; /* ^R */
string++;
break;
case GUI_ATTR_ITALIC_CHAR:
string++;
break;
case GUI_ATTR_UNDERLINE_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x15; /* ^U */
string++;
break;
case GUI_ATTR_COLOR_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'C';
out[out_pos++] = 0x03; /* ^C */
string++;
break;
default:
@@ -324,12 +323,14 @@ gui_color_decode_for_user_entry (unsigned char *string)
/*
* gui_color_encode: parses a message (entered by user), and
* encode special chars (%B, %C, ..) in IRC colors
* encode special chars (^Cb, ^Cc, ..) in IRC colors
* if keep_colors == 0: remove any color/style in message
* otherwise: keep colors
* After use, string returned has to be free()
*/
unsigned char *
gui_color_encode (unsigned char *string)
gui_color_encode (unsigned char *string, int keep_colors)
{
unsigned char *out;
int out_length, out_pos;
@@ -340,72 +341,65 @@ gui_color_encode (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case '%':
case 0x02: /* ^B */
if (keep_colors)
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
switch (string[0])
break;
case 0x03: /* ^C */
if (keep_colors)
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
string++;
if (isdigit (string[0]))
{
case '\0':
out[out_pos++] = '%';
break;
case '%': /* double '%' replaced by single '%' */
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
break;
case 'B': /* bold */
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
break;
case 'C': /* color */
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
}
}
if (string[0] == ',')
{
if (keep_colors)
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
if (string[0] == ',')
{
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
}
break;
case 'O': /* reset */
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 'R': /* reverse */
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 'U': /* underline */
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = '%';
out[out_pos++] = string[0];
string++;
}
}
break;
case 0x0F: /* ^O */
if (keep_colors)
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 0x12: /* ^R */
if (keep_colors)
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 0x15: /* ^U */
if (keep_colors)
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = string[0];
string++;
+27 -7
View File
@@ -273,7 +273,7 @@ gui_input_draw_prompt (t_gui_window *window, char *nick)
int
gui_input_draw_text (t_gui_window *window, int input_width)
{
char *ptr_start, *ptr_next, saved_char, *output;
char *ptr_start, *ptr_next, saved_char, *output, *ptr_string;
int pos_mask, size, last_color, color, count_cursor, offset_cursor;
ptr_start = utf8_add_offset (window->buffer->input_buffer,
@@ -316,14 +316,34 @@ gui_input_draw_text (t_gui_window *window, int input_width)
last_color = color;
}
output = weechat_iconv_from_internal (NULL, ptr_start);
wprintw (GUI_CURSES(window)->win_input, "%s", (output) ? output : ptr_start);
ptr_string = (output) ? output : ptr_start;
if ((((unsigned char)ptr_string[0]) < 32) && (!ptr_string[1]))
{
wattron (GUI_CURSES(window)->win_input, A_REVERSE);
wprintw (GUI_CURSES(window)->win_input, "%c",
'A' + ((unsigned char)ptr_string[0]) - 1);
wattroff (GUI_CURSES(window)->win_input, A_REVERSE);
if (count_cursor > 0)
{
offset_cursor++;
count_cursor--;
}
}
else
{
wprintw (GUI_CURSES(window)->win_input, "%s", ptr_string);
if (count_cursor > 0)
{
offset_cursor += utf8_width_screen (ptr_start);
count_cursor--;
}
}
if (output)
free (output);
if (count_cursor > 0)
{
offset_cursor += utf8_width_screen (ptr_start);
count_cursor--;
}
ptr_next[0] = saved_char;
ptr_start = ptr_next;
pos_mask += size;
@@ -105,6 +105,11 @@ gui_keyboard_default_bindings ()
gui_keyboard_bind ( /* m-s */ "meta-s", "switch_server");
gui_keyboard_bind ( /* m-u */ "meta-u", "scroll_unread");
gui_keyboard_bind ( /* ^R */ "ctrl-R", "search_text");
gui_keyboard_bind ( /* ^Cb */ "ctrl-Cb", "insert \\x02");
gui_keyboard_bind ( /* ^Cc */ "ctrl-Cc", "insert \\x03");
gui_keyboard_bind ( /* ^Co */ "ctrl-Co", "insert \\x0F");
gui_keyboard_bind ( /* ^Cr */ "ctrl-Cr", "insert \\x12");
gui_keyboard_bind ( /* ^Cu */ "ctrl-Cu", "insert \\x15");
/* keys bound with commands */
gui_keyboard_bind ( /* m-left */ "meta-meta2-D", "/buffer -1");
+2 -1
View File
@@ -323,7 +323,8 @@ gui_main_init ()
curs_set (1);
noecho ();
nodelay (stdscr, TRUE);
raw ();
gui_color_init ();
gui_infobar = NULL;
+2 -1
View File
@@ -263,6 +263,7 @@ gui_chat_word_get_next_char (t_gui_window *window, unsigned char *string,
}
break;
case GUI_ATTR_RESET_CHAR:
case GUI_ATTR_WEECHAT_RESET_CHAR:
string++;
if (apply_style)
gui_chat_reset_style (window);
@@ -628,7 +629,7 @@ gui_chat_draw_line (t_gui_buffer *buffer, t_gui_line *line)
ptr_win = gui_buffer_find_window (buffer);
if (ptr_win)
{
text_without_color = gui_color_decode ((unsigned char *)(line->data), 0);
text_without_color = gui_color_decode ((unsigned char *)(line->data), 0, 0);
if (text_without_color)
{
gtk_text_buffer_insert_at_cursor (GUI_GTK(ptr_win)->textbuffer_chat,
+76 -82
View File
@@ -112,16 +112,14 @@ gui_color_get_name (int num_color)
/*
* gui_color_decode: parses a message (coming from IRC server),
* and according:
* - remove any color/style in message
* or:
* - change colors by codes to be compatible with
* other IRC clients
* if keep_colors == 0: remove any color/style in message
* otherwise change colors by internal WeeChat color codes
* if wkeep_eechat_attr == 0: remove any weechat color/style attribute
* After use, string returned has to be free()
*/
unsigned char *
gui_color_decode (unsigned char *string, int keep_colors)
gui_color_decode (unsigned char *string, int keep_irc_colors, int keep_weechat_attr)
{
unsigned char *out;
int out_length, out_pos;
@@ -134,7 +132,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
@@ -145,7 +143,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
case GUI_ATTR_REVERSE2_CHAR:
case GUI_ATTR_ITALIC_CHAR:
case GUI_ATTR_UNDERLINE_CHAR:
if (keep_colors)
if (keep_irc_colors)
out[out_pos++] = string[0];
string++;
break;
@@ -181,7 +179,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
}
}
if (keep_colors)
if (keep_irc_colors)
{
if (!str_fg[0] && !str_bg[0])
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
@@ -191,13 +189,13 @@ gui_color_decode (unsigned char *string, int keep_colors)
if (str_fg[0])
{
sscanf (str_fg, "%d", &fg);
fg %= 16;
fg %= GUI_NUM_IRC_COLORS;
attr |= gui_irc_colors[fg][1];
}
if (str_bg[0])
{
sscanf (str_bg, "%d", &bg);
bg %= 16;
bg %= GUI_NUM_IRC_COLORS;
attr |= gui_irc_colors[bg][1];
}
if (attr & A_BOLD)
@@ -226,10 +224,12 @@ gui_color_decode (unsigned char *string, int keep_colors)
}
break;
case GUI_ATTR_WEECHAT_COLOR_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]) && isdigit (string[1]))
{
if (keep_colors)
if (keep_weechat_attr)
{
out[out_pos++] = string[0];
out[out_pos++] = string[1];
@@ -239,17 +239,21 @@ gui_color_decode (unsigned char *string, int keep_colors)
break;
case GUI_ATTR_WEECHAT_SET_CHAR:
case GUI_ATTR_WEECHAT_REMOVE_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
if (string[0])
{
if (keep_colors)
{
out[out_pos++] = *(string - 1);
if (keep_weechat_attr)
out[out_pos++] = string[0];
}
string++;
}
break;
case GUI_ATTR_WEECHAT_RESET_CHAR:
if (keep_weechat_attr)
out[out_pos++] = string[0];
string++;
break;
default:
out[out_pos++] = string[0];
string++;
@@ -261,7 +265,7 @@ gui_color_decode (unsigned char *string, int keep_colors)
/*
* gui_color_decode_for_user_entry: parses a message (coming from IRC server),
* and replaces colors/bold/.. by %C, %B, ..
* and replaces colors/bold/.. by ^C, ^B, ..
* After use, string returned has to be free()
*/
@@ -277,40 +281,35 @@ gui_color_decode_for_user_entry (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case GUI_ATTR_BOLD_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'B';
out[out_pos++] = 0x02; /* ^B */
string++;
break;
case GUI_ATTR_FIXED_CHAR:
string++;
break;
case GUI_ATTR_RESET_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'O';
out[out_pos++] = 0x0F; /* ^O */
string++;
break;
case GUI_ATTR_REVERSE_CHAR:
case GUI_ATTR_REVERSE2_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x12; /* ^R */
string++;
break;
case GUI_ATTR_ITALIC_CHAR:
string++;
break;
case GUI_ATTR_UNDERLINE_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'R';
out[out_pos++] = 0x15; /* ^U */
string++;
break;
case GUI_ATTR_COLOR_CHAR:
out[out_pos++] = '%';
out[out_pos++] = 'C';
out[out_pos++] = 0x03; /* ^C */
string++;
break;
default:
@@ -324,12 +323,14 @@ gui_color_decode_for_user_entry (unsigned char *string)
/*
* gui_color_encode: parses a message (entered by user), and
* encode special chars (%B, %C, ..) in IRC colors
* encode special chars (^Cb, ^Cc, ..) in IRC colors
* if keep_colors == 0: remove any color/style in message
* otherwise: keep colors
* After use, string returned has to be free()
*/
unsigned char *
gui_color_encode (unsigned char *string)
gui_color_encode (unsigned char *string, int keep_colors)
{
unsigned char *out;
int out_length, out_pos;
@@ -340,72 +341,65 @@ gui_color_encode (unsigned char *string)
return NULL;
out_pos = 0;
while (string[0] && (out_pos < out_length - 1))
while (string && string[0] && (out_pos < out_length - 1))
{
switch (string[0])
{
case '%':
case 0x02: /* ^B */
if (keep_colors)
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
switch (string[0])
break;
case 0x03: /* ^C */
if (keep_colors)
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
string++;
if (isdigit (string[0]))
{
case '\0':
out[out_pos++] = '%';
break;
case '%': /* double '%' replaced by single '%' */
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
break;
case 'B': /* bold */
out[out_pos++] = GUI_ATTR_BOLD_CHAR;
string++;
break;
case 'C': /* color */
out[out_pos++] = GUI_ATTR_COLOR_CHAR;
}
}
if (string[0] == ',')
{
if (keep_colors)
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
if (keep_colors)
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
if (string[0] == ',')
{
out[out_pos++] = ',';
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
if (isdigit (string[0]))
{
out[out_pos++] = string[0];
string++;
}
}
}
break;
case 'O': /* reset */
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 'R': /* reverse */
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 'U': /* underline */
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = '%';
out[out_pos++] = string[0];
string++;
}
}
break;
case 0x0F: /* ^O */
if (keep_colors)
out[out_pos++] = GUI_ATTR_RESET_CHAR;
string++;
break;
case 0x12: /* ^R */
if (keep_colors)
out[out_pos++] = GUI_ATTR_REVERSE_CHAR;
string++;
break;
case 0x15: /* ^U */
if (keep_colors)
out[out_pos++] = GUI_ATTR_UNDERLINE_CHAR;
string++;
break;
default:
out[out_pos++] = string[0];
string++;
+8 -1
View File
@@ -39,6 +39,7 @@
#include "../common/hotlist.h"
#include "../common/log.h"
#include "../common/utf8.h"
#include "../common/util.h"
#include "../irc/irc.h"
@@ -1446,10 +1447,16 @@ gui_action_grab_key (t_gui_window *window, char *args)
void
gui_action_insert_string (t_gui_window *window, char *args)
{
char *args2;
if (args)
{
gui_insert_string_input (window, args, -1);
args2 = weechat_convert_hex_chars (args);
gui_insert_string_input (window,
(args2) ? args2 : args, -1);
gui_input_draw (window->buffer, 0);
if (args2)
free (args2);
}
}
+1 -1
View File
@@ -735,7 +735,7 @@ gui_buffer_line_search (t_gui_line *line, char *text, int case_sensitive)
return 0;
rc = 0;
data = (char *)gui_color_decode ((unsigned char *)line->data, 0);
data = (char *)gui_color_decode ((unsigned char *)line->data, 0, 0);
if (data)
{
if ((case_sensitive && (strstr (data, text)))
+3 -1
View File
@@ -122,9 +122,11 @@ enum t_weechat_color
#define GUI_ATTR_WEECHAT_SET_STR "\x1A"
#define GUI_ATTR_WEECHAT_REMOVE_CHAR '\x1B'
#define GUI_ATTR_WEECHAT_REMOVE_STR "\x1B"
#define GUI_ATTR_WEECHAT_RESET_CHAR '\x1C'
#define GUI_ATTR_WEECHAT_RESET_STR "\x1C"
#define GUI_COLOR(color) ((gui_color[color]) ? gui_color[color]->string : "")
#define GUI_NO_COLOR GUI_ATTR_RESET_STR
#define GUI_NO_COLOR GUI_ATTR_WEECHAT_RESET_STR
/* color structure */
+20 -8
View File
@@ -220,11 +220,12 @@ gui_add_to_line (t_gui_buffer *buffer, int type, time_t date, char *nick, char *
*/
void
gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nick, char *message, ...)
gui_printf_internal (t_gui_buffer *buffer, int display_time, int type,
int keep_irc_colors, char *nick, char *message, ...)
{
static char buf[8192];
char text_time[1024];
char text_time_char[2];
char *buf2;
char text_time[1024], text_time_char[2];
time_t date;
struct tm *local_time;
int time_first_digit, time_last_digit;
@@ -267,12 +268,20 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
if (!buf[0])
return;
utf8_normalize (buf, '?');
buf2 = (char *)gui_color_decode ((unsigned char *)buf,
(keep_irc_colors >= 0) ?
keep_irc_colors : cfg_irc_colors_receive,
1);
if (!buf2)
return;
utf8_normalize (buf2, '?');
if (gui_init_ok)
{
pos = buf;
pos = buf2;
while (pos)
{
date = time (NULL);
@@ -356,7 +365,10 @@ gui_printf_internal (t_gui_buffer *buffer, int display_time, int type, char *nic
}
}
else
weechat_iconv_fprintf (stdout, buf);
weechat_iconv_fprintf (stdout, buf2);
if (buf2)
free (buf2);
}
/*
@@ -417,7 +429,7 @@ gui_infobar_printf (int time_displayed, int color, char *message, ...)
ptr_infobar = (t_gui_infobar *)malloc (sizeof (t_gui_infobar));
if (ptr_infobar)
{
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0);
buf2 = (char *)gui_color_decode ((unsigned char *)buf, 0, 0);
ptr_buf = (buf2) ? buf2 : buf;
ptr_infobar->color = color;
+13 -7
View File
@@ -469,7 +469,7 @@ gui_keyboard_bind (char *key, char *command)
{
t_gui_key_func *ptr_function;
t_gui_key *new_key;
char *ptr_args;
char *command2, *ptr_args;
if (!key || !command)
{
@@ -480,18 +480,24 @@ gui_keyboard_bind (char *key, char *command)
ptr_function = NULL;
ptr_args = NULL;
if (command[0] != '/')
{
ptr_args = strchr (command, ' ');
if (ptr_args)
ptr_args[0] = '\0';
ptr_function = gui_keyboard_function_search_by_name (command);
if (ptr_args)
command2 = strndup (command, ptr_args - command);
else
command2 = strdup (command);
if (command2)
{
ptr_args[0] = ' ';
ptr_args++;
while (ptr_args[0] == ' ')
ptr_function = gui_keyboard_function_search_by_name (command2);
if (ptr_args)
{
ptr_args++;
while (ptr_args[0] == ' ')
ptr_args++;
}
free (command2);
}
if (!ptr_function)
{
+2 -2
View File
@@ -69,7 +69,7 @@ gui_log_write_line (t_gui_buffer *buffer, char *message)
if (buffer->log_file)
{
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0, 0);
weechat_iconv_fprintf (buffer->log_file,
"%s\n", (msg_no_color) ? msg_no_color : message);
fflush (buffer->log_file);
@@ -89,7 +89,7 @@ gui_log_write (t_gui_buffer *buffer, char *message)
if (buffer->log_file)
{
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0);
msg_no_color = (char *)gui_color_decode ((unsigned char *)message, 0, 0);
weechat_iconv_fprintf (buffer->log_file,
"%s", (msg_no_color) ? msg_no_color : message);
fflush (buffer->log_file);
+11 -8
View File
@@ -28,19 +28,22 @@
#define gui_printf(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, NULL, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, -1, NULL, fmt, ##argz)
#define gui_printf_keep_colors(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO, 1, NULL, fmt, ##argz)
#define gui_printf_type(buffer, type, fmt, argz...) \
gui_printf_internal(buffer, 1, type, NULL, fmt, ##argz)
gui_printf_internal(buffer, 1, type, -1, NULL, fmt, ##argz)
#define gui_printf_type_nick(buffer, type, nick, fmt, argz...) \
gui_printf_internal(buffer, 1, type, nick, fmt, ##argz)
gui_printf_internal(buffer, 1, type, -1, nick, fmt, ##argz)
#define gui_printf_nolog(buffer, fmt, argz...) \
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, NULL, fmt, ##argz)
gui_printf_internal(buffer, 1, MSG_TYPE_INFO | MSG_TYPE_NOLOG, -1, NULL, fmt, ##argz)
#define gui_printf_nolog_notime(buffer, fmt, argz...) \
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, NULL, fmt, ##argz)
gui_printf_internal(buffer, 0, MSG_TYPE_NOLOG, -1, NULL, fmt, ##argz)
typedef struct t_gui_infobar t_gui_infobar;
@@ -191,7 +194,7 @@ extern void gui_log_end (t_gui_buffer *);
/* other */
extern int gui_word_strlen (t_gui_window *, char *);
extern int gui_word_real_pos (t_gui_window *, char *, int);
extern void gui_printf_internal (t_gui_buffer *, int, int, char *, char *, ...);
extern void gui_printf_internal (t_gui_buffer *, int, int, int, char *, char *, ...);
extern void gui_printf_raw_data (void *, int, int, char *);
extern void gui_infobar_printf (int, int, char *, ...);
extern void gui_infobar_printf_from_buffer (t_gui_buffer *, int, int, char *, char *, ...);
@@ -210,9 +213,9 @@ extern int gui_insert_string_input (t_gui_window *, char *, int);
/* color */
extern int gui_color_assign (int *, char *);
extern char *gui_color_get_name (int);
extern unsigned char *gui_color_decode (unsigned char *, int);
extern unsigned char *gui_color_decode (unsigned char *, int, int);
extern unsigned char *gui_color_decode_for_user_entry (unsigned char *);
extern unsigned char *gui_color_encode (unsigned char *);
extern unsigned char *gui_color_encode (unsigned char *, int);
extern void gui_color_init_pairs ();
extern void gui_color_rebuild_weechat();
+2 -9
View File
@@ -1241,7 +1241,6 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
static struct timeval timeout;
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
char *ptr_buf_color;
int num_read;
FD_ZERO (&read_fd);
@@ -1305,9 +1304,6 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
if (ptr_buf)
{
ptr_buf_color = (char *)gui_color_decode ((unsigned char *)ptr_buf,
cfg_irc_colors_receive);
if (irc_recv_is_highlight (ptr_buf, ptr_dcc->server->nick))
{
irc_display_nick (ptr_dcc->channel->buffer, NULL, ptr_dcc->nick,
@@ -1319,8 +1315,7 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
gui_infobar_printf (cfg_look_infobar_delay_highlight,
COLOR_WIN_INFOBAR_HIGHLIGHT,
_("Private %s> %s"),
ptr_dcc->nick,
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
ptr_dcc->nick, ptr_buf);
}
}
else
@@ -1329,9 +1324,7 @@ irc_dcc_chat_recv (t_irc_dcc *ptr_dcc)
gui_printf_type (ptr_dcc->channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(ptr_buf_color) ? ptr_buf_color : ptr_buf);
if (ptr_buf_color)
free (ptr_buf_color);
ptr_buf);
}
ptr_buf = next_ptr_buf;
+3 -8
View File
@@ -228,7 +228,7 @@ irc_recv_command (t_irc_server *server, char *entire_line,
char *host, char *command, char *arguments)
{
int i, cmd_found, return_code;
char *pos, *nick, *args_after_color;
char *pos, *nick;
char *dup_entire_line, *dup_host, *dup_arguments;
t_irc_recv_func *cmd_recv_func;
char *cmd_name;
@@ -294,16 +294,11 @@ irc_recv_command (t_irc_server *server, char *entire_line,
nick = (dup_host) ? strdup (dup_host) : NULL;
if (pos)
pos[0] = '!';
args_after_color = (char *)gui_color_decode ((unsigned char *)dup_arguments,
cfg_irc_colors_receive);
irc_last_command_received = strdup (dup_entire_line);
return_code = (int) (cmd_recv_func) (server, dup_host, nick,
(args_after_color) ?
args_after_color : dup_arguments);
dup_arguments);
if (irc_last_command_received)
free (irc_last_command_received);
if (args_after_color)
free (args_after_color);
if (nick)
free (nick);
if (dup_entire_line)
@@ -3728,7 +3723,7 @@ irc_recv_cmd_332 (t_irc_server *server, char *host, char *nick, char *arguments)
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
pos,
GUI_COLOR(COLOR_WIN_CHAT));
gui_printf (ptr_buffer, "\"%s\"\n", pos2);
gui_printf (ptr_buffer, "\"%s%s\"\n", pos2, GUI_NO_COLOR);
}
if (ptr_channel)
+10 -10
View File
@@ -96,7 +96,7 @@ irc_send_me (t_irc_server *server, t_irc_channel *channel,
(arguments && arguments[0]) ? arguments : "");
irc_display_prefix (NULL, channel->buffer, PREFIX_ACTION_ME);
string = (arguments && arguments[0]) ?
(char *)gui_color_decode ((unsigned char *)arguments, 1) : NULL;
(char *)gui_color_decode ((unsigned char *)arguments, 1, 0) : NULL;
gui_printf (channel->buffer, "%s%s %s%s\n",
GUI_COLOR(COLOR_WIN_CHAT_NICK),
server->nick,
@@ -195,7 +195,7 @@ irc_send_cmd_amsg (t_irc_server *server, t_irc_channel *channel,
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, -1, 0);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1, 0);
gui_printf (ptr_channel->buffer, "%s\n", (string) ? string : arguments);
if (string)
free (string);
@@ -248,7 +248,7 @@ irc_send_away (t_irc_server *server, char *arguments)
irc_server_sendf (server, "AWAY :%s", arguments);
if (cfg_irc_display_away != CFG_IRC_DISPLAY_AWAY_OFF)
{
string = (char *)gui_color_decode ((unsigned char *)arguments, 1);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1, 0);
if (cfg_irc_display_away == CFG_IRC_DISPLAY_AWAY_LOCAL)
irc_display_away (server, "away", (string) ? string : arguments);
else
@@ -272,7 +272,7 @@ irc_send_away (t_irc_server *server, char *arguments)
{
/* server not connected, store away for future usage
(when connecting to server) */
string = (char *)gui_color_decode ((unsigned char *)arguments, 1);
string = (char *)gui_color_decode ((unsigned char *)arguments, 1, 0);
irc_display_prefix (NULL, server->buffer, PREFIX_INFO);
gui_printf_nolog (server->buffer,
_("Future away on %s%s%s: %s\n"),
@@ -1246,7 +1246,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
irc_display_nick (buffer, ptr_nick,
(ptr_nick) ? NULL : server->nick,
MSG_TYPE_NICK, 1, -1, 0);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf_type (buffer, MSG_TYPE_MSG, "%s\n",
(string) ? string : "");
if (string)
@@ -1266,7 +1266,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
{
irc_display_nick (ptr_channel->buffer, ptr_nick, NULL,
MSG_TYPE_NICK, 1, -1, 0);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG, "%s\n",
(string) ? string : "");
if (string)
@@ -1297,7 +1297,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
string = (char *)gui_color_decode ((unsigned char *)msg_pwd_hidden, 1);
string = (char *)gui_color_decode ((unsigned char *)msg_pwd_hidden, 1, 0);
gui_printf (server->buffer, "%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
(string) ? string : "");
@@ -1308,7 +1308,7 @@ irc_send_cmd_msg (t_irc_server *server, t_irc_channel *channel,
return 0;
}
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
ptr_channel = irc_channel_search (server, arguments);
if (ptr_channel)
{
@@ -1466,7 +1466,7 @@ irc_send_cmd_notice (t_irc_server *server, t_irc_channel *channel,
while (pos[0] == ' ')
pos++;
irc_display_prefix (server, server->buffer, PREFIX_SERVER);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf (server->buffer, "notice%s(%s%s%s)%s: %s\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT_NICK),
@@ -1712,7 +1712,7 @@ irc_send_cmd_query (t_irc_server *server, t_irc_channel *channel,
{
irc_display_nick (ptr_channel->buffer, NULL, server->nick,
MSG_TYPE_NICK, 1, COLOR_WIN_NICK_SELF, 0);
string = (char *)gui_color_decode ((unsigned char *)pos, 1);
string = (char *)gui_color_decode ((unsigned char *)pos, 1, 0);
gui_printf_type (ptr_channel->buffer, MSG_TYPE_MSG,
"%s%s\n",
GUI_COLOR(COLOR_WIN_CHAT),
+5 -13
View File
@@ -165,7 +165,7 @@ weechat_plugin_print (t_weechat_plugin *plugin,
t_gui_buffer *ptr_buffer;
va_list argptr;
static char buf[8192];
char *buf2, *buf3;
char *buf2;
if (!plugin || !message)
return;
@@ -176,14 +176,10 @@ weechat_plugin_print (t_weechat_plugin *plugin,
va_end (argptr);
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
buf3 = (char *)gui_color_decode ((unsigned char *)((buf2) ? buf2 : buf),
cfg_irc_colors_receive);
irc_display_prefix (NULL, ptr_buffer, PREFIX_PLUGIN);
gui_printf (ptr_buffer, "%s\n", (buf3) ? buf3 : ((buf2) ? buf2 : buf));
gui_printf_keep_colors (ptr_buffer, "%s\n", (buf2) ? buf2 : buf);
if (buf2)
free (buf2);
if (buf3)
free (buf3);
}
/*
@@ -195,7 +191,7 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
{
va_list argptr;
static char buf[8192];
char *buf2, *buf3;
char *buf2;
if (!plugin || !message)
return;
@@ -205,14 +201,10 @@ weechat_plugin_print_server (t_weechat_plugin *plugin, char *message, ...)
va_end (argptr);
buf2 = weechat_iconv_to_internal (plugin->charset, buf);
buf3 = (char *)gui_color_decode ((unsigned char *)((buf2) ? buf2 : buf),
cfg_irc_colors_receive);
irc_display_prefix (NULL, NULL, PREFIX_PLUGIN);
gui_printf (NULL, "%s\n", (buf3) ? buf3 : ((buf2) ? buf2 : buf));
gui_printf_keep_colors (NULL, "%s\n", (buf2) ? buf2 : buf);
if (buf2)
free (buf2);
if (buf3)
free (buf3);
}
/*
@@ -1420,7 +1412,7 @@ weechat_plugin_get_buffer_data (t_weechat_plugin *plugin, char *server, char *ch
new_buffer_line->nick = (ptr_line->nick) ? strdup (ptr_line->nick) : NULL;
if (ptr_line->data)
{
data1 = (char *) gui_color_decode ((unsigned char *)(ptr_line->data + ptr_line->ofs_start_message), 0);
data1 = (char *) gui_color_decode ((unsigned char *)(ptr_line->data + ptr_line->ofs_start_message), 0, 0);
data2 = (data1) ? weechat_iconv_from_internal (plugin->charset, data1) : NULL;
if (data2)
new_buffer_line->data = data2;