In addition to GATE-146: How should the registration process in XEP-0100 interpreted? I’‘ve written a number of tests based on my interpretation of the XEP. I’‘m noticing a number of failures though, when I run those tests on the gateway plugin. I’'m listing them here. For your consideration
Following section 4.1.1.6, the transport should check the legacy credentials received for validity on the legacy domain, returning if that fails. The plugin however accepts any user/pass combination during registration.
Taking 4.1.1.9 into account, I would expect the transport to send out an subscription request, after the legacy credentials have been verified. The gateway plugin doesn’'t send out subscription requests though.
Going further on the same subject, I would expect the transport to accept and return subscription requests from previously registered users (section 9 and 10). Subscription requests addressed at transport components of the gateway plugin go unanswered though.
Trying to unregister with a malformed packet (XEP-0077, section 3.2, table 1) should return , but is accepted. That’'s easily fixed by adjusting BaseTransport like this:
@@ -554,6 +554,12 @@
// this.convinceNotToLeave() ... kidding.
IQ result = IQ.createResultIQ(packet); + if (packet.getChildElement().elements().size() != 1) {
+ result.setError(Condition.bad_request);
+ reply.add(result);
+ return reply;
+ }
+
// Tell the end user the transport went byebye.
Presence unavailable = new Presence(Presence.Type.unavailable);
unavailable.setTo(from);
If a user tries to delete his registration, without being registered first, the XEP calls for a . The current plugin doesn’‘t even send back an error (but throws a only if the user isn’'t a member of the local XMPP domain). Two adjustments will fix this:
@@ -565,7 +571,7 @@
}
catch (UserNotFoundException e) {
Log.error("Error cleaning up contact list of: " + from);
- result.setError(Condition.bad_request);
+ result.setError(Condition.registration_required);
} reply.add(result);
@@ -1331,6 +1345,9 @@
*/
public void deleteRegistration(JID jid) throws UserNotFoundException {
Collection<Registration> registrations = registrationManager.getRegistrations(jid, this.transportType);
+ if (registrations.isEmpty()) {
+ throw new UserNotFoundException("User wasn''t registered.");
+ }
// For now, we''re going to have to just nuke all of these. Sorry.
for (Registration reg : registrations) {
registrationManager.deleteRegistration(reg);