1
2
3
4
5 """ channel specific data """
6
7 __copyright__ = 'this file is in the public domain'
8
9 from gozerbot.pdod import Pdod
10
12
13 """ Channels class .. channels object is a pickled dict of dicts """
14
16 Pdod.__init__(self, fname)
17 for j in self.data.values():
18 if not j.has_key('perms'):
19 j['perms'] = []
20 if not j.has_key('autovoice'):
21 j['autovoice'] = 0
22
24 """ return channels """
25 result = []
26 for channel in self.data.keys():
27 channel = channel.strip()
28 if channel and channel[0] in ['&', '#', '+', '!']:
29 if channel not in result:
30 result.append(channel)
31 return result
32
34 """ return channels with keys """
35 result = []
36 for channel in self.data.keys():
37 channel = channel.strip()
38 if channel and channel[0] in ['&', '#', '+', '!']:
39 try:
40 key = self.data[channel]['key']
41 if not channel + ' ' + key in result:
42 result.append(channel + ' ' + key)
43 except KeyError:
44 if channel not in result:
45 result.append(channel)
46 return result
47
49 """ return key of channel if set """
50 try:
51 key = self.data[channel]['key']
52 except:
53 key = None
54 return key
55
57 """ return bot nick of channel if set """
58 try:
59 nick = self.data[channel]['nick']
60 except:
61 nick = None
62 return nick
63