ejabberd
ejabberd copied to clipboard
Why basic XEP-0172 is not supported in community edition?
What version of ejabberd are you using?
Ejabberd 17.01, community
What operating system (version) are you using?
CentOS release 6.7 (Final)
How did you install ejabberd (source, package, distribution)?
Source
What did not work as expected? Are there error messages in the log? What was the unexpected behavior? What was the expected result?
I'm utilizing Ejabberd in Ionic-powered mobile app using Strophe.js library. When I need to initiate the chat with new contact I send the following subscription request according to XEP-0172 and following Stackoverflow answer (http://stackoverflow.com/questions/31197590/ejabberd-can-not-set-nickname-when-add-roster-sometimes):
<body rid='515477470' xmlns='http://jabber.org/protocol/httpbind' sid='0a19b4d4f79ab9107f9655ae3f93e7830aa8b542'>
<presence to='xloading\[email protected]' type='subscribe' xmlns='jabber:client'>
<nick xmlns='http://jabber.org/protocol/nick'>Test T</nick>
</presence>
</body>
The subscription request is processed properly and two records are created in rosterusers table (I use MySQL) with Ask flags set as "O" and "I", however the Nick field is not populated in any of records even though the field is present there.
As I have noticed later XEP-0172 support is not present in Community edition (https://www.process-one.net/en/ejabberd/protocols/). Does it mean that I can't achieve such a trivial behavior without Business edition and only option is to query vcards nickname? :(
I'm not sure exactly this functionality is implemented in eBE. So you cannot do that even with eBE probably :) Also, IIRC, the XEP doesn't say a server should consider this field when populating rosters. I mean, this is not something "basic", but an implementation choice.
I wrote an initial minimal implementation of this. It works with Psi and Converse, and halway works with Gajim. Before applying this patch, it requires having applied the patch from https://github.com/processone/ejabberd/issues/870#issuecomment-1147668375
For testing purposes, if you cannot compile ejabberd yourself, there's a container image available that includes ejabberd with both patches applied in https://github.com/badlop/ejabberd/pkgs/container/ejabberd/24478807?tag=1611
From fe91ab0d17cbdda0c26850c77825526ff5fb3044 Mon Sep 17 00:00:00 2001
From: Badlop <[email protected]>
Date: Tue, 7 Jun 2022 12:07:23 +0200
Subject: Set roster name from XEP-0172, or the stored one (#1611)
---
src/mod_roster.erl | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/mod_roster.erl b/src/mod_roster.erl
index eeefe011b..ab2106954 100644
--- a/src/mod_roster.erl
+++ b/src/mod_roster.erl
@@ -619,6 +619,7 @@ process_subscription(Direction, User, Server, JID1,
{Subscription, Pending} ->
NewItem = Item#roster{subscription = Subscription,
ask = Pending,
+ name = get_nick_subels(SubEls, Item#roster.name),
xs = SubEls,
askmessage = AskMessage},
roster_subscribe_t(LUser, LServer, LJID, NewItem),
@@ -655,6 +656,12 @@ process_subscription(Direction, User, Server, JID1,
false
end.
+get_nick_subels(SubEls, Default) ->
+ case xmpp:get_subtag(#presence{sub_els = SubEls}, #nick{}) of
+ {nick, N} -> N;
+ _ -> Default
+ end.
+
%% in_state_change(Subscription, Pending, Type) -> NewState
%% NewState = none | {NewSubscription, NewPending}
-ifdef(ROSTER_GATEWAY_WORKAROUND).
--
2.34.1
(for version 22.10) I have the same problem. nickName [onSubscirbe] is null from offline state, but if you both online - it's work correct.
- that's as ejabberd should work? (I should call for vCard each time for that information onSubscribe state?)
I wrote an initial minimal implementation of this. It works with Psi and Converse, and halway works with Gajim. Before applying this patch, it requires having applied the patch from #870 (comment)
For testing purposes, if you cannot compile ejabberd yourself, there's a container image available that includes ejabberd with both patches applied in https://github.com/badlop/ejabberd/pkgs/container/ejabberd/24478807?tag=1611
it's possible to use your patch on last version of ejabberd?
it's possible to use your patch on last version of ejabberd?
Yes. I've rebased to master
the branch 1611
which includes both patches, see it in https://github.com/badlop/ejabberd/commits/1611
The container with that branch is in https://github.com/badlop/ejabberd/pkgs/container/ejabberd/70125712?tag=1611 The installers in https://github.com/badlop/ejabberd/actions/runs/4163021389
it's possible to use your patch on last version of ejabberd?
Yes. I've rebased to
master
the branch1611
which includes both patches, see it in https://github.com/badlop/ejabberd/commits/1611The container with that branch is in https://github.com/badlop/ejabberd/pkgs/container/ejabberd/70125712?tag=1611 The installers in https://github.com/badlop/ejabberd/actions/runs/4163021389
Thanks so much! can you make installer for 22.10 version please? it's bring Nick from rosterList? or from original msg created for subscribe with some <Nick> value? (because I push there: Nick|Avatar(in string64) - it will save it for offline notification?
<nick xmlns='http://jabber.org/protocol/nick'>Nick|Avatar(stringBase64)</nick>
Looking at the patch, it gets the nick from the presence stanza, "nick" tag
Installer based in 22.10: https://github.com/badlop/ejabberd/actions/runs/4166669090 Container: https://github.com/badlop/ejabberd/pkgs/container/ejabberd/70245962?tag=1611
Looking at the patch, it gets the nick from the presence stanza, "nick" tag
Installer based in 22.10: https://github.com/badlop/ejabberd/actions/runs/4166669090 Container: https://github.com/badlop/ejabberd/pkgs/container/ejabberd/70245962?tag=1611
Thanks so much. I can see there "ejabberd_22.05.150-1_arm64.deb" - I can install it over 22.10 version without any conflict?(because I'm using 22.10 at the moment)
Yes, it was built using 22.10 + some patches, as seen on the corresponding git branch. For some reason it didn't pick the proper version number.
By the way, it's always recommendable to backup ejabberd install path, database and configuration before upgrading: just copy those directories to a safe place. In case of any trouble with a new version, you can always restore the old directories.
@badlop: Have you planned to look for 870 and 1611 in master?
@Vladimir7i, were you able to test the patch? And does it solve the problem?
Thanks @badlop for the integration in next version :)
@badlop Thanks for add that in next update. it's Awesome! But I actually don't tested it at the moment=( it's possible to download it again? because I lost a lot of data and my prew patch=(
by the way - is super mustHave feature is needed to ejabberd - is add to banList [nickNames] of banned users(like in roster) - blockedList with JID only is unreadable for games - where used googleID/SteamID as JID.
and How take Avatars for rull rosterList - download vCard for eatch player is only way?
But I actually don't tested it at the moment=( it's possible to download it again? because I lost a lot of data and my prew patch=(
Installers are in the bottom of https://github.com/processone/ejabberd/actions/runs/4565926850 and container in https://github.com/processone/ejabberd/pkgs/container/ejabberd/82120965?tag=master