view data/plugin/macro/ @ 625:f4e63b74b969

FormSubmit: adapt to werkzeug MultiDict
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Mon, 25 Mar 2013 17:47:30 +0100
parents 466dca86625d
line wrap: on
line source
# -*- coding: iso-8859-1 -*-
    MoinMoin - embed a qwebirc based IRC chat iframe


    # . in nick name will give some random number:

    # maybe nice for a wiki homepage:

    # choose a random nickname, but still show dialogue (so you can change it):

    The macro has a (small) builtin list of qwebirc based chat servers, but you
    can use your own by defining it in your wiki config:

    qwebirc_servers = {
        # server name: web based service url
        'freenode': '',
        # add your own ones here

    For more information about qwebirc, see:

    @copyright: 2009 MoinMoin:ThomasWaldmann
    @license: GNU GPL, see COPYING for details.

# "known" qwebirc servers, use cfg.qwebirc_servers to give more
builtin_servers = {
    'freenode': '',
    'freenode-ssl': '',
    'quakenet': '',

from MoinMoin import wikiutil

def macro_qwebirc(macro,
                  nick=u'', randomnick=0, prompt=0, width=647, height=400):
    """ Embed a qwebirc based IRC chat iframe """
    request = macro.request
    cfg = request.cfg
    servers = getattr(cfg, 'qwebirc_servers', builtin_servers)

        base_url = servers[server]
    except KeyError:
        # unknown server (we only allow specific server urls to avoid XSS)
        return u'qwebirc: unknown server (choose from %r)' % servers.keys()

    qs = dict(width=width, height=height)
    if channels:
        qs['channels'] = channels
    if nick:
        qs['nick'] = nick
    if randomnick:
        qs['randomnick'] = randomnick
    if prompt:
        qs['prompt'] = prompt
    qs = wikiutil.makeQueryString(qs)
    html = u"""<iframe src="%(base_url)s?%(qs)s" width="%(width)d" height="%(height)d"></iframe>\n""" % locals()
    return macro.formatter.rawHTML(html)