Skip to content

Eliminate / from appearing in XMPP targets#487

Closed
caronc wants to merge 1 commit intomasterfrom
455-xmpp-slash-prefix-fix
Closed

Eliminate / from appearing in XMPP targets#487
caronc wants to merge 1 commit intomasterfrom
455-xmpp-slash-prefix-fix

Conversation

@caronc
Copy link
Owner

@caronc caronc commented Nov 24, 2021

Description:

Related issue (if applicable): #455

This is a follow up to Merge request #485 (thanks so much to @linkmauve).

This slight update addresses just one small comment found post-code-review.

It should properly prevent any XMPP targets from starting with a / (slash)

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

@caronc caronc closed this Dec 2, 2021
@linkmauve
Copy link
Contributor

Woops sorry I missed this one, it looks fine to me.

@caronc
Copy link
Owner Author

caronc commented Dec 2, 2021

Woops sorry I missed this one, it looks fine to me.

No worries, I was thinking about this more and thought that (XMPP) targets can include slashes on them no?

like topic/additional/stuff?

It would make it more tricky to have an xmpp://topic/additional/stuff/topic2/
the current patch (this PR as it is now) would be break it into 4 things (topic, additional, stuff, and topic) where one might have intended:

  • topic/additional/stuff
  • topic2

The way you have it now, you're dropping the initial slash (/) but are only able to contain 1 target per Apprise URL (which isn't the end of the world).

Or am in interpreting this wrong? Would you be able to just throw some advance/basic topics at me one my pass in?

@linkmauve
Copy link
Contributor

linkmauve commented Dec 2, 2021

A JID (Jabber ID, or XMPP address nowadays since “Jabber” is less used) can indeed contain a slash followed with a string we call a resource, in which case it becomes what we call a full JID (the opposite is a bare JID). It is meant as an internal routing detail of the protocol, to address a particular running client.

Nowadays, with Message Carbons and Message Archive Management being ubiquitous, all clients of a user (even non-connected ones) will eventually see the same messages, so it doesn’t really make sense any more to expose this detail to users. It is pretty much considered a UX bug to do so as the resource can be a very technical-looking string which can scare less-technical users, and doesn’t bring anything to them.

For this reason, I’d say it’s best to consider JIDs as always being bare JIDs, of the form username@domain, and to repurpose the slash however you want.

And as always, feel free to ask me anything about the protocols, I really enjoy talking about them!

@caronc
Copy link
Owner Author

caronc commented Dec 2, 2021

Thank you for your fast response. I can re-open this ticket and perform the merge if you want. It would definitely allow Apprise to handle:
xmpp://service/user@test/user2@testserver2 as an example and break that into 2 separate JID's (by the sounds of what you're describing) but it will invalidate the use of slashes for resources. But as you identified, that shouldn't be a problem anyway.

I don't have an XMPP endpoint to test against, but if you wouldn't mind just doing the following for me, i'd relaly really appreciate it:

# Create a virtual environment to work in
# This way you can just destroy it after when it's all over.
# The below will create a directory called apprise
python3 -m venv apprise

# Change into our new directory
cd apprise

# Activate our virtual environment
source bin/activate

# Install the branch
pip install git+https://github.com/caronc/apprise.git@455-xmpp-slash-prefix-fix

# Give it a go:
# JID 1 and JID2 can be the same (you'll just get 2 notifications if it all works as expected anyway):
apprise -vv -b "test" \
   "xmpp://server.details/JID1/JID2"

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.

2 participants