From d97b52b5a2829294fd2454b06002c616f485312d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 1 Oct 2003 19:13:38 +0000 Subject: missed git-svn-id: http://svn.irssi.org/repos/irssi/trunk@3128 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- src/fe-common/irc/dcc/fe-dcc-server.c | 83 +++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/fe-common/irc/dcc/fe-dcc-server.c diff --git a/src/fe-common/irc/dcc/fe-dcc-server.c b/src/fe-common/irc/dcc/fe-dcc-server.c new file mode 100644 index 00000000..7f8e2fcd --- /dev/null +++ b/src/fe-common/irc/dcc/fe-dcc-server.c @@ -0,0 +1,83 @@ +/* + fe-dcc-server.c : irssi + + Copyright (C) 2003 Mark Trumbull + + 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 2 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, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#include "module.h" +#include "signals.h" +#include "commands.h" +#include "network.h" +#include "levels.h" + +#include "dcc-server.h" + +#include "module-formats.h" +#include "printtext.h" +#include "themes.h" + +static void dcc_server_started(SERVER_DCC_REC *dcc) +{ + if (!IS_DCC_SERVER(dcc)) { + return; + } + + printformat(dcc->server, NULL, MSGLEVEL_DCC, + IRCTXT_DCC_SERVER_STARTED, dcc->port); +} + +static void dcc_closed(SERVER_DCC_REC *dcc) +{ + /* We don't want to print a msg if its just starting a chat/get */ + /* and getting rid of the leftover SERVER_DCC_REC */ + if (!IS_DCC_SERVER(dcc) || dcc->connection_established) { + return; + } + + printformat(dcc->server, NULL, MSGLEVEL_DCC, + IRCTXT_DCC_SERVER_CLOSED, dcc->port); +} + +static void sig_dcc_list_print(SERVER_DCC_REC *dcc) +{ + /* We don't want to print a msg if its just starting a chat/get */ + /* and getting rid of the leftover SERVER_DCC_REC */ + if (!IS_DCC_SERVER(dcc) || dcc->connection_established) { + return; + } + + /* SERVER: Port(59) - Send(on) - Chat(on) - Fserve(on) */ + printformat(NULL, NULL, MSGLEVEL_DCC, IRCTXT_DCC_LIST_LINE_SERVER, + "SERVER", dcc->port, dcc->accept_send ? "on" : "off", + dcc->accept_chat ? "on" : "off", + dcc->accept_fserve ? "on" : "off"); +} + +void fe_dcc_server_init(void) +{ + signal_add("dcc server started", (SIGNAL_FUNC) dcc_server_started); + signal_add("dcc closed", (SIGNAL_FUNC) dcc_closed); + signal_add("dcc list print", (SIGNAL_FUNC) sig_dcc_list_print); +} + +void fe_dcc_server_deinit(void) +{ + signal_remove("dcc server started", (SIGNAL_FUNC) dcc_server_started); + signal_remove("dcc closed", (SIGNAL_FUNC) dcc_closed); + signal_remove("dcc list print", (SIGNAL_FUNC) sig_dcc_list_print); +} + -- cgit v1.2.3