Merged silc_1_0_branch to trunk.
[silc.git] / apps / irssi / src / silc / core / silc-chatnets.c
1 /*
2  silc-chatnets.c : irssi
3
4     Copyright (C) 1999-2000 Timo Sirainen
5     Copyright (C) 2003 Jochen Eisinger
6
7     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by
9     the Free Software Foundation; either version 2 of the License, or
10     (at your option) any later version.
11
12     This program is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with this program; if not, write to the Free Software
19     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 */
21
22 #include "module.h"
23 #include "signals.h"
24 #include "lib-config/iconfig.h"
25 #include "settings.h"
26
27 #include "silc-chatnets.h"
28
29 void silcnet_create(SILC_CHATNET_REC *rec)
30 {
31         g_return_if_fail(rec != NULL);
32
33         rec->chat_type = SILC_PROTOCOL;
34         chatnet_create((CHATNET_REC *) rec);
35 }
36
37 static void sig_chatnet_read(SILC_CHATNET_REC *rec, CONFIG_NODE *node)
38 {
39         if (!IS_SILC_CHATNET(rec))
40                 return;
41         
42         /* read settings */
43 }
44
45 static void sig_chatnet_saved(SILC_CHATNET_REC *rec, CONFIG_NODE *node)
46 {
47         if (!IS_SILC_CHATNET(rec))
48                 return;
49
50         /* save settings */
51 }
52
53 static void sig_chatnet_destroyed(SILC_CHATNET_REC *rec)
54 {
55         if (!IS_SILC_CHATNET(rec))
56                 return;
57
58         /* free eventually allocated memory */
59 }
60
61
62 void silc_chatnets_init(void)
63 {
64         signal_add("chatnet read", (SIGNAL_FUNC) sig_chatnet_read);
65         signal_add("chatnet saved", (SIGNAL_FUNC) sig_chatnet_saved);
66         signal_add("chatnet destroyed", (SIGNAL_FUNC) sig_chatnet_destroyed);
67 }
68
69 void silc_chatnets_deinit(void)
70 {
71         GSList *tmp, *next;
72
73         for (tmp = chatnets; tmp != NULL; tmp = next) {
74                 CHATNET_REC *rec = tmp->data;
75
76                 next = tmp->next;
77                 if (IS_SILC_CHATNET(rec))
78                         chatnet_destroy(rec);
79         }
80
81         signal_remove("chatnet read", (SIGNAL_FUNC) sig_chatnet_read);
82         signal_remove("chatnet saved", (SIGNAL_FUNC) sig_chatnet_saved);
83         signal_remove("chatnet destroyed", (SIGNAL_FUNC) sig_chatnet_destroyed);
84 }