1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
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
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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);
}
|