Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/plugin.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugin.py')
-rw-r--r--plugin.py32
1 files changed, 29 insertions, 3 deletions
diff --git a/plugin.py b/plugin.py
index 2496a3e..d36ea91 100644
--- a/plugin.py
+++ b/plugin.py
@@ -70,7 +70,9 @@ class Lingvo(callbacks.Plugin):
if self._groups_value is None:
self._groups_value = {}
- for lang, name, __ in config.CHANNELS:
+ for lang, name, __ in config.CHANNELS + \
+ [('en', str(i), None) for i in \
+ self.registryValue('channels')]:
if not lang:
continue
@@ -83,6 +85,7 @@ class Lingvo(callbacks.Plugin):
if group_channel == group.channel and lang:
group[i] = lang
+ self.log.info('[lingvo] Add lingva channel %s', name)
self._groups_value[name] = group
return self._groups_value
@@ -126,8 +129,10 @@ class Lingvo(callbacks.Plugin):
group_channel, __ = _normalize_channel(channel)
if group_channel not in self._groups:
irc.error('Channel "%s" cannot be translated, ' \
- 'request it using %s contact' % \
- (group_channel, self.registryValue('contact')))
+ 'request it using %s contact, ' \
+ 'permitted channels are %s' % \
+ (group_channel, self.registryValue('contact'),
+ ', '.join(self._groups.keys())))
return
group = self._groups[group_channel]
@@ -261,6 +266,26 @@ class Lingvo(callbacks.Plugin):
unpin = wrap(cmd_unpin, ['channel'])
+ def cmd_lingvanicks(self, irc, msg, args, channel):
+ """[<channel>]
+
+ List all nicks that are on translation channels.
+ """
+ if channel:
+ if not channel.startswith('#'):
+ channel = '#' + channel
+ channel, __ = _normalize_channel(channel)
+
+ for group in sorted(self._groups.values(),
+ cmp=lambda x, y: cmp(x.channel, y.channel)):
+ if channel and channel != group.channel or not group:
+ continue
+ for lingva_channel in group.keys():
+ nicks = irc.state.channels[lingva_channel].users
+ irc.reply('%s: %s' % (lingva_channel, ', '.join(nicks)))
+
+ lingvanicks = wrap(cmd_lingvanicks, [optional('channel')])
+
def cmd_nicks(self, irc, msg, args, channel):
"""[<channel>]
@@ -297,6 +322,7 @@ class Lingvo(callbacks.Plugin):
if time_last is None:
self._auto_parts[channel] = time_current
elif time_current - time_last >= self.registryValue('timeout'):
+ self.log.info('[lingvo] Timeout part from %s', channel)
irc.queueMsg(ircmsgs.part(channel, 'Lingvo part'))
elif channel in self._auto_parts:
del self._auto_parts[channel]