Skip to content

Commit

Permalink
OF-2397: Do not process subscription requests for shared contacts
Browse files Browse the repository at this point in the history
When a contact is a contact by virtue of being in a shared group, the presence subscription between the roster owner and this contact is deemed to be static.

Presence subscriptions sent by the client of either party should not affect this status.
  • Loading branch information
guusdk committed Nov 27, 2024
1 parent 9b4ce6f commit 8ea2adc
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2004-2008 Jive Software, 2017-2023 Ignite Realtime Foundation. All rights reserved.
* Copyright (C) 2004-2008 Jive Software, 2017-2024 Ignite Realtime Foundation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -299,6 +299,9 @@ private boolean manageSub(JID target, boolean isSending, Presence presence, Rost
try {
if (roster.isRosterItem(target)) {
item = roster.getRosterItem(target);
if (item.isShared()) {
throw new SharedGroupException("Target '" + target + "' is on the roster of '" + roster.getUsername() + "' as part of a shared group. As such, its presence subscription status cannot be modified with subscription requests.");
}
}
else {
if (Presence.Type.unsubscribed == type || Presence.Type.unsubscribe == type ||
Expand Down

0 comments on commit 8ea2adc

Please sign in to comment.