public abstract class PresenceAbstract extends AnnotatedXMPPProcessor implements XMPPProcessorIfc
Modifier and Type | Field and Description |
---|---|
static String |
PRESENCE_ELEMENT_NAME
Field description
|
static String |
PRESENCE_PROBE_FULL_JID_KEY |
protected static boolean |
probeFullJID |
protected RosterAbstract |
roster_util
Field description
|
static String |
SKIP_OFFLINE_PROP_KEY
Field description
|
static String |
SKIP_OFFLINE_SYS_PROP_KEY
Field description
|
protected static boolean |
skipOffline |
static String |
USERS_STATUS_CHANGES
Field description
|
protected static String |
XMLNS
Field description
|
ALL_NAMES, ALL_PATHS, cmpInfo
CLIENT_XMLNS
Constructor and Description |
---|
PresenceAbstract() |
Modifier and Type | Method and Description |
---|---|
void |
broadcastProbe(XMPPResourceConnection session,
Queue<Packet> results,
Map<String,Object> settings)
sendPresenceBroadcast method broadcasts given presence to all
buddies from roster and to all users to which direct presence was sent. |
int |
concurrentQueuesNo()
Methods returns a preferable number of threads/packets queues for the plugin.
|
protected static void |
forwardPresence(Queue<Packet> results,
Packet packet,
JID from)
Simply forwards packet to the destination
|
protected static RosterAbstract |
getRosterUtil()
Returns shared instance of class implementing
RosterAbstract -
either default one (RosterFlat ) or the one configured with
"roster-implementation" property. |
protected static void |
initSettings(Map<String,Object> settings) |
protected static Element |
prepareProbe(XMPPResourceConnection session) |
protected static boolean |
requiresPresenceSending(RosterAbstract roster,
JID buddy,
XMPPResourceConnection session,
boolean systemCheck)
Method checks whether a given contact requires sending presence.
|
static void |
sendPresence(StanzaType t,
BareJID from,
BareJID to,
Queue<Packet> results,
Element pres)
Sends Presence stanza from provided parameters without returning created
result
Packet object. |
static Packet |
sendPresence(StanzaType t,
JID from,
JID to,
Queue<Packet> results,
Element pres)
Sends Presence stanza from provided parameters as well as returns created
result
Packet object. |
static void |
updatePresenceChange(Packet presence,
XMPPResourceConnection session,
Queue<Packet> results)
updatePresenceChange method is used to broadcast to all active
resources presence stanza received from other users, like incoming
availability presence, subscription presence and so on... |
static void |
updateUserResources(Element presence,
XMPPResourceConnection session,
Queue<Packet> results,
boolean initial)
updateUserResources method is used to broadcast to all
other resources presence stanza from one user resource. |
id, supDiscoFeatures, supElementNamePaths, supNamespaces, supStreamFeatures, supTypes
canHandle, compareTo, concurrentThreadsPerQueue, getComponentInfo, getInstance, getStatistics, init, isSupporting, supElements, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
process
canHandle, concurrentThreadsPerQueue, getComponentInfo, getStatistics, id, init, isSupporting, supDiscoFeatures, supElementNamePaths, supElements, supNamespaces, supStreamFeatures, supTypes
compareTo
public static final String PRESENCE_ELEMENT_NAME
public static final String SKIP_OFFLINE_PROP_KEY
public static final String PRESENCE_PROBE_FULL_JID_KEY
public static final String SKIP_OFFLINE_SYS_PROP_KEY
public static final String USERS_STATUS_CHANGES
protected static final String XMLNS
protected static boolean skipOffline
protected static boolean probeFullJID
protected RosterAbstract roster_util
public void broadcastProbe(XMPPResourceConnection session, Queue<Packet> results, Map<String,Object> settings) throws NotAuthorizedException, TigaseDBException
sendPresenceBroadcast
method broadcasts given presence to all
buddies from roster and to all users to which direct presence was sent.
Before sending presence method calls requiresPresenceSending()
,
configured to only check local environment status (if enabled) to verify
whether presence needs to be sent.session
- user session which keeps all the user session data and also
gives an access to the user's repository data.results
- this a collection with packets which have been generated as
input packet processing results.settings
- this map keeps plugin specific settings loaded from the
Tigase server configuration.NotAuthorizedException
- if an error occursTigaseDBException
protected static Element prepareProbe(XMPPResourceConnection session) throws NotAuthorizedException
NotAuthorizedException
public int concurrentQueuesNo()
XMPPImplIfc
concurrentQueuesNo
in interface XMPPImplIfc
protected static void initSettings(Map<String,Object> settings) throws TigaseDBException
TigaseDBException
public static void sendPresence(StanzaType t, BareJID from, BareJID to, Queue<Packet> results, Element pres)
Packet
object. In case of missing pres
parameter a
Presence stanza will be created with provided StanzaType
type
t
, JID
type from
and JID
type to
.
Otherwise Presence stanza pres
will be cloned and to
attribute will be set from parameter to
.t
- specifies type of the presence to be send.from
- is a JID
instance with stanza source address.to
- is a JID
instance with stanza destination
address.results
- this a collection with packets which have been generated as
input packet processing results.pres
- an Object of type Element
holding Presence stanza to
be sent.public static Packet sendPresence(StanzaType t, JID from, JID to, Queue<Packet> results, Element pres)
Packet
object. In case of missing pres
parameter a
Presence stanza will be created with provided StanzaType
type
t
, JID
type from
and JID
type to
.
Otherwise Presence stanza pres
will be cloned and to
attribute will be set from parameter to
.t
- specifies type of the presence to be send.from
- is a JID
instance with stanza source address.to
- is a JID
instance with stanza destination
address.results
- this a collection with packets which have been generated as
input packet processing results.pres
- an Object of type Element
holding Presence stanza to
be sent.Packet
holding Presence stanza created from
provided parameters.public static void updatePresenceChange(Packet presence, XMPPResourceConnection session, Queue<Packet> results) throws NotAuthorizedException
updatePresenceChange
method is used to broadcast to all active
resources presence stanza received from other users, like incoming
availability presence, subscription presence and so on... Initial presences
are however sent only to those resources which already have sent initial
presence.presence
- an Element
presence received from other users,
we have to change 'to' attribute to full resource JID.session
- user session which keeps all the user session data and also
gives an access to the user's repository data.results
- this a collection with packets which have been generated as
input packet processing results.NotAuthorizedException
- if an error occurspublic static void updateUserResources(Element presence, XMPPResourceConnection session, Queue<Packet> results, boolean initial) throws NotAuthorizedException
updateUserResources
method is used to broadcast to all
other resources presence stanza from one user resource. So
if new resource connects this method updates presence information about new
resource to old resources and about old resources to new resource.presence
- an Element
presence received from other users,
we have to change 'to' attribute to full resource JID.session
- user session which keeps all the user session data and also
gives an access to the user's repository data.results
- this a collection with packets which have been generated as
input packet processing results.initial
- specifies whether this is an initial presence or not (i.e.
if there is a presence data from the presence stored within
user session object or not)NotAuthorizedException
- if an error occursprotected static void forwardPresence(Queue<Packet> results, Packet packet, JID from)
results
- this a collection with packets which have been generated as
input packet processing results.packet
- to forwardfrom
- is a JID
instance with stanza source address.protected static RosterAbstract getRosterUtil()
RosterAbstract
-
either default one (RosterFlat
) or the one configured with
"roster-implementation" property.RosterAbstract
protected static boolean requiresPresenceSending(RosterAbstract roster, JID buddy, XMPPResourceConnection session, boolean systemCheck) throws NotAuthorizedException, TigaseDBException
skipOffline
and user being offline in the roster
the presence is not sent. Alternatively enabling option
skipOfflineSys
would cause local environment check for user status
and omit sending presence if the local use is offline.roster
- instance of class implementing RosterAbstract
.buddy
- JID of a contact for which a check is to be performed.session
- user session which keeps all the user session data and
also gives an access to the user's repository data.systemCheck
- indicates whether the check should be only based on
local environment state (true
) or rooster state
of given user should also be taken into consideration
(false
).TigaseDBException
NotAuthorizedException
Copyright © 2022 "Tigase, Inc.". All rights reserved.