本文整理汇总了Java中org.xmpp.muc.LeaveRoom类的典型用法代码示例。如果您正苦于以下问题:Java LeaveRoom类的具体用法?Java LeaveRoom怎么用?Java LeaveRoom使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LeaveRoom类属于org.xmpp.muc包,在下文中一共展示了LeaveRoom类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: filter
import org.xmpp.muc.LeaveRoom; //导入依赖的package包/类
/**
* Filters XMPP Packets based on whether the packets should be processed or
* not. The filtering process is determined by the type of
* <code>Packet</code> that is being passed into the method.
*
* @param packet
* The XMPP packet to be filtered.
* @return <code>true</code> if the packet is <code>null</code> or should be
* filtered out, otherwise <code>false</code>.
*/
public boolean filter(final Packet packet) {
if (LOG.isDebugEnabled()) {
LOG.debug("Filtering XMPP packet");
}
if (packet == null) {
return true;
} else if (packet instanceof Presence) {
return (!(packet instanceof JoinRoom) && !(packet instanceof LeaveRoom));
} else if (packet instanceof Message) {
final Message message = (Message) packet;
final Message.Type messageType = message.getType();
return (messageType != Type.normal && messageType != Type.chat && messageType != Type.groupchat);
} else {
return true;
}
}
开发者ID:surevine,项目名称:openfire-audit-plugin,代码行数:28,代码来源:PacketFilter.java
示例2: setup
import org.xmpp.muc.LeaveRoom; //导入依赖的package包/类
/**
* Sets up the test fixtures.
*/
@Before
public void setup() {
normalMessage = new Message();
normalMessage.setType(Message.Type.normal);
chatMessage = new Message();
chatMessage.setType(Message.Type.chat);
groupMessage = new Message();
groupMessage.setType(Message.Type.groupchat);
errorMessage = new Message();
errorMessage.setType(Message.Type.error);
headlineMessage = new Message();
headlineMessage.setType(Message.Type.headline);
presence = new Presence();
joinRoom = new JoinRoom("a", "b");
leaveRoom = new LeaveRoom("a", "b");
iq = new IQ();
route = new Route("id");
}
开发者ID:surevine,项目名称:openfire-audit-plugin,代码行数:22,代码来源:PacketFilterTest.java
示例3: createAuditMessage
import org.xmpp.muc.LeaveRoom; //导入依赖的package包/类
/**
* Creates an {@link AuditMessage} from an XMPP {@link Presence} packet. This method only
* supports the creation of <code>AuditMessage</code> objects from {@link JoinRoom} and
* {@link LeaveRoom} subclasses.
*
* @param presence
* The XMPP presence packet.
* @return The <code>AuditMessage</code> for the provided <code>Presence</code> packet or an
* <code>AuditException</code> if the <code>Presence</code> packet is <code>null</code>
* or an unsupported subclass.
*/
public AuditMessage createAuditMessage(final Presence presence) {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating an audit message from a presence packet: " + presence);
}
if (presence == null) {
throw new AuditException(
"Unable to create an audit message from a null presence packet");
}
/*
* We are only interested in the presence types for joining or leaving a room. If we receive
* any other types then an error has occured with the packet filtering.
*/
AuditEvent event = null;
if (presence instanceof JoinRoom) {
event = AuditEvent.JOIN_ROOM;
} else if (presence instanceof LeaveRoom) {
event = AuditEvent.LEAVE_ROOM;
} else {
throw new AuditException(
"Unsupported presence type found when creating an audit message");
}
String sender = presence.getFrom().toString();
String receiver = presence.getTo().toString();
Date eventTime = new Date();
return new AuditMessage(event, sender, receiver, eventTime);
}
开发者ID:surevine,项目名称:openfire-audit-plugin,代码行数:42,代码来源:AuditMessageFactory.java
示例4: createGroupChatRoom
import org.xmpp.muc.LeaveRoom; //导入依赖的package包/类
void createGroupChatRoom() {
String roomJID = getGroupChatRoomName() + "/workgroup";
// Create the room by joining it. The workgroup will be the owner of the room and will
// invite the Agent and the user to join the room
JoinRoom joinRoom = new JoinRoom(getFullJID().toString(), roomJID);
send(joinRoom);
// Configure the newly created room
Map<String, Collection<String>> fields = new HashMap<String, Collection<String>>();
// Make a non-public room
List<String> values = new ArrayList<String>();
values.add("0");
fields.put("muc#roomconfig_publicroom", values);
// Set the room name
values = new ArrayList<String>();
values.add("Workgroup " + getJID().getNode() + " Chat Room");
fields.put("muc#roomconfig_roomname", values);
// Set the room description
values = new ArrayList<String>();
values.add("Workgroup Chat Room");
fields.put("muc#roomconfig_roomdesc", values);
// Set the max number of occupants to unlimited
values = new ArrayList<String>();
values.add("0");
fields.put("muc#roomconfig_maxusers", values);
// Set that anyone can change the room subject
values = new ArrayList<String>();
values.add("1");
fields.put("muc#roomconfig_changesubject", values);
// Make the room persistent
values = new ArrayList<String>();
values.add("1");
fields.put("muc#roomconfig_persistentroom", values);
// Make the room not moderated
values = new ArrayList<String>();
values.add("0");
fields.put("muc#roomconfig_moderatedroom", values);
// Make the room not members-only
values = new ArrayList<String>();
values.add("0");
fields.put("muc#roomconfig_membersonly", values);
// Set that anyone can send invitations
values = new ArrayList<String>();
values.add("1");
fields.put("muc#roomconfig_allowinvites", values);
// Make the room not password protected
values = new ArrayList<String>();
values.add("0");
fields.put("muc#roomconfig_passwordprotectedroom", values);
// Enable the log for the room
values = new ArrayList<String>();
values.add("1");
fields.put("muc#roomconfig_enablelogging", values);
// Set that only moderators can see the occupants' JID
values = new ArrayList<String>();
values.add("moderators");
fields.put("muc#roomconfig_whois", values);
// Only broadcast presences of participants and visitors
values = new ArrayList<String>();
values.add("moderator");
values.add("participant");
values.add("visitor");
fields.put("muc#roomconfig_presencebroadcast", values);
RoomConfiguration conf = new RoomConfiguration(fields);
conf.setTo(getGroupChatRoomName());
conf.setFrom(getFullJID());
send(conf);
// Change the subject of the room by sending a new message
Message message = new Message();
message.setType(Message.Type.groupchat);
message.setSubject("This is a private discussion room for members of this workgroup.");
message.setFrom(getFullJID());
message.setTo(getGroupChatRoomName());
send(message);
// Leave Chat Room
LeaveRoom leaveRoom = new LeaveRoom(getFullJID().toString(), roomJID);
send(leaveRoom);
}
开发者ID:igniterealtime,项目名称:Openfire,代码行数:81,代码来源:Workgroup.java
注:本文中的org.xmpp.muc.LeaveRoom类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论