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);
}
}
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();
}
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");
}
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();
});
}
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);
}
Aggregations