mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-24 03:29:28 +01:00
Irc: make loopback hook in msg() optional
This commit is contained in:
parent
e06a6ae5bd
commit
0a436cdf4c
11
classes.py
11
classes.py
@ -493,7 +493,7 @@ class Irc():
|
|||||||
"""
|
"""
|
||||||
world.services['pylink'].call_cmd(self, source, text)
|
world.services['pylink'].call_cmd(self, source, text)
|
||||||
|
|
||||||
def msg(self, target, text, notice=False, source=None):
|
def msg(self, target, text, notice=False, source=None, loopback=True):
|
||||||
"""Handy function to send messages/notices to clients. Source
|
"""Handy function to send messages/notices to clients. Source
|
||||||
is optional, and defaults to the main PyLink client if not specified."""
|
is optional, and defaults to the main PyLink client if not specified."""
|
||||||
if not text:
|
if not text:
|
||||||
@ -507,9 +507,14 @@ class Irc():
|
|||||||
else:
|
else:
|
||||||
self.proto.message(source, target, text)
|
self.proto.message(source, target, text)
|
||||||
cmd = 'PYLINK_SELF_PRIVMSG'
|
cmd = 'PYLINK_SELF_PRIVMSG'
|
||||||
|
|
||||||
|
if loopback:
|
||||||
|
# Determines whether we should send a hook for this msg(), to relay things like services
|
||||||
|
# replies across relay.
|
||||||
self.callHooks([source, cmd, {'target': target, 'text': text}])
|
self.callHooks([source, cmd, {'target': target, 'text': text}])
|
||||||
|
|
||||||
def reply(self, text, notice=False, source=None, private=False, force_privmsg_in_private=False):
|
def reply(self, text, notice=False, source=None, private=False, force_privmsg_in_private=False,
|
||||||
|
loopback=True):
|
||||||
"""Replies to the last caller in the right context (channel or PM)."""
|
"""Replies to the last caller in the right context (channel or PM)."""
|
||||||
|
|
||||||
# Private reply is enabled, or the caller was originally a PM
|
# Private reply is enabled, or the caller was originally a PM
|
||||||
@ -523,7 +528,7 @@ class Irc():
|
|||||||
else:
|
else:
|
||||||
target = self.called_in
|
target = self.called_in
|
||||||
|
|
||||||
self.msg(target, text, notice=notice, source=source)
|
self.msg(target, text, notice=notice, source=source, loopback=loopback)
|
||||||
|
|
||||||
def toLower(self, text):
|
def toLower(self, text):
|
||||||
"""Returns a lowercase representation of text based on the IRC object's
|
"""Returns a lowercase representation of text based on the IRC object's
|
||||||
|
Loading…
Reference in New Issue
Block a user