mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2025-12-13 08:31:08 +01:00
Renamed Connection to XMPPConnection
This commit is contained in:
parent
f3e007bad5
commit
489816c61f
145 changed files with 639 additions and 641 deletions
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.jivesoftware.smackx.iqlast;
|
||||
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.ConnectionCreationListener;
|
||||
import org.jivesoftware.smack.PacketListener;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
|
|
@ -54,7 +54,7 @@ import org.jivesoftware.smackx.iqlast.packet.LastActivity;
|
|||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* Connection con = new TCPConnection("jabber.org");
|
||||
* XMPPConnection con = new TCPConnection("jabber.org");
|
||||
* con.login("john", "doe");
|
||||
* LastActivity activity = LastActivity.getLastActivity(con, "xray@jabber.org/Smack");
|
||||
* </pre>
|
||||
|
|
@ -83,12 +83,12 @@ public class LastActivityManager {
|
|||
|
||||
private long lastMessageSent;
|
||||
|
||||
private Connection connection;
|
||||
private XMPPConnection connection;
|
||||
|
||||
// Enable the LastActivity support on every established connection
|
||||
static {
|
||||
Connection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(Connection connection) {
|
||||
XMPPConnection.addConnectionCreationListener(new ConnectionCreationListener() {
|
||||
public void connectionCreated(XMPPConnection connection) {
|
||||
new LastActivityManager(connection);
|
||||
}
|
||||
});
|
||||
|
|
@ -98,9 +98,9 @@ public class LastActivityManager {
|
|||
* Creates a last activity manager to response last activity requests.
|
||||
*
|
||||
* @param connection
|
||||
* The Connection that the last activity requests will use.
|
||||
* The XMPPConnection that the last activity requests will use.
|
||||
*/
|
||||
private LastActivityManager(Connection connection) {
|
||||
private LastActivityManager(XMPPConnection connection) {
|
||||
this.connection = connection;
|
||||
|
||||
// Listen to all the sent messages to reset the idle time on each one
|
||||
|
|
@ -185,14 +185,14 @@ public class LastActivityManager {
|
|||
* 'host') the last activity is the uptime.
|
||||
*
|
||||
* @param con
|
||||
* the current Connection.
|
||||
* the current XMPPConnection.
|
||||
* @param jid
|
||||
* the JID of the user.
|
||||
* @return the LastActivity packet of the jid.
|
||||
* @throws XMPPException
|
||||
* thrown if a server error has occured.
|
||||
*/
|
||||
public static LastActivity getLastActivity(Connection con, String jid) throws XMPPException {
|
||||
public static LastActivity getLastActivity(XMPPConnection con, String jid) throws XMPPException {
|
||||
LastActivity activity = new LastActivity();
|
||||
activity.setTo(jid);
|
||||
|
||||
|
|
@ -207,7 +207,7 @@ public class LastActivityManager {
|
|||
* @param jid a JID to be tested for Last Activity support
|
||||
* @return true if Last Activity is supported, otherwise false
|
||||
*/
|
||||
public static boolean isLastActivitySupported(Connection connection, String jid) {
|
||||
public static boolean isLastActivitySupported(XMPPConnection connection, String jid) {
|
||||
try {
|
||||
DiscoverInfo result =
|
||||
ServiceDiscoveryManager.getInstanceFor(connection).discoverInfo(jid);
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ package org.jivesoftware.smackx.iqlast.packet;
|
|||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.jivesoftware.smack.Connection;
|
||||
import org.jivesoftware.smack.XMPPConnection;
|
||||
import org.jivesoftware.smack.XMPPException;
|
||||
import org.jivesoftware.smack.packet.IQ;
|
||||
import org.jivesoftware.smack.provider.IQProvider;
|
||||
|
|
@ -128,14 +128,14 @@ public class LastActivity extends IQ {
|
|||
|
||||
/**
|
||||
* Retrieve the last activity of a particular jid.
|
||||
* @param con the current Connection.
|
||||
* @param con the current XMPPConnection.
|
||||
* @param jid the JID of the user.
|
||||
* @return the LastActivity packet of the jid.
|
||||
* @throws XMPPException thrown if a server error has occured.
|
||||
* @deprecated This method only retreives the lapsed time since the last logout of a particular jid.
|
||||
* Replaced by {@link org.jivesoftware.smackx.iqlast.LastActivityManager#getLastActivity(Connection, String) getLastActivity}
|
||||
* Replaced by {@link org.jivesoftware.smackx.iqlast.LastActivityManager#getLastActivity(XMPPConnection, String) getLastActivity}
|
||||
*/
|
||||
public static LastActivity getLastActivity(Connection con, String jid) throws XMPPException {
|
||||
public static LastActivity getLastActivity(XMPPConnection con, String jid) throws XMPPException {
|
||||
LastActivity activity = new LastActivity();
|
||||
jid = StringUtils.parseBareAddress(jid);
|
||||
activity.setTo(jid);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue