# Richard Darst, May 2009 ### # Copyright (c) 2009, Richard Darst # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyright notice, # this list of conditions, and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright notice, # this list of conditions, and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the author of this software nor the name of # contributors to this software may be used to endorse or promote products # derived from this software without specific prior written consent. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE # ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. ### import time import os import re import stat import pygments # # Throw any overrides into meetingLocalConfig.py in this directory: # # Where to store files on disk logFileDir = '/home/richard/meetbot/' # The links to the logfiles are given this prefix logUrlPrefix = 'http://rkd.zgib.net/meetbot/' # Give the pattern to save files into here. Use %(channel)s for # channel. This will be sent through strftime for substituting it # times, howover, for strftime codes you must use doubled percent # signs (%%). This will be joined with the directories above. filenamePattern = '%(channel)s/%%Y/%(channel)s.%%F-%%H.%%M' # Where to say to go for more information about MeetBot MeetBotInfoURL = 'http://wiki.debian.org/MeetBot' # This is used with the #restrict command to remove permissions from files. RestrictPerm = stat.S_IRWXO|stat.S_IRWXG # g,o perm zeroed # RestrictPerm = stat.S_IRWXU|stat.S_IRWXO|stat.S_IRWXG # u,g,o perm zeroed. # used to detect #link : UrlProtocols = ('http:', 'https:', 'irc:', 'ftp:', 'mailto:', 'ssh:') # regular expression for parsing commands. First group is the command name, # second group is the rest of the line. command_RE = re.compile(r'#([\w]+)[ \t]*(.*)') # This is the help printed when a meeting starts usefulCommands = "#action #agreed #halp #info #idea #link #topic" # The channels which won't have date/time appended to the filename. specialChannels = ("#meetbot-test", "#meetbot-test2") specialChannelFilenamePattern = '%(channel)s/%(channel)s' # HTML irc log highlighting style. `pygmentize -L styles` to list. pygmentizeStyle = 'friendly' # Timezone setting. You can use friendly names like 'US/Eastern', etc. # Check /usr/share/zoneinfo/ . Or `man timezone`: this is the contents # of the TZ environment variable. timeZone = 'UTC' def html(text): """Escape bad sequences (in HTML) in user-generated lines.""" return text.replace("&", "&").replace("<", "<").replace(">", ">") def enc(text): return text.encode('utf-8', 'replace') def dec(text): return text.decode('utf-8', 'replace') # Set the timezone, using the variable above os.environ['TZ'] = timeZone time.tzset() def parse_time(time_): try: return time.strptime(time_, "%H:%M:%S") except ValueError: pass try: return time.strptime(time_, "%H:%M") except ValueError: pass logline_re = re.compile(r'\[?([0-9: ]*)\]? *<[@+]?([^>]+)> *(.*)') loglineAction_re = re.compile(r'\[?([0-9: ]*)\]? *\* *([^ ]+) *(.*)') # load custom local configurations try: import meetingLocalConfig meetingLocalConfig = reload(meetingLocalConfig) from meetingLocalConfig import * except ImportError: pass class MeetingCommands(object): # Command Definitions # generic parameters to these functions: # nick= # line= # linenum= # time_=