Commit cf752c27 authored by mathieui's avatar mathieui
Browse files

Add an IRC/biboumi plugin

parent 550aa6ef
......@@ -224,6 +224,11 @@ Plugin index
Add new ways to correct messages.
:ref:`Documentation <irc-plugin>`
Manage IRC gateways with biboumi more easily
.. toctree::
......@@ -261,3 +266,4 @@ Plugin index
.. _irc-plugin:
.. automodule:: irc
Plugin destined to be used together with the Biboumi IRC gateway.
For more information about Biboumi, please see the `official website`_.
This plugin is here as a non-default extension of the poezio configuration
made to work with IRC rooms and logins. Therefore, it does not define any
commands or do anything useful except on load.
Global configuration
.. glossary::
**Default:** ````
The JID of the IRC gateway to use. If empty, will be
used. Please try to run your own, though, it’s painless to setup.
.. note:: There is no nickname option because the default from poezio will be used.
Server-specific configuration
Write a configuration section for each server, with the server address as the
section name, and the following options:
.. glossary::
**Default:** ``[empty]``
The command used to identify with the services (e.g. ``IDENTIFY mypassword``).
**Default:** ``[empty]``
The nickname to whom the auth command will be sent.
**Default:** ``[empty]``
Your nickname on this server. If empty, the default configuration will be used.
**Default:** ``[empty]``
The list of rooms to join on this server (e.g. ``#room1:#room2``).
.. note:: If no login_command or login_nick is set, the authentication phase
won’t take place and you will join the rooms after a small delay.
Example configuration
.. code-block:: ini
gateway =
nickname = mynick
login_nick = nickserv
login_command = identify mynick mypassword
rooms = #testroom1:#testroom2
nickname = anothernick
login_nick = C
login_command = nick identify mypassword
rooms = #testvroum
.. _official website:
from plugin import BasePlugin
class Plugin(BasePlugin):
def init(self):
def join(server):
"Join rooms after a small delay"
nick = self.config.get('nickname', '', server) or self.core.own_nick
rooms = self.config.get('rooms', '', server).split(':')
for room in rooms:
room = '{}%{}@{}/{}'.format(room, server, gateway, nick)
gateway = self.config.get('gateway', '')
sections = self.config.sections()
for section in (s for s in sections if s != 'irc'):
server_suffix = '%%%s@%s' % (section, gateway)
already_opened = False
for tab in self.core.tabs:
already_opened = True
login_command = self.config.get('login_command', '', section)
login_nick = self.config.get('login_nick', '', section)
nick = self.config.get('nickname', '', section) or self.core.own_nick
if login_command and login_nick:
dest = '{}{}/{}'.format(login_nick, server_suffix, nick)
self.core.xmpp.send_message(mto=dest, mbody=login_command, mtype='chat')
if not already_opened:
delayed = self.api.create_delayed_event(5, join, section)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment