use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ChatActivity method handleOtrIntent.
private void handleOtrIntent(Intent intent) {
String account = intent.getStringExtra(KEY_ACCOUNT);
String user = intent.getStringExtra(KEY_USER);
String question = intent.getStringExtra(KEY_QUESTION);
if (account != null && user != null) {
try {
AccountJid accountJid = AccountJid.from(account);
UserJid userJid = UserJid.from(user);
AbstractChat chat = MessageManager.getInstance().getOrCreateChat(accountJid, userJid);
if (chat != null && chat instanceof RegularChat) {
if (intent.getBooleanExtra(EXTRA_OTR_PROGRESS, false)) {
((RegularChat) chat).setIntent(QuestionActivity.createCancelIntent(Application.getInstance(), accountJid, userJid));
} else {
((RegularChat) chat).setIntent(QuestionActivity.createIntent(Application.getInstance(), accountJid, userJid, question != null, true, question));
}
}
} catch (UserJid.UserJidCreateException | XmppStringprepException e) {
e.printStackTrace();
}
}
getIntent().removeExtra(EXTRA_OTR_REQUEST);
getIntent().removeExtra(EXTRA_OTR_PROGRESS);
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ContactListActivity method showMucPrivateChatDialog.
private void showMucPrivateChatDialog() {
Intent intent = getIntent();
AccountJid account = getRoomInviteAccount(intent);
UserJid user = getRoomInviteUser(intent);
if (account != null && user != null) {
MucPrivateChatInvitationDialog.newInstance(account, user).show(getFragmentManager(), MucPrivateChatInvitationDialog.class.getName());
}
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ContactListActivity method showPassDialogs.
public void showPassDialogs() {
List<XMPPAccountSettings> items = XabberAccountManager.getInstance().getXmppAccountsForCreate();
if (items != null && items.size() > 0) {
for (XMPPAccountSettings item : items) {
if (XabberAccountManager.getInstance().isAccountSynchronize(item.getJid()) || SettingsManager.isSyncAllAccounts()) {
if (!item.isDeleted() && XabberAccountManager.getInstance().getExistingAccount(item.getJid()) == null) {
if (item.getToken() != null && !item.getToken().isEmpty()) {
// create account if exist token
try {
AccountJid accountJid = AccountManager.getInstance().addAccount(item.getJid(), "", item.getToken(), false, true, true, false, false, true);
AccountManager.getInstance().setColor(accountJid, ColorManager.getInstance().convertColorNameToIndex(item.getColor()));
AccountManager.getInstance().setOrder(accountJid, item.getOrder());
AccountManager.getInstance().setTimestamp(accountJid, item.getTimestamp());
AccountManager.getInstance().onAccountChanged(accountJid);
} catch (NetworkException e) {
Application.getInstance().onError(e);
}
// require pass if token not exist
} else
EnterPassDialog.newInstance(item).show(getFragmentManager(), EnterPassDialog.class.getName());
}
}
}
XabberAccountManager.getInstance().clearXmppAccountsForCreate();
}
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class ServerInfoActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_server_info);
final Intent intent = getIntent();
AccountJid account = getAccount(intent);
if (account == null) {
finish();
return;
}
accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
Application.getInstance().onError(R.string.NO_SUCH_ACCOUNT);
finish();
return;
}
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_default);
toolbar.setNavigationIcon(R.drawable.ic_arrow_left_white_24dp);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolbar.setTitle(accountItem.getConnection().getXMPPServiceDomain());
BarPainter barPainter = new BarPainter(this, toolbar);
barPainter.updateWithAccountName(account);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.server_info_recycler_view);
serverInfoAdapter = new ServerInfoAdapter();
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(serverInfoAdapter);
progressBar = findViewById(R.id.server_info_progress_bar);
requestServerInfo();
}
use of com.xabber.android.data.entity.AccountJid in project xabber-android by redsolution.
the class AttentionManager method onSettingsChanged.
public void onSettingsChanged() {
synchronized (enabledLock) {
for (AccountJid account : AccountManager.getInstance().getEnabledAccounts()) {
AccountItem accountItem = AccountManager.getInstance().getAccount(account);
if (accountItem == null) {
continue;
}
ServiceDiscoveryManager manager = ServiceDiscoveryManager.getInstanceFor(accountItem.getConnection());
if (manager == null) {
continue;
}
boolean contains = false;
for (String feature : manager.getFeatures()) {
if (AttentionExtension.NAMESPACE.equals(feature)) {
contains = true;
}
}
if (SettingsManager.chatsAttention() == contains) {
continue;
}
if (SettingsManager.chatsAttention()) {
manager.addFeature(AttentionExtension.NAMESPACE);
} else {
manager.removeFeature(AttentionExtension.NAMESPACE);
}
}
AccountManager.getInstance().resendPresence();
}
}
Aggregations