From ae094fe9b4448edc0364d3fe2c0cd17211826368 Mon Sep 17 00:00:00 2001 From: theunkn0wn1 Date: Sun, 3 Feb 2019 12:16:58 -0800 Subject: [PATCH 1/7] Split users by space only. - resolves #113 (non-standard hostmasks) - this change falls in line with the RFC specification for whitespace -- Python considers formatting characters as whitespace(incorrect here) --- pydle/features/rfc1459/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydle/features/rfc1459/client.py b/pydle/features/rfc1459/client.py index 773efed..86a6636 100644 --- a/pydle/features/rfc1459/client.py +++ b/pydle/features/rfc1459/client.py @@ -914,7 +914,7 @@ async def on_raw_353(self, message): self.channels[channel]['public'] = False # Update channel user list. - for entry in names.split(): + for entry in names.split(' '): statuses = [] # Make entry safe for _parse_user(). safe_entry = entry.lstrip(''.join(self._nickname_prefixes.keys())) From c80380a996d2af703b5aee89b97fed4817b0697f Mon Sep 17 00:00:00 2001 From: theunkn0wn1 Date: Sun, 7 Apr 2019 13:17:07 -0700 Subject: [PATCH 2/7] Resolved missing client import in ctcp --- pydle/features/ctcp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydle/features/ctcp.py b/pydle/features/ctcp.py index 84cd631..42cdbf4 100644 --- a/pydle/features/ctcp.py +++ b/pydle/features/ctcp.py @@ -2,7 +2,7 @@ # Client-to-Client-Protocol (CTCP) support. import pydle.protocol from pydle.features import rfc1459 - +from pydle import client __all__ = [ 'CTCPSupport' ] From ea2e118c8d4262717d28427b06dcebe54514f872 Mon Sep 17 00:00:00 2001 From: theunkn0wn1 Date: Sun, 7 Apr 2019 13:17:17 -0700 Subject: [PATCH 3/7] resolved missing await in ctcp --- pydle/features/ctcp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pydle/features/ctcp.py b/pydle/features/ctcp.py index 42cdbf4..ac0d297 100644 --- a/pydle/features/ctcp.py +++ b/pydle/features/ctcp.py @@ -36,7 +36,7 @@ async def on_ctcp_version(self, by, target, contents): import pydle version = '{name} v{ver}'.format(name=pydle.__name__, ver=pydle.__version__) - self.ctcp_reply(by, 'VERSION', version) + await self.ctcp_reply(by, 'VERSION', version) ## IRC API. From d2a4df0f02e92c170c699d95aa4f3d35776b3b96 Mon Sep 17 00:00:00 2001 From: theunkn0wn1 Date: Sun, 7 Apr 2019 13:18:20 -0700 Subject: [PATCH 4/7] resolved a name shadowing in ctcp --- pydle/features/ctcp.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pydle/features/ctcp.py b/pydle/features/ctcp.py index ac0d297..b307731 100644 --- a/pydle/features/ctcp.py +++ b/pydle/features/ctcp.py @@ -84,14 +84,14 @@ async def on_raw_notice(self, message): if is_ctcp(msg): self._sync_user(nick, metadata) - type, response = parse_ctcp(msg) + _type, response = parse_ctcp(msg) # Find dedicated handler if it exists. - attr = 'on_ctcp_' + pydle.protocol.identifierify(type) + '_reply' + attr = 'on_ctcp_' + pydle.protocol.identifierify(_type) + '_reply' if hasattr(self, attr): await getattr(self, attr)(user, target, response) # Invoke global handler. - await self.on_ctcp_reply(user, target, type, response) + await self.on_ctcp_reply(user, target, _type, response) else: await super().on_raw_notice(message) From 5d1e54cf230845301e56c39dfc12b00fedf3ce41 Mon Sep 17 00:00:00 2001 From: theunkn0wn1 Date: Sun, 7 Apr 2019 13:22:20 -0700 Subject: [PATCH 5/7] Hopefully resolved bad reference to `user` in ctcp - Changed to nickname as that seens to make the most sense. --- pydle/features/ctcp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pydle/features/ctcp.py b/pydle/features/ctcp.py index b307731..9f4e594 100644 --- a/pydle/features/ctcp.py +++ b/pydle/features/ctcp.py @@ -89,9 +89,9 @@ async def on_raw_notice(self, message): # Find dedicated handler if it exists. attr = 'on_ctcp_' + pydle.protocol.identifierify(_type) + '_reply' if hasattr(self, attr): - await getattr(self, attr)(user, target, response) + await getattr(self, attr)(nick, target, response) # Invoke global handler. - await self.on_ctcp_reply(user, target, _type, response) + await self.on_ctcp_reply(nick, target, _type, response) else: await super().on_raw_notice(message) From 7e2ba474d0e787612f2aea516eca4086125540c0 Mon Sep 17 00:00:00 2001 From: theunkn0wn1 Date: Sun, 7 Apr 2019 14:15:46 -0700 Subject: [PATCH 6/7] Added authentication information. closes #115 --- README.md | 2 +- docs/usage.rst | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ad1f5e1..6e7b75b 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Features Basic Usage ----------- -`python3 setup.py install` +`pip install pydle` From there, you can `import pydle` and subclass `pydle.Client` for your own functionality. diff --git a/docs/usage.rst b/docs/usage.rst index 65268d5..ac97b8f 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -60,6 +60,53 @@ This trivial example shows a few things: was implemented or no callbacks overridden. .. _`advanced string formatting`: http://legacy.python.org/dev/peps/pep-3101/ +Authentication +----------------- +Pydle can also handle authenticating against IRC services by default, all you need to do is tell +it what its credentials are. + +.. note:: + the server must support SASL based authentication. + +----------- +SASL(Username + password) +----------- +To authenticate, pydle simply needs to be provided with a set of credentials to present during the +connection process, the most common type being a username+password pair + +.. code:: python + + import pydle + + client = pydle.Client( + nickname="my_irc_bot[bot]", + sasl_username = "username", + sasl_password = "my_secret_bot_password", + sasl_identity = "account_to_identify_against", + ) + +----------- +External authentication (Certificate) +----------- +As an alternative to using passwords for credentials, certificates can also be used via the +SASL (External) authentication method. + +All you need to do is tell pydle where it can find the certificate, which it will then present +during the TLS handshake when connecting to the server. + +.. code:: python + + import pydle + + client = pydle.Client( + nickname="my_irc_bot[bot]", + sasl_mechanism = "EXTERNAL", + tls_client_cert = "/path/to/client_certificate" + ) + +.. note:: + this authentication mode only works over TLS connections + Multiple servers, multiple clients ---------------------------------- From 2038642c5af3998e0c1ff46b0cfcde78f848eb48 Mon Sep 17 00:00:00 2001 From: Joshua Salzedo Date: Sun, 4 Aug 2019 20:36:05 -0700 Subject: [PATCH 7/7] Release 0.9.2 --- pydle/__init__.py | 4 ++-- setup.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pydle/__init__.py b/pydle/__init__.py index ee4c02c..0837794 100644 --- a/pydle/__init__.py +++ b/pydle/__init__.py @@ -8,8 +8,8 @@ from asyncio import coroutine, Future __name__ = 'pydle' -__version__ = '0.9.1' -__version_info__ = (0, 9, 1) +__version__ = '0.9.2' +__version_info__ = (0, 9, 2) __license__ = 'BSD' diff --git a/setup.py b/setup.py index fe13b71..8689ee9 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='pydle', - version='0.9.1', + version='0.9.2', python_requires=">=3.5", packages=[ 'pydle',