diff -r 9c7769850195 -r 6db2527b67cf qmsk/irclogs/channels.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qmsk/irclogs/channels.py Sun Sep 13 01:15:56 2009 +0300 @@ -0,0 +1,38 @@ +""" + Our list of LogChannels +""" + +class ChannelList (object) : + """ + The list of channels, and related methods + """ + + + def __init__ (self, channel_list) : + """ + Initialize with the given channel dict + """ + + self.channel_list = channel_list + self.channel_dict = dict((channel.id, channel) for channel in channel_list) + + def lookup (self, channel_name) : + """ + Looks up the LogChannel for the given name + """ + + return self.channel_dict[channel_name] + + def dict (self) : + """ + Returns a { name: LogChannel } dict + """ + return self.channel_dict + + def __iter__ (self) : + """ + Iterate over our defined LogChannel objects + """ + + return iter(self.channel_list) +