changeset 435:fea4aee3658a

FreeNodeChat macro: embeds freenode IRC chat window
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 03 Oct 2009 18:35:00 +0200
parents 89b8539eebd9
children a0088ccd5b91
files data/plugin/macro/FreeNodeChat.py
diffstat 1 files changed, 28 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/data/plugin/macro/FreeNodeChat.py	Sat Oct 03 18:35:00 2009 +0200
@@ -0,0 +1,28 @@
+# -*- coding: iso-8859-1 -*-
+"""
+    MoinMoin - embed a webchat.freenode.net IRC chat iframe
+
+    @copyright: 2009 MoinMoin:ThomasWaldmann
+    @license: GNU GPL, see COPYING for details.
+"""
+
+from MoinMoin import wikiutil
+
+base_url = 'http://webchat.freenode.net/'
+
+def macro_FreeNodeChat(macro, nick=u'', randomnick=0, prompt=0, width=647, height=400):
+    """ Embed a freenode web chat iframe
+
+        <<FreeNodeChat()>>
+    """
+    qs = dict(width=width, height=height)
+    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)
+