Skip to content

Commit 5bda28c

Browse files
committed
Improved logging. Do not reuse old subscription if affiliation is none.
1 parent 82a529f commit 5bda28c

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

  • src/main/java/org/buddycloud/channelserver/packetprocessor/iq/namespace/pubsub/set

src/main/java/org/buddycloud/channelserver/packetprocessor/iq/namespace/pubsub/set/SubscribeSet.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import org.apache.log4j.Logger;
1010
import org.buddycloud.channelserver.channel.ChannelManager;
1111
import org.buddycloud.channelserver.channel.Conf;
12-
import org.buddycloud.channelserver.db.NodeStore.Transaction;
1312
import org.buddycloud.channelserver.db.exception.NodeStoreException;
1413
import org.buddycloud.channelserver.packetprocessor.iq.namespace.pubsub.JabberPubsub;
1514
import org.buddycloud.channelserver.packetprocessor.iq.namespace.pubsub.PubSubElementProcessorAbstract;
@@ -130,16 +129,18 @@ public void process(Element elm, JID actorJID, IQ reqIQ, Element rsm)
130129
Affiliations defaultAffiliation = null;
131130
Subscriptions defaultSubscription = null;
132131

133-
if (!possibleExistingSubscription.in(Subscriptions.none)) {
132+
if (!possibleExistingSubscription.in(Subscriptions.none) &&
133+
!possibleExistingAffiliation.in(Affiliations.none)) {
134134
LOGGER.debug("User already has a '"
135135
+ possibleExistingSubscription.toString()
136136
+ "' subscription");
137137
defaultAffiliation = possibleExistingAffiliation;
138138
defaultSubscription = possibleExistingSubscription;
139139
} else {
140140
try {
141-
defaultAffiliation = Affiliations.createFromString(nodeConf
142-
.get(Conf.DEFAULT_AFFILIATION));
141+
String nodeDefAffiliation = nodeConf.get(Conf.DEFAULT_AFFILIATION);
142+
LOGGER.debug("Node default affiliation: '" + nodeDefAffiliation + "'");
143+
defaultAffiliation = Affiliations.createFromString(nodeDefAffiliation);
143144
} catch (NullPointerException e) {
144145
LOGGER.error("Could not create affiliation.", e);
145146
defaultAffiliation = Affiliations.member;

0 commit comments

Comments
 (0)