This file is indexed.

/usr/share/weechat/python/notifo_notify.py is in weechat-scripts 20120603-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# -*- coding: utf-8 -*-
"""
Author: SAEKI Yoshiyasu <laclef_yoshiyasu@yahoo.co.jp>
Homepage: http://bitbucket.org/laclefyoshi/weechat/
Version: 1.0
License: MIT License

This plugin requires "notifo" in your iPod touch/iPhone
See here: http://notifo.com/
"""

import weechat
import urllib
import urllib2

## registration

weechat.register("notifo_notify", "SAEKI Yoshiyasu", "1.0", "MIT License",
    "notifo_notify: Push notification to iPod touch/iPhone with notifo", "", "")

## settings

script_options = {
    "username": "",
    "api_secret": ""
}

for option, default_value in script_options.items():
    if weechat.config_get_plugin(option) == "":
        weechat.prnt("", weechat.prefix("error") + "notifo_notify: Please set option: %s" % option)
        weechat.prnt("", "notifo_notify: /set plugins.var.python.notifo_notify.%s STRING" % option)

## functions

def postNotifo(message, handler=None, label=None, title=None):
    NOTIFO_USER = weechat.config_get_plugin("username")
    NOTIFO_API_SECRET = weechat.config_get_plugin("api_secret")
    if NOTIFO_USER != "" and NOTIFO_API_SECRET != "":
        url = "https://api.notifo.com/v1/send_notification"
        opt_dict = {
            "msg": message,
            "label": label,
            "title":title
            }
        opt = urllib.urlencode(opt_dict)
        req = urllib2.Request(url, opt)
        basic = "Basic %s" % ":".join([NOTIFO_USER, NOTIFO_API_SECRET]).encode("base64").strip()
        req.add_header("Authorization", basic)
        res = urllib2.urlopen(req)

def signal_callback(data, signal, signal_data):
    if signal == "weechat_pv":
        postNotifo(signal_data, label="weechat", title="Private Message")
    elif signal == "weechat_highlight":
        postNotifo(signal_data, label="weechat", title="Highlight")
    return weechat.WEECHAT_RC_OK

weechat.hook_signal("weechat_highlight", "signal_callback", "")
weechat.hook_signal("weechat_pv", "signal_callback", "")