ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/src/servers.C
(Generate patch)

Comparing ermyth/src/servers.C (file contents):
Revision 1.4 by pippijn, Tue Aug 28 17:08:12 2007 UTC vs.
Revision 1.5 by pippijn, Sun Sep 9 20:05:52 2007 UTC

3 * Rights to this code are documented in doc/pod/license.pod. 3 * Rights to this code are documented in doc/pod/license.pod.
4 * 4 *
5 * Copyright © 2005-2007 Atheme Project (http://www.atheme.org) 5 * Copyright © 2005-2007 Atheme Project (http://www.atheme.org)
6 */ 6 */
7 7
8static char const rcsid[] = "$Id: servers.C,v 1.4 2007/08/28 17:08:12 pippijn Exp $"; 8static char const rcsid[] = "$Id: servers.C,v 1.5 2007/09/09 20:05:52 pippijn Exp $";
9 9
10#include "atheme.h" 10#include "atheme.h"
11#include "servers.h"
11#include <account/myuser.h> 12#include <account/myuser.h>
12 13
13typedef std::pair<char const * const, server_t *> server_pair; 14typedef std::pair<char const * const, server_t *> server_pair;
14typedef std::map<char const * const, server_t *, irccase_lt> server_map; 15typedef std::map<char const * const, server_t *, irccase_lt> server_map;
15server_map sidlist; 16server_map sidlist;
120 cnt.server++; 121 cnt.server++;
121 122
122 return s; 123 return s;
123} 124}
124 125
125/*
126 * server_delete(char const * const name)
127 *
128 * Finds and recursively destroys a server object.
129 *
130 * Inputs:
131 * - name of server to find and destroy
132 *
133 * Outputs:
134 * - nothing
135 *
136 * Side Effects:
137 * - all users and servers attached to the target are recursively deleted
138 */
139void 126void
140server_delete (char const * const name) 127server_delete (char const * const name)
141{ 128{
142 server_t *s = server_find (name); 129 server_t *s = server_find (name);
130 server_delete (s);
131
132 if (!s)
133 {
134 slog (LG_DEBUG, "server_delete(): called for nonexistant server: %s", name);
135
136 return;
137 }
138}
139
140/*
141 * server_delete(char const * const name)
142 *
143 * Finds and recursively destroys a server object.
144 *
145 * Inputs:
146 * - name of server to find and destroy
147 *
148 * Outputs:
149 * - nothing
150 *
151 * Side Effects:
152 * - all users and servers attached to the target are recursively deleted
153 */
154void
155server_delete (server_t *s, bool force)
156{
143 server_t *child; 157 server_t *child;
144 user_t *u; 158 user_t *u;
145 node_t *n, *tn; 159 node_t *n, *tn;
146 160
147 if (!s)
148 {
149 slog (LG_DEBUG, "server_delete(): called for nonexistant server: %s", name);
150
151 return;
152 }
153 if (s == me.me) 161 if (!force && s == me.me)
154 { 162 {
155 /* Deleting this would cause confusion, so let's not do it. 163 /* Deleting this would cause confusion, so let's not do it.
156 * Some ircds send SQUIT <myname> when we are squitted. 164 * Some ircds send SQUIT <myname> when we are squitted.
157 * -- jilles 165 * -- jilles
158 */ 166 */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines