mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-06 21:21:08 +01:00
merged branch improve_bytestreams in trunk
git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@11821 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
parent
ef74695a1b
commit
8b54f34153
74 changed files with 11866 additions and 1902 deletions
|
|
@ -0,0 +1,57 @@
|
|||
package org.jivesoftware.smackx.bytestreams.ibb;
|
||||
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.packet.XMPPError;
|
||||
|
||||
/**
|
||||
* Utility methods to create packets.
|
||||
*
|
||||
* @author Henning Staib
|
||||
*/
|
||||
public class IBBPacketUtils {
|
||||
|
||||
/**
|
||||
* Returns an error IQ.
|
||||
*
|
||||
* @param from the senders JID
|
||||
* @param to the recipients JID
|
||||
* @param xmppError the XMPP error
|
||||
* @return an error IQ
|
||||
*/
|
||||
public static IQ createErrorIQ(String from, String to, XMPPError xmppError) {
|
||||
IQ errorIQ = new IQ() {
|
||||
|
||||
public String getChildElementXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
errorIQ.setType(IQ.Type.ERROR);
|
||||
errorIQ.setFrom(from);
|
||||
errorIQ.setTo(to);
|
||||
errorIQ.setError(xmppError);
|
||||
return errorIQ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a result IQ.
|
||||
*
|
||||
* @param from the senders JID
|
||||
* @param to the recipients JID
|
||||
* @return a result IQ
|
||||
*/
|
||||
public static IQ createResultIQ(String from, String to) {
|
||||
IQ result = new IQ() {
|
||||
|
||||
public String getChildElementXML() {
|
||||
return null;
|
||||
}
|
||||
|
||||
};
|
||||
result.setType(IQ.Type.RESULT);
|
||||
result.setFrom(from);
|
||||
result.setTo(to);
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue