mirror of
http://aero2k.de/t/repos/urlbot-native.git
synced 2017-09-06 15:25:38 +02:00
using broadcast to all rooms
This commit is contained in:
@@ -895,6 +895,8 @@ def command_dsa_watcher(argv, **args):
|
|||||||
status, title = extract_title(url)
|
status, title = extract_title(url)
|
||||||
|
|
||||||
if 0 == status:
|
if 0 == status:
|
||||||
|
send_reply('new Debian Security Announce found: %s' % url)
|
||||||
|
|
||||||
if conf('persistent_locked'):
|
if conf('persistent_locked'):
|
||||||
msg = "couldn't get exclusive lock"
|
msg = "couldn't get exclusive lock"
|
||||||
log.warn(msg)
|
log.warn(msg)
|
||||||
|
|||||||
20
urlbot.py
20
urlbot.py
@@ -98,7 +98,7 @@ def extract_title(url):
|
|||||||
|
|
||||||
return (-1, 'error')
|
return (-1, 'error')
|
||||||
|
|
||||||
def send_reply(message, msg_obj):
|
def send_reply(message, msg_obj=None):
|
||||||
set_conf('request_counter', conf('request_counter') + 1)
|
set_conf('request_counter', conf('request_counter') + 1)
|
||||||
|
|
||||||
if str is not type(message):
|
if str is not type(message):
|
||||||
@@ -107,11 +107,19 @@ def send_reply(message, msg_obj):
|
|||||||
if debug_enabled():
|
if debug_enabled():
|
||||||
print(message)
|
print(message)
|
||||||
else:
|
else:
|
||||||
xmpp.send_message(
|
if msg_obj:
|
||||||
mto = msg_obj['from'].bare,
|
xmpp.send_message(
|
||||||
mbody = message,
|
mto = msg_obj['from'].bare,
|
||||||
mtype = 'groupchat'
|
mbody = message,
|
||||||
)
|
mtype = 'groupchat'
|
||||||
|
)
|
||||||
|
else: # unset msg_obj == broadcast
|
||||||
|
for room in xmpp.rooms:
|
||||||
|
xmpp.send_message(
|
||||||
|
mto = room,
|
||||||
|
mbody = message,
|
||||||
|
mtype = 'groupchat'
|
||||||
|
)
|
||||||
|
|
||||||
def ratelimit_touch(ignored=None): # FIXME: separate counters
|
def ratelimit_touch(ignored=None): # FIXME: separate counters
|
||||||
hist_ts.append(time.time())
|
hist_ts.append(time.time())
|
||||||
|
|||||||
Reference in New Issue
Block a user