1 """
2 email -> Wiki bridge
3
4 The commands sent by email with wiki markup will be stored on the wiki page
5 with the given name
6
7 @copyright: (c) 2011 hackmeeting U{http://sindominio.net/hackmeeting}
8 @author: Ruben Pollan
9 @organization: hackmeeting U{http://sindominio.net/hackmeeting}
10 @contact: meskio@sindominio.net
11 @license:
12 This program is free software; you can redistribute it and/or
13 modify it under the terms of the Do What The Fuck You Want To
14 Public License, Version 2, as published by Sam Hocevar. See
15 U{http://sam.zoy.org/projects/COPYING.WTFPL} for more details.
16 """
17
18 from emma.events import Event, subscribe, trigger
19 from emma.module import Module
20
21
30
31
33 if not data:
34 return _(" * _.wiki wiki page name\n" \
35 " text on wiki markup._\n" \
36 " Store the text on the wiki page\n")
37 elif data == _('wiki'):
38 return _("The arguments up to the first change of line will " \
39 "be considered the name of the page on the wiki\n" \
40 "to create or change with the text given after the" \
41 "first change of line")
42 return ""
43
45 cmd, args = data[0]
46 page, text = args.split("\n", 1)
47 page = page.strip()
48 event_write = Event(event='write', interface='mediawiki',
49 identifier=self.conf['wiki_id'])
50 self.log(_("Store '%(page)s' page on the '%(wiki)s' wiki") %
51 {'page':page, 'wiki':self.conf['wiki_id']})
52 trigger(event_write, (page, text))
53