WatchWebsite module: dusting & fix unwatch authorizations

This commit is contained in:
nemunaire 2014-08-06 16:20:51 +02:00
commit c15127feb8
2 changed files with 6 additions and 7 deletions

View file

@ -24,6 +24,11 @@ def help_full ():
def load(context):
"""Register watched website"""
from hooks import Hook
add_hook("cmd_hook", Hook(add_site, "watch", data="diff"))
add_hook("cmd_hook", Hook(add_site, "updown", data="updown"))
add_hook("cmd_hook", Hook(del_site, "unwatch"))
DATAS.setIndex("url", "watch")
for site in DATAS.getNodes("watch"):
if site.hasNode("alert"):
@ -62,7 +67,7 @@ def del_site(msg):
site = DATAS.index[url]
for a in site.getNodes("alert"):
if a["channel"] == msg.channel:
if (msg.sender == a["sender"] or msg.is_owner):
if not (msg.sender == a["sender"] or msg.is_owner):
raise IRCException("vous ne pouvez pas supprimer cette URL.")
site.delChild(a)
if not site.hasNode("alert"):