public final class CarbonManager
extends org.jivesoftware.smack.Manager
CarbonExtension
support, enabling and disabling message carbons, and for CarbonCopyReceivedListener.
Note that it is important to match the 'from' attribute of the message wrapping a carbon copy, as otherwise it would
may be possible for others to impersonate users. Smack's CarbonManager takes care of that in
CarbonCopyReceivedListeners which where registered with
addCarbonCopyReceivedListener(CarbonCopyReceivedListener).
You should call enableCarbons() before sending your first undirected presence (aka. the "initial presence").
| Modifier and Type | Method and Description |
|---|---|
boolean |
addCarbonCopyReceivedListener(CarbonCopyReceivedListener listener)
Add a carbon copy received listener.
|
void |
disableCarbons()
Helper method to disable carbons.
|
static void |
disableCarbons(org.jivesoftware.smack.packet.Message msg)
Deprecated.
|
void |
disableCarbonsAsync(org.jivesoftware.smack.util.ExceptionCallback<java.lang.Exception> exceptionCallback)
Disable carbons asynchronously.
|
void |
enableCarbons()
Helper method to enable carbons.
|
void |
enableCarbonsAsync(org.jivesoftware.smack.util.ExceptionCallback<java.lang.Exception> exceptionCallback)
Enable carbons asynchronously.
|
boolean |
getCarbonsEnabled()
Check if carbons are enabled on this connection.
|
static CarbonManager |
getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
Obtain the CarbonManager responsible for a connection.
|
boolean |
isSupportedByServer()
Returns true if XMPP Carbons are supported by the server.
|
boolean |
removeCarbonCopyReceivedListener(CarbonCopyReceivedListener listener)
Remove a carbon copy received listener.
|
void |
sendCarbonsEnabled(boolean new_state)
Deprecated.
|
void |
setCarbonsEnabled(boolean new_state)
Notify server to change the carbons state.
|
public static CarbonManager getInstanceFor(org.jivesoftware.smack.XMPPConnection connection)
connection - the connection object.public boolean addCarbonCopyReceivedListener(CarbonCopyReceivedListener listener)
listener - the listener to register.true if the filter was not already registered.public boolean removeCarbonCopyReceivedListener(CarbonCopyReceivedListener listener)
listener - the listener to register.true if the filter was registered.public boolean isSupportedByServer()
throws org.jivesoftware.smack.SmackException.NoResponseException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
java.lang.InterruptedException
org.jivesoftware.smack.SmackException.NotConnectedExceptionorg.jivesoftware.smack.XMPPException.XMPPErrorExceptionorg.jivesoftware.smack.SmackException.NoResponseExceptionjava.lang.InterruptedException@Deprecated
public void sendCarbonsEnabled(boolean new_state)
throws org.jivesoftware.smack.SmackException.NotConnectedException,
java.lang.InterruptedException
enableCarbonsAsync(ExceptionCallback) or disableCarbonsAsync(ExceptionCallback) instead.new_state - whether carbons should be enabled or disabledorg.jivesoftware.smack.SmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic void enableCarbonsAsync(org.jivesoftware.smack.util.ExceptionCallback<java.lang.Exception> exceptionCallback)
exceptionCallback will be invoked.
Note that although this method is asynchronous, it may block if the outgoing stream element queue is full (e.g.
because of a slow network connection). Thus, if the thread performing this operation is interrupted while the
queue is full, an InterruptedException is thrown.
exceptionCallback - the optional exception callback.public void disableCarbonsAsync(org.jivesoftware.smack.util.ExceptionCallback<java.lang.Exception> exceptionCallback)
exceptionCallback will be invoked.
Note that although this method is asynchronous, it may block if the outgoing stream element queue is full (e.g.
because of a slow network connection). Thus, if the thread performing this operation is interrupted while the
queue is full, an InterruptedException is thrown.
exceptionCallback - the optional exception callback.public void setCarbonsEnabled(boolean new_state)
throws org.jivesoftware.smack.SmackException.NoResponseException,
org.jivesoftware.smack.XMPPException.XMPPErrorException,
org.jivesoftware.smack.SmackException.NotConnectedException,
java.lang.InterruptedException
new_state - whether carbons should be enabled or disabledorg.jivesoftware.smack.XMPPException.XMPPErrorExceptionorg.jivesoftware.smack.SmackException.NoResponseExceptionorg.jivesoftware.smack.SmackException.NotConnectedExceptionjava.lang.InterruptedExceptionpublic void enableCarbons()
throws org.jivesoftware.smack.XMPPException,
org.jivesoftware.smack.SmackException,
java.lang.InterruptedException
org.jivesoftware.smack.XMPPExceptionorg.jivesoftware.smack.SmackException - if there was no response from the server.java.lang.InterruptedExceptionpublic void disableCarbons()
throws org.jivesoftware.smack.XMPPException,
org.jivesoftware.smack.SmackException,
java.lang.InterruptedException
org.jivesoftware.smack.XMPPExceptionorg.jivesoftware.smack.SmackException - if there was no response from the server.java.lang.InterruptedExceptionpublic boolean getCarbonsEnabled()
@Deprecated public static void disableCarbons(org.jivesoftware.smack.packet.Message msg)
CarbonExtension.Private.addTo(Message)msg - Message object to mark private