ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_gecos.c
Revision: 7668
Committed: Wed Jul 20 17:09:49 2016 UTC (9 years, 1 month ago) by michael
Content type: text/x-csrc
File size: 2531 byte(s)
Log Message:
- Fixed svn properties

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1998-2016 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 * USA
20 */
21
22 /*! \file conf_gecos.c
23 * \brief Implements gecos {} block configuration management.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "send.h"
30 #include "client.h"
31 #include "irc_string.h"
32 #include "ircd.h"
33 #include "memory.h"
34 #include "conf.h"
35 #include "conf_gecos.h"
36
37
38 static dlink_list gecos_list;
39
40
41 const dlink_list *
42 gecos_get_list(void)
43 {
44 return &gecos_list;
45 }
46
47 void
48 gecos_clear(void)
49 {
50 dlink_node *node, *node_next;
51
52 DLINK_FOREACH_SAFE(node, node_next, gecos_list.head)
53 {
54 struct GecosItem *gecos = node->data;
55
56 if (!gecos->in_database)
57 gecos_delete(gecos);
58 }
59 }
60
61 void
62 gecos_delete(struct GecosItem *gecos)
63 {
64 dlinkDelete(&gecos->node, &gecos_list);
65 xfree(gecos->mask);
66 xfree(gecos->reason);
67 xfree(gecos);
68 }
69
70 struct GecosItem *
71 gecos_make(void)
72 {
73 struct GecosItem *gecos = xcalloc(sizeof(*gecos));
74 dlinkAdd(gecos, &gecos->node, &gecos_list);
75
76 return gecos;
77 }
78
79 struct GecosItem *
80 gecos_find(const char *name, int (*compare)(const char *, const char *))
81 {
82 dlink_node *node;
83
84 DLINK_FOREACH(node, gecos_list.head)
85 {
86 struct GecosItem *gecos = node->data;
87
88 if (!compare(gecos->mask, name))
89 return gecos;
90 }
91
92 return NULL;
93 }
94
95 void
96 gecos_expire(void)
97 {
98 dlink_node *node, *node_next;
99
100 DLINK_FOREACH_SAFE(node, node_next, gecos_list.head)
101 {
102 struct GecosItem *gecos = node->data;
103
104 if (!gecos->expire || gecos->expire > CurrentTime)
105 continue;
106
107 if (ConfigGeneral.tkline_expire_notices)
108 sendto_realops_flags(UMODE_SERVNOTICE, L_ALL, SEND_NOTICE, "Temporary X-line for [%s] expired",
109 gecos->mask);
110 gecos_delete(gecos);
111 }
112 }

Properties

Name Value
svn:eol-style native
svn:keywords Id