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

Comparing ermyth/src/channels.C (file contents):
Revision 1.4 by pippijn, Tue Aug 28 17:08:12 2007 UTC vs.
Revision 1.5 by pippijn, Thu Aug 30 06:57:25 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: channels.C,v 1.4 2007/08/28 17:08:12 pippijn Exp $"; 8static char const rcsid[] = "$Id: channels.C,v 1.5 2007/08/30 06:57:25 pippijn Exp $";
9 9
10#include "atheme.h" 10#include "atheme.h"
11#include <account/mychan.h> 11#include <account/mychan.h>
12 12
13dictionary_tree_t *chanlist; 13channel_map chanlist;
14channel_t::callbacks channel_t::callback; 14channel_t::callbacks channel_t::callback;
15chanuser_t::callbacks chanuser_t::callback; 15chanuser_t::callbacks chanuser_t::callback;
16 16
17/* 17/*
18 * init_channels() 18 * init_channels()
34#if 0 34#if 0
35 chan_heap = BlockHeapCreate (sizeof (channel_t), HEAP_CHANNEL); 35 chan_heap = BlockHeapCreate (sizeof (channel_t), HEAP_CHANNEL);
36 chanuser_heap = BlockHeapCreate (sizeof (chanuser_t), HEAP_CHANUSER); 36 chanuser_heap = BlockHeapCreate (sizeof (chanuser_t), HEAP_CHANUSER);
37 chanban_heap = BlockHeapCreate (sizeof (chanban_t), HEAP_CHANUSER); 37 chanban_heap = BlockHeapCreate (sizeof (chanban_t), HEAP_CHANUSER);
38#endif 38#endif
39
40 chanlist = dictionary_create ("channel", HASH_CHANNEL, irccasecmp);
41} 39}
42 40
43/* 41/*
44 * channel_add(char const * const name, unsigned int ts, server_t *creator) 42 * channel_add(char const * const name, unsigned int ts, server_t *creator)
45 * 43 *
97 c->bans.count = 0; 95 c->bans.count = 0;
98 96
99 if ((mc = mychan_find (c->name))) 97 if ((mc = mychan_find (c->name)))
100 mc->chan = c; 98 mc->chan = c;
101 99
102 dictionary_add (chanlist, c->name, c); 100 chanlist[c->name] = c;
103 101
104 cnt.chan++; 102 cnt.chan++;
105 103
106 if (creator != me.me) 104 if (creator != me.me)
107 { 105 {
158 } 156 }
159 c->nummembers = 0; 157 c->nummembers = 0;
160 158
161 c->callback.remove (c); 159 c->callback.remove (c);
162 160
163 dictionary_delete (chanlist, c->name); 161 chanlist.erase (c->name);
164 162
165 if ((mc = mychan_find (c->name))) 163 if ((mc = mychan_find (c->name)))
166 mc->chan = NULL; 164 mc->chan = NULL;
167 165
168 clear_simple_modes (c); 166 clear_simple_modes (c);
195 * - none 193 * - none
196 */ 194 */
197channel_t * 195channel_t *
198channel_find (char const * const name) 196channel_find (char const * const name)
199{ 197{
200 return static_cast<channel_t *> (dictionary_retrieve (chanlist, name)); 198 channel_map::iterator it = chanlist.find (name);
199 if (it == chanlist.end ())
200 return NULL;
201
202 return it->second;
201} 203}
202 204
203/* 205/*
204 * chanban_add(channel_t *c, char const * const mask, int type) 206 * chanban_add(channel_t *c, char const * const mask, int type)
205 * 207 *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines