@Override public void action() throws NotConnectedException { try { connection.sendStanza(response); } catch (InterruptedException e) { // Ignore } } });
public void sendErrorMalformedRequest(Jingle request) throws SmackException.NotConnectedException, InterruptedException { connection.sendStanza(createErrorMalformedRequest(request)); } }
@Override public void actionPerformed(ActionEvent e) { if (!"".equals(adhocMessages.getText())) { AdHocPacket packetToSend = new AdHocPacket(adhocMessages.getText()); try { connection.sendStanza(packetToSend); } catch (InterruptedException | NotConnectedException e1) { LOGGER.log(Level.WARNING, "exception", e); } } } });
void sendMessage(Chat chat, Message message) throws NotConnectedException, InterruptedException { for (Map.Entry<MessageListener, StanzaFilter> interceptor : interceptors.entrySet()) { StanzaFilter filter = interceptor.getValue(); if (filter != null && filter.accept(message)) { interceptor.getKey().processMessage(message); } } connection().sendStanza(message); }
/** * Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream open * request is rejected because its block size is greater than the maximum allowed block size. * * @param request IQ stanza that should be answered with a resource-constraint error * @throws NotConnectedException * @throws InterruptedException */ protected void replyResourceConstraintPacket(IQ request) throws NotConnectedException, InterruptedException { IQ error = IQ.createErrorResponse(request, StanzaError.Condition.resource_constraint); connection().sendStanza(error); }
/** * Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream * session could not be found. * * @param request IQ stanza that should be answered with a item-not-found error * @throws NotConnectedException * @throws InterruptedException */ protected void replyItemNotFoundPacket(IQ request) throws NotConnectedException, InterruptedException { IQ error = IQ.createErrorResponse(request, StanzaError.Condition.item_not_found); connection().sendStanza(error); }
/** * Reloads the entire roster from the server. This is an asynchronous operation, * which means the method will return immediately, and the roster will be * reloaded at a later point when the server responds to the reload request. * @throws NotConnectedException * @throws InterruptedException */ public void reload() throws NotConnectedException, InterruptedException { AgentStatusRequest request = new AgentStatusRequest(); request.setTo(workgroupJID); connection.sendStanza(request); }
/** * Accepts the offer. * @throws NotConnectedException * @throws InterruptedException */ public void accept() throws NotConnectedException, InterruptedException { Stanza acceptPacket = new AcceptPacket(this.session.getWorkgroupJID()); connection.sendStanza(acceptPacket); // TODO: listen for a reply. accepted = true; }
/** * Responses to the given IQ packet's sender with an XMPP error that an In-Band Bytestream is * not accepted. * * @param request IQ stanza that should be answered with a not-acceptable error * @throws NotConnectedException * @throws InterruptedException */ protected void replyRejectPacket(IQ request) throws NotConnectedException, InterruptedException { IQ error = IQ.createErrorResponse(request, StanzaError.Condition.not_acceptable); connection().sendStanza(error); }
/** * Sends a message to the chat room. * * @param text the text of the message to send. * @throws NotConnectedException * @throws InterruptedException */ public void sendMessage(String text) throws NotConnectedException, InterruptedException { Message message = createMessage(); message.setBody(text); connection.sendStanza(message); }
public void sendStanza(IQ iq) throws NotConnectedException, InterruptedException { if (iq instanceof Jingle) { sendFormattedJingle((Jingle) iq); } else { getConnection().sendStanza(iq); } }
/** * Sends a Message to the chat room. * * @param message the message. * @throws NotConnectedException * @throws InterruptedException */ public void sendMessage(Message message) throws NotConnectedException, InterruptedException { message.setTo(room); message.setType(Message.Type.groupchat); connection.sendStanza(message); }
/** * Rejects the offer. * @throws NotConnectedException * @throws InterruptedException */ public void reject() throws NotConnectedException, InterruptedException { RejectPacket rejectPacket = new RejectPacket(this.session.getWorkgroupJID()); connection.sendStanza(rejectPacket); // TODO: listen for a reply. rejected = true; }
@Override protected synchronized void writeToXML(DataPacketExtension data) throws NotConnectedException, InterruptedException { // create message stanza containing data packet Message message = new Message(remoteJID); message.addExtension(data); connection.sendStanza(message); }
/** * Cancel the presence subscription the XMPP entity representing this roster entry has with us. * * @throws NotConnectedException * @throws InterruptedException * @since 4.2 */ public void cancelSubscription() throws NotConnectedException, InterruptedException { Presence unsubscribed = new Presence(item.getJid(), Type.unsubscribed); connection().sendStanza(unsubscribed); }
public void sendSubscriptionRequest(BareJid jid) throws NotLoggedInException, NotConnectedException, InterruptedException { final XMPPConnection connection = getAuthenticatedConnectionOrThrow(); // Create a presence subscription packet and send. Presence presencePacket = new Presence(Presence.Type.subscribe); presencePacket.setTo(jid); connection.sendStanza(presencePacket); }
private static void send(String messageString, XMPPConnection from, XMPPConnection to) throws NotConnectedException, InterruptedException { Message message = new Message(to.getUser()); message.setBody(messageString); from.sendStanza(message); }
public void sendGeoLocationToJid(GeoLocation geoLocation, Jid jid) throws InterruptedException, NotConnectedException { final XMPPConnection connection = connection(); Message geoLocationMessage = new Message(jid); geoLocationMessage.addExtension(geoLocation); connection.sendStanza(geoLocationMessage); }
public void sendFriendshipRequest(BareJid bareJid) throws NotConnectedException, InterruptedException { Presence presence = new Presence(Presence.Type.subscribe); presence.setTo(bareJid); friendshipRequestedCache.put(bareJid, null); connection().sendStanza(presence); }
public void unfriend(Jid friend) throws NotConnectedException, InterruptedException { if (isMyFriend(friend)) { Presence presence = new Presence(Presence.Type.unsubscribed); presence.setTo(friend); connection().sendStanza(presence); } }