Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
Openfire
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Openfire
Commits
b99be2d6
Commit
b99be2d6
authored
Mar 18, 2018
by
Guus der Kinderen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OF-1513: Replaced boilerplate code with utility method.
parent
c26930cf
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
62 additions
and
84 deletions
+62
-84
IQOwnerHandler.java
...ava/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java
+42
-39
LeafNode.java
src/java/org/jivesoftware/openfire/pubsub/LeafNode.java
+6
-13
Node.java
src/java/org/jivesoftware/openfire/pubsub/Node.java
+9
-22
NodeSubscription.java
...va/org/jivesoftware/openfire/pubsub/NodeSubscription.java
+5
-10
No files found.
src/java/org/jivesoftware/openfire/muc/spi/IQOwnerHandler.java
View file @
b99be2d6
...
@@ -207,7 +207,6 @@ public class IQOwnerHandler {
...
@@ -207,7 +207,6 @@ public class IQOwnerHandler {
throws
ForbiddenException
,
ConflictException
,
NotAcceptableException
throws
ForbiddenException
,
ConflictException
,
NotAcceptableException
{
{
List
<
String
>
values
;
List
<
String
>
values
;
String
booleanValue
;
FormField
field
;
FormField
field
;
// Get the new list of admins
// Get the new list of admins
...
@@ -262,9 +261,7 @@ public class IQOwnerHandler {
...
@@ -262,9 +261,7 @@ public class IQOwnerHandler {
field
=
completedForm
.
getField
(
"muc#roomconfig_changesubject"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_changesubject"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setCanOccupantsChangeSubject
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setCanOccupantsChangeSubject
(
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
));
}
}
field
=
completedForm
.
getField
(
"muc#roomconfig_maxusers"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_maxusers"
);
...
@@ -281,16 +278,12 @@ public class IQOwnerHandler {
...
@@ -281,16 +278,12 @@ public class IQOwnerHandler {
field
=
completedForm
.
getField
(
"muc#roomconfig_publicroom"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_publicroom"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setPublicRoom
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setPublicRoom
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
)));
}
}
field
=
completedForm
.
getField
(
"muc#roomconfig_persistentroom"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_persistentroom"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
boolean
isPersistent
=
parseFirstValueAsBoolean
(
field
,
true
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
boolean
isPersistent
=
(
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
));
// Delete the room from the DB if it's no longer persistent
// Delete the room from the DB if it's no longer persistent
if
(
room
.
isPersistent
()
&&
!
isPersistent
)
{
if
(
room
.
isPersistent
()
&&
!
isPersistent
)
{
MUCPersistenceManager
.
deleteFromDB
(
room
);
MUCPersistenceManager
.
deleteFromDB
(
room
);
...
@@ -300,23 +293,17 @@ public class IQOwnerHandler {
...
@@ -300,23 +293,17 @@ public class IQOwnerHandler {
field
=
completedForm
.
getField
(
"muc#roomconfig_moderatedroom"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_moderatedroom"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setModerated
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setModerated
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
)));
}
}
field
=
completedForm
.
getField
(
"muc#roomconfig_membersonly"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_membersonly"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
presences
.
addAll
(
room
.
setMembersOnly
(
parseFirstValueAsBoolean
(
field
,
true
)
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
presences
.
addAll
(
room
.
setMembersOnly
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
))));
}
}
field
=
completedForm
.
getField
(
"muc#roomconfig_allowinvites"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_allowinvites"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setCanOccupantsInvite
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setCanOccupantsInvite
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
)));
}
}
...
@@ -330,9 +317,7 @@ public class IQOwnerHandler {
...
@@ -330,9 +317,7 @@ public class IQOwnerHandler {
if
(
field
!=
null
)
if
(
field
!=
null
)
{
{
passwordProtectionChanged
=
true
;
passwordProtectionChanged
=
true
;
final
String
value
=
field
.
getFirstValue
();
updatedIsPasswordProtected
=
parseFirstValueAsBoolean
(
field
,
true
);
booleanValue
=
(
(
value
!=
null
?
value
:
"1"
)
);
updatedIsPasswordProtected
=
"1"
.
equals
(
booleanValue
);
}
}
field
=
completedForm
.
getField
(
"muc#roomconfig_roomsecret"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_roomsecret"
);
...
@@ -373,43 +358,32 @@ public class IQOwnerHandler {
...
@@ -373,43 +358,32 @@ public class IQOwnerHandler {
field
=
completedForm
.
getField
(
"muc#roomconfig_whois"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_whois"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setCanAnyoneDiscoverJID
((
"anyone"
.
equals
(
field
.
getFirstValue
())));
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setCanAnyoneDiscoverJID
((
"anyone"
.
equals
(
booleanValue
)));
}
}
field
=
completedForm
.
getField
(
"muc#roomconfig_allowpm"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_allowpm"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setCanSendPrivateMessage
(
field
.
getFirstValue
());
room
.
setCanSendPrivateMessage
(
value
);
}
}
field
=
completedForm
.
getField
(
"muc#roomconfig_enablelogging"
);
field
=
completedForm
.
getField
(
"muc#roomconfig_enablelogging"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setLogEnabled
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setLogEnabled
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
)));
}
}
field
=
completedForm
.
getField
(
"x-muc#roomconfig_reservednick"
);
field
=
completedForm
.
getField
(
"x-muc#roomconfig_reservednick"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setLoginRestrictedToNickname
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setLoginRestrictedToNickname
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
)));
}
}
field
=
completedForm
.
getField
(
"x-muc#roomconfig_canchangenick"
);
field
=
completedForm
.
getField
(
"x-muc#roomconfig_canchangenick"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setChangeNickname
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setChangeNickname
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
)));
}
}
field
=
completedForm
.
getField
(
"x-muc#roomconfig_registration"
);
field
=
completedForm
.
getField
(
"x-muc#roomconfig_registration"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
final
String
value
=
field
.
getFirstValue
();
room
.
setRegistrationEnabled
(
parseFirstValueAsBoolean
(
field
,
true
)
);
booleanValue
=
((
value
!=
null
?
value
:
"1"
));
room
.
setRegistrationEnabled
((
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
)));
}
}
// Update the modification date to reflect the last time when the room's configuration
// Update the modification date to reflect the last time when the room's configuration
...
@@ -719,4 +693,33 @@ public class IQOwnerHandler {
...
@@ -719,4 +693,33 @@ public class IQOwnerHandler {
probeResult
=
element
;
probeResult
=
element
;
probeResult
.
add
(
configurationForm
.
getElement
());
probeResult
.
add
(
configurationForm
.
getElement
());
}
}
/**
* Returns the first value of the formfield as a boolean.
*
* @param field A form field (cannot be null)
* @param defaultValue Returned if first value is null or empty.
* @return true if the provided input equals '1' or 'true', false if the input equals '0' or 'false'.
* @throws IllegalArgumentException when the input cannot be parsed as a boolean.
* @Deprecated Use {@link FormField#parseFirstValueAsBoolean(String)} provided by Tinder version 1.3.1 or newer.
*/
@Deprecated
public
static
boolean
parseFirstValueAsBoolean
(
FormField
field
,
boolean
defaultValue
)
{
final
String
value
=
field
.
getFirstValue
();
if
(
value
==
null
||
value
.
isEmpty
()
)
{
return
defaultValue
;
}
if
(
"0"
.
equals
(
value
)
||
"false"
.
equals
(
value
)
)
{
return
false
;
}
if
(
"1"
.
equals
(
value
)
||
"true"
.
equals
(
value
)
)
{
return
true
;
}
throw
new
IllegalArgumentException
(
"Unable to parse value '"
+
value
+
"' as Data Form Field boolean."
);
}
}
}
src/java/org/jivesoftware/openfire/pubsub/LeafNode.java
View file @
b99be2d6
...
@@ -33,6 +33,8 @@ import org.xmpp.packet.IQ;
...
@@ -33,6 +33,8 @@ import org.xmpp.packet.IQ;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.Message
;
import
org.xmpp.packet.Message
;
import
static
org
.
jivesoftware
.
openfire
.
muc
.
spi
.
IQOwnerHandler
.
parseFirstValueAsBoolean
;
/**
/**
* A type of node that contains published items only. It is NOT a container for
* A type of node that contains published items only. It is NOT a container for
* other nodes.
* other nodes.
...
@@ -84,27 +86,19 @@ public class LeafNode extends Node {
...
@@ -84,27 +86,19 @@ public class LeafNode extends Node {
@Override
@Override
protected
void
configure
(
FormField
field
)
throws
NotAcceptableException
{
protected
void
configure
(
FormField
field
)
throws
NotAcceptableException
{
List
<
String
>
values
;
String
booleanValue
;
if
(
"pubsub#persist_items"
.
equals
(
field
.
getVariable
()))
{
if
(
"pubsub#persist_items"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
persistPublishedItems
=
parseFirstValueAsBoolean
(
field
,
true
);
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
persistPublishedItems
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#max_payload_size"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#max_payload_size"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
maxPayloadSize
=
field
.
getFirstValue
()
!=
null
?
Integer
.
parseInt
(
field
.
getFirstValue
()
)
:
5120
;
maxPayloadSize
=
values
.
size
()
>
0
?
Integer
.
parseInt
(
values
.
get
(
0
))
:
5120
;
}
}
else
if
(
"pubsub#send_item_subscribe"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#send_item_subscribe"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
sendItemSubscribe
=
parseFirstValueAsBoolean
(
field
,
true
);
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
sendItemSubscribe
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
}
}
@Override
@Override
void
postConfigure
(
DataForm
completedForm
)
{
void
postConfigure
(
DataForm
completedForm
)
{
List
<
String
>
values
;
if
(!
persistPublishedItems
)
{
if
(!
persistPublishedItems
)
{
// Always save the last published item when not configured to use persistent items
// Always save the last published item when not configured to use persistent items
maxPublishedItems
=
1
;
maxPublishedItems
=
1
;
...
@@ -112,8 +106,7 @@ public class LeafNode extends Node {
...
@@ -112,8 +106,7 @@ public class LeafNode extends Node {
else
{
else
{
FormField
field
=
completedForm
.
getField
(
"pubsub#max_items"
);
FormField
field
=
completedForm
.
getField
(
"pubsub#max_items"
);
if
(
field
!=
null
)
{
if
(
field
!=
null
)
{
values
=
field
.
getValues
();
maxPublishedItems
=
field
.
getFirstValue
()
!=
null
?
Integer
.
parseInt
(
field
.
getFirstValue
()
)
:
50
;
maxPublishedItems
=
values
.
size
()
>
0
?
Integer
.
parseInt
(
values
.
get
(
0
))
:
50
;
}
}
}
}
}
}
...
...
src/java/org/jivesoftware/openfire/pubsub/Node.java
View file @
b99be2d6
...
@@ -44,6 +44,8 @@ import org.xmpp.packet.IQ;
...
@@ -44,6 +44,8 @@ import org.xmpp.packet.IQ;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.JID
;
import
org.xmpp.packet.Message
;
import
org.xmpp.packet.Message
;
import
static
org
.
jivesoftware
.
openfire
.
muc
.
spi
.
IQOwnerHandler
.
parseFirstValueAsBoolean
;
/**
/**
* A virtual location to which information can be published and from which event
* A virtual location to which information can be published and from which event
* notifications and/or payloads can be received (in other pubsub systems, this may
* notifications and/or payloads can be received (in other pubsub systems, this may
...
@@ -498,7 +500,6 @@ public abstract class Node {
...
@@ -498,7 +500,6 @@ public abstract class Node {
}
}
else
if
(
DataForm
.
Type
.
submit
.
equals
(
completedForm
.
getType
()))
{
else
if
(
DataForm
.
Type
.
submit
.
equals
(
completedForm
.
getType
()))
{
List
<
String
>
values
;
List
<
String
>
values
;
String
booleanValue
;
// Get the new list of owners
// Get the new list of owners
FormField
ownerField
=
completedForm
.
getField
(
"pubsub#owner"
);
FormField
ownerField
=
completedForm
.
getField
(
"pubsub#owner"
);
...
@@ -525,40 +526,26 @@ public abstract class Node {
...
@@ -525,40 +526,26 @@ public abstract class Node {
// Do nothing
// Do nothing
}
}
else
if
(
"pubsub#deliver_payloads"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#deliver_payloads"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
deliverPayloads
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
deliverPayloads
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#notify_config"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#notify_config"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
notifyConfigChanges
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
notifyConfigChanges
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#notify_delete"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#notify_delete"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
notifyDelete
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
notifyDelete
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#notify_retract"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#notify_retract"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
notifyRetract
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
notifyRetract
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#presence_based_delivery"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#presence_based_delivery"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
presenceBasedDelivery
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
presenceBasedDelivery
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#subscribe"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#subscribe"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
subscriptionEnabled
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
subscriptionEnabled
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#subscription_required"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#subscription_required"
.
equals
(
field
.
getVariable
()))
{
// TODO Replace this variable for the one defined in the JEP (once one is defined)
// TODO Replace this variable for the one defined in the JEP (once one is defined)
values
=
field
.
getValues
();
subscriptionConfigurationRequired
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
subscriptionConfigurationRequired
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#type"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#type"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
values
=
field
.
getValues
();
...
...
src/java/org/jivesoftware/openfire/pubsub/NodeSubscription.java
View file @
b99be2d6
...
@@ -36,6 +36,8 @@ import org.xmpp.packet.JID;
...
@@ -36,6 +36,8 @@ import org.xmpp.packet.JID;
import
org.xmpp.packet.Message
;
import
org.xmpp.packet.Message
;
import
org.xmpp.packet.Presence
;
import
org.xmpp.packet.Presence
;
import
static
org
.
jivesoftware
.
openfire
.
muc
.
spi
.
IQOwnerHandler
.
parseFirstValueAsBoolean
;
/**
/**
* A subscription to a node. Entities may subscribe to a node to be notified when new events
* A subscription to a node. Entities may subscribe to a node to be notified when new events
* are published to the node. Published events may contain a {@link PublishedItem}. Only
* are published to the node. Published events may contain a {@link PublishedItem}. Only
...
@@ -409,7 +411,6 @@ public class NodeSubscription {
...
@@ -409,7 +411,6 @@ public class NodeSubscription {
void
configure
(
DataForm
options
)
{
void
configure
(
DataForm
options
)
{
List
<
String
>
values
;
List
<
String
>
values
;
String
booleanValue
;
boolean
wasUsingPresence
=
!
presenceStates
.
isEmpty
();
boolean
wasUsingPresence
=
!
presenceStates
.
isEmpty
();
...
@@ -435,14 +436,10 @@ public class NodeSubscription {
...
@@ -435,14 +436,10 @@ public class NodeSubscription {
for
(
FormField
field
:
options
.
getFields
())
{
for
(
FormField
field
:
options
.
getFields
())
{
boolean
fieldExists
=
true
;
boolean
fieldExists
=
true
;
if
(
"pubsub#deliver"
.
equals
(
field
.
getVariable
()))
{
if
(
"pubsub#deliver"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
deliverNotifications
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
deliverNotifications
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#digest"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#digest"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
usingDigest
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
usingDigest
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#digest_frequency"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#digest_frequency"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
values
=
field
.
getValues
();
...
@@ -457,9 +454,7 @@ public class NodeSubscription {
...
@@ -457,9 +454,7 @@ public class NodeSubscription {
}
}
}
}
else
if
(
"pubsub#include_body"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#include_body"
.
equals
(
field
.
getVariable
()))
{
values
=
field
.
getValues
();
includingBody
=
parseFirstValueAsBoolean
(
field
,
true
)
;
booleanValue
=
(
values
.
size
()
>
0
?
values
.
get
(
0
)
:
"1"
);
includingBody
=
"1"
.
equals
(
booleanValue
)
||
"true"
.
equalsIgnoreCase
(
booleanValue
);
}
}
else
if
(
"pubsub#show-values"
.
equals
(
field
.
getVariable
()))
{
else
if
(
"pubsub#show-values"
.
equals
(
field
.
getVariable
()))
{
// Get the new list of presence states for which an entity wants to
// Get the new list of presence states for which an entity wants to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment