本文整理了Java中org.jivesoftware.smack.packet.Message.getThread()
方法的一些代码示例,展示了Message.getThread()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getThread()
方法的具体详情如下:
包路径:org.jivesoftware.smack.packet.Message
类名称:Message
方法名:getThread
[英]Returns the thread id of the message, which is a unique identifier for a sequence of "chat" messages. If no thread id is set, null will be returned.
[中]返回消息的线程id,它是一系列“聊天”消息的唯一标识符。如果未设置线程id,则返回null。
代码示例来源:origin: igniterealtime/Smack
@Override
protected boolean acceptSpecific(Message message) {
return thread.equals(message.getThread());
}
代码示例来源:origin: igniterealtime/Smack
@Override
protected boolean acceptSpecific(Message message) {
return StringUtils.isNotEmpty(message.getThread());
}
代码示例来源:origin: igniterealtime/Smack
@Override
public void processStanza(Stanza packet) {
Message message = (Message) packet;
Chat chat;
if (message.getThread() == null) {
// CHECKSTYLE:OFF
chat = getUserChat(message.getFrom());
// CHECKSTYLE:ON
}
else {
chat = getThreadChat(message.getThread());
}
if (chat == null) {
chat = createChat(message);
}
// The chat could not be created, abort here
if (chat == null)
return;
// TODO: Use AsyncButOrdered (with Chat as Key?)
deliverMessage(chat, message);
}
}, packetFilter);
代码示例来源:origin: igniterealtime/Smack
/**
* Creates a new {@link Chat} based on the message. May returns null if no chat could be
* created, e.g. because the message comes without from.
*
* @param message
* @return a Chat or null if none can be created
*/
private Chat createChat(Message message) {
Jid from = message.getFrom();
// According to RFC6120 8.1.2.1 4. messages without a 'from' attribute are valid, but they
// are of no use in this case for ChatManager
if (from == null) {
return null;
}
EntityJid userJID = from.asEntityJidIfPossible();
if (userJID == null) {
LOGGER.warning("Message from JID without localpart: '" + message.toXML(null) + "'");
return null;
}
String threadID = message.getThread();
if (threadID == null) {
threadID = nextID();
}
return createChat(userJID, threadID, false);
}
代码示例来源:origin: igniterealtime/Smack
@Test
public void setMessageThreadTest() throws IOException, SAXException {
final String messageThread = "1234";
StringBuilder controlBuilder = new StringBuilder();
controlBuilder.append("<message>")
.append("<thread>")
.append(messageThread)
.append("</thread>")
.append("</message>");
String control = controlBuilder.toString();
Message message = getNewMessage();
message.setThread(messageThread);
assertEquals(messageThread, message.getThread());
assertXMLEqual(control, message.toXML(StreamOpen.CLIENT_NAMESPACE).toString());
}
代码示例来源:origin: igniterealtime/Smack
if (original.getThread() != null) {
reply.setThread(original.getThread());
代码示例来源:origin: spring-projects/spring-integration
@Override
protected Map<String, Object> extractStandardHeaders(Message source) {
Map<String, Object> headers = new HashMap<>();
Jid from = source.getFrom();
if (from != null) {
headers.put(XmppHeaders.FROM, from.toString());
}
String subject = source.getSubject();
if (StringUtils.hasText(subject)) {
headers.put(XmppHeaders.SUBJECT, subject);
}
String thread = source.getThread();
if (StringUtils.hasText(thread)) {
headers.put(XmppHeaders.THREAD, thread);
}
Jid to = source.getTo();
if (to != null) {
headers.put(XmppHeaders.TO, to.toString());
}
Message.Type type = source.getType();
if (type != null) {
headers.put(XmppHeaders.TYPE, type);
}
return headers;
}
代码示例来源:origin: igniterealtime/Smack
msg2.setThread(msg.getThread());
msg2.setType(Message.Type.chat);
msg2.setBody("To enter a case please fill out this form and send it back to me");
代码示例来源:origin: org.littleshoot/smack-xmpp-3-2-2
public boolean accept(Packet packet) {
return packet instanceof Message && thread.equals(((Message) packet).getThread());
}
}
代码示例来源:origin: org.mobicents.resources/mobicents-slee-ra-xmpp-library
public boolean accept(Packet packet) {
if (packet instanceof Message) {
return thread.equals(((Message)packet).getThread());
}
else {
return false;
}
}
}
代码示例来源:origin: spring-projects/spring-integration
@Test
public void fromHeadersStandardOutbound() {
DefaultXmppHeaderMapper mapper = new DefaultXmppHeaderMapper();
Map<String, Object> headerMap = new HashMap<>();
headerMap.put("userDefined1", "foo");
headerMap.put("userDefined2", "bar");
headerMap.put(XmppHeaders.THREAD, "test.thread");
headerMap.put(XmppHeaders.TO, "test.to");
headerMap.put(XmppHeaders.FROM, "test.from");
headerMap.put(XmppHeaders.SUBJECT, "test.subject");
headerMap.put(XmppHeaders.TYPE, "headline");
MessageHeaders headers = new MessageHeaders(headerMap);
Message target = new Message();
mapper.fromHeadersToRequest(headers, target);
// "standard" XMPP headers
assertEquals("test.thread", target.getThread());
assertEquals("test.to", target.getTo().toString());
assertEquals("test.from", target.getFrom().toString());
assertEquals("test.subject", target.getSubject());
assertEquals(Message.Type.headline, target.getType());
// user-defined headers not included by default
assertNull(JivePropertiesManager.getProperty(target, "userDefined1"));
assertNull(JivePropertiesManager.getProperty(target, "userDefined2"));
// transient headers should not be copied
assertNull(JivePropertiesManager.getProperty(target, "id"));
assertNull(JivePropertiesManager.getProperty(target, "timestamp"));
}
代码示例来源:origin: spring-projects/spring-integration
assertNull(target.getThread());
assertNull(target.getTo());
assertNull(target.getFrom());
代码示例来源:origin: spring-projects/spring-integration
boolean bodyMatches = smackMessage.getBody().equals("Hello Kitty");
boolean toMatches = smackMessage.getTo().equals("kermit@frog.com");
boolean threadIdMatches = smackMessage.getThread().equals("123");
return bodyMatches & toMatches & threadIdMatches;
}));
代码示例来源:origin: org.mule.transports/mule-transport-xmpp
private void copyThread(Message xmppMessage, MuleMessage muleMessage)
{
String thread = xmppMessage.getThread();
if (StringUtils.isNotEmpty(thread))
{
muleMessage.setOutboundProperty(XmppConnector.XMPP_THREAD, thread);
}
}
代码示例来源:origin: org.igniterealtime.smack/smack
private Chat createChat(Message message) {
String threadID = message.getThread();
if(threadID == null) {
threadID = nextID();
}
String userJID = message.getFrom();
return createChat(userJID, threadID, false);
}
代码示例来源:origin: org.littleshoot/smack-xmpp-3-2-2
private Chat createChat(Message message) {
String threadID = message.getThread();
if(threadID == null) {
threadID = nextID();
}
String userJID = message.getFrom();
return createChat(userJID, threadID, false);
}
代码示例来源:origin: org.littleshoot/smack-xmpp-3-2-2
public void interceptPacket(Packet packet) {
Message message = (Message) packet;
Chat chat = connection.getChatManager().getThreadChat(message.getThread());
if (chat == null) {
return;
}
if (updateChatState(chat, ChatState.active)) {
message.addExtension(new ChatStateExtension(ChatState.active));
}
}
}
代码示例来源:origin: apache/servicemix-bundles
@Override
protected void onSendBeforeWrite(WebServiceMessage message) throws IOException {
responseMessage = new Message(requestMessage.getFrom(), Message.Type.chat);
responseMessage.setFrom(connection.getUser());
responseMessage.setThread(requestMessage.getThread());
}
代码示例来源:origin: org.springframework.ws/spring-ws-support
private StanzaFilter createPacketFilter() {
AndFilter andFilter = new AndFilter();
andFilter.addFilter(new StanzaTypeFilter(Message.class));
andFilter.addFilter(new ThreadFilter(requestMessage.getThread()));
return andFilter;
}
代码示例来源:origin: spring-projects/spring-ws
@Override
protected void onSendBeforeWrite(WebServiceMessage message) throws IOException {
responseMessage = new Message(requestMessage.getFrom(), Message.Type.chat);
responseMessage.setFrom(connection.getUser());
responseMessage.setThread(requestMessage.getThread());
}
内容来源于网络,如有侵权,请联系作者删除!