private DisplayedManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(Displayed.NAMESPACE); connection.addAsyncStanzaListener(packet -> { Displayed receipt = Displayed.from((Message) packet); for (ReceiptReceivedListener listener : receiptReceivedListeners) { listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet); } }, MESSAGES_WITH_DISPLAYED); }
private ReceivedManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(Received.NAMESPACE); connection.addAsyncStanzaListener(packet -> { Received receipt = Received.from((Message) packet); for (ReceiptReceivedListener listener : receiptReceivedListeners) { listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet); } }, MESSAGES_WITH_RECEIVED); }
private DeliveredReceiptManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(DeliveredReceipt.NAMESPACE); connection.addAsyncStanzaListener(packet -> { DeliveredReceipt receipt = DeliveredReceipt.from((Message) packet); for (ReceiptReceivedListener listener : receiptReceivedListeners) { listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet); } }, MESSAGES_WITH_DELIVERED_RECEIPT); }
private ReadReceiptManager(XMPPConnection connection) { super(connection); ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(connection); sdm.addFeature(ReadReceipt.NAMESPACE); connection.addAsyncStanzaListener(packet -> { ReadReceipt receipt = ReadReceipt.from((Message) packet); for (ReceiptReceivedListener listener : receiptReceivedListeners) { listener.onReceiptReceived(packet.getFrom(), packet.getTo(), receipt.getId(), packet); } }, MESSAGES_WITH_READ_RECEIPT); }
private void initServiceDiscovery() { // register connection features ServiceDiscoveryManager sdm = ServiceDiscoveryManager.getInstanceFor(mXMPPConnection); // init Entity Caps manager with storage in app's cache dir try { if (capsCacheDir == null) { capsCacheDir = new File(mService.getCacheDir(), "entity-caps-cache"); capsCacheDir.mkdirs(); EntityCapsManager.setPersistentCache(new SimpleDirectoryPersistentCache(capsCacheDir)); } } catch (java.io.IOException e) { Log.e(TAG, "Could not init Entity Caps cache: " + e.getLocalizedMessage()); } // reference PingManager, set ping flood protection to 10s PingManager.getInstanceFor(mXMPPConnection).setPingMinimumInterval(10*1000); // set Version for replies String app_name = mService.getString(org.yaxim.androidclient.R.string.app_name); String build_version[] = mService.getString(org.yaxim.androidclient.R.string.build_version).split(" "); Version.Manager.getInstanceFor(mXMPPConnection).setVersion( new Version(app_name, build_version[1], "Android")); // reference DeliveryReceiptManager, add listener DeliveryReceiptManager dm = DeliveryReceiptManager.getInstanceFor(mXMPPConnection); dm.enableAutoReceipts(); dm.addReceiptReceivedListener(new ReceiptReceivedListener() { // DOES NOT WORK IN CARBONS public void onReceiptReceived(String fromJid, String toJid, String receiptId) { Log.d(TAG, "got delivery receipt for " + receiptId); changeMessageDeliveryStatus(receiptId, ChatConstants.DS_ACKED); }}); }
public void addDisplayedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.add(listener); }
public void removeDisplayedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.remove(listener); }
public void addReceivedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.add(listener); }
public void removeReceivedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.remove(listener); }
public void addDeliveredReceivedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.add(listener); }
public void removeDeliveredReceivedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.remove(listener); }
public void addReadReceivedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.add(listener); }
public void removeRemoveReceivedListener(ReceiptReceivedListener listener) { receiptReceivedListeners.remove(listener); }