ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/conf_shared.c
Revision: 7924
Committed: Sat Dec 31 13:57:08 2016 UTC (8 years, 7 months ago) by michael
Content type: text/x-csrc
File size: 2070 byte(s)
Log Message:
- Update copyright years

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2017 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_shared.c
23 * \brief Implements shared {} block configuration management.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "irc_string.h"
30 #include "memory.h"
31 #include "conf_shared.h"
32
33
34 static dlink_list shared_list;
35
36
37 const dlink_list *
38 shared_get_list(void)
39 {
40 return &shared_list;
41 }
42
43 void
44 shared_clear(void)
45 {
46 while (shared_list.head)
47 {
48 struct SharedItem *shared = shared_list.head->data;
49
50 dlinkDelete(&shared->node, &shared_list);
51 xfree(shared->server);
52 xfree(shared->user);
53 xfree(shared->host);
54 xfree(shared);
55 }
56 }
57
58 struct SharedItem *
59 shared_make(void)
60 {
61 struct SharedItem *shared = xcalloc(sizeof(*shared));
62 dlinkAdd(shared, &shared->node, &shared_list);
63
64 return shared;
65 }
66
67 const struct SharedItem *
68 shared_find(unsigned int type, const char *server,
69 const char *user, const char *host)
70 {
71 dlink_node *node;
72
73 DLINK_FOREACH(node, shared_list.head)
74 {
75 const struct SharedItem *shared = node->data;
76
77 if (shared->type & type)
78 if (!match(shared->server, server))
79 if (!match(shared->user, user) &&
80 !match(shared->host, host))
81 return shared;
82 }
83
84 return NULL;
85 }

Properties

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