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
|
/*
irc-chatnets.c : irssi
Copyright (C) 1999-2000 Timo Sirainen
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 "lib-config/iconfig.h"
#include "settings.h"
#include "irc-chatnets.h"
void ircnet_create(IRC_CHATNET_REC *rec)
{
g_return_if_fail(rec != NULL);
rec->chat_type = IRC_PROTOCOL;
chatnet_create((CHATNET_REC *) rec);
}
static void sig_chatnet_read(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
{
if (!IS_IRC_CHATNET(rec))
return;
rec->max_cmds_at_once = config_node_get_int(node, "cmdmax", 0);
rec->cmd_queue_speed = config_node_get_int(node, "cmdspeed", 0);
rec->max_query_chans = config_node_get_int(node, "max_query_chans", 0);
rec->max_kicks = config_node_get_int(node, "max_kicks", 0);
rec->max_msgs = config_node_get_int(node, "max_msgs", 0);
rec->max_modes = config_node_get_int(node, "max_modes", 0);
rec->max_whois = config_node_get_int(node, "max_whois", 0);
}
static void sig_chatnet_saved(IRC_CHATNET_REC *rec, CONFIG_NODE *node)
{
if (!IS_IRC_CHATNET(rec))
return;
if (rec->max_cmds_at_once > 0)
iconfig_node_set_int(node, "cmdmax", rec->max_cmds_at_once);
if (rec->cmd_queue_speed > 0)
iconfig_node_set_int(node, "cmdspeed", rec->cmd_queue_speed);
if (rec->max_query_chans > 0)
iconfig_node_set_int(node, "max_query_chans", rec->max_query_chans);
if (rec->max_kicks > 0)
iconfig_node_set_int(node, "max_kicks", rec->max_kicks);
if (rec->max_msgs > 0)
iconfig_node_set_int(node, "max_msgs", rec->max_msgs);
if (rec->max_modes > 0)
iconfig_node_set_int(node, "max_modes", rec->max_modes);
if (rec->max_whois > 0)
iconfig_node_set_int(node, "max_whois", rec->max_whois);
}
void irc_chatnets_init(void)
{
signal_add("chatnet read", (SIGNAL_FUNC) sig_chatnet_read);
signal_add("chatnet saved", (SIGNAL_FUNC) sig_chatnet_saved);
}
void irc_chatnets_deinit(void)
{
signal_remove("chatnet read", (SIGNAL_FUNC) sig_chatnet_read);
signal_remove("chatnet saved", (SIGNAL_FUNC) sig_chatnet_saved);
}
|