本文整理汇总了Java中org.jivesoftware.openfire.session.LocalClientSession.process方法的典型用法代码示例。如果您正苦于以下问题:Java LocalClientSession.process方法的具体用法?Java LocalClientSession.process怎么用?Java LocalClientSession.process使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jivesoftware.openfire.session.LocalClientSession
的用法示例。
在下文中一共展示了LocalClientSession.process方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: broadcastPresenceOfOtherResource
import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
* Sends the presences of other connected resources to the resource that just connected.
*
* @param session the newly created session.
*/
private void broadcastPresenceOfOtherResource(LocalClientSession session) {
Presence presence;
// Get list of sessions of the same user
JID searchJID = new JID(session.getAddress().getNode(), session.getAddress().getDomain(), null);
List<JID> addresses = routingTable.getRoutes(searchJID, null);
for (JID address : addresses) {
if (address.equals(session.getAddress())) {
continue;
}
// Send the presence of an existing session to the session that has just changed
// the presence
ClientSession userSession = routingTable.getClientRoute(address);
presence = userSession.getPresence().createCopy();
presence.setTo(session.getAddress());
session.process(presence);
}
}
示例2: broadcastPresenceOfOtherResource
import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
* Sends the presences of other connected resources to the resource that just connected.
*
* @param session the newly created session.
*/
private void broadcastPresenceOfOtherResource(LocalClientSession session) {
if (!SessionManager.isOtherResourcePresenceEnabled()) {
return;
}
Presence presence;
// Get list of sessions of the same user
JID searchJID = new JID(session.getAddress().getNode(), session.getAddress().getDomain(), null);
List<JID> addresses = routingTable.getRoutes(searchJID, null);
for (JID address : addresses) {
if (address.equals(session.getAddress())) {
continue;
}
// Send the presence of an existing session to the session that has just changed
// the presence
ClientSession userSession = routingTable.getClientRoute(address);
presence = userSession.getPresence().createCopy();
presence.setTo(session.getAddress());
session.process(presence);
}
}
示例3: changePriority
import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
* Change the priority of a session, that was already available, associated with the sender.
*
* @param session The session whose presence priority has been modified
* @param oldPriority The old priority for the session
*/
public void changePriority(LocalClientSession session, int oldPriority) {
if (session.getAuthToken().isAnonymous()) {
// Do nothing if the session belongs to an anonymous user
return;
}
int newPriority = session.getPresence().getPriority();
if (newPriority < 0 || oldPriority >= 0) {
// Do nothing if new presence priority is not positive and old presence negative
return;
}
// Check presence's priority of other available resources
JID searchJID = new JID(session.getAddress().toBareJID());
for (JID address : routingTable.getRoutes(searchJID, null)) {
if (address.equals(session.getAddress())) {
continue;
}
ClientSession otherSession = routingTable.getClientRoute(address);
if (otherSession.getPresence().getPriority() >= 0) {
return;
}
}
// User sessions had negative presence before this change so deliver messages
if (session.canFloodOfflineMessages()) {
OfflineMessageStore messageStore = server.getOfflineMessageStore();
Collection<OfflineMessage> messages = messageStore.getMessages(session.getAuthToken().getUsername(), true);
for (Message message : messages) {
session.process(message);
}
}
}
示例4: changePriority
import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
* Change the priority of a session, that was already available, associated with the sender.
*
* @param session The session whose presence priority has been modified
* @param oldPriority The old priority for the session
*/
public void changePriority(LocalClientSession session, int oldPriority) {
if (session.getAuthToken().isAnonymous()) {
// Do nothing if the session belongs to an anonymous user
return;
}
int newPriority = session.getPresence().getPriority();
if (newPriority < 0 || oldPriority >= 0) {
// Do nothing if new presence priority is not positive and old presence negative
return;
}
// Check presence's priority of other available resources
JID searchJID = session.getAddress().asBareJID();
for (JID address : routingTable.getRoutes(searchJID, null)) {
if (address.equals(session.getAddress())) {
continue;
}
ClientSession otherSession = routingTable.getClientRoute(address);
if (otherSession.getPresence().getPriority() >= 0) {
return;
}
}
// User sessions had negative presence before this change so deliver messages
if (session.canFloodOfflineMessages()) {
OfflineMessageStore messageStore = server.getOfflineMessageStore();
Collection<OfflineMessage> messages = messageStore.getMessages(session.getAuthToken().getUsername(), true);
for (Message message : messages) {
session.process(message);
}
}
}
示例5: changePriority
import org.jivesoftware.openfire.session.LocalClientSession; //导入方法依赖的package包/类
/**
* Change the priority of a session, that was already available, associated with the sender.
*
* @param session The session whose presence priority has been modified
* @param oldPriority The old priority for the session
*/
public void changePriority(LocalClientSession session, int oldPriority) {
if (session.getAuthToken().isAnonymous()) {
// Do nothing if the session belongs to an anonymous user
return;
}
int newPriority = session.getPresence().getPriority();
if (newPriority < 0 || oldPriority >= 0) {
// Do nothing if new presence priority is not positive and old presence negative
return;
}
// Check presence's priority of other available resources
JID searchJID = new JID(session.getAddress().toBareJID());
for (JID address : routingTable.getRoutes(searchJID, null)) {
if (address.equals(session.getAddress())) {
continue;
}
ClientSession otherSession = routingTable.getClientRoute(address);
if (otherSession.getPresence().getPriority() >= 0) {
return;
}
}
// User sessions had negative presence before this change so deliver messages
if (session.canFloodOfflineMessages()) {
OfflineMessageStore messageStore = server.getOfflineMessageStore();
Collection<OfflineMessage> messages = messageStore.getMessages(session.getAuthToken().getUsername(), true);
Log.info("Delivering " + messages.size() + " offline messages to " + session.getAddress());
for (Message message : messages) {
session.process(message);
}
}
}