mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 23:36:37 +02:00
Version 0.0.8-pre2: DCC window with Alt-D, /query command now reopens private buffer if already opened
This commit is contained in:
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2004-08-25
|
||||
ChangeLog - 2004-09-01
|
||||
|
||||
|
||||
Version 0.0.8 (under dev!):
|
||||
* DCC window with Alt-D
|
||||
* /query command now reopens private buffer if already opened
|
||||
* added key for redrawing terminal (Ctrl-L)
|
||||
* added key for clearing hotlist (Alt-R)
|
||||
|
||||
|
||||
+2
-2
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.8-pre1, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.0.8-pre2, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.8-pre1])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.8-pre2])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/irc/irc-dcc.c
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/plugins/plugins.c
|
||||
|
||||
+266
-189
File diff suppressed because it is too large
Load Diff
+38
-2
@@ -193,6 +193,12 @@ int cfg_col_nick_sep;
|
||||
int cfg_col_nick_self;
|
||||
int cfg_col_nick_private;
|
||||
int cfg_col_nick_bg;
|
||||
int cfg_col_dcc_waiting;
|
||||
int cfg_col_dcc_connecting;
|
||||
int cfg_col_dcc_active;
|
||||
int cfg_col_dcc_done;
|
||||
int cfg_col_dcc_failed;
|
||||
int cfg_col_dcc_aborted;
|
||||
|
||||
t_config_option weechat_options_colors[] =
|
||||
{ /* title window */
|
||||
@@ -347,6 +353,32 @@ t_config_option weechat_options_colors[] =
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"default", NULL, &cfg_col_nick_bg, NULL, &config_change_color },
|
||||
|
||||
/* DCC */
|
||||
{ "col_dcc_waiting", N_("color for \"waiting\" dcc status"),
|
||||
N_("color for \"waiting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_dcc_waiting, NULL, &config_change_color },
|
||||
{ "col_dcc_connecting", N_("color for \"connecting\" dcc status"),
|
||||
N_("color for \"connecting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"yellow", NULL, &cfg_col_dcc_connecting, NULL, &config_change_color },
|
||||
{ "col_dcc_active", N_("color for \"active\" dcc status"),
|
||||
N_("color for \"active\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightblue", NULL, &cfg_col_dcc_active, NULL, &config_change_color },
|
||||
{ "col_dcc_done", N_("color for \"done\" dcc status"),
|
||||
N_("color for \"done\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_dcc_done, NULL, &config_change_color },
|
||||
{ "col_dcc_failed", N_("color for \"failed\" dcc status"),
|
||||
N_("color for \"failed\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightred", NULL, &cfg_col_dcc_failed, NULL, &config_change_color },
|
||||
{ "col_dcc_aborted", N_("color for \"aborted\" dcc status"),
|
||||
N_("color for \"aborted\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightred", NULL, &cfg_col_dcc_aborted, NULL, &config_change_color },
|
||||
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -419,6 +451,7 @@ int cfg_dcc_auto_accept_files;
|
||||
int cfg_dcc_auto_accept_max_size;
|
||||
int cfg_dcc_auto_accept_chats;
|
||||
int cfg_dcc_timeout;
|
||||
int cfg_dcc_blocksize;
|
||||
char *cfg_dcc_download_path;
|
||||
char *cfg_dcc_upload_path;
|
||||
int cfg_dcc_auto_rename;
|
||||
@@ -441,6 +474,10 @@ t_config_option weechat_options_dcc[] =
|
||||
N_("timeout for dcc request (in seconds)"),
|
||||
OPTION_TYPE_INT, 1, INT_MAX, 300,
|
||||
NULL, NULL, &cfg_dcc_timeout, NULL, NULL },
|
||||
{ "dcc_blocksize", N_("block size for dcc packets"),
|
||||
N_("block size for dcc packets in bytes (default: 1024)"),
|
||||
OPTION_TYPE_INT, 1024, 102400, 1024,
|
||||
NULL, NULL, &cfg_dcc_blocksize, NULL, NULL },
|
||||
{ "dcc_download_path", N_("path for incoming files with dcc"),
|
||||
N_("path for writing incoming files with dcc (default: user home)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -1263,8 +1300,7 @@ config_write (char *config_name)
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
if ((i == CONFIG_SECTION_LOG) || (i == CONFIG_SECTION_DCC) ||
|
||||
(i == CONFIG_SECTION_PROXY))
|
||||
if ((i == CONFIG_SECTION_LOG) || (i == CONFIG_SECTION_PROXY))
|
||||
fprintf (file,
|
||||
"# WARNING!!! Options for section \"%s\" are not developed!\n",
|
||||
config_sections[i].section_name);
|
||||
|
||||
@@ -127,6 +127,12 @@ extern int cfg_col_nick_sep;
|
||||
extern int cfg_col_nick_self;
|
||||
extern int cfg_col_nick_private;
|
||||
extern int cfg_col_nick_bg;
|
||||
extern int cfg_col_dcc_waiting;
|
||||
extern int cfg_col_dcc_connecting;
|
||||
extern int cfg_col_dcc_active;
|
||||
extern int cfg_col_dcc_done;
|
||||
extern int cfg_col_dcc_failed;
|
||||
extern int cfg_col_dcc_aborted;
|
||||
|
||||
extern int cfg_history_max_lines;
|
||||
extern int cfg_history_max_commands;
|
||||
@@ -143,6 +149,7 @@ extern int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_max_size;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
extern int cfg_dcc_timeout;
|
||||
extern int cfg_dcc_blocksize;
|
||||
extern char *cfg_dcc_download_path;
|
||||
extern char *cfg_dcc_upload_path;
|
||||
extern int cfg_dcc_auto_rename;
|
||||
|
||||
@@ -553,8 +553,14 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_line *ptr_line;
|
||||
t_dcc *ptr_dcc;
|
||||
char format_empty[32];
|
||||
int i, lines_used;
|
||||
int i, j, lines_used, num_bars;
|
||||
char *unit_name[] = { N_("bytes"), N_("Kb"), N_("Mb"), N_("Gb") };
|
||||
char *unit_format[] = { "%.0Lf", "%.1Lf", "%.02Lf", "%.02Lf" };
|
||||
long unit_divide[] = { 1, 1024, 1024*1024, 1024*1024,1024 };
|
||||
int num_unit;
|
||||
char format[32];
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
@@ -562,8 +568,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
if (erase)
|
||||
{
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", ptr_win->win_chat_width);
|
||||
for (i = 0; i < ptr_win->win_chat_height; i++)
|
||||
@@ -572,16 +577,65 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
}
|
||||
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
|
||||
if (buffer->dcc)
|
||||
{
|
||||
mvwprintw (ptr_win->win_chat, ptr_win->win_y, ptr_win->win_x,
|
||||
"%s", _(" Type Status Filename / progress"));
|
||||
for (i = 0; i < ptr_win->win_width; i++)
|
||||
mvwprintw (ptr_win->win_chat, 1, i, "%c", '-');
|
||||
move (ptr_win->win_y + 3, ptr_win->win_x);
|
||||
i = 0;
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
if (i >= ptr_win->win_chat_height - 1)
|
||||
break;
|
||||
if ((ptr_dcc->type == DCC_FILE_RECV)
|
||||
|| (ptr_dcc->type == DCC_FILE_SEND))
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
mvwprintw (ptr_win->win_chat, i, 0, " %-16s %s",
|
||||
ptr_dcc->nick, ptr_dcc->filename);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
mvwprintw (ptr_win->win_chat, i + 1, 0, " %s ",
|
||||
(ptr_dcc->type == DCC_FILE_RECV) ?
|
||||
"--->" : "<---");
|
||||
gui_window_set_color (ptr_win->win_chat,
|
||||
COLOR_DCC_WAITING + ptr_dcc->status);
|
||||
wprintw (ptr_win->win_chat, "%-10s",
|
||||
dcc_status_string[ptr_dcc->status]);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
wprintw (ptr_win->win_chat, " [",
|
||||
dcc_status_string[ptr_dcc->status]);
|
||||
if (ptr_dcc->size == 0)
|
||||
num_bars = 10;
|
||||
else
|
||||
num_bars = (int)((((long double)(ptr_dcc->pos)/(long double)(ptr_dcc->size))*100) / 10);
|
||||
for (j = 0; j < num_bars - 1; j++)
|
||||
wprintw (ptr_win->win_chat, "=");
|
||||
if (num_bars > 0)
|
||||
wprintw (ptr_win->win_chat, ">");
|
||||
for (j = 0; j < 10 - num_bars; j++)
|
||||
wprintw (ptr_win->win_chat, " ");
|
||||
if (ptr_dcc->size < 1024*10)
|
||||
num_unit = 0;
|
||||
else if (ptr_dcc->size < 1024*1024)
|
||||
num_unit = 1;
|
||||
else if (ptr_dcc->size < 1024*1024*1024)
|
||||
num_unit = 2;
|
||||
else
|
||||
num_unit = 3;
|
||||
wprintw (ptr_win->win_chat, "] %3lu%% ",
|
||||
(unsigned long)(((long double)(ptr_dcc->pos)/(long double)(ptr_dcc->size))*100),
|
||||
dcc_status_string[ptr_dcc->status]);
|
||||
sprintf (format, "%s %%s / %s %%s",
|
||||
unit_format[num_unit],
|
||||
unit_format[num_unit]);
|
||||
wprintw (ptr_win->win_chat, format,
|
||||
((long double) ptr_dcc->pos) / ((long double)(unit_divide[num_unit])),
|
||||
unit_name[num_unit],
|
||||
((long double) ptr_dcc->size) / ((long double)(unit_divide[num_unit])),
|
||||
unit_name[num_unit]);
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
move (ptr_win->win_y + 1, ptr_win->win_x);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -653,8 +707,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
if (erase)
|
||||
{
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
|
||||
for (i = 0; i < ptr_win->win_nick_height; i++)
|
||||
@@ -682,8 +735,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
ptr_win->win_nick_x);
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
|
||||
for (i = 0; i < ptr_win->win_nick_height; i++)
|
||||
@@ -908,7 +960,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
|
||||
if (ptr_win->buffer->dcc)
|
||||
wprintw (ptr_win->win_status, _("%d:<DCC> "),
|
||||
wprintw (ptr_win->win_status, "%d:<DCC> ",
|
||||
ptr_win->buffer->number);
|
||||
else
|
||||
wprintw (ptr_win->win_status, _("%d:[not connected] "),
|
||||
@@ -1577,6 +1629,19 @@ gui_init_colors ()
|
||||
color_attr[COLOR_WIN_NICK_FIRST + i - 1] =
|
||||
(color & A_BOLD) ? A_BOLD : 0;
|
||||
}
|
||||
|
||||
init_pair (COLOR_DCC_WAITING,
|
||||
cfg_col_dcc_waiting & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_CONNECTING,
|
||||
cfg_col_dcc_connecting & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_ACTIVE,
|
||||
cfg_col_dcc_active & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_DONE,
|
||||
cfg_col_dcc_done & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_FAILED,
|
||||
cfg_col_dcc_failed & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_ABORTED,
|
||||
cfg_col_dcc_aborted & A_CHARTEXT, cfg_col_chat_bg);
|
||||
|
||||
color_attr[COLOR_WIN_TITLE - 1] = cfg_col_title & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT - 1] = cfg_col_chat & A_BOLD;
|
||||
@@ -1608,6 +1673,12 @@ gui_init_colors ()
|
||||
color_attr[COLOR_WIN_NICK_SEP - 1] = 0;
|
||||
color_attr[COLOR_WIN_NICK_SELF - 1] = cfg_col_nick_self & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_PRIVATE - 1] = cfg_col_nick_private & A_BOLD;
|
||||
color_attr[COLOR_DCC_WAITING - 1] = cfg_col_dcc_waiting & A_BOLD;
|
||||
color_attr[COLOR_DCC_CONNECTING - 1] = cfg_col_dcc_connecting & A_BOLD;
|
||||
color_attr[COLOR_DCC_ACTIVE - 1] = cfg_col_dcc_active & A_BOLD;
|
||||
color_attr[COLOR_DCC_DONE - 1] = cfg_col_dcc_done & A_BOLD;
|
||||
color_attr[COLOR_DCC_FAILED - 1] = cfg_col_dcc_failed & A_BOLD;
|
||||
color_attr[COLOR_DCC_ABORTED - 1] = cfg_col_dcc_aborted & A_BOLD;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-1
@@ -26,7 +26,7 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 39
|
||||
#define NUM_COLORS 45
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
@@ -59,6 +59,12 @@
|
||||
#define COLOR_WIN_NICK_FIRST 30
|
||||
#define COLOR_WIN_NICK_LAST 39
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_WAITING 40
|
||||
#define COLOR_DCC_CONNECTING 41
|
||||
#define COLOR_DCC_ACTIVE 42
|
||||
#define COLOR_DCC_DONE 43
|
||||
#define COLOR_DCC_FAILED 44
|
||||
#define COLOR_DCC_ABORTED 45
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
@@ -24,8 +24,19 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_dcc *dcc_list = NULL; /* DCC files & chat list */
|
||||
char *dcc_status_string[] = /* strings for DCC status */
|
||||
{ N_("Waiting"), N_("Connecting"), N_("Active"), N_("Done"), N_("Failed"),
|
||||
N_("Aborted") };
|
||||
|
||||
|
||||
/*
|
||||
@@ -45,3 +56,52 @@ void
|
||||
dcc_send ()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_free: free DCC struct
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_free (t_dcc *ptr_dcc)
|
||||
{
|
||||
if (ptr_dcc->nick)
|
||||
free (ptr_dcc->nick);
|
||||
if (ptr_dcc->filename)
|
||||
free (ptr_dcc->filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_add: add a DCC file to queue
|
||||
*/
|
||||
|
||||
t_dcc *
|
||||
dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick, char *filename,
|
||||
unsigned int size)
|
||||
{
|
||||
t_dcc *new_dcc;
|
||||
|
||||
if ((new_dcc = (t_dcc *) malloc (sizeof (t_dcc))) == NULL)
|
||||
{
|
||||
gui_printf (NULL, _("%s not enough memory for new DCC\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
new_dcc->server = server;
|
||||
new_dcc->type = type;
|
||||
new_dcc->status = DCC_ACTIVE;
|
||||
new_dcc->addr = addr;
|
||||
new_dcc->port = port;
|
||||
new_dcc->nick = strdup (nick);
|
||||
new_dcc->file = -1;
|
||||
new_dcc->filename = strdup (filename);
|
||||
new_dcc->size = size;
|
||||
new_dcc->pos = 0;
|
||||
new_dcc->next_dcc = dcc_list;
|
||||
dcc_list = new_dcc;
|
||||
|
||||
gui_printf (NULL, "Incoming DCC file: type:%d, nick:%s, address:%d.%d.%d.%d, "
|
||||
"port=%d, name=%s, size=%lu\n",
|
||||
type, nick,
|
||||
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff,
|
||||
port, filename, size);
|
||||
return new_dcc;
|
||||
}
|
||||
|
||||
+2
-3
@@ -1140,9 +1140,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
wee_log_printf ("Incoming DCC file (NOT DEVELOPED!): "
|
||||
"\"%s\", address=\"%s\", port=\"%s\", size=\"%s\"\n",
|
||||
pos_file, pos_addr, pos_port, pos_size);
|
||||
dcc_add (server, DCC_FILE_RECV, (unsigned long) atol (pos_addr),
|
||||
atoi (pos_port), host, pos_file, (unsigned int) atoi (pos_size));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -734,6 +734,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
@@ -761,6 +762,18 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
}
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->channel == ptr_channel)
|
||||
{
|
||||
gui_switch_to_buffer (gui_current_window, ptr_buffer);
|
||||
gui_redraw_buffer (ptr_buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* display text if given */
|
||||
if (pos)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
|
||||
#define PREFIX_SERVER "-@-"
|
||||
#define PREFIX_INFO "-=-"
|
||||
#define PREFIX_ACTION_ME "-*-"
|
||||
@@ -34,6 +36,8 @@
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
/* channel modes */
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
#define CHANNEL_MODE_KEY 1
|
||||
@@ -50,6 +54,20 @@
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* DCC types & status */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
@@ -143,6 +161,8 @@ struct t_irc_command
|
||||
/* function called when cmd is received */
|
||||
};
|
||||
|
||||
/* irc messages */
|
||||
|
||||
typedef struct t_irc_message t_irc_message;
|
||||
|
||||
struct t_irc_message
|
||||
@@ -152,10 +172,31 @@ struct t_irc_message
|
||||
t_irc_message *next_message; /* link to next message */
|
||||
};
|
||||
|
||||
/* DCC */
|
||||
|
||||
typedef struct t_dcc t_dcc;
|
||||
|
||||
struct t_dcc
|
||||
{
|
||||
t_irc_server *server; /* irc server */
|
||||
int type; /* DCC type (send or receive) */
|
||||
int status; /* DCC status (waiting, sending, ..) */
|
||||
unsigned long addr; /* IP address */
|
||||
int port; /* port */
|
||||
char *nick; /* remote nick */
|
||||
int file; /* local file (for reading or writing) */
|
||||
char *filename; /* local filename */
|
||||
unsigned long size; /* file size */
|
||||
unsigned long pos; /* number of bytes received/sent */
|
||||
t_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers, *current_irc_server;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern t_irc_channel *current_channel;
|
||||
extern t_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
@@ -201,6 +242,8 @@ extern int nick_get_max_length (t_irc_channel *);
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_send ();
|
||||
extern t_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, char *,
|
||||
unsigned int);
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
WeeChat - Wee Enhanced Environment for Chat
|
||||
===========================================
|
||||
|
||||
ChangeLog - 2004-08-25
|
||||
ChangeLog - 2004-09-01
|
||||
|
||||
|
||||
Version 0.0.8 (under dev!):
|
||||
* DCC window with Alt-D
|
||||
* /query command now reopens private buffer if already opened
|
||||
* added key for redrawing terminal (Ctrl-L)
|
||||
* added key for clearing hotlist (Alt-R)
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.56)
|
||||
AC_INIT(WeeChat, 0.0.8-pre1, flashcode@flashtux.org)
|
||||
AC_INIT(WeeChat, 0.0.8-pre2, flashcode@flashtux.org)
|
||||
AC_CONFIG_SRCDIR([src/common/weechat.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.8-pre1])
|
||||
AM_INIT_AUTOMAKE([weechat], [0.0.8-pre2])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
./src/irc/irc-display.c
|
||||
./src/irc/irc-send.c
|
||||
./src/irc/irc-recv.c
|
||||
./src/irc/irc-dcc.c
|
||||
./src/plugins/perl/wee-perl.c
|
||||
./src/plugins/perl/wee-perl.h
|
||||
./src/plugins/plugins.c
|
||||
|
||||
+268
-195
File diff suppressed because it is too large
Load Diff
+266
-189
File diff suppressed because it is too large
Load Diff
@@ -193,6 +193,12 @@ int cfg_col_nick_sep;
|
||||
int cfg_col_nick_self;
|
||||
int cfg_col_nick_private;
|
||||
int cfg_col_nick_bg;
|
||||
int cfg_col_dcc_waiting;
|
||||
int cfg_col_dcc_connecting;
|
||||
int cfg_col_dcc_active;
|
||||
int cfg_col_dcc_done;
|
||||
int cfg_col_dcc_failed;
|
||||
int cfg_col_dcc_aborted;
|
||||
|
||||
t_config_option weechat_options_colors[] =
|
||||
{ /* title window */
|
||||
@@ -347,6 +353,32 @@ t_config_option weechat_options_colors[] =
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"default", NULL, &cfg_col_nick_bg, NULL, &config_change_color },
|
||||
|
||||
/* DCC */
|
||||
{ "col_dcc_waiting", N_("color for \"waiting\" dcc status"),
|
||||
N_("color for \"waiting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"white", NULL, &cfg_col_dcc_waiting, NULL, &config_change_color },
|
||||
{ "col_dcc_connecting", N_("color for \"connecting\" dcc status"),
|
||||
N_("color for \"connecting\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"yellow", NULL, &cfg_col_dcc_connecting, NULL, &config_change_color },
|
||||
{ "col_dcc_active", N_("color for \"active\" dcc status"),
|
||||
N_("color for \"active\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightblue", NULL, &cfg_col_dcc_active, NULL, &config_change_color },
|
||||
{ "col_dcc_done", N_("color for \"done\" dcc status"),
|
||||
N_("color for \"done\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightgreen", NULL, &cfg_col_dcc_done, NULL, &config_change_color },
|
||||
{ "col_dcc_failed", N_("color for \"failed\" dcc status"),
|
||||
N_("color for \"failed\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightred", NULL, &cfg_col_dcc_failed, NULL, &config_change_color },
|
||||
{ "col_dcc_aborted", N_("color for \"aborted\" dcc status"),
|
||||
N_("color for \"aborted\" dcc status"),
|
||||
OPTION_TYPE_COLOR, 0, 0, 0,
|
||||
"lightred", NULL, &cfg_col_dcc_aborted, NULL, &config_change_color },
|
||||
|
||||
{ NULL, NULL, NULL, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL }
|
||||
};
|
||||
|
||||
@@ -419,6 +451,7 @@ int cfg_dcc_auto_accept_files;
|
||||
int cfg_dcc_auto_accept_max_size;
|
||||
int cfg_dcc_auto_accept_chats;
|
||||
int cfg_dcc_timeout;
|
||||
int cfg_dcc_blocksize;
|
||||
char *cfg_dcc_download_path;
|
||||
char *cfg_dcc_upload_path;
|
||||
int cfg_dcc_auto_rename;
|
||||
@@ -441,6 +474,10 @@ t_config_option weechat_options_dcc[] =
|
||||
N_("timeout for dcc request (in seconds)"),
|
||||
OPTION_TYPE_INT, 1, INT_MAX, 300,
|
||||
NULL, NULL, &cfg_dcc_timeout, NULL, NULL },
|
||||
{ "dcc_blocksize", N_("block size for dcc packets"),
|
||||
N_("block size for dcc packets in bytes (default: 1024)"),
|
||||
OPTION_TYPE_INT, 1024, 102400, 1024,
|
||||
NULL, NULL, &cfg_dcc_blocksize, NULL, NULL },
|
||||
{ "dcc_download_path", N_("path for incoming files with dcc"),
|
||||
N_("path for writing incoming files with dcc (default: user home)"),
|
||||
OPTION_TYPE_STRING, 0, 0, 0,
|
||||
@@ -1263,8 +1300,7 @@ config_write (char *config_name)
|
||||
if ((i != CONFIG_SECTION_ALIAS) && (i != CONFIG_SECTION_SERVER))
|
||||
{
|
||||
fprintf (file, "\n[%s]\n", config_sections[i].section_name);
|
||||
if ((i == CONFIG_SECTION_LOG) || (i == CONFIG_SECTION_DCC) ||
|
||||
(i == CONFIG_SECTION_PROXY))
|
||||
if ((i == CONFIG_SECTION_LOG) || (i == CONFIG_SECTION_PROXY))
|
||||
fprintf (file,
|
||||
"# WARNING!!! Options for section \"%s\" are not developed!\n",
|
||||
config_sections[i].section_name);
|
||||
|
||||
@@ -127,6 +127,12 @@ extern int cfg_col_nick_sep;
|
||||
extern int cfg_col_nick_self;
|
||||
extern int cfg_col_nick_private;
|
||||
extern int cfg_col_nick_bg;
|
||||
extern int cfg_col_dcc_waiting;
|
||||
extern int cfg_col_dcc_connecting;
|
||||
extern int cfg_col_dcc_active;
|
||||
extern int cfg_col_dcc_done;
|
||||
extern int cfg_col_dcc_failed;
|
||||
extern int cfg_col_dcc_aborted;
|
||||
|
||||
extern int cfg_history_max_lines;
|
||||
extern int cfg_history_max_commands;
|
||||
@@ -143,6 +149,7 @@ extern int cfg_dcc_auto_accept_files;
|
||||
extern int cfg_dcc_auto_accept_max_size;
|
||||
extern int cfg_dcc_auto_accept_chats;
|
||||
extern int cfg_dcc_timeout;
|
||||
extern int cfg_dcc_blocksize;
|
||||
extern char *cfg_dcc_download_path;
|
||||
extern char *cfg_dcc_upload_path;
|
||||
extern int cfg_dcc_auto_rename;
|
||||
|
||||
@@ -553,8 +553,14 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
t_gui_window *ptr_win;
|
||||
t_gui_line *ptr_line;
|
||||
t_dcc *ptr_dcc;
|
||||
char format_empty[32];
|
||||
int i, lines_used;
|
||||
int i, j, lines_used, num_bars;
|
||||
char *unit_name[] = { N_("bytes"), N_("Kb"), N_("Mb"), N_("Gb") };
|
||||
char *unit_format[] = { "%.0Lf", "%.1Lf", "%.02Lf", "%.02Lf" };
|
||||
long unit_divide[] = { 1, 1024, 1024*1024, 1024*1024,1024 };
|
||||
int num_unit;
|
||||
char format[32];
|
||||
|
||||
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
|
||||
{
|
||||
@@ -562,8 +568,7 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
if (erase)
|
||||
{
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", ptr_win->win_chat_width);
|
||||
for (i = 0; i < ptr_win->win_chat_height; i++)
|
||||
@@ -572,16 +577,65 @@ gui_draw_buffer_chat (t_gui_buffer *buffer, int erase)
|
||||
}
|
||||
}
|
||||
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
|
||||
if (buffer->dcc)
|
||||
{
|
||||
mvwprintw (ptr_win->win_chat, ptr_win->win_y, ptr_win->win_x,
|
||||
"%s", _(" Type Status Filename / progress"));
|
||||
for (i = 0; i < ptr_win->win_width; i++)
|
||||
mvwprintw (ptr_win->win_chat, 1, i, "%c", '-');
|
||||
move (ptr_win->win_y + 3, ptr_win->win_x);
|
||||
i = 0;
|
||||
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
|
||||
{
|
||||
if (i >= ptr_win->win_chat_height - 1)
|
||||
break;
|
||||
if ((ptr_dcc->type == DCC_FILE_RECV)
|
||||
|| (ptr_dcc->type == DCC_FILE_SEND))
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
mvwprintw (ptr_win->win_chat, i, 0, " %-16s %s",
|
||||
ptr_dcc->nick, ptr_dcc->filename);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
mvwprintw (ptr_win->win_chat, i + 1, 0, " %s ",
|
||||
(ptr_dcc->type == DCC_FILE_RECV) ?
|
||||
"--->" : "<---");
|
||||
gui_window_set_color (ptr_win->win_chat,
|
||||
COLOR_DCC_WAITING + ptr_dcc->status);
|
||||
wprintw (ptr_win->win_chat, "%-10s",
|
||||
dcc_status_string[ptr_dcc->status]);
|
||||
gui_window_set_color (ptr_win->win_chat, COLOR_WIN_CHAT);
|
||||
wprintw (ptr_win->win_chat, " [",
|
||||
dcc_status_string[ptr_dcc->status]);
|
||||
if (ptr_dcc->size == 0)
|
||||
num_bars = 10;
|
||||
else
|
||||
num_bars = (int)((((long double)(ptr_dcc->pos)/(long double)(ptr_dcc->size))*100) / 10);
|
||||
for (j = 0; j < num_bars - 1; j++)
|
||||
wprintw (ptr_win->win_chat, "=");
|
||||
if (num_bars > 0)
|
||||
wprintw (ptr_win->win_chat, ">");
|
||||
for (j = 0; j < 10 - num_bars; j++)
|
||||
wprintw (ptr_win->win_chat, " ");
|
||||
if (ptr_dcc->size < 1024*10)
|
||||
num_unit = 0;
|
||||
else if (ptr_dcc->size < 1024*1024)
|
||||
num_unit = 1;
|
||||
else if (ptr_dcc->size < 1024*1024*1024)
|
||||
num_unit = 2;
|
||||
else
|
||||
num_unit = 3;
|
||||
wprintw (ptr_win->win_chat, "] %3lu%% ",
|
||||
(unsigned long)(((long double)(ptr_dcc->pos)/(long double)(ptr_dcc->size))*100),
|
||||
dcc_status_string[ptr_dcc->status]);
|
||||
sprintf (format, "%s %%s / %s %%s",
|
||||
unit_format[num_unit],
|
||||
unit_format[num_unit]);
|
||||
wprintw (ptr_win->win_chat, format,
|
||||
((long double) ptr_dcc->pos) / ((long double)(unit_divide[num_unit])),
|
||||
unit_name[num_unit],
|
||||
((long double) ptr_dcc->size) / ((long double)(unit_divide[num_unit])),
|
||||
unit_name[num_unit]);
|
||||
i += 2;
|
||||
}
|
||||
}
|
||||
move (ptr_win->win_y + 1, ptr_win->win_x);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -653,8 +707,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
if (erase)
|
||||
{
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
|
||||
for (i = 0; i < ptr_win->win_nick_height; i++)
|
||||
@@ -682,8 +735,7 @@ gui_draw_buffer_nick (t_gui_buffer *buffer, int erase)
|
||||
ptr_win->win_nick_x);
|
||||
gui_draw_buffer_chat (buffer, 1);
|
||||
|
||||
if (has_colors ())
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
gui_window_set_color (ptr_win->win_nick, COLOR_WIN_NICK);
|
||||
|
||||
snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width);
|
||||
for (i = 0; i < ptr_win->win_nick_height; i++)
|
||||
@@ -908,7 +960,7 @@ gui_draw_buffer_status (t_gui_buffer *buffer, int erase)
|
||||
{
|
||||
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS);
|
||||
if (ptr_win->buffer->dcc)
|
||||
wprintw (ptr_win->win_status, _("%d:<DCC> "),
|
||||
wprintw (ptr_win->win_status, "%d:<DCC> ",
|
||||
ptr_win->buffer->number);
|
||||
else
|
||||
wprintw (ptr_win->win_status, _("%d:[not connected] "),
|
||||
@@ -1577,6 +1629,19 @@ gui_init_colors ()
|
||||
color_attr[COLOR_WIN_NICK_FIRST + i - 1] =
|
||||
(color & A_BOLD) ? A_BOLD : 0;
|
||||
}
|
||||
|
||||
init_pair (COLOR_DCC_WAITING,
|
||||
cfg_col_dcc_waiting & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_CONNECTING,
|
||||
cfg_col_dcc_connecting & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_ACTIVE,
|
||||
cfg_col_dcc_active & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_DONE,
|
||||
cfg_col_dcc_done & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_FAILED,
|
||||
cfg_col_dcc_failed & A_CHARTEXT, cfg_col_chat_bg);
|
||||
init_pair (COLOR_DCC_ABORTED,
|
||||
cfg_col_dcc_aborted & A_CHARTEXT, cfg_col_chat_bg);
|
||||
|
||||
color_attr[COLOR_WIN_TITLE - 1] = cfg_col_title & A_BOLD;
|
||||
color_attr[COLOR_WIN_CHAT - 1] = cfg_col_chat & A_BOLD;
|
||||
@@ -1608,6 +1673,12 @@ gui_init_colors ()
|
||||
color_attr[COLOR_WIN_NICK_SEP - 1] = 0;
|
||||
color_attr[COLOR_WIN_NICK_SELF - 1] = cfg_col_nick_self & A_BOLD;
|
||||
color_attr[COLOR_WIN_NICK_PRIVATE - 1] = cfg_col_nick_private & A_BOLD;
|
||||
color_attr[COLOR_DCC_WAITING - 1] = cfg_col_dcc_waiting & A_BOLD;
|
||||
color_attr[COLOR_DCC_CONNECTING - 1] = cfg_col_dcc_connecting & A_BOLD;
|
||||
color_attr[COLOR_DCC_ACTIVE - 1] = cfg_col_dcc_active & A_BOLD;
|
||||
color_attr[COLOR_DCC_DONE - 1] = cfg_col_dcc_done & A_BOLD;
|
||||
color_attr[COLOR_DCC_FAILED - 1] = cfg_col_dcc_failed & A_BOLD;
|
||||
color_attr[COLOR_DCC_ABORTED - 1] = cfg_col_dcc_aborted & A_BOLD;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
|
||||
#define INPUT_BUFFER_BLOCK_SIZE 256
|
||||
|
||||
#define NUM_COLORS 39
|
||||
#define NUM_COLORS 45
|
||||
#define COLOR_WIN_TITLE 1
|
||||
#define COLOR_WIN_CHAT 2
|
||||
#define COLOR_WIN_CHAT_TIME 3
|
||||
@@ -59,6 +59,12 @@
|
||||
#define COLOR_WIN_NICK_FIRST 30
|
||||
#define COLOR_WIN_NICK_LAST 39
|
||||
#define COLOR_WIN_NICK_NUMBER (COLOR_WIN_NICK_LAST - COLOR_WIN_NICK_FIRST + 1)
|
||||
#define COLOR_DCC_WAITING 40
|
||||
#define COLOR_DCC_CONNECTING 41
|
||||
#define COLOR_DCC_ACTIVE 42
|
||||
#define COLOR_DCC_DONE 43
|
||||
#define COLOR_DCC_FAILED 44
|
||||
#define COLOR_DCC_ABORTED 45
|
||||
|
||||
#define SERVER(buffer) ((t_irc_server *)(buffer->server))
|
||||
#define CHANNEL(buffer) ((t_irc_channel *)(buffer->channel))
|
||||
|
||||
@@ -24,8 +24,19 @@
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../common/weechat.h"
|
||||
#include "irc.h"
|
||||
#include "../common/weeconfig.h"
|
||||
#include "../gui/gui.h"
|
||||
|
||||
|
||||
t_dcc *dcc_list = NULL; /* DCC files & chat list */
|
||||
char *dcc_status_string[] = /* strings for DCC status */
|
||||
{ N_("Waiting"), N_("Connecting"), N_("Active"), N_("Done"), N_("Failed"),
|
||||
N_("Aborted") };
|
||||
|
||||
|
||||
/*
|
||||
@@ -45,3 +56,52 @@ void
|
||||
dcc_send ()
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_free: free DCC struct
|
||||
*/
|
||||
|
||||
void
|
||||
dcc_free (t_dcc *ptr_dcc)
|
||||
{
|
||||
if (ptr_dcc->nick)
|
||||
free (ptr_dcc->nick);
|
||||
if (ptr_dcc->filename)
|
||||
free (ptr_dcc->filename);
|
||||
}
|
||||
|
||||
/*
|
||||
* dcc_add: add a DCC file to queue
|
||||
*/
|
||||
|
||||
t_dcc *
|
||||
dcc_add (t_irc_server *server, int type, unsigned long addr, int port, char *nick, char *filename,
|
||||
unsigned int size)
|
||||
{
|
||||
t_dcc *new_dcc;
|
||||
|
||||
if ((new_dcc = (t_dcc *) malloc (sizeof (t_dcc))) == NULL)
|
||||
{
|
||||
gui_printf (NULL, _("%s not enough memory for new DCC\n"), WEECHAT_ERROR);
|
||||
return NULL;
|
||||
}
|
||||
new_dcc->server = server;
|
||||
new_dcc->type = type;
|
||||
new_dcc->status = DCC_ACTIVE;
|
||||
new_dcc->addr = addr;
|
||||
new_dcc->port = port;
|
||||
new_dcc->nick = strdup (nick);
|
||||
new_dcc->file = -1;
|
||||
new_dcc->filename = strdup (filename);
|
||||
new_dcc->size = size;
|
||||
new_dcc->pos = 0;
|
||||
new_dcc->next_dcc = dcc_list;
|
||||
dcc_list = new_dcc;
|
||||
|
||||
gui_printf (NULL, "Incoming DCC file: type:%d, nick:%s, address:%d.%d.%d.%d, "
|
||||
"port=%d, name=%s, size=%lu\n",
|
||||
type, nick,
|
||||
addr >> 24, (addr >> 16) & 0xff, (addr >> 8) & 0xff, addr & 0xff,
|
||||
port, filename, size);
|
||||
return new_dcc;
|
||||
}
|
||||
|
||||
@@ -1140,9 +1140,8 @@ irc_cmd_recv_privmsg (t_irc_server *server, char *host, char *arguments)
|
||||
pos2--;
|
||||
pos2[1] = '\0';
|
||||
|
||||
wee_log_printf ("Incoming DCC file (NOT DEVELOPED!): "
|
||||
"\"%s\", address=\"%s\", port=\"%s\", size=\"%s\"\n",
|
||||
pos_file, pos_addr, pos_port, pos_size);
|
||||
dcc_add (server, DCC_FILE_RECV, (unsigned long) atol (pos_addr),
|
||||
atoi (pos_port), host, pos_file, (unsigned int) atoi (pos_size));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -734,6 +734,7 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
{
|
||||
char *pos;
|
||||
t_irc_channel *ptr_channel;
|
||||
t_gui_buffer *ptr_buffer;
|
||||
|
||||
pos = strchr (arguments, ' ');
|
||||
if (pos)
|
||||
@@ -761,6 +762,18 @@ irc_cmd_send_query (t_irc_server *server, char *arguments)
|
||||
}
|
||||
gui_draw_buffer_title (ptr_channel->buffer, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
|
||||
{
|
||||
if (ptr_buffer->channel == ptr_channel)
|
||||
{
|
||||
gui_switch_to_buffer (gui_current_window, ptr_buffer);
|
||||
gui_redraw_buffer (ptr_buffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* display text if given */
|
||||
if (pos)
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
|
||||
#include "../gui/gui.h"
|
||||
|
||||
/* prefixes for chat window */
|
||||
|
||||
#define PREFIX_SERVER "-@-"
|
||||
#define PREFIX_INFO "-=-"
|
||||
#define PREFIX_ACTION_ME "-*-"
|
||||
@@ -34,6 +36,8 @@
|
||||
|
||||
#define CHANNEL_PREFIX "#&+!"
|
||||
|
||||
/* channel modes */
|
||||
|
||||
#define NUM_CHANNEL_MODES 7
|
||||
#define CHANNEL_MODE_INVITE 0
|
||||
#define CHANNEL_MODE_KEY 1
|
||||
@@ -50,6 +54,20 @@
|
||||
|
||||
#define DEFAULT_IRC_PORT 6667
|
||||
|
||||
/* DCC types & status */
|
||||
|
||||
#define DCC_CHAT_RECV 0 /* receiving DCC chat */
|
||||
#define DCC_CHAT_SEND 1 /* sending DCC chat */
|
||||
#define DCC_FILE_RECV 2 /* incoming DCC file */
|
||||
#define DCC_FILE_SEND 3 /* sending DCC file */
|
||||
|
||||
#define DCC_WAITING 0 /* waiting for host answer */
|
||||
#define DCC_CONNECTING 1 /* connecting to host */
|
||||
#define DCC_ACTIVE 2 /* sending/receiving data */
|
||||
#define DCC_DONE 3 /* transfer done */
|
||||
#define DCC_FAILED 4 /* DCC failed */
|
||||
#define DCC_ABORTED 5 /* DCC aborted by user */
|
||||
|
||||
/* nick types */
|
||||
|
||||
typedef struct t_irc_nick t_irc_nick;
|
||||
@@ -143,6 +161,8 @@ struct t_irc_command
|
||||
/* function called when cmd is received */
|
||||
};
|
||||
|
||||
/* irc messages */
|
||||
|
||||
typedef struct t_irc_message t_irc_message;
|
||||
|
||||
struct t_irc_message
|
||||
@@ -152,10 +172,31 @@ struct t_irc_message
|
||||
t_irc_message *next_message; /* link to next message */
|
||||
};
|
||||
|
||||
/* DCC */
|
||||
|
||||
typedef struct t_dcc t_dcc;
|
||||
|
||||
struct t_dcc
|
||||
{
|
||||
t_irc_server *server; /* irc server */
|
||||
int type; /* DCC type (send or receive) */
|
||||
int status; /* DCC status (waiting, sending, ..) */
|
||||
unsigned long addr; /* IP address */
|
||||
int port; /* port */
|
||||
char *nick; /* remote nick */
|
||||
int file; /* local file (for reading or writing) */
|
||||
char *filename; /* local filename */
|
||||
unsigned long size; /* file size */
|
||||
unsigned long pos; /* number of bytes received/sent */
|
||||
t_dcc *next_dcc; /* link to next dcc file/chat */
|
||||
};
|
||||
|
||||
extern t_irc_command irc_commands[];
|
||||
extern t_irc_server *irc_servers, *current_irc_server;
|
||||
extern t_irc_message *recv_msgq, *msgq_last_msg;
|
||||
extern t_irc_channel *current_channel;
|
||||
extern t_dcc *dcc_list;
|
||||
extern char *dcc_status_string[6];
|
||||
extern char *channel_modes;
|
||||
|
||||
/* server functions (irc-server.c) */
|
||||
@@ -201,6 +242,8 @@ extern int nick_get_max_length (t_irc_channel *);
|
||||
/* DCC functions (irc-dcc.c) */
|
||||
|
||||
extern void dcc_send ();
|
||||
extern t_dcc *dcc_add (t_irc_server *, int, unsigned long, int, char *, char *,
|
||||
unsigned int);
|
||||
|
||||
/* IRC display (irc-diplay.c) */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user