Search in sources :

Example 1 with XmppConnection

use of de.pixart.messenger.xmpp.XmppConnection in project Pix-Art-Messenger by kriztan.

the class XmppConnectionService method sendCreateAccountWithCaptchaPacket.

public void sendCreateAccountWithCaptchaPacket(Account account, String id, Data data) {
    final XmppConnection connection = account.getXmppConnection();
    if (connection != null) {
        IqPacket request = mIqGenerator.generateCreateAccountWithCaptcha(account, id, data);
        connection.sendUnmodifiedIqPacket(request, connection.registrationResponseListener, true);
    }
}
Also used : XmppConnection(de.pixart.messenger.xmpp.XmppConnection) IqPacket(de.pixart.messenger.xmpp.stanzas.IqPacket)

Example 2 with XmppConnection

use of de.pixart.messenger.xmpp.XmppConnection in project Pix-Art-Messenger by kriztan.

the class XmppConnectionService method resetAllAttemptCounts.

private void resetAllAttemptCounts(boolean reallyAll, boolean retryImmediately) {
    Log.d(Config.LOGTAG, "resetting all attempt counts");
    for (Account account : accounts) {
        if (account.hasErrorStatus() || reallyAll) {
            final XmppConnection connection = account.getXmppConnection();
            if (connection != null) {
                connection.resetAttemptCount(retryImmediately);
            }
        }
        if (account.setShowErrorNotification(true)) {
            databaseBackend.updateAccount(account);
        }
    }
    mNotificationService.updateErrorNotification();
}
Also used : XmppConnection(de.pixart.messenger.xmpp.XmppConnection) Account(de.pixart.messenger.entities.Account)

Example 3 with XmppConnection

use of de.pixart.messenger.xmpp.XmppConnection in project Pix-Art-Messenger by kriztan.

the class XmppConnectionService method switchToBackground.

private void switchToBackground() {
    final boolean broadcastLastActivity = broadcastLastActivity();
    for (Account account : getAccounts()) {
        if (account.getStatus() == Account.State.ONLINE) {
            XmppConnection connection = account.getXmppConnection();
            if (connection != null) {
                if (broadcastLastActivity) {
                    sendPresence(account, broadcastLastActivity);
                }
                if (connection.getFeatures().csi()) {
                    connection.sendInactive();
                }
            }
        }
    }
    this.mNotificationService.setIsInForeground(false);
    Log.d(Config.LOGTAG, "app switched into background");
}
Also used : XmppConnection(de.pixart.messenger.xmpp.XmppConnection) Account(de.pixart.messenger.entities.Account)

Example 4 with XmppConnection

use of de.pixart.messenger.xmpp.XmppConnection in project Pix-Art-Messenger by kriztan.

the class EditAccountActivity method finishInitialSetup.

protected void finishInitialSetup(final Avatar avatar) {
    runOnUiThread(() -> {
        hideKeyboard();
        final Intent intent;
        final XmppConnection connection = mAccount.getXmppConnection();
        final boolean wasFirstAccount = xmppConnectionService != null && xmppConnectionService.getAccounts().size() == 1;
        if (avatar != null || (connection != null && !connection.getFeatures().pep())) {
            intent = new Intent(getApplicationContext(), StartConversationActivity.class);
            if (wasFirstAccount) {
                intent.putExtra("init", true);
            }
        } else {
            intent = new Intent(getApplicationContext(), PublishProfilePictureActivity.class);
            intent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toBareJid().toString());
            intent.putExtra("setup", true);
        }
        if (wasFirstAccount) {
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
        }
        WelcomeActivity.addInviteUri(intent, getIntent());
        startActivity(intent);
        finish();
    });
}
Also used : XmppConnection(de.pixart.messenger.xmpp.XmppConnection) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Example 5 with XmppConnection

use of de.pixart.messenger.xmpp.XmppConnection in project Pix-Art-Messenger by kriztan.

the class EditAccountActivity method onOptionsItemSelected.

@Override
public boolean onOptionsItemSelected(final MenuItem item) {
    switch(item.getItemId()) {
        case R.id.mgmt_account_reconnect:
            XmppConnection connection = mAccount.getXmppConnection();
            if (connection != null) {
                connection.resetStreamId();
            }
            xmppConnectionService.reconnectAccountInBackground(mAccount);
            break;
        case R.id.action_show_block_list:
            final Intent showBlocklistIntent = new Intent(this, BlocklistActivity.class);
            showBlocklistIntent.putExtra(EXTRA_ACCOUNT, mAccount.getJid().toString());
            startActivity(showBlocklistIntent);
            break;
        case R.id.action_server_info_show_more:
            changeMoreTableVisibility(!item.isChecked());
            break;
        case R.id.action_share_barcode:
            shareBarcode();
            break;
        case R.id.action_share_http:
            shareLink(true);
            break;
        case R.id.action_share_uri:
            shareLink(false);
            break;
        case R.id.action_change_password_on_server:
            gotoChangePassword(null);
            break;
        case R.id.action_mam_prefs:
            editMamPrefs();
            break;
        case R.id.action_renew_certificate:
            renewCertificate();
            break;
        case R.id.action_change_presence:
            changePresence();
            break;
        case R.id.action_show_password:
            showPassword();
            break;
        case R.id.mgmt_account_announce_pgp:
            publishOpenPGPPublicKey(mAccount);
            return true;
    }
    return super.onOptionsItemSelected(item);
}
Also used : XmppConnection(de.pixart.messenger.xmpp.XmppConnection) PendingIntent(android.app.PendingIntent) Intent(android.content.Intent)

Aggregations

XmppConnection (de.pixart.messenger.xmpp.XmppConnection)15 Account (de.pixart.messenger.entities.Account)5 PendingIntent (android.app.PendingIntent)3 AxolotlService (de.pixart.messenger.crypto.axolotl.AxolotlService)3 Conversation (de.pixart.messenger.entities.Conversation)3 SuppressLint (android.annotation.SuppressLint)2 Intent (android.content.Intent)2 Uri (android.net.Uri)1 Handler (android.os.Handler)1 MenuItem (android.view.MenuItem)1 Contact (de.pixart.messenger.entities.Contact)1 DownloadableFile (de.pixart.messenger.entities.DownloadableFile)1 Message (de.pixart.messenger.entities.Message)1 TransferablePlaceholder (de.pixart.messenger.entities.TransferablePlaceholder)1 PresenceSelector (de.pixart.messenger.ui.util.PresenceSelector)1 IqPacket (de.pixart.messenger.xmpp.stanzas.IqPacket)1 Iterator (java.util.Iterator)1