return contact and account.getServer() as String
This commit is contained in:
parent
dbcc54799d
commit
4bb45996c5
|
@ -228,7 +228,7 @@ public class Account extends AbstractEntity {
|
||||||
protected Jid jid;
|
protected Jid jid;
|
||||||
protected String password;
|
protected String password;
|
||||||
protected int options = 0;
|
protected int options = 0;
|
||||||
protected String rosterVersion;
|
private String rosterVersion;
|
||||||
protected State status = State.OFFLINE;
|
protected State status = State.OFFLINE;
|
||||||
protected final JSONObject keys;
|
protected final JSONObject keys;
|
||||||
protected String resource;
|
protected String resource;
|
||||||
|
@ -336,8 +336,8 @@ public class Account extends AbstractEntity {
|
||||||
return next != null && !next.equals(previousFull);
|
return next != null && !next.equals(previousFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Jid getServer() {
|
public String getServer() {
|
||||||
return Jid.ofDomain(jid.getDomain());
|
return jid.getDomain();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPassword() {
|
public String getPassword() {
|
||||||
|
@ -357,8 +357,8 @@ public class Account extends AbstractEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isOnion() {
|
public boolean isOnion() {
|
||||||
final Jid server = getServer();
|
final String server = getServer();
|
||||||
return server != null && server.toString().toLowerCase().endsWith(".onion");
|
return server != null && server.endsWith(".onion");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPort(int port) {
|
public void setPort(int port) {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package eu.siacs.conversations.entities;
|
package eu.siacs.conversations.entities;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
import java.lang.ref.WeakReference;
|
import java.lang.ref.WeakReference;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -46,7 +47,7 @@ public class Bookmark extends Element implements ListItem {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(final ListItem another) {
|
public int compareTo(final @NonNull ListItem another) {
|
||||||
return this.getDisplayName().compareToIgnoreCase(
|
return this.getDisplayName().compareToIgnoreCase(
|
||||||
another.getDisplayName());
|
another.getDisplayName());
|
||||||
}
|
}
|
||||||
|
@ -55,7 +56,7 @@ public class Bookmark extends Element implements ListItem {
|
||||||
public String getDisplayName() {
|
public String getDisplayName() {
|
||||||
final Conversation c = getConversation();
|
final Conversation c = getConversation();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
return c.getName();
|
return c.getName().toString();
|
||||||
} else if (getBookmarkName() != null
|
} else if (getBookmarkName() != null
|
||||||
&& !getBookmarkName().trim().isEmpty()) {
|
&& !getBookmarkName().trim().isEmpty()) {
|
||||||
return getBookmarkName().trim();
|
return getBookmarkName().trim();
|
||||||
|
|
|
@ -394,8 +394,8 @@ public class Contact implements ListItem, Blockable {
|
||||||
another.getDisplayName());
|
another.getDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public Jid getServer() {
|
public String getServer() {
|
||||||
return Jid.ofDomain(getJid().getDomain());
|
return getJid().getDomain();
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean setAvatar(Avatar avatar) {
|
public boolean setAvatar(Avatar avatar) {
|
||||||
|
|
|
@ -465,7 +465,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
public CharSequence getName() {
|
||||||
if (getMode() == MODE_MULTI) {
|
if (getMode() == MODE_MULTI) {
|
||||||
final String subject = getMucOptions().getSubject();
|
final String subject = getMucOptions().getSubject();
|
||||||
Bookmark bookmark = getBookmark();
|
Bookmark bookmark = getBookmark();
|
||||||
|
@ -483,7 +483,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (isWithStranger()) {
|
} else if (isWithStranger()) {
|
||||||
return contactJid.asBareJid().toString();
|
return contactJid;
|
||||||
} else {
|
} else {
|
||||||
return this.getContact().getDisplayName();
|
return this.getContact().getDisplayName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -301,7 +301,7 @@ public class IqGenerator extends AbstractGenerator {
|
||||||
|
|
||||||
public IqPacket generateSetPassword(final Account account, final String newPassword) {
|
public IqPacket generateSetPassword(final Account account, final String newPassword) {
|
||||||
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
|
final IqPacket packet = new IqPacket(IqPacket.TYPE.SET);
|
||||||
packet.setTo(account.getServer());
|
packet.setTo(Jid.of(account.getServer()));
|
||||||
final Element query = packet.addChild("query", Namespace.REGISTER);
|
final Element query = packet.addChild("query", Namespace.REGISTER);
|
||||||
final Jid jid = account.getJid();
|
final Jid jid = account.getJid();
|
||||||
query.addChild("username").setContent(jid.getLocal());
|
query.addChild("username").setContent(jid.getLocal());
|
||||||
|
@ -368,7 +368,7 @@ public class IqGenerator extends AbstractGenerator {
|
||||||
public IqPacket generateCreateAccountWithCaptcha(Account account, String id, Data data) {
|
public IqPacket generateCreateAccountWithCaptcha(Account account, String id, Data data) {
|
||||||
final IqPacket register = new IqPacket(IqPacket.TYPE.SET);
|
final IqPacket register = new IqPacket(IqPacket.TYPE.SET);
|
||||||
register.setFrom(account.getJid().asBareJid());
|
register.setFrom(account.getJid().asBareJid());
|
||||||
register.setTo(account.getServer());
|
register.setTo(Jid.of(account.getServer()));
|
||||||
register.setId(id);
|
register.setId(id);
|
||||||
Element query = register.query("jabber:iq:register");
|
Element query = register.query("jabber:iq:register");
|
||||||
if (data != null) {
|
if (data != null) {
|
||||||
|
|
|
@ -216,7 +216,7 @@ public class AvatarService implements OnAdvancedStreamFeaturesLoaded {
|
||||||
final List<MucOptions.User> users = mucOptions.getUsersRelevantForNameAndAvatar();
|
final List<MucOptions.User> users = mucOptions.getUsersRelevantForNameAndAvatar();
|
||||||
if (users.size() == 0) {
|
if (users.size() == 0) {
|
||||||
Conversation c = mucOptions.getConversation();
|
Conversation c = mucOptions.getConversation();
|
||||||
bitmap = getImpl(c.getName(),c.getJid().asBareJid().toString(),size);
|
bitmap = getImpl(c.getName().toString(),c.getJid().asBareJid().toString(),size);
|
||||||
} else {
|
} else {
|
||||||
bitmap = getImpl(users,size);
|
bitmap = getImpl(users,size);
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class ContactChooserTargetService extends ChooserTargetService implements
|
||||||
final int pixel = (int) (48 * getResources().getDisplayMetrics().density);
|
final int pixel = (int) (48 * getResources().getDisplayMetrics().density);
|
||||||
for(int i = 0; i < Math.min(conversations.size(),MAX_TARGETS); ++i) {
|
for(int i = 0; i < Math.min(conversations.size(),MAX_TARGETS); ++i) {
|
||||||
final Conversation conversation = conversations.get(i);
|
final Conversation conversation = conversations.get(i);
|
||||||
final String name = conversation.getName();
|
final String name = conversation.getName().toString();
|
||||||
final Icon icon = Icon.createWithBitmap(mXmppConnectionService.getAvatarService().get(conversation, pixel));
|
final Icon icon = Icon.createWithBitmap(mXmppConnectionService.getAvatarService().get(conversation, pixel));
|
||||||
final float score = 1 - (1.0f / MAX_TARGETS) * i;
|
final float score = 1 - (1.0f / MAX_TARGETS) * i;
|
||||||
final Bundle extras = new Bundle();
|
final Bundle extras = new Bundle();
|
||||||
|
|
|
@ -340,7 +340,7 @@ public class NotificationService {
|
||||||
for (final ArrayList<Message> messages : notifications.values()) {
|
for (final ArrayList<Message> messages : notifications.values()) {
|
||||||
if (messages.size() > 0) {
|
if (messages.size() > 0) {
|
||||||
conversation = messages.get(0).getConversation();
|
conversation = messages.get(0).getConversation();
|
||||||
final String name = conversation.getName();
|
final String name = conversation.getName().toString();
|
||||||
SpannableString styledString;
|
SpannableString styledString;
|
||||||
if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) {
|
if (Config.HIDE_MESSAGE_TEXT_IN_NOTIFICATION) {
|
||||||
int count = messages.size();
|
int count = messages.size();
|
||||||
|
@ -379,7 +379,7 @@ public class NotificationService {
|
||||||
final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);
|
final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService);
|
||||||
if (messages.size() >= 1) {
|
if (messages.size() >= 1) {
|
||||||
final Conversation conversation = messages.get(0).getConversation();
|
final Conversation conversation = messages.get(0).getConversation();
|
||||||
final UnreadConversation.Builder mUnreadBuilder = new UnreadConversation.Builder(conversation.getName());
|
final UnreadConversation.Builder mUnreadBuilder = new UnreadConversation.Builder(conversation.getName().toString());
|
||||||
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
|
mBuilder.setLargeIcon(mXmppConnectionService.getAvatarService()
|
||||||
.get(conversation, getPixel(64)));
|
.get(conversation, getPixel(64)));
|
||||||
mBuilder.setContentTitle(conversation.getName());
|
mBuilder.setContentTitle(conversation.getName());
|
||||||
|
|
|
@ -55,6 +55,7 @@ import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
@ -3392,42 +3393,40 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getKnownHosts() {
|
public Collection<String> getKnownHosts() {
|
||||||
final List<String> hosts = new ArrayList<>();
|
final Set<String> hosts = new HashSet<>();
|
||||||
for (final Account account : getAccounts()) {
|
for (final Account account : getAccounts()) {
|
||||||
if (!hosts.contains(account.getServer().toString())) {
|
hosts.add(account.getServer());
|
||||||
hosts.add(account.getServer().toString());
|
|
||||||
}
|
|
||||||
for (final Contact contact : account.getRoster().getContacts()) {
|
for (final Contact contact : account.getRoster().getContacts()) {
|
||||||
if (contact.showInRoster()) {
|
if (contact.showInRoster()) {
|
||||||
final String server = contact.getServer().toString();
|
final String server = contact.getServer();
|
||||||
if (server != null && !hosts.contains(server)) {
|
if (server != null && !hosts.contains(server)) {
|
||||||
hosts.add(server);
|
hosts.add(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Config.DOMAIN_LOCK != null && !hosts.contains(Config.DOMAIN_LOCK)) {
|
if (Config.DOMAIN_LOCK != null) {
|
||||||
hosts.add(Config.DOMAIN_LOCK);
|
hosts.add(Config.DOMAIN_LOCK);
|
||||||
}
|
}
|
||||||
if (Config.MAGIC_CREATE_DOMAIN != null && !hosts.contains(Config.MAGIC_CREATE_DOMAIN)) {
|
if (Config.MAGIC_CREATE_DOMAIN != null) {
|
||||||
hosts.add(Config.MAGIC_CREATE_DOMAIN);
|
hosts.add(Config.MAGIC_CREATE_DOMAIN);
|
||||||
}
|
}
|
||||||
return hosts;
|
return hosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getKnownConferenceHosts() {
|
public Collection<String> getKnownConferenceHosts() {
|
||||||
final ArrayList<String> mucServers = new ArrayList<>();
|
final Set<String> mucServers = new HashSet<>();
|
||||||
for (final Account account : accounts) {
|
for (final Account account : accounts) {
|
||||||
if (account.getXmppConnection() != null) {
|
if (account.getXmppConnection() != null) {
|
||||||
final String server = account.getXmppConnection().getMucServer();
|
final String server = account.getXmppConnection().getMucServer();
|
||||||
if (server != null && !mucServers.contains(server)) {
|
if (server != null) {
|
||||||
mucServers.add(server);
|
mucServers.add(server);
|
||||||
}
|
}
|
||||||
for (Bookmark bookmark : account.getBookmarks()) {
|
for (Bookmark bookmark : account.getBookmarks()) {
|
||||||
final Jid jid = bookmark.getJid();
|
final Jid jid = bookmark.getJid();
|
||||||
final String s = jid == null ? null : jid.getDomain();
|
final String s = jid == null ? null : jid.getDomain();
|
||||||
if (s != null && !mucServers.contains(s)) {
|
if (s != null) {
|
||||||
mucServers.add(s);
|
mucServers.add(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@ import android.widget.AdapterView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@ -19,7 +20,7 @@ import eu.siacs.conversations.xmpp.OnUpdateBlocklist;
|
||||||
import rocks.xmpp.addr.Jid;
|
import rocks.xmpp.addr.Jid;
|
||||||
|
|
||||||
public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist {
|
public class BlocklistActivity extends AbstractSearchableListItemActivity implements OnUpdateBlocklist {
|
||||||
private List<String> mKnownHosts = new ArrayList<>();
|
private Collection<String> mKnownHosts = new ArrayList<>();
|
||||||
|
|
||||||
private Account account = null;
|
private Account account = null;
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@ import android.widget.AbsListView.MultiChoiceModeListener;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -37,7 +38,7 @@ import rocks.xmpp.addr.Jid;
|
||||||
public class ChooseContactActivity extends AbstractSearchableListItemActivity {
|
public class ChooseContactActivity extends AbstractSearchableListItemActivity {
|
||||||
public static final String EXTRA_TITLE_RES_ID = "extra_title_res_id";
|
public static final String EXTRA_TITLE_RES_ID = "extra_title_res_id";
|
||||||
private List<String> mActivatedAccounts = new ArrayList<>();
|
private List<String> mActivatedAccounts = new ArrayList<>();
|
||||||
private List<String> mKnownHosts;
|
private Collection<String> mKnownHosts;
|
||||||
private Set<Contact> selected;
|
private Set<Contact> selected;
|
||||||
private Set<String> filterContacts;
|
private Set<String> filterContacts;
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import android.widget.AutoCompleteTextView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import eu.siacs.conversations.Config;
|
import eu.siacs.conversations.Config;
|
||||||
|
@ -40,9 +41,9 @@ public class EnterJidDialog {
|
||||||
protected OnEnterJidDialogPositiveListener listener = null;
|
protected OnEnterJidDialogPositiveListener listener = null;
|
||||||
|
|
||||||
public EnterJidDialog(
|
public EnterJidDialog(
|
||||||
final Context context, List<String> knownHosts, final List<String> activatedAccounts,
|
final Context context, Collection<String> knownHosts, final List<String> activatedAccounts,
|
||||||
final String title, final String positiveButton,
|
final String title, final String positiveButton,
|
||||||
final String prefilledJid, final String account, boolean allowEditJid
|
final String prefilledJid, final String account, boolean allowEditJid
|
||||||
) {
|
) {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
builder.setTitle(title);
|
builder.setTitle(title);
|
||||||
|
|
|
@ -59,6 +59,7 @@ import android.widget.Toast;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
@ -94,8 +95,8 @@ public class StartConversationActivity extends XmppActivity implements OnRosterU
|
||||||
private List<ListItem> conferences = new ArrayList<>();
|
private List<ListItem> conferences = new ArrayList<>();
|
||||||
private ListItemAdapter mConferenceAdapter;
|
private ListItemAdapter mConferenceAdapter;
|
||||||
private List<String> mActivatedAccounts = new ArrayList<>();
|
private List<String> mActivatedAccounts = new ArrayList<>();
|
||||||
private List<String> mKnownHosts;
|
private Collection<String> mKnownHosts;
|
||||||
private List<String> mKnownConferenceHosts;
|
private Collection<String> mKnownConferenceHosts;
|
||||||
private Invite mPendingInvite = null;
|
private Invite mPendingInvite = null;
|
||||||
private EditText mSearchEditText;
|
private EditText mSearchEditText;
|
||||||
private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false);
|
private AtomicBoolean mRequestedContactsPermission = new AtomicBoolean(false);
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.Typeface;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
import android.graphics.drawable.BitmapDrawable;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.Pair;
|
import android.util.Pair;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -30,7 +31,9 @@ import eu.siacs.conversations.ui.XmppActivity;
|
||||||
import eu.siacs.conversations.ui.util.Color;
|
import eu.siacs.conversations.ui.util.Color;
|
||||||
import eu.siacs.conversations.ui.widget.UnreadCountCustomView;
|
import eu.siacs.conversations.ui.widget.UnreadCountCustomView;
|
||||||
import eu.siacs.conversations.utils.EmojiWrapper;
|
import eu.siacs.conversations.utils.EmojiWrapper;
|
||||||
|
import eu.siacs.conversations.utils.IrregularUnicodeDetector;
|
||||||
import eu.siacs.conversations.utils.UIHelper;
|
import eu.siacs.conversations.utils.UIHelper;
|
||||||
|
import rocks.xmpp.addr.Jid;
|
||||||
|
|
||||||
public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
|
|
||||||
|
@ -43,7 +46,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View view, ViewGroup parent) {
|
public View getView(int position, View view, @NonNull ViewGroup parent) {
|
||||||
if (view == null) {
|
if (view == null) {
|
||||||
LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||||
view = inflater.inflate(R.layout.conversation_list_row,parent, false);
|
view = inflater.inflate(R.layout.conversation_list_row,parent, false);
|
||||||
|
@ -55,7 +58,12 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
viewHolder.swipeableItem.setBackgroundColor(c);
|
viewHolder.swipeableItem.setBackgroundColor(c);
|
||||||
}
|
}
|
||||||
if (conversation.getMode() == Conversation.MODE_SINGLE || activity.useSubjectToIdentifyConference()) {
|
if (conversation.getMode() == Conversation.MODE_SINGLE || activity.useSubjectToIdentifyConference()) {
|
||||||
viewHolder.name.setText(EmojiWrapper.transform(conversation.getName()));
|
CharSequence name = conversation.getName();
|
||||||
|
if (name instanceof Jid) {
|
||||||
|
viewHolder.name.setText(IrregularUnicodeDetector.style(activity, (Jid) name));
|
||||||
|
} else {
|
||||||
|
viewHolder.name.setText(EmojiWrapper.transform(name));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
viewHolder.name.setText(conversation.getJid().asBareJid().toString());
|
viewHolder.name.setText(conversation.getJid().asBareJid().toString());
|
||||||
}
|
}
|
||||||
|
@ -236,7 +244,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadAvatar(Conversation conversation, ImageView imageView) {
|
private void loadAvatar(Conversation conversation, ImageView imageView) {
|
||||||
if (cancelPotentialWork(conversation, imageView)) {
|
if (cancelPotentialWork(conversation, imageView)) {
|
||||||
final Bitmap bm = activity.avatarService().get(conversation, activity.getPixel(56), true);
|
final Bitmap bm = activity.avatarService().get(conversation, activity.getPixel(56), true);
|
||||||
if (bm != null) {
|
if (bm != null) {
|
||||||
|
@ -244,7 +252,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
imageView.setImageBitmap(bm);
|
imageView.setImageBitmap(bm);
|
||||||
imageView.setBackgroundColor(0x00000000);
|
imageView.setBackgroundColor(0x00000000);
|
||||||
} else {
|
} else {
|
||||||
imageView.setBackgroundColor(UIHelper.getColorForName(conversation.getName()));
|
imageView.setBackgroundColor(UIHelper.getColorForName(conversation.getName().toString()));
|
||||||
imageView.setImageDrawable(null);
|
imageView.setImageDrawable(null);
|
||||||
final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
|
final BitmapWorkerTask task = new BitmapWorkerTask(imageView);
|
||||||
final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
|
final AsyncDrawable asyncDrawable = new AsyncDrawable(activity.getResources(), null, task);
|
||||||
|
@ -257,7 +265,7 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean cancelPotentialWork(Conversation conversation, ImageView imageView) {
|
private static boolean cancelPotentialWork(Conversation conversation, ImageView imageView) {
|
||||||
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
|
final BitmapWorkerTask bitmapWorkerTask = getBitmapWorkerTask(imageView);
|
||||||
|
|
||||||
if (bitmapWorkerTask != null) {
|
if (bitmapWorkerTask != null) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import android.widget.ArrayAdapter;
|
||||||
import android.widget.Filter;
|
import android.widget.Filter;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
@ -58,7 +59,7 @@ public class KnownHostsAdapter extends ArrayAdapter<String> {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
public KnownHostsAdapter(Context context, int viewResourceId, List<String> mKnownHosts) {
|
public KnownHostsAdapter(Context context, int viewResourceId, Collection<String> mKnownHosts) {
|
||||||
super(context, viewResourceId, new ArrayList<>());
|
super(context, viewResourceId, new ArrayList<>());
|
||||||
domains = new ArrayList<>(mKnownHosts);
|
domains = new ArrayList<>(mKnownHosts);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ public class GeoHelper {
|
||||||
String label;
|
String label;
|
||||||
if (conversation.getMode() == Conversation.MODE_SINGLE && message.getStatus() == Message.STATUS_RECEIVED) {
|
if (conversation.getMode() == Conversation.MODE_SINGLE && message.getStatus() == Message.STATUS_RECEIVED) {
|
||||||
try {
|
try {
|
||||||
label = "(" + URLEncoder.encode(message.getConversation().getName(), "UTF-8") + ")";
|
label = "(" + URLEncoder.encode(message.getConversation().getName().toString(), "UTF-8") + ")";
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
label = "";
|
label = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,10 +289,10 @@ public class XmppConnection implements Runnable {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new IOException(e.getMessage());
|
throw new IOException(e.getMessage());
|
||||||
}
|
}
|
||||||
} else if (IP.matches(account.getServer().toString())) {
|
} else if (IP.matches(account.getServer())) {
|
||||||
localSocket = new Socket();
|
localSocket = new Socket();
|
||||||
try {
|
try {
|
||||||
localSocket.connect(new InetSocketAddress(account.getServer().toString(), 5222), Config.SOCKET_TIMEOUT * 1000);
|
localSocket.connect(new InetSocketAddress(account.getServer(), 5222), Config.SOCKET_TIMEOUT * 1000);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UnknownHostException();
|
throw new UnknownHostException();
|
||||||
}
|
}
|
||||||
|
@ -352,12 +352,12 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
SSLSocketHelper.setSecurity((SSLSocket) localSocket);
|
SSLSocketHelper.setSecurity((SSLSocket) localSocket);
|
||||||
SSLSocketHelper.setSNIHost(tlsFactoryVerifier.factory, (SSLSocket) localSocket, account.getServer().getDomain());
|
SSLSocketHelper.setSNIHost(tlsFactoryVerifier.factory, (SSLSocket) localSocket, account.getServer());
|
||||||
SSLSocketHelper.setAlpnProtocol(tlsFactoryVerifier.factory, (SSLSocket) localSocket, "xmpp-client");
|
SSLSocketHelper.setAlpnProtocol(tlsFactoryVerifier.factory, (SSLSocket) localSocket, "xmpp-client");
|
||||||
|
|
||||||
localSocket.connect(addr, Config.SOCKET_TIMEOUT * 1000);
|
localSocket.connect(addr, Config.SOCKET_TIMEOUT * 1000);
|
||||||
|
|
||||||
if (!tlsFactoryVerifier.verifier.verify(account.getServer().getDomain(), verifiedHostname, ((SSLSocket) localSocket).getSession())) {
|
if (!tlsFactoryVerifier.verifier.verify(account.getServer(), verifiedHostname, ((SSLSocket) localSocket).getSession())) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS certificate verification failed");
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS certificate verification failed");
|
||||||
if (!iterator.hasNext()) {
|
if (!iterator.hasNext()) {
|
||||||
throw new StateChangingException(Account.State.TLS_ERROR);
|
throw new StateChangingException(Account.State.TLS_ERROR);
|
||||||
|
@ -794,7 +794,7 @@ public class XmppConnection implements Runnable {
|
||||||
|
|
||||||
SSLSocketHelper.setSecurity(sslSocket);
|
SSLSocketHelper.setSecurity(sslSocket);
|
||||||
|
|
||||||
if (!tlsFactoryVerifier.verifier.verify(account.getServer().getDomain(), this.verifiedHostname, sslSocket.getSession())) {
|
if (!tlsFactoryVerifier.verifier.verify(account.getServer(), this.verifiedHostname, sslSocket.getSession())) {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS certificate verification failed");
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": TLS certificate verification failed");
|
||||||
throw new StateChangingException(Account.State.TLS_ERROR);
|
throw new StateChangingException(Account.State.TLS_ERROR);
|
||||||
}
|
}
|
||||||
|
@ -898,74 +898,70 @@ public class XmppConnection implements Runnable {
|
||||||
private void sendRegistryRequest() {
|
private void sendRegistryRequest() {
|
||||||
final IqPacket register = new IqPacket(IqPacket.TYPE.GET);
|
final IqPacket register = new IqPacket(IqPacket.TYPE.GET);
|
||||||
register.query("jabber:iq:register");
|
register.query("jabber:iq:register");
|
||||||
register.setTo(account.getServer());
|
register.setTo(Jid.of(account.getServer()));
|
||||||
sendUnmodifiedIqPacket(register, new OnIqPacketReceived() {
|
sendUnmodifiedIqPacket(register, (account, packet) -> {
|
||||||
|
if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (packet.getType() == IqPacket.TYPE.ERROR) {
|
||||||
|
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
||||||
|
}
|
||||||
|
final Element query = packet.query("jabber:iq:register");
|
||||||
|
if (query.hasChild("username") && (query.hasChild("password"))) {
|
||||||
|
final IqPacket register1 = new IqPacket(IqPacket.TYPE.SET);
|
||||||
|
final Element username = new Element("username").setContent(account.getUsername());
|
||||||
|
final Element password = new Element("password").setContent(account.getPassword());
|
||||||
|
register1.query("jabber:iq:register").addChild(username);
|
||||||
|
register1.query().addChild(password);
|
||||||
|
register1.setFrom(account.getJid().asBareJid());
|
||||||
|
sendUnmodifiedIqPacket(register1, registrationResponseListener, true);
|
||||||
|
} else if (query.hasChild("x", Namespace.DATA)) {
|
||||||
|
final Data data = Data.parse(query.findChild("x", Namespace.DATA));
|
||||||
|
final Element blob = query.findChild("data", "urn:xmpp:bob");
|
||||||
|
final String id = packet.getId();
|
||||||
|
InputStream is;
|
||||||
|
if (blob != null) {
|
||||||
|
try {
|
||||||
|
final String base64Blob = blob.getContent();
|
||||||
|
final byte[] strBlob = Base64.decode(base64Blob, Base64.DEFAULT);
|
||||||
|
is = new ByteArrayInputStream(strBlob);
|
||||||
|
} catch (Exception e) {
|
||||||
|
is = null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
Field field = data.getFieldByName("url");
|
||||||
|
URL url = field != null && field.getValue() != null ? new URL(field.getValue()) : null;
|
||||||
|
is = url != null ? url.openStream() : null;
|
||||||
|
} catch (IOException e) {
|
||||||
|
is = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
if (is != null) {
|
||||||
public void onIqPacketReceived(final Account account, final IqPacket packet) {
|
Bitmap captcha = BitmapFactory.decodeStream(is);
|
||||||
if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
try {
|
||||||
return;
|
if (mXmppConnectionService.displayCaptchaRequest(account, id, data, captcha)) {
|
||||||
}
|
return;
|
||||||
if (packet.getType() == IqPacket.TYPE.ERROR) {
|
|
||||||
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
|
||||||
}
|
|
||||||
final Element query = packet.query("jabber:iq:register");
|
|
||||||
if (query.hasChild("username") && (query.hasChild("password"))) {
|
|
||||||
final IqPacket register = new IqPacket(IqPacket.TYPE.SET);
|
|
||||||
final Element username = new Element("username").setContent(account.getUsername());
|
|
||||||
final Element password = new Element("password").setContent(account.getPassword());
|
|
||||||
register.query("jabber:iq:register").addChild(username);
|
|
||||||
register.query().addChild(password);
|
|
||||||
register.setFrom(account.getJid().asBareJid());
|
|
||||||
sendUnmodifiedIqPacket(register, registrationResponseListener, true);
|
|
||||||
} else if (query.hasChild("x", Namespace.DATA)) {
|
|
||||||
final Data data = Data.parse(query.findChild("x", Namespace.DATA));
|
|
||||||
final Element blob = query.findChild("data", "urn:xmpp:bob");
|
|
||||||
final String id = packet.getId();
|
|
||||||
InputStream is;
|
|
||||||
if (blob != null) {
|
|
||||||
try {
|
|
||||||
final String base64Blob = blob.getContent();
|
|
||||||
final byte[] strBlob = Base64.decode(base64Blob, Base64.DEFAULT);
|
|
||||||
is = new ByteArrayInputStream(strBlob);
|
|
||||||
} catch (Exception e) {
|
|
||||||
is = null;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
Field field = data.getFieldByName("url");
|
|
||||||
URL url = field != null && field.getValue() != null ? new URL(field.getValue()) : null;
|
|
||||||
is = url != null ? url.openStream() : null;
|
|
||||||
} catch (IOException e) {
|
|
||||||
is = null;
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is != null) {
|
|
||||||
Bitmap captcha = BitmapFactory.decodeStream(is);
|
|
||||||
try {
|
|
||||||
if (mXmppConnectionService.displayCaptchaRequest(account, id, data, captcha)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
|
||||||
} else if (query.hasChild("instructions") || query.hasChild("x",Namespace.OOB)) {
|
|
||||||
final String instructions = query.findChildContent("instructions");
|
|
||||||
final Element oob = query.findChild("x", Namespace.OOB);
|
|
||||||
final String url = oob == null ? null : oob.findChildContent("url");
|
|
||||||
if (url != null) {
|
|
||||||
setAccountCreationFailed(url);
|
|
||||||
} else if (instructions != null) {
|
|
||||||
Matcher matcher = Patterns.AUTOLINK_WEB_URL.matcher(instructions);
|
|
||||||
if (matcher.find()) {
|
|
||||||
setAccountCreationFailed(instructions.substring(matcher.start(), matcher.end()));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
|
||||||
}
|
}
|
||||||
|
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
||||||
|
} else if (query.hasChild("instructions") || query.hasChild("x",Namespace.OOB)) {
|
||||||
|
final String instructions = query.findChildContent("instructions");
|
||||||
|
final Element oob = query.findChild("x", Namespace.OOB);
|
||||||
|
final String url = oob == null ? null : oob.findChildContent("url");
|
||||||
|
if (url != null) {
|
||||||
|
setAccountCreationFailed(url);
|
||||||
|
} else if (instructions != null) {
|
||||||
|
Matcher matcher = Patterns.AUTOLINK_WEB_URL.matcher(instructions);
|
||||||
|
if (matcher.find()) {
|
||||||
|
setAccountCreationFailed(instructions.substring(matcher.start(), matcher.end()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new StateChangingError(Account.State.REGISTRATION_FAILED);
|
||||||
}
|
}
|
||||||
},true);
|
},true);
|
||||||
}
|
}
|
||||||
|
@ -1142,17 +1138,17 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
final boolean requestDiscoItemsFirst = !account.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
|
final boolean requestDiscoItemsFirst = !account.isOptionSet(Account.OPTION_LOGGED_IN_SUCCESSFULLY);
|
||||||
if (requestDiscoItemsFirst) {
|
if (requestDiscoItemsFirst) {
|
||||||
sendServiceDiscoveryItems(account.getServer());
|
sendServiceDiscoveryItems(Jid.of(account.getServer()));
|
||||||
}
|
}
|
||||||
if (discoveryResult == null) {
|
if (discoveryResult == null) {
|
||||||
sendServiceDiscoveryInfo(account.getServer());
|
sendServiceDiscoveryInfo(Jid.of(account.getServer()));
|
||||||
} else {
|
} else {
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": server caps came from cache");
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": server caps came from cache");
|
||||||
disco.put(account.getServer(), discoveryResult);
|
disco.put(Jid.of(account.getServer()), discoveryResult);
|
||||||
}
|
}
|
||||||
sendServiceDiscoveryInfo(account.getJid().asBareJid());
|
sendServiceDiscoveryInfo(account.getJid().asBareJid());
|
||||||
if (!requestDiscoItemsFirst) {
|
if (!requestDiscoItemsFirst) {
|
||||||
sendServiceDiscoveryItems(account.getServer());
|
sendServiceDiscoveryItems(Jid.of(account.getServer()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mWaitForDisco.get()) {
|
if (!mWaitForDisco.get()) {
|
||||||
|
@ -1166,32 +1162,28 @@ public class XmppConnection implements Runnable {
|
||||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||||
iq.setTo(jid);
|
iq.setTo(jid);
|
||||||
iq.query("http://jabber.org/protocol/disco#info");
|
iq.query("http://jabber.org/protocol/disco#info");
|
||||||
this.sendIqPacket(iq, new OnIqPacketReceived() {
|
this.sendIqPacket(iq, (account, packet) -> {
|
||||||
|
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||||
@Override
|
boolean advancedStreamFeaturesLoaded;
|
||||||
public void onIqPacketReceived(final Account account, final IqPacket packet) {
|
synchronized (XmppConnection.this.disco) {
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
ServiceDiscoveryResult result = new ServiceDiscoveryResult(packet);
|
||||||
boolean advancedStreamFeaturesLoaded;
|
if (jid.equals(Jid.of(account.getServer()))) {
|
||||||
synchronized (XmppConnection.this.disco) {
|
mXmppConnectionService.databaseBackend.insertDiscoveryResult(result);
|
||||||
ServiceDiscoveryResult result = new ServiceDiscoveryResult(packet);
|
|
||||||
if (jid.equals(account.getServer())) {
|
|
||||||
mXmppConnectionService.databaseBackend.insertDiscoveryResult(result);
|
|
||||||
}
|
|
||||||
disco.put(jid, result);
|
|
||||||
advancedStreamFeaturesLoaded = disco.containsKey(account.getServer())
|
|
||||||
&& disco.containsKey(account.getJid().asBareJid());
|
|
||||||
}
|
}
|
||||||
if (advancedStreamFeaturesLoaded && (jid.equals(account.getServer()) || jid.equals(account.getJid().asBareJid()))) {
|
disco.put(jid, result);
|
||||||
enableAdvancedStreamFeatures();
|
advancedStreamFeaturesLoaded = disco.containsKey(Jid.of(account.getServer()))
|
||||||
}
|
&& disco.containsKey(account.getJid().asBareJid());
|
||||||
} else {
|
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not query disco info for " + jid.toString());
|
|
||||||
}
|
}
|
||||||
if (packet.getType() != IqPacket.TYPE.TIMEOUT) {
|
if (advancedStreamFeaturesLoaded && (jid.equals(Jid.of(account.getServer())) || jid.equals(account.getJid().asBareJid()))) {
|
||||||
if (mPendingServiceDiscoveries.decrementAndGet() == 0
|
enableAdvancedStreamFeatures();
|
||||||
&& mWaitForDisco.compareAndSet(true, false)) {
|
}
|
||||||
finalizeBind();
|
} else {
|
||||||
}
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not query disco info for " + jid.toString());
|
||||||
|
}
|
||||||
|
if (packet.getType() != IqPacket.TYPE.TIMEOUT) {
|
||||||
|
if (mPendingServiceDiscoveries.decrementAndGet() == 0
|
||||||
|
&& mWaitForDisco.compareAndSet(true, false)) {
|
||||||
|
finalizeBind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1223,32 +1215,28 @@ public class XmppConnection implements Runnable {
|
||||||
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
final IqPacket iq = new IqPacket(IqPacket.TYPE.GET);
|
||||||
iq.setTo(Jid.ofDomain(server.getDomain()));
|
iq.setTo(Jid.ofDomain(server.getDomain()));
|
||||||
iq.query("http://jabber.org/protocol/disco#items");
|
iq.query("http://jabber.org/protocol/disco#items");
|
||||||
this.sendIqPacket(iq, new OnIqPacketReceived() {
|
this.sendIqPacket(iq, (account, packet) -> {
|
||||||
|
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||||
@Override
|
HashSet<Jid> items = new HashSet<Jid>();
|
||||||
public void onIqPacketReceived(final Account account, final IqPacket packet) {
|
final List<Element> elements = packet.query().getChildren();
|
||||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
for (final Element element : elements) {
|
||||||
HashSet<Jid> items = new HashSet<Jid>();
|
if (element.getName().equals("item")) {
|
||||||
final List<Element> elements = packet.query().getChildren();
|
final Jid jid = element.getAttributeAsJid("jid");
|
||||||
for (final Element element : elements) {
|
if (jid != null && !jid.equals(Jid.of(account.getServer()))) {
|
||||||
if (element.getName().equals("item")) {
|
items.add(jid);
|
||||||
final Jid jid = element.getAttributeAsJid("jid");
|
|
||||||
if (jid != null && !jid.equals(account.getServer())) {
|
|
||||||
items.add(jid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (Jid jid : items) {
|
|
||||||
sendServiceDiscoveryInfo(jid);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not query disco items of " + server);
|
|
||||||
}
|
}
|
||||||
if (packet.getType() != IqPacket.TYPE.TIMEOUT) {
|
for (Jid jid : items) {
|
||||||
if (mPendingServiceDiscoveries.decrementAndGet() == 0
|
sendServiceDiscoveryInfo(jid);
|
||||||
&& mWaitForDisco.compareAndSet(true, false)) {
|
}
|
||||||
finalizeBind();
|
} else {
|
||||||
}
|
Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": could not query disco items of " + server);
|
||||||
|
}
|
||||||
|
if (packet.getType() != IqPacket.TYPE.TIMEOUT) {
|
||||||
|
if (mPendingServiceDiscoveries.decrementAndGet() == 0
|
||||||
|
&& mWaitForDisco.compareAndSet(true, false)) {
|
||||||
|
finalizeBind();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1479,7 +1467,7 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void resetStreamId() {
|
private void resetStreamId() {
|
||||||
this.streamId = null;
|
this.streamId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1619,7 +1607,7 @@ public class XmppConnection implements Runnable {
|
||||||
private final SSLSocketFactory factory;
|
private final SSLSocketFactory factory;
|
||||||
private final DomainHostnameVerifier verifier;
|
private final DomainHostnameVerifier verifier;
|
||||||
|
|
||||||
public TlsFactoryVerifier(final SSLSocketFactory factory, final DomainHostnameVerifier verifier) throws IOException {
|
TlsFactoryVerifier(final SSLSocketFactory factory, final DomainHostnameVerifier verifier) throws IOException {
|
||||||
this.factory = factory;
|
this.factory = factory;
|
||||||
this.verifier = verifier;
|
this.verifier = verifier;
|
||||||
if (factory == null || verifier == null) {
|
if (factory == null || verifier == null) {
|
||||||
|
@ -1705,23 +1693,23 @@ public class XmppConnection implements Runnable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean carbons() {
|
public boolean carbons() {
|
||||||
return hasDiscoFeature(account.getServer(), "urn:xmpp:carbons:2");
|
return hasDiscoFeature(Jid.of(account.getServer()), "urn:xmpp:carbons:2");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean blocking() {
|
public boolean blocking() {
|
||||||
return hasDiscoFeature(account.getServer(), Namespace.BLOCKING);
|
return hasDiscoFeature(Jid.of(account.getServer()), Namespace.BLOCKING);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean spamReporting() {
|
public boolean spamReporting() {
|
||||||
return hasDiscoFeature(account.getServer(), "urn:xmpp:reporting:reason:spam:0");
|
return hasDiscoFeature(Jid.of(account.getServer()), "urn:xmpp:reporting:reason:spam:0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean flexibleOfflineMessageRetrieval() {
|
public boolean flexibleOfflineMessageRetrieval() {
|
||||||
return hasDiscoFeature(account.getServer(), Namespace.FLEXIBLE_OFFLINE_MESSAGE_RETRIEVAL);
|
return hasDiscoFeature(Jid.of(account.getServer()), Namespace.FLEXIBLE_OFFLINE_MESSAGE_RETRIEVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean register() {
|
public boolean register() {
|
||||||
return hasDiscoFeature(account.getServer(), Namespace.REGISTER);
|
return hasDiscoFeature(Jid.of(account.getServer()), Namespace.REGISTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean sm() {
|
public boolean sm() {
|
||||||
|
@ -1767,7 +1755,7 @@ public class XmppConnection implements Runnable {
|
||||||
|
|
||||||
public boolean push() {
|
public boolean push() {
|
||||||
return hasDiscoFeature(account.getJid().asBareJid(), "urn:xmpp:push:0")
|
return hasDiscoFeature(account.getJid().asBareJid(), "urn:xmpp:push:0")
|
||||||
|| hasDiscoFeature(account.getServer(), "urn:xmpp:push:0");
|
|| hasDiscoFeature(Jid.of(account.getServer()), "urn:xmpp:push:0");
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean rosterVersioning() {
|
public boolean rosterVersioning() {
|
||||||
|
|
Loading…
Reference in a new issue