/** * Sets who the stanza is being sent "to". The XMPP protocol often makes * the "to" attribute optional, so it does not always need to be set. * * @param to who the stanza is being sent to. * @throws IllegalArgumentException if to is not a valid JID String. * @deprecated use {@link #setTo(Jid)} instead. */ @Deprecated public void setTo(String to) { Jid jid; try { jid = JidCreate.from(to); } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } setTo(jid); }
private static void sendToIndividualRecipients(XMPPConnection connection, Stanza packet, Collection<? extends Jid> to, Collection<? extends Jid> cc, Collection<? extends Jid> bcc) throws NotConnectedException, InterruptedException { if (to != null) { for (Jid jid : to) { packet.setTo(jid); connection.sendStanza(new PacketCopy(packet.toXML(null))); } } if (cc != null) { for (Jid jid : cc) { packet.setTo(jid); connection.sendStanza(new PacketCopy(packet.toXML(null))); } } if (bcc != null) { for (Jid jid : bcc) { packet.setTo(jid); connection.sendStanza(new PacketCopy(packet.toXML(null))); } } }
&& StringUtils.isNullOrEmpty(replyTo) && StringUtils.isNullOrEmpty(replyRoom)) { Jid toJid = to.iterator().next(); packet.setTo(toJid); connection.sendStanza(packet); return;
packet.setTo(serviceAddress);
/** * Sets who the stanza is being sent "to". The XMPP protocol often makes * the "to" attribute optional, so it does not always need to be set. * * @param to who the stanza is being sent to. * @throws IllegalArgumentException if to is not a valid JID String. * @deprecated use {@link #setTo(Jid)} instead. */ @Deprecated public void setTo(String to) { Jid jid; try { jid = JidCreate.from(to); } catch (XmppStringprepException e) { throw new IllegalArgumentException(e); } setTo(jid); }
mChatMessageListener = new ChatMessageListener() { @Override public void processMessage(Chat chat, Message message) { log.log(Level.INFO, "Received message: " + message.getBody() + " from: " + chat.getParticipant()); if(message != null || !message.getBody().isEmpty()) { DeliveryReceiptManager deliveryReceiptManager = DeliveryReceiptManager.getInstanceFor(mClientConnection); if(DeliveryReceiptManager.hasDeliveryReceiptRequest(message)) { log.log(Level.INFO, "hasDeliveryReceiptRequest == true"); Stanza received = new Message(); received.addExtension(new DeliveryReceipt(message.getStanzaId())); received.setTo(message.getFrom()); try { mClientConnection.sendStanza(received); } catch(NotConnectedException ex) { log.log(Level.SEVERE, "NotConnectedException: " + ex.getMessage()); } catch(Exception ex) { log.log(Level.SEVERE, "Exception: " + ex.getMessage()); } } ......
presencePacketWithSSRC.setTo(recipient); presencePacketWithSSRC.addExtension(new Nick(this.nickname)); MediaPacketExtension mediaPacket = new MediaPacketExtension();
presencePacket.setTo(roomURL + "/" + nickname); presencePacket.addExtension(new Nick(nickname)); connection.sendStanza(presencePacket);