class GenericExtractor:
"Generic class for encapsulating data from a VCS."
- booleans = ["tcp", "color"]
+ booleans = ["tcp"]
numerics = ["maxchannels"]
def __init__(self, arguments):
self.arguments = arguments
self.files = None
self.logmsg = None
self.rev = None
- self.color = False
+ self.color = None
# Color highlighting is disabled by default.
self.bold = self.green = self.blue = ""
self.yellow = self.brown = self.reset = ""
- def activate_color(self):
+ def activate_color(self, style):
"IRC color codes."
- self.bold = '\x02'
- self.green = '\x033'
- self.blue = '\x032'
- self.yellow = '\x037'
- self.brown = '\x035'
- self.reset = '\x0F'
+ if style == 'mIRC':
+ self.bold = '\x02'
+ self.green = '\x033'
+ self.blue = '\x032'
+ self.yellow = '\x037'
+ self.brown = '\x035'
+ self.reset = '\x0F'
+ if style == 'ANSI':
+ self.bold = '\x1b[1m;'
+ self.green = '\x1b[1;2m;'
+ self.blue = '\x1b[1;4m;'
+ self.yellow = '\x1b[1;3m;'
+ self.brown = '\x1b[3m;'
+ self.reset = '\x1b[0m;'
def load_preferences(self, conf):
"Load preferences from a file in the repository root."
if not os.path.exists(conf):
self.url = webview
except IOError:
self.url = ""
- if self.color:
- self.activate_color()
+ if self.color and self.color.lower() != "none":
+ self.activate_color(self.color)
class GitExtractor(GenericExtractor):
"Metadata extraction for the git version control system."
self.channels = do("git config --get irker.channels")
self.tcp = do("git config --bool --get irker.tcp")
self.template = '%(bold)s%(project)s:%(reset)s %(green)s%(author)s%(reset)s %(repo)s:%(yellow)s%(branch)s%(reset)s * %(bold)s%(rev)s%(reset)s / %(bold)s%(files)s%(reset)s: %(logmsg)s %(brown)s%(url)s%(reset)s'
- self.color = do("git config --bool --get irker.color")
+ self.color = do("git config --get irker.color")
self.urlprefix = do("git config --get irker.urlprefix") or "gitweb"
# This one is git-specific
self.revformat = do("git config --get irker.revformat")
<varlistentry>
<term>color</term>
<listitem>
-<para>If "true", highlight notification fields with IRC colors.
-Defaults to "false". Note: if you turn this on and notifications stop
-appearing on your channel, you need to turn off IRC's color filter
-on that channel. To do this you will need op privileges; issue
-the command "/mode #irker -c". You may need to first issue
-the command "/msg chanserv set #irker MLOCK +nt-slk".</para>
+<para>If "mIRC", highlight notification fields with mIRC color codes.
+If "ANSI", highlight notification fields with ANSI color escape sequences.
+Defaults to "none" (no colors). Note: if you turn this on and
+notifications stop appearing on your channel, you need to turn off
+IRC's color filter on that channel. To do this you will need op
+privileges; issue the command "/mode #irker -c". You may need to
+first issue the command "/msg chanserv set #irker MLOCK
++nt-slk".</para>
</listitem>
</varlistentry>
<varlistentry>