Skip to content

Fixed XMPP Support & SleekXMPP dropped#485

Merged
caronc merged 6 commits intocaronc:masterfrom
linkmauve:fix-slixmpp
Nov 24, 2021
Merged

Fixed XMPP Support & SleekXMPP dropped#485
caronc merged 6 commits intocaronc:masterfrom
linkmauve:fix-slixmpp

Conversation

@linkmauve
Copy link
Contributor

Description:

Related issue (if applicable): #455

Hi, slixmpp dev here. I fixed a bunch of things in the XMPP plugin, and things work here now. I have fixed the most glaring issues as well, each commit is to be reviewed separately for more context.

Fixes #455.

Checklist

  • The code change is tested and works locally.
  • There is no commented out code in this PR.
  • No lint errors (use flake8)
  • 100% test coverage

This adapter had been copied from the SleekXMPP one without ever being
tested, no released version of slixmpp ever used the reattempt=False or
block=True parameters for these two functions.  Additionally,
ClientXMPP.connect() only sets up the connection, the actual connection
will be established in the asyncio event loop.
Those would require a very specialised XMPP service, if the user has
such a server they will be able to modify apprise to support it.
This was the cause of a disconnection in the syntax with non-self JIDs
as targets.
This sends it in the message as <subject/>, as defined in RFC 6121.
The previous code was overriding the hostname and the port in all cases,
which would basically require the user to do the SRV resolving manually
in case their server isn’t on the default port on the same hostname as
their JID’s domainpart.
SleekXMPP has been unmaintained for years now, and is unlikely to ever
be maintained again given its fork slixmpp brought proper Python 3
support alongside asyncio.

In addition, this adapter was already not working for quite a while.

It’s time to say good bye. :)
@caronc
Copy link
Owner

caronc commented Nov 23, 2021

Great work! ❤️ I'm still torn with the thought of dropping SleekXMPP; but i guess if it wasn't working for the users of it anyway, it's not a bad idea. The intent of the module in the past was to use Slixmpp if found (in the event they were both present) and fall back to SleekXMPP. I think the last version of SleekXMPP was a bit broken, but if you were to install 1 version back, it worked okay (can't confirm though)

I was just curious on your opinion here or thought process behind the removal of the legacy module (for those using legacy versions of Python)?

@linkmauve
Copy link
Contributor Author

SleekXMPP hasn’t seen a single commit in three years, last time I’ve heard it was broken with pyasn1 and no one ever stepped up to fix it, I consider it dead. If people want to continue to use that old library, they could also pick an old version of apprise where maybe it would work, but I am in no capacity to maintain or even test it.

The only reason I removed it here was that it was preventing some tests from passing. ^^'

@caronc
Copy link
Owner

caronc commented Nov 24, 2021

@linkmauve I'm okay with your responses; thanks again for such awesome work!

@caronc caronc merged commit 1dfde96 into caronc:master Nov 24, 2021
@linkmauve linkmauve deleted the fix-slixmpp branch November 24, 2021 00:17
# By default we send ourselves a message
if targets:
self.targets = parse_list(targets)
self.targets[0] = self.targets[0][1:]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@linkmauve : Your code is already merged, but i just stumbled on this now. I'm just curious if you could explain to me why we're removing the first entry from the list of targets and keeping the rest?

Copy link
Contributor Author

@linkmauve linkmauve Nov 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually the first character of the first entry, which was previously always a '/' and would make the XMPP server close our connection. I’m definitely not sure this was the proper fix, but something somewhere in the parsing of the URI is keeping the initial slash, that is xmpp://foo:bar@baz/quux@target would otherwise try to send a message to='/quux@target', which is an obviously invalid JID and the server rightfully closes our connection. Other targets work fine.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reply; I believe I tracked the issue down. As a result i created one more small PR (#487) that should fix it and allow you to delimit as many targets as you want on the URL path (/target1/target2/targetN/) . 👍 .

Would you be able to give it a quick test for me? You're so enriched in this XMPP world where as i don't even have a test client 🙂

You should just be able to check the branch out and use the /bin/apprise reference from within it (that will allow you to run an apprise instance against the branch you're within)

@Neustradamus
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Has anyone managed to send an Apprise/XMPP message?

3 participants