Add color for nicks in xfer chat (DCC chat), add missing command /me in xfer plugin (bug #28658)

This commit is contained in:
Sebastien Helleu 2010-01-18 10:43:55 +01:00
parent a3efc89a7f
commit dac4764394
19 changed files with 223 additions and 29 deletions

View File

@ -1,7 +1,7 @@
WeeChat ChangeLog
=================
FlashCode <flashcode@flashtux.org>
v0.3.1-dev, 2010-01-17
v0.3.1-dev, 2010-01-18
Version 0.3.1 (under dev!)
@ -45,6 +45,8 @@ Version 0.3.1 (under dev!)
* irc: fix nick color for nicks with wide chars (bug #28547)
* irc: fix autorejoin on channels with key
* irc: fix command /connect (options -ssl, -ipv6 and -port) (bug #27486)
* xfer: add color for nicks in chat
* xfer: add missing command /me (bug #28658)
* xfer: add missing charset decoding/encoding for IRC DCC chat (bug #27482)
* ruby: support of Ruby >= 1.9.1 (patch #6989)
* fifo: remove old pipes before creating new pipe

View File

@ -1,3 +1,11 @@
&bull; *`/me`* `message`::
........................................
send a CTCP action to remote host
message: message to send
........................................
&bull; *`/xfer`* `[list | listfull]`::
........................................

View File

@ -1,3 +1,11 @@
&bull; *`/me`* `message`::
........................................
envoyer une action CTCP à l'hôte distant
message: message à envoyer
........................................
&bull; *`/xfer`* `[list | listfull]`::
........................................

View File

@ -1,3 +1,11 @@
&bull; *`/me`* `messaggio`::
........................................
send a CTCP action to remote host
messaggio: messaggio da inviare
........................................
&bull; *`/xfer`* `[list | listfull]`::
........................................

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-03 15:15+0100\n"
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4296,6 +4296,10 @@ msgstr "získat aktuální přezdívku na serveru"
msgid "get nick from IRC host"
msgstr "získat přezdívku od IRC hosta"
#, fuzzy
msgid "get nick color"
msgstr "barva textu"
msgid "get buffer pointer for an IRC server/channel"
msgstr "získat ukazatel bufferu od IRC serveru/kanálu"
@ -5779,6 +5783,10 @@ msgstr "ne"
msgid "No xfer"
msgstr "Žádný xfer"
#, fuzzy
msgid "send a CTCP action to remote host"
msgstr "poslat CTCP akci na aktuální kanál"
msgid "xfer control"
msgstr "ovládání xfer"

View File

@ -10,7 +10,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-17 16:17+0100\n"
"Last-Translator: Nils G <weechatter@arcor.de>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4481,6 +4481,10 @@ msgstr "Aktuellen Nicknamen für den Server erhalten"
msgid "get nick from IRC host"
msgstr "Nicknamen des IRC-Hosts erhalten"
#, fuzzy
msgid "get nick color"
msgstr "Textfarbe"
msgid "get buffer pointer for an IRC server/channel"
msgstr "Zeiger auf den Buffer für einen IRC-Server oder Channel erhalten"
@ -6001,6 +6005,10 @@ msgstr "keine"
msgid "No xfer"
msgstr "Kein Transfer (xfer)"
#, fuzzy
msgid "send a CTCP action to remote host"
msgstr "Eine CTCP ACTION an den aktuellen Channel senden"
msgid "xfer control"
msgstr "Transfer-Steuerung"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-03 15:16+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4387,6 +4387,10 @@ msgstr "devuelve el apodo actual en el servidor"
msgid "get nick from IRC host"
msgstr "devuelve apodo de un host IRC"
#, fuzzy
msgid "get nick color"
msgstr "color del texto"
msgid "get buffer pointer for an IRC server/channel"
msgstr "devuelve el puntero del buffer de un canal/servidor IRC"
@ -5901,6 +5905,10 @@ msgstr "no"
msgid "No xfer"
msgstr "Ninguna transferencia"
#, fuzzy
msgid "send a CTCP action to remote host"
msgstr "envía una acción CTCP al canal actual"
msgid "xfer control"
msgstr "control de transferencias"

View File

@ -6,8 +6,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"PO-Revision-Date: 2010-01-17 15:44+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-18 10:29+0100\n"
"Last-Translator: FlashCode <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"MIME-Version: 1.0\n"
@ -4415,6 +4415,9 @@ msgstr "retourne le pseudo utilisé actuellement sur un serveur"
msgid "get nick from IRC host"
msgstr "retourne le pseudo à partir d'un host IRC"
msgid "get nick color"
msgstr "retourne la couleur du pseudo"
msgid "get buffer pointer for an IRC server/channel"
msgstr "retourne le pointeur vers le tampon pour un serveur/canal IRC"
@ -5922,6 +5925,9 @@ msgstr "non"
msgid "No xfer"
msgstr "Pas de xfer"
msgid "send a CTCP action to remote host"
msgstr "envoyer une action CTCP à l'hôte distant"
msgid "xfer control"
msgstr "contrôle xfer"

View File

@ -12,7 +12,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-03 15:16+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4238,6 +4238,10 @@ msgstr "aktuális név megváltoztatása"
msgid "get nick from IRC host"
msgstr "név vagy gép letiltása"
#, fuzzy
msgid "get nick color"
msgstr "üzenetek színe"
msgid "get buffer pointer for an IRC server/channel"
msgstr ""
@ -5712,6 +5716,10 @@ msgstr ""
msgid "No xfer"
msgstr "Nincs szerver.\n"
#, fuzzy
msgid "send a CTCP action to remote host"
msgstr "CTCP parancs küldése az aktuális szobába"
msgid "xfer control"
msgstr ""

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Weechat 0.31-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-17 16:27+0100\n"
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4384,6 +4384,10 @@ msgstr "ottiene nick corrente su un server"
msgid "get nick from IRC host"
msgstr "ottiene nick dall'host IRC"
#, fuzzy
msgid "get nick color"
msgstr "colore del testo"
msgid "get buffer pointer for an IRC server/channel"
msgstr "ottiene puntatore al buffer per un server/canale IRC"
@ -5882,6 +5886,10 @@ msgstr "no"
msgid "No xfer"
msgstr "Nessun xfer"
#, fuzzy
msgid "send a CTCP action to remote host"
msgstr "invia un'azione CTCP al canale corrente"
msgid "xfer control"
msgstr "controllo xfer"

View File

@ -9,7 +9,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.0-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-17 00:15+0100\n"
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
"Language-Team: Polish\n"
@ -4369,6 +4369,10 @@ msgstr "pobiera aktualny nick z serwera"
msgid "get nick from IRC host"
msgstr "pobiera nick z hosta IRC"
#, fuzzy
msgid "get nick color"
msgstr "kolor tekstu"
msgid "get buffer pointer for an IRC server/channel"
msgstr "pobiera wskaźnik bufora kanału/serwera IRC"
@ -5859,6 +5863,10 @@ msgstr "nie"
msgid "No xfer"
msgstr "Brak xfer"
#, fuzzy
msgid "send a CTCP action to remote host"
msgstr "wysyła akcję CTCP na aktualny kanał"
msgid "xfer control"
msgstr "kontrola xfer"

View File

@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat 0.3.1-dev\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: 2010-01-03 15:16+0100\n"
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4240,6 +4240,10 @@ msgstr "сменить текущий ник"
msgid "get nick from IRC host"
msgstr "банит ник или хост"
#, fuzzy
msgid "get nick color"
msgstr "цвет чата"
msgid "get buffer pointer for an IRC server/channel"
msgstr ""
@ -5708,6 +5712,10 @@ msgstr ""
msgid "No xfer"
msgstr "Нет сервера.\n"
#, fuzzy
msgid "send a CTCP action to remote host"
msgstr "отправить CTCP-действие на текущий канал"
msgid "xfer control"
msgstr ""

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2010-01-17 15:43+0100\n"
"POT-Creation-Date: 2010-01-18 10:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -3609,6 +3609,9 @@ msgstr ""
msgid "get nick from IRC host"
msgstr ""
msgid "get nick color"
msgstr ""
msgid "get buffer pointer for an IRC server/channel"
msgstr ""
@ -4974,6 +4977,9 @@ msgstr ""
msgid "No xfer"
msgstr ""
msgid "send a CTCP action to remote host"
msgstr ""
msgid "xfer control"
msgstr ""

View File

@ -41,6 +41,7 @@
#include "irc-nick.h"
#include "irc-display.h"
#include "irc-ignore.h"
#include "irc-protocol.h"
#include "irc-raw.h"
@ -339,13 +340,14 @@ irc_command_me_channel (struct t_irc_server *server,
string = (arguments && arguments[0]) ?
irc_color_decode (arguments,
weechat_config_boolean (irc_config_network_colors_receive)) : NULL;
weechat_printf (channel->buffer,
"%s%s%s %s%s",
weechat_prefix ("action"),
IRC_COLOR_CHAT_NICK_SELF,
server->nick,
IRC_COLOR_CHAT,
(string) ? string : "");
weechat_printf_tags (channel->buffer,
irc_protocol_tags ("privmsg", "irc_action,no_highlight"),
"%s%s%s %s%s",
weechat_prefix ("action"),
IRC_COLOR_CHAT_NICK_SELF,
server->nick,
IRC_COLOR_CHAT,
(string) ? string : "");
if (string)
free (string);
}

View File

@ -96,9 +96,9 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
{
struct t_xfer *xfer;
static char buffer[4096 + 2];
char *buf2, *pos, *ptr_buf, *next_ptr_buf;
char *buf2, *pos, *ptr_buf, *ptr_buf2, *next_ptr_buf;
char *ptr_buf_decoded, *ptr_buf_without_weechat_colors, *ptr_buf_color;
int num_read;
int num_read, length, ctcp_action;
/* make C compiler happy */
(void) fd;
@ -144,6 +144,20 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
if (ptr_buf)
{
ctcp_action = 0;
length = strlen (ptr_buf);
if ((ptr_buf[0] == '\01')
&& (ptr_buf[length - 1] == '\01'))
{
ptr_buf[length - 1] = '\0';
ptr_buf++;
if (strncmp (ptr_buf, "ACTION ", 7) == 0)
{
ptr_buf += 7;
ctcp_action = 1;
}
}
ptr_buf_decoded = (xfer->charset_modifier) ?
weechat_hook_modifier_exec ("charset_decode",
xfer->charset_modifier,
@ -154,11 +168,32 @@ xfer_chat_recv_cb (void *arg_xfer, int fd)
"1",
(ptr_buf_without_weechat_colors) ?
ptr_buf_without_weechat_colors : ((ptr_buf_decoded) ? ptr_buf_decoded : ptr_buf));
weechat_printf_tags (xfer->buffer, "notify_message", "%s\t%s",
xfer->remote_nick,
(ptr_buf_color) ?
ptr_buf_color : ((ptr_buf_without_weechat_colors) ?
ptr_buf_without_weechat_colors : ((ptr_buf_decoded) ? ptr_buf_decoded : ptr_buf)));
ptr_buf2 = (ptr_buf_color) ?
ptr_buf_color : ((ptr_buf_without_weechat_colors) ?
ptr_buf_without_weechat_colors : ((ptr_buf_decoded) ? ptr_buf_decoded : ptr_buf));
if (ctcp_action)
{
weechat_printf_tags (xfer->buffer,
"irc_privmsg,irc_action,notify_message",
"%s%s%s%s%s%s",
weechat_prefix ("action"),
(xfer->remote_nick_color) ?
xfer->remote_nick_color : weechat_color ("chat_nick_other"),
xfer->remote_nick,
weechat_color ("chat"),
(ptr_buf2[0]) ? " " : "",
ptr_buf2);
}
else
{
weechat_printf_tags (xfer->buffer,
"irc_privmsg,notify_message",
"%s%s\t%s",
(xfer->remote_nick_color) ?
xfer->remote_nick_color : weechat_color ("chat_nick_other"),
xfer->remote_nick,
ptr_buf2);
}
if (ptr_buf_decoded)
free (ptr_buf_decoded);
if (ptr_buf_without_weechat_colors)
@ -216,10 +251,12 @@ xfer_chat_buffer_input_cb (void *data, struct t_gui_buffer *buffer,
input_data_color = weechat_hook_modifier_exec ("irc_color_decode",
"1",
input_data);
weechat_printf (buffer,
"%s\t%s",
ptr_xfer->local_nick,
(input_data_color) ? input_data_color : input_data);
weechat_printf_tags (buffer,
"irc_privmsg,no_highlight",
"%s%s\t%s",
weechat_color ("chat_nick_self"),
ptr_xfer->local_nick,
(input_data_color) ? input_data_color : input_data);
if (input_data_color)
free (input_data_color);
}

View File

@ -20,6 +20,7 @@
#ifndef __WEECHAT_XFER_CHAT_H
#define __WEECHAT_XFER_CHAT_H 1
extern void xfer_chat_sendf (struct t_xfer *xfer, const char *format, ...);
extern int xfer_chat_recv_cb (void *arg_xfer, int fd);
extern void xfer_chat_open_buffer (struct t_xfer *xfer);

View File

@ -26,9 +26,53 @@
#include "../weechat-plugin.h"
#include "xfer.h"
#include "xfer-buffer.h"
#include "xfer-chat.h"
#include "xfer-config.h"
/*
* xfer_command_me: send a ctcp action to remote host
*/
int
xfer_command_me (void *data, struct t_gui_buffer *buffer, int argc,
char **argv, char **argv_eol)
{
struct t_xfer *ptr_xfer;
/* make C compiler happy */
(void) data;
(void) argc;
(void) argv;
ptr_xfer = xfer_search_by_buffer (buffer);
if (!ptr_xfer)
{
weechat_printf (NULL,
_("%s%s: can't find xfer for buffer \"%s\""),
weechat_prefix ("error"), XFER_PLUGIN_NAME,
weechat_buffer_get_string (buffer, "name"));
return WEECHAT_RC_OK;
}
if (!XFER_HAS_ENDED(ptr_xfer->status))
{
xfer_chat_sendf (ptr_xfer, "\01ACTION %s\01\n",
(argv_eol[1]) ? argv_eol[1] : "");
weechat_printf_tags (buffer,
"no_highlight",
"%s%s%s %s%s",
weechat_prefix ("action"),
weechat_color ("chat_nick_self"),
ptr_xfer->local_nick,
weechat_color ("chat"),
(argv_eol[1]) ? argv_eol[1] : "");
}
return WEECHAT_RC_OK;
}
/*
* xfer_command_xfer_list: list xfer
*/
@ -195,6 +239,11 @@ xfer_command_xfer (void *data, struct t_gui_buffer *buffer, int argc,
void
xfer_command_init ()
{
weechat_hook_command ("me",
N_("send a CTCP action to remote host"),
N_("message"),
N_("message: message to send"),
NULL, &xfer_command_me, NULL);
weechat_hook_command ("xfer",
N_("xfer control"),
"[list | listfull]",

View File

@ -440,6 +440,7 @@ xfer_alloc ()
new_xfer->protocol = 0;
new_xfer->status = 0;
new_xfer->buffer = NULL;
new_xfer->remote_nick_color = NULL;
new_xfer->fast_send = weechat_config_boolean (xfer_config_network_fast_send);
new_xfer->blocksize = weechat_config_integer (xfer_config_network_blocksize);
new_xfer->start_time = time_now;
@ -489,6 +490,7 @@ xfer_new (const char *plugin_name, const char *plugin_id,
int port, int sock, const char *local_filename)
{
struct t_xfer *new_xfer;
const char *ptr_color;
new_xfer = xfer_alloc ();
if (!new_xfer)
@ -511,6 +513,8 @@ xfer_new (const char *plugin_name, const char *plugin_id,
new_xfer->type = type;
new_xfer->protocol = protocol;
new_xfer->remote_nick = strdup (remote_nick);
ptr_color = weechat_info_get ("irc_nick_color", remote_nick);
new_xfer->remote_nick_color = (ptr_color) ? strdup (ptr_color) : NULL;
new_xfer->local_nick = (local_nick) ? strdup (local_nick) : NULL;
new_xfer->charset_modifier = (charset_modifier) ? strdup (charset_modifier) : NULL;
if (XFER_IS_FILE(type))
@ -671,6 +675,8 @@ xfer_free (struct t_xfer *xfer)
free (xfer->charset_modifier);
if (xfer->filename)
free (xfer->filename);
if (xfer->remote_nick_color)
free (xfer->remote_nick_color);
if (xfer->unterminated_message)
free (xfer->unterminated_message);
if (xfer->local_filename)
@ -1272,6 +1278,8 @@ xfer_add_to_infolist (struct t_infolist *infolist, struct t_xfer *xfer)
return 0;
if (!weechat_infolist_new_var_pointer (ptr_item, "buffer", xfer->buffer))
return 0;
if (!weechat_infolist_new_var_string (ptr_item, "remote_nick_color", xfer->remote_nick_color))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "fast_send", xfer->fast_send))
return 0;
if (!weechat_infolist_new_var_integer (ptr_item, "blocksize", xfer->blocksize))
@ -1360,6 +1368,7 @@ xfer_print_log ()
ptr_xfer->status,
xfer_status_string[ptr_xfer->status]);
weechat_log_printf (" buffer. . . . . . . : 0x%lx", ptr_xfer->buffer);
weechat_log_printf (" remote_nick_color . : '%s'", ptr_xfer->remote_nick_color);
weechat_log_printf (" fast_send . . . . . : %d", ptr_xfer->fast_send);
weechat_log_printf (" blocksize . . . . . : %d", ptr_xfer->blocksize);
weechat_log_printf (" start_time. . . . . : %ld", ptr_xfer->start_time);

View File

@ -123,6 +123,8 @@ struct t_xfer
/* internal data */
enum t_xfer_status status; /* xfer status (waiting, sending,..) */
struct t_gui_buffer *buffer; /* buffer (for chat only) */
char *remote_nick_color; /* color for remote nick (given by */
/* IRC plugin) */
int fast_send; /* fast send file: does not wait ACK */
int blocksize; /* block size for sending file */
time_t start_time; /* time when xfer started */