3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-24 19:52:53 +01:00

protocols: messageClient -> message, noticeClient -> notice

This commit is contained in:
James Lu 2016-01-16 16:44:23 -08:00
parent 108be5e25e
commit 3a53005d8c
5 changed files with 11 additions and 11 deletions

View File

@ -428,10 +428,10 @@ class Irc():
is optional, and defaults to the main PyLink client if not specified.""" is optional, and defaults to the main PyLink client if not specified."""
source = source or self.pseudoclient.uid source = source or self.pseudoclient.uid
if notice: if notice:
self.proto.noticeClient(source, target, text) self.proto.notice(source, target, text)
cmd = 'PYLINK_SELF_NOTICE' cmd = 'PYLINK_SELF_NOTICE'
else: else:
self.proto.messageClient(source, target, text) self.proto.message(source, target, text)
cmd = 'PYLINK_SELF_PRIVMSG' cmd = 'PYLINK_SELF_PRIVMSG'
self.callHooks([source, cmd, {'target': target, 'text': text}]) self.callHooks([source, cmd, {'target': target, 'text': text}])

View File

@ -58,7 +58,7 @@ internals](https://github.com/GLolol/PyLink/blob/0.4.0-dev/classes.py#L267-L272)
- **`knock`**`(self, source, target, text)` - Sends a KNOCK from a PyLink client. - **`knock`**`(self, source, target, text)` - Sends a KNOCK from a PyLink client.
- **`messageClient`**`(self, source, target, text)` - Sends a PRIVMSG from a PyLink client. - **`message`**`(self, source, target, text)` - Sends a PRIVMSG from a PyLink client.
- **`modeClient`**`(self, source, target, modes, ts=None)` - Sends modes from a PyLink client. `modes` takes a set of `([+/-]mode char, mode arg)` tuples. - **`modeClient`**`(self, source, target, modes, ts=None)` - Sends modes from a PyLink client. `modes` takes a set of `([+/-]mode char, mode arg)` tuples.
@ -66,7 +66,7 @@ internals](https://github.com/GLolol/PyLink/blob/0.4.0-dev/classes.py#L267-L272)
- **`nickClient`**`(self, source, newnick)` - Changes the nick of a PyLink client. - **`nickClient`**`(self, source, newnick)` - Changes the nick of a PyLink client.
- **`noticeClient`**`(self, source, target, text)` - Sends a NOTICE from a PyLink client. - **`notice`**`(self, source, target, text)` - Sends a NOTICE from a PyLink client.
- **`numericServer`**`(self, source, numeric, target, text)` - Sends a raw numeric `numeric` with `text` from the `source` server to `target`. - **`numericServer`**`(self, source, numeric, target, text)` - Sends a raw numeric `numeric` with `text` from the `source` server to `target`.

View File

@ -146,5 +146,5 @@ def msg(irc, source, args):
if not text: if not text:
irc.reply('Error: No text given.') irc.reply('Error: No text given.')
return return
irc.proto.messageClient(sourceuid, real_target, text) irc.proto.message(sourceuid, real_target, text)
irc.callHooks([sourceuid, 'PYLINK_BOTSPLUGIN_MSG', {'target': real_target, 'text': text, 'parse_as': 'PRIVMSG'}]) irc.callHooks([sourceuid, 'PYLINK_BOTSPLUGIN_MSG', {'target': real_target, 'text': text, 'parse_as': 'PRIVMSG'}])

View File

@ -753,9 +753,9 @@ def handle_messages(irc, numeric, command, args):
user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False) user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
real_target = prefix + real_target real_target = prefix + real_target
if notice: if notice:
remoteirc.proto.noticeClient(user, real_target, text) remoteirc.proto.notice(user, real_target, text)
else: else:
remoteirc.proto.messageClient(user, real_target, text) remoteirc.proto.message(user, real_target, text)
else: else:
remoteuser = getOrigUser(irc, target) remoteuser = getOrigUser(irc, target)
if remoteuser is None: if remoteuser is None:
@ -773,9 +773,9 @@ def handle_messages(irc, numeric, command, args):
remoteirc = world.networkobjects[homenet] remoteirc = world.networkobjects[homenet]
user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False) user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
if notice: if notice:
remoteirc.proto.noticeClient(user, real_target, text) remoteirc.proto.notice(user, real_target, text)
else: else:
remoteirc.proto.messageClient(user, real_target, text) remoteirc.proto.message(user, real_target, text)
for cmd in ('PRIVMSG', 'NOTICE', 'PYLINK_SELF_NOTICE', 'PYLINK_SELF_PRIVMSG'): for cmd in ('PRIVMSG', 'NOTICE', 'PYLINK_SELF_NOTICE', 'PYLINK_SELF_PRIVMSG'):
utils.add_hook(handle_messages, cmd) utils.add_hook(handle_messages, cmd)

View File

@ -91,13 +91,13 @@ class TS6BaseProtocol(Protocol):
else: else:
raise LookupError("No such PyLink client exists.") raise LookupError("No such PyLink client exists.")
def messageClient(self, numeric, target, text): def message(self, numeric, target, text):
"""Sends a PRIVMSG from a PyLink client.""" """Sends a PRIVMSG from a PyLink client."""
if not self.irc.isInternalClient(numeric): if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink client exists.') raise LookupError('No such PyLink client exists.')
self._send(numeric, 'PRIVMSG %s :%s' % (target, text)) self._send(numeric, 'PRIVMSG %s :%s' % (target, text))
def noticeClient(self, numeric, target, text): def notice(self, numeric, target, text):
"""Sends a NOTICE from a PyLink client.""" """Sends a NOTICE from a PyLink client."""
if not self.irc.isInternalClient(numeric): if not self.irc.isInternalClient(numeric):
raise LookupError('No such PyLink client exists.') raise LookupError('No such PyLink client exists.')