irssi/src/irc/core/irc-chatnets.c
Timo Sirainen 13712d83b2 /IRCNET ADD didn't work
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1279 dbcabf3a-b0e7-0310-adc4-f8d773084564
2001-02-22 05:19:11 +00:00

84 lines
2.6 KiB
C

/*
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);
}