mirror of
				https://github.com/jlu5/PyLink.git
				synced 2025-11-04 00:47:21 +01:00 
			
		
		
		
	protocols: messageClient -> message, noticeClient -> notice
This commit is contained in:
		
							parent
							
								
									108be5e25e
								
							
						
					
					
						commit
						3a53005d8c
					
				@ -428,10 +428,10 @@ class Irc():
 | 
			
		||||
        is optional, and defaults to the main PyLink client if not specified."""
 | 
			
		||||
        source = source or self.pseudoclient.uid
 | 
			
		||||
        if notice:
 | 
			
		||||
            self.proto.noticeClient(source, target, text)
 | 
			
		||||
            self.proto.notice(source, target, text)
 | 
			
		||||
            cmd = 'PYLINK_SELF_NOTICE'
 | 
			
		||||
        else:
 | 
			
		||||
            self.proto.messageClient(source, target, text)
 | 
			
		||||
            self.proto.message(source, target, text)
 | 
			
		||||
            cmd = 'PYLINK_SELF_PRIVMSG'
 | 
			
		||||
        self.callHooks([source, cmd, {'target': target, 'text': text}])
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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.
 | 
			
		||||
 | 
			
		||||
- **`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.
 | 
			
		||||
 | 
			
		||||
@ -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.
 | 
			
		||||
 | 
			
		||||
- **`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`.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -146,5 +146,5 @@ def msg(irc, source, args):
 | 
			
		||||
    if not text:
 | 
			
		||||
        irc.reply('Error: No text given.')
 | 
			
		||||
        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'}])
 | 
			
		||||
 | 
			
		||||
@ -753,9 +753,9 @@ def handle_messages(irc, numeric, command, args):
 | 
			
		||||
            user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
 | 
			
		||||
            real_target = prefix + real_target
 | 
			
		||||
            if notice:
 | 
			
		||||
                remoteirc.proto.noticeClient(user, real_target, text)
 | 
			
		||||
                remoteirc.proto.notice(user, real_target, text)
 | 
			
		||||
            else:
 | 
			
		||||
                remoteirc.proto.messageClient(user, real_target, text)
 | 
			
		||||
                remoteirc.proto.message(user, real_target, text)
 | 
			
		||||
    else:
 | 
			
		||||
        remoteuser = getOrigUser(irc, target)
 | 
			
		||||
        if remoteuser is None:
 | 
			
		||||
@ -773,9 +773,9 @@ def handle_messages(irc, numeric, command, args):
 | 
			
		||||
        remoteirc = world.networkobjects[homenet]
 | 
			
		||||
        user = getRemoteUser(irc, remoteirc, numeric, spawnIfMissing=False)
 | 
			
		||||
        if notice:
 | 
			
		||||
            remoteirc.proto.noticeClient(user, real_target, text)
 | 
			
		||||
            remoteirc.proto.notice(user, real_target, text)
 | 
			
		||||
        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'):
 | 
			
		||||
    utils.add_hook(handle_messages, cmd)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -91,13 +91,13 @@ class TS6BaseProtocol(Protocol):
 | 
			
		||||
        else:
 | 
			
		||||
            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."""
 | 
			
		||||
        if not self.irc.isInternalClient(numeric):
 | 
			
		||||
            raise LookupError('No such PyLink client exists.')
 | 
			
		||||
        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."""
 | 
			
		||||
        if not self.irc.isInternalClient(numeric):
 | 
			
		||||
            raise LookupError('No such PyLink client exists.')
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user