diff --git a/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java b/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java index a6153a2e3..37756c51b 100644 --- a/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java +++ b/app/src/main/java/org/kontalk/service/msgcenter/MessageCenterService.java @@ -52,9 +52,6 @@ import org.jivesoftware.smackx.disco.packet.DiscoverInfo; import org.jivesoftware.smackx.iqlast.packet.LastActivity; import org.jivesoftware.smackx.iqversion.VersionManager; -import org.jivesoftware.smackx.ping.PingFailedListener; -import org.jivesoftware.smackx.ping.PingManager; -import org.jivesoftware.smackx.ping.packet.Ping; import org.jivesoftware.smackx.receipts.DeliveryReceipt; import org.jivesoftware.smackx.receipts.DeliveryReceiptRequest; import org.spongycastle.openpgp.PGPException; @@ -142,9 +139,6 @@ public class MessageCenterService extends Service implements ConnectionHelperLis SmackConfiguration.DEBUG = BuildConfig.DEBUG; } - /** Ping to server interval in seconds. */ - private static final int PING_INTERVAL = 120; - public static final String ACTION_PACKET = "org.kontalk.action.PACKET"; public static final String ACTION_HOLD = "org.kontalk.action.HOLD"; public static final String ACTION_RELEASE = "org.kontalk.action.RELEASE"; @@ -943,29 +937,12 @@ public synchronized void created(XMPPConnection connection) { Log.v(TAG, "connection created."); mConnection = (KontalkConnection) connection; - // setup ping manager - final PingManager pingMgr = PingManager.getInstanceFor(connection); - pingMgr.setPingInterval(PING_INTERVAL); - pingMgr.registerPingFailedListener(new PingFailedListener() { - @Override - public void pingFailed() { - Log.v(TAG, "ping failed, restarting message center"); - // unregister this listener - pingMgr.unregisterPingFailedListener(this); - // restart the message center - restart(getApplicationContext()); - } - }); - // setup version manager final VersionManager verMgr = VersionManager.getInstanceFor(connection); verMgr.setVersion(getString(R.string.app_name), SystemUtils.getVersionName(this)); PacketFilter filter; - filter = new PacketTypeFilter(Ping.class); - connection.addAsyncPacketListener(new PingListener(this), filter); - filter = new PacketTypeFilter(Presence.class); connection.addAsyncPacketListener(new PresenceListener(this), filter); diff --git a/app/src/main/java/org/kontalk/service/msgcenter/PingListener.java b/app/src/main/java/org/kontalk/service/msgcenter/PingListener.java deleted file mode 100644 index 601934134..000000000 --- a/app/src/main/java/org/kontalk/service/msgcenter/PingListener.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Kontalk Android client - * Copyright (C) 2014 Kontalk Devteam - - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package org.kontalk.service.msgcenter; - -import org.jivesoftware.smack.packet.IQ; -import org.jivesoftware.smack.packet.Stanza; - - -/** - * Packet listener for ping packets. - * @author Daniele Ricci - */ -class PingListener extends MessageCenterPacketListener { - - public PingListener(MessageCenterService instance) { - super(instance); - } - - @Override - public void processPacket(Stanza packet) { - sendPacket(IQ.createResultIQ((IQ) packet), false); - } -}