From ede921cc4d74df47b08405c468be2ec7b6f34069 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Tue, 20 May 2008 17:29:44 +0200 Subject: [PATCH] Remove old dcc code, unused now --- po/POTFILES.in | 2 - po/srcfiles.cmake | 2 - src/gui/curses/gui-curses-input.c | 54 ------------ src/gui/gui-buffer.h | 2 - src/gui/gui-window.c | 7 -- src/gui/gui-window.h | 5 -- src/plugins/irc/CMakeLists.txt | 1 - src/plugins/irc/Makefile.am | 2 - src/plugins/irc/irc-channel.c | 1 - src/plugins/irc/irc-channel.h | 2 +- src/plugins/irc/irc-config.c | 1 - src/plugins/irc/irc-dcc.c | 88 -------------------- src/plugins/irc/irc-dcc.h | 134 ------------------------------ src/plugins/irc/irc-input.c | 1 - src/plugins/irc/irc.c | 2 - 15 files changed, 1 insertion(+), 303 deletions(-) delete mode 100644 src/plugins/irc/irc-dcc.c delete mode 100644 src/plugins/irc/irc-dcc.h diff --git a/po/POTFILES.in b/po/POTFILES.in index 642a3ca7e..5703819be 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -106,8 +106,6 @@ ./src/plugins/irc/irc-completion.h ./src/plugins/irc/irc-config.c ./src/plugins/irc/irc-config.h -./src/plugins/irc/irc-dcc.c -./src/plugins/irc/irc-dcc.h ./src/plugins/irc/irc-debug.c ./src/plugins/irc/irc-debug.h ./src/plugins/irc/irc-display.c diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake index 957050768..37718bae8 100644 --- a/po/srcfiles.cmake +++ b/po/srcfiles.cmake @@ -107,8 +107,6 @@ SET(WEECHAT_SOURCES ./src/plugins/irc/irc-completion.h ./src/plugins/irc/irc-config.c ./src/plugins/irc/irc-config.h -./src/plugins/irc/irc-dcc.c -./src/plugins/irc/irc-dcc.h ./src/plugins/irc/irc-debug.c ./src/plugins/irc/irc-debug.h ./src/plugins/irc/irc-display.c diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c index dd027e2a3..be0a79da5 100644 --- a/src/gui/curses/gui-curses-input.c +++ b/src/gui/curses/gui-curses-input.c @@ -279,7 +279,6 @@ gui_input_draw (struct t_gui_buffer *buffer, int erase) struct t_gui_window *ptr_win; char format[32]; int prompt_length, display_prompt, offset_cursor; - /*t_irc_dcc *dcc_selected;*/ if (!gui_ok) return; @@ -365,59 +364,6 @@ gui_input_draw (struct t_gui_buffer *buffer, int erase) move (ptr_win->win_input_y, ptr_win->win_input_x + ptr_win->win_input_cursor_x); } - /* - case GUI_BUFFER_TYPE_DCC: - dcc_selected = (ptr_win->dcc_selected) ? (t_irc_dcc *) ptr_win->dcc_selected : irc_dcc_list; - wmove (GUI_CURSES(ptr_win)->win_input, 0, 0); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, - GUI_COLOR_WIN_INPUT_ACTIONS); - if (dcc_selected) - { - switch (dcc_selected->status) - { - case IRC_DCC_WAITING: - if (IRC_DCC_IS_RECV(dcc_selected->type)) - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [A] Accept")); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [C] Cancel")); - break; - case IRC_DCC_CONNECTING: - case IRC_DCC_ACTIVE: - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [C] Cancel")); - break; - case IRC_DCC_DONE: - case IRC_DCC_FAILED: - case IRC_DCC_ABORTED: - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [R] Remove")); - break; - } - } - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [P] Purge old DCC")); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [Q] Close DCC view")); - wclrtoeol (GUI_CURSES(ptr_win)->win_input); - ptr_win->win_input_cursor_x = 0; - if (ptr_win == gui_current_window) - move (ptr_win->win_input_y, ptr_win->win_input_x); - break; - case GUI_BUFFER_TYPE_RAW_DATA: - wmove (GUI_CURSES(ptr_win)->win_input, 0, 0); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, - GUI_COLOR_WIN_INPUT_ACTIONS); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [C] Clear buffer")); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" [Q] Close raw data view")); - wclrtoeol (GUI_CURSES(ptr_win)->win_input); - ptr_win->win_input_cursor_x = 0; - if (ptr_win == gui_current_window) - move (ptr_win->win_input_y, ptr_win->win_input_x); - break; - }*/ } wrefresh (GUI_CURSES(ptr_win)->win_input); refresh (); diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index 4951b8df3..121cd185e 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -190,14 +190,12 @@ extern struct t_gui_window *gui_buffer_find_window (struct t_gui_buffer *buffer) extern int gui_buffer_is_scrolled (struct t_gui_buffer *buffer); extern int gui_buffer_match_category_name (struct t_gui_buffer *buffer, char *mask, int case_sensitive); -extern struct t_gui_buffer *gui_buffer_get_dcc (struct t_gui_window *window); extern void gui_buffer_clear (struct t_gui_buffer *buffer); extern void gui_buffer_clear_all (); extern void gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another); extern void gui_buffer_switch_previous (struct t_gui_window *window); extern void gui_buffer_switch_next (struct t_gui_window *window); -extern void gui_buffer_switch_dcc (struct t_gui_window *window); extern void gui_buffer_switch_by_number (struct t_gui_window *window, int number); extern void gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number); diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index 78e8a461f..adb7202e5 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -249,10 +249,6 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height new_window->refresh_needed = 0; - new_window->dcc_first = NULL; - new_window->dcc_selected = NULL; - new_window->dcc_last_displayed = NULL; - new_window->buffer = NULL; new_window->first_line_displayed = 0; @@ -942,9 +938,6 @@ gui_window_print_log () log_printf (" win_input_width . . : %d", ptr_window->win_input_width); log_printf (" win_input_height. . : %d", ptr_window->win_input_height); log_printf (" win_input_cursor_x. : %d", ptr_window->win_input_cursor_x); - log_printf (" dcc_first . . . . . : 0x%x", ptr_window->dcc_first); - log_printf (" dcc_selected. . . . : 0x%x", ptr_window->dcc_selected); - log_printf (" dcc_last_displayed. : 0x%x", ptr_window->dcc_last_displayed); log_printf (" buffer. . . . . . . : 0x%x", ptr_window->buffer); log_printf (" first_line_displayed: %d", ptr_window->first_line_displayed); log_printf (" start_line. . . . . : 0x%x", ptr_window->start_line); diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h index 9215f748b..f5d0564e5 100644 --- a/src/gui/gui-window.h +++ b/src/gui/gui-window.h @@ -83,11 +83,6 @@ struct t_gui_window /* GUI specific objects */ void *gui_objects; /* pointer to a GUI specific struct */ - /* DCC */ - void *dcc_first; /* first dcc displayed */ - void *dcc_selected; /* selected dcc */ - void *dcc_last_displayed; /* last dcc displayed (for scroll) */ - struct t_gui_buffer *buffer; /* buffer currently displayed */ int first_line_displayed; /* = 1 if first line is displayed */ diff --git a/src/plugins/irc/CMakeLists.txt b/src/plugins/irc/CMakeLists.txt index c4da9b459..bb5bc4e53 100644 --- a/src/plugins/irc/CMakeLists.txt +++ b/src/plugins/irc/CMakeLists.txt @@ -22,7 +22,6 @@ irc-color.c irc-color.h irc-command.c irc-command.h irc-completion.c irc-completion.h irc-config.c irc-config.h -irc-dcc.c irc-dcc.h irc-debug.c irc-debug.h irc-display.c irc-display.h irc-input.c irc-input.h diff --git a/src/plugins/irc/Makefile.am b/src/plugins/irc/Makefile.am index e4e25fe30..39583cce3 100644 --- a/src/plugins/irc/Makefile.am +++ b/src/plugins/irc/Makefile.am @@ -34,8 +34,6 @@ irc_la_SOURCES = irc.c \ irc-completion.h \ irc-config.c \ irc-config.h \ - irc-dcc.c \ - irc-dcc.h \ irc-debug.c \ irc-debug.h \ irc-display.c \ diff --git a/src/plugins/irc/irc-channel.c b/src/plugins/irc/irc-channel.c index 48c63bcbc..ecca71e8d 100644 --- a/src/plugins/irc/irc-channel.c +++ b/src/plugins/irc/irc-channel.c @@ -28,7 +28,6 @@ #include "irc-channel.h" #include "irc-buffer.h" #include "irc-config.h" -#include "irc-dcc.h" #include "irc-nick.h" #include "irc-server.h" #include "irc-input.h" diff --git a/src/plugins/irc/irc-channel.h b/src/plugins/irc/irc-channel.h index ca335639e..7aa4ca493 100644 --- a/src/plugins/irc/irc-channel.h +++ b/src/plugins/irc/irc-channel.h @@ -39,7 +39,7 @@ struct t_irc_channel char *modes; /* channel modes */ int limit; /* user limit (0 is limit not set) */ char *key; /* channel key (NULL if no key set) */ - int nicks_count; /* # nicks on channel (0 if dcc/pv) */ + int nicks_count; /* # nicks on channel (0 if pv) */ int checking_away; /* = 1 if checking away with WHO cmd */ char *away_message; /* to display away only once in pv */ int cycle; /* currently cycling (/part + /join) */ diff --git a/src/plugins/irc/irc-config.c b/src/plugins/irc/irc-config.c index 603f0a0c9..104d648a3 100644 --- a/src/plugins/irc/irc-config.c +++ b/src/plugins/irc/irc-config.c @@ -29,7 +29,6 @@ #include "../weechat-plugin.h" #include "irc.h" #include "irc-config.h" -#include "irc-dcc.h" #include "irc-server.h" diff --git a/src/plugins/irc/irc-dcc.c b/src/plugins/irc/irc-dcc.c deleted file mode 100644 index 0cd4aab7b..000000000 --- a/src/plugins/irc/irc-dcc.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -/* irc-dcc.c: Direct Client-to-Client (DCC) communication (files & chat) */ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "../weechat-plugin.h" -#include "irc.h" -#include "irc-dcc.h" -#include "irc-config.h" - - -struct t_irc_dcc *irc_dcc_list = NULL; /* DCC files & chat list */ -struct t_irc_dcc *irc_last_dcc = NULL; /* last DCC in list */ - - - -/* - * irc_dcc_accept_resume: accepts a resume and inform the receiver - */ -/* -void -irc_dcc_accept_resume (struct t_irc_server *server, char *filename, int port, - unsigned long pos_start) -{ - struct t_irc_dcc *ptr_dcc; - - ptr_dcc = irc_dcc_search (server, IRC_DCC_FILE_SEND, IRC_DCC_CONNECTING, - port); - if (ptr_dcc) - { - ptr_dcc->pos = pos_start; - ptr_dcc->ack = pos_start; - ptr_dcc->start_resume = pos_start; - ptr_dcc->last_check_pos = pos_start; - irc_server_sendf (ptr_dcc->server, - (strchr (ptr_dcc->filename, ' ')) ? - "PRIVMSG %s :\01DCC ACCEPT \"%s\" %d %u\01\n" : - "PRIVMSG %s :\01DCC ACCEPT %s %d %u\01", - ptr_dcc->nick, ptr_dcc->filename, - ptr_dcc->port, ptr_dcc->start_resume); - - gui_chat_printf_info (ptr_dcc->server->buffer, - _("DCC: file %s%s%s resumed at position %u\n"), - GUI_COLOR(GUI_COLOR_CHAT_CHANNEL), - ptr_dcc->filename, - GUI_COLOR(GUI_COLOR_CHAT), - ptr_dcc->start_resume); - irc_dcc_redraw (WEECHAT_HOTLIST_MESSAGE); - } - else - gui_chat_printf (server->buffer, - _("%s can't resume file \"%s\" (port: %d, start " - "position: %u): DCC not found or ended\n"), - WEECHAT_ERROR, filename, port, pos_start); -} -*/ diff --git a/src/plugins/irc/irc-dcc.h b/src/plugins/irc/irc-dcc.h deleted file mode 100644 index 19a0a304e..000000000 --- a/src/plugins/irc/irc-dcc.h +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - - -#ifndef __WEECHAT_IRC_DCC_H -#define __WEECHAT_IRC_DCC_H 1 - -/* DCC types */ - -#define IRC_DCC_CHAT_RECV 0 /* receiving DCC chat */ -#define IRC_DCC_CHAT_SEND 1 /* sending DCC chat */ -#define IRC_DCC_FILE_RECV 2 /* incoming DCC file */ -#define IRC_DCC_FILE_SEND 3 /* sending DCC file */ - -/* DCC status */ - -#define IRC_DCC_WAITING 0 /* waiting for host answer */ -#define IRC_DCC_CONNECTING 1 /* connecting to host */ -#define IRC_DCC_ACTIVE 2 /* sending/receiving data */ -#define IRC_DCC_DONE 3 /* transfer done */ -#define IRC_DCC_FAILED 4 /* DCC failed */ -#define IRC_DCC_ABORTED 5 /* DCC aborted by user */ - -/* DCC blocksize (for file) */ - -#define IRC_DCC_MIN_BLOCKSIZE 1024 /* min DCC block size when sending file*/ -#define IRC_DCC_MAX_BLOCKSIZE 102400 /* max DCC block size when sending file*/ - -/* DCC errors (for file) */ - -#define IRC_DCC_NO_ERROR 0 /* no error to report, all ok! */ -#define IRC_DCC_ERROR_READ_LOCAL 1 /* unable to read local file */ -#define IRC_DCC_ERROR_SEND_BLOCK 2 /* unable to send block to receiver */ -#define IRC_DCC_ERROR_READ_ACK 3 /* unable to read ACK from receiver */ -#define IRC_DCC_ERROR_CONNECT_SENDER 4 /* unable to connect to sender */ -#define IRC_DCC_ERROR_RECV_BLOCK 5 /* unable to recv block from sender */ -#define IRC_DCC_ERROR_WRITE_LOCAL 6 /* unable to write to local file */ - -/* DCC macros for type */ - -#define IRC_DCC_IS_CHAT(type) ((type == IRC_DCC_CHAT_RECV) || \ - (type == IRC_DCC_CHAT_SEND)) -#define IRC_DCC_IS_FILE(type) ((type == IRC_DCC_FILE_RECV) || \ - (type == IRC_DCC_FILE_SEND)) -#define IRC_DCC_IS_RECV(type) ((type == IRC_DCC_CHAT_RECV) || \ - (type == IRC_DCC_FILE_RECV)) -#define IRC_DCC_IS_SEND(type) ((type == IRC_DCC_CHAT_SEND) || \ - (type == IRC_DCC_FILE_SEND)) - -/* DCC macro for status */ - -#define IRC_DCC_ENDED(status) ((status == IRC_DCC_DONE) || \ - (status == IRC_DCC_FAILED) || \ - (status == IRC_DCC_ABORTED)) - -struct t_irc_dcc -{ - struct t_irc_server *server; /* irc server */ - struct t_irc_channel *channel; /* irc channel (for DCC chat only) */ - int type; /* DCC type (file/chat, send/receive) */ - int status; /* DCC status (waiting, sending, ..) */ - time_t start_time; /* the time when DCC started */ - time_t start_transfer; /* the time when DCC transfer started */ - unsigned long addr; /* IP address */ - int port; /* port */ - char *nick; /* remote nick */ - int sock; /* socket for connection */ - pid_t child_pid; /* pid of child process (sending/recving)*/ - int child_read; /* to read into child pipe */ - int child_write; /* to write into child pipe */ - char *unterminated_message; /* beginning of a message in input buf */ - int fast_send; /* fase send for files: does not wait ACK*/ - int file; /* local file (for reading or writing) */ - char *filename; /* filename (given by sender) */ - char *local_filename; /* local filename (with path) */ - int filename_suffix; /* suffix (.1 for ex) if renaming file */ - int blocksize; /* block size for sending file */ - unsigned long size; /* file size */ - unsigned long pos; /* number of bytes received/sent */ - unsigned long ack; /* number of bytes received OK */ - unsigned long start_resume; /* start of resume (in bytes) */ - time_t last_check_time; /* last time we looked at bytes sent/recv*/ - unsigned long last_check_pos; /* bytes sent/recv at last check */ - time_t last_activity; /* time of last byte received/sent */ - unsigned long bytes_per_sec; /* bytes per second */ - unsigned long eta; /* estimated time of arrival */ - struct t_irc_dcc *prev_dcc; /* link to previous dcc file/chat */ - struct t_irc_dcc *next_dcc; /* link to next dcc file/chat */ -}; - -extern struct t_irc_dcc *irc_dcc_list; -extern struct t_irc_dcc *irc_last_dcc; -extern char *irc_dcc_status_string[6]; - -extern void irc_dcc_redraw (int highlight); -extern void irc_dcc_free (struct t_irc_dcc *dcc); -extern void irc_dcc_close (struct t_irc_dcc *dcc, int status); -extern void irc_dcc_chat_remove_channel (struct t_irc_channel *channel); -extern void irc_dcc_accept (struct t_irc_dcc *dcc); -extern void irc_dcc_accept_resume (struct t_irc_server *server, char *filename, - int port, unsigned long pos_start); -extern void irc_dcc_start_resume (struct t_irc_server *server, char *filename, - int port, unsigned long pos_start); -extern struct t_irc_dcc *irc_dcc_alloc (); -extern struct t_irc_dcc *irc_dcc_add (struct t_irc_server *server, - int type, unsigned long addr, - int port, char *nick, int sock, - char *filename, char *local_filename, - unsigned long size); -extern void irc_dcc_send_request (struct t_irc_server *server, int type, - char *nick, char *filename); -extern void irc_dcc_chat_sendf (struct t_irc_dcc *dcc, char *format, ...); -extern void irc_dcc_file_send_fork (struct t_irc_dcc *dcc); -extern void irc_dcc_file_recv_fork (struct t_irc_dcc *dcc); -extern void irc_dcc_handle (); -extern void irc_dcc_end (); -extern void irc_dcc_print_log (); - -#endif /* irc-dcc.h */ diff --git a/src/plugins/irc/irc-input.c b/src/plugins/irc/irc-input.c index 03e7d9147..47c22f3f7 100644 --- a/src/plugins/irc/irc-input.c +++ b/src/plugins/irc/irc-input.c @@ -27,7 +27,6 @@ #include "irc-server.h" #include "irc-channel.h" #include "irc-nick.h" -#include "irc-dcc.h" #include "irc-color.h" #include "irc-config.h" diff --git a/src/plugins/irc/irc.c b/src/plugins/irc/irc.c index ee9f24481..f4947f8bf 100644 --- a/src/plugins/irc/irc.c +++ b/src/plugins/irc/irc.c @@ -31,7 +31,6 @@ #include "irc-server.h" #include "irc-channel.h" #include "irc-nick.h" -#include "irc-dcc.h" WEECHAT_PLUGIN_NAME("irc"); @@ -154,7 +153,6 @@ weechat_plugin_end (struct t_weechat_plugin *plugin) irc_config_write (); irc_server_disconnect_all (); - //irc_dcc_end (); irc_server_free_all (); return WEECHAT_RC_OK;