Attachment 'GoogleTalk-0.1.py'

Download

   1 # -*- coding: iso-8859-1 -*-
   2 u"""
   3     MoinMoin - GoogleTalk macro Version 0.1 ALPHA
   4     This macro will let your visitors to chat directly with you
   5 
   6     <<GoogleTalk(badge="the badge id", title="your title for the link", nichname="whatever you like")>>
   7     You have allways create a badge id via your Google Talk Account and add this to your macro!
   8 
   9     Examples:
  10      * <<GoogleTalk(z01q6amlqf4qijtj2tko5ro20gi71ftvhgl62duou3thjptol6ubdfasdfsadfadhsbgkm54q1v5pnott46lk73nfld8g2vhavoljvsnsjsfjanud07hg)>>
  11      * <<GoogleTalk(badge="z01q6amlqf4qijtj2tko5ro20gi71ftvhgl62duou3thjptol6ubdfasdfsadfadhsbgkm54q1v5pnott46lk73nfld8g2vhavoljvsnsjsfjanud07hg", title="Open Up and Say aah!", nickname="Poison")>>
  12 
  13     @copyright: 2011 by MarcelHäfner (http://moinmo.in/MarcelHäfner),
  14 
  15     @license: GNU GPL, see COPYING for details.
  16 
  17     Attention:
  18      * This macro just using features from Google Talk. Read Term of Services, Privacy Polices and Legal Notice:
  19        http://www.google.com//talk/terms.html
  20      * To work with this macro you need to have a Google Mail-/Talk-Account and also neeed first to create a
  21        unique batch for yourself, see here http://www.google.com/talk/service/badge/New
  22        1. change style to "URL only"
  23        2. copy the value from the paramter "tk"
  24        3. this is now your "badge" to add to your macro
  25 
  26 """
  27 
  28 from MoinMoin import wikiutil
  29 Dependencies = ['time', ]
  30 
  31 def macro_GoogleTalk(macro, badge, title=u"Talk to us!", nickname=u"MoinMoin", ssl=False):
  32     request = macro.request
  33     _ = request.getText
  34     
  35     if ssl is True:
  36         protocol = "https"
  37     else:
  38         protocol = "http"
  39     if badge is not None:
  40         parameters = {
  41             "title":  wikiutil.escape(title),
  42             "nickname": wikiutil.escape(nickname),
  43             "badge": wikiutil.escape(badge),
  44             "height": "12", 
  45             "width": "12", 
  46             "protocol": protocol, 
  47         }
  48         
  49         html = u"""
  50         <span class="googletalk %(nickname)s">
  51             <img style="padding:0 2px 0 0;margin:0;border:none" src="%(protocol)s://www.google.com/talk/service/badge/Show?tk=%(badge)s&amp;w=%(width)s&amp;h=%(height)s" alt="" height="%(height)s" width="%(width)s">
  52             <a href="%(protocol)s://www.google.com/talk/service/badge/Start?tk=%(badge)s" target="_blank" title="%(nickname)s">%(title)s</a>
  53         </span>
  54         """ % parameters
  55     else:
  56         parameters = {
  57                       "message": _("Error, Missing parameter 'badge'"), 
  58                       }
  59         html = """
  60             <div class="error">
  61                 <p>%(message)s<br><a href="http://www.google.com/talk/service/badge/New">Google Talk Servic</a></p>
  62             </div>
  63         """ % parameters
  64 
  65     return macro.formatter.rawHTML(html)

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.
  • [get | view] (2011-06-23 22:27:27, 2.7 KB) [[attachment:GoogleTalk-0.1.py]]
  • [get | view] (2011-06-23 21:26:47, 26.8 KB) [[attachment:chat-window.png]]
  • [get | view] (2011-06-23 21:29:17, 26.4 KB) [[attachment:mail.png]]
  • [get | view] (2011-06-23 21:24:53, 117.6 KB) [[attachment:website.png]]
 All files | Selected Files: delete move to page copy to page

You are not allowed to attach a file to this page.