Merge branch 'development' of https://github.com/siacs/Conversations into development

This commit is contained in:
iNPUTmice 2014-11-09 17:05:20 +01:00
commit c310ada8b3
28 changed files with 103 additions and 110 deletions

View File

@ -23,9 +23,6 @@ repositories {
maven { maven {
url "http://jitsi.github.com/otr4j/repository/" url "http://jitsi.github.com/otr4j/repository/"
} }
maven {
url "https://oss.sonatype.org/content/repositories/releases/"
}
jcenter() jcenter()
mavenCentral() mavenCentral()
} }
@ -37,7 +34,7 @@ dependencies {
compile 'com.android.support:support-v13:19.1.0' compile 'com.android.support:support-v13:19.1.0'
compile 'org.bouncycastle:bcprov-jdk15on:1.50' compile 'org.bouncycastle:bcprov-jdk15on:1.50'
compile 'net.java:otr4j:0.21' compile 'net.java:otr4j:0.21'
compile 'org.jxmpp:jxmpp-stringprep-libidn:0.4.0' compile 'org.gnu.inet:libidn:1.15'
compile 'com.google.zxing:core:3.1.0' compile 'com.google.zxing:core:3.1.0'
compile 'com.google.zxing:android-integration:3.1.0' compile 'com.google.zxing:android-integration:3.1.0'
} }

View File

@ -153,7 +153,7 @@ public class OtrEngine implements OtrEngineHost {
public void injectMessage(SessionID session, String body) public void injectMessage(SessionID session, String body)
throws OtrException { throws OtrException {
MessagePacket packet = new MessagePacket(); MessagePacket packet = new MessagePacket();
packet.setFrom(account.getFullJid()); packet.setFrom(account.getJid());
if (session.getUserID().isEmpty()) { if (session.getUserID().isEmpty()) {
packet.setAttribute("to", session.getAccountID()); packet.setAttribute("to", session.getAccountID());
} else { } else {

View File

@ -41,7 +41,7 @@ public class PgpEngine {
Intent params = new Intent(); Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY); params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, message params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, message
.getConversation().getAccount().getJid().toString()); .getConversation().getAccount().getJid().toBareJid().toString());
if (message.getType() == Message.TYPE_TEXT) { if (message.getType() == Message.TYPE_TEXT) {
InputStream is = new ByteArrayInputStream(message.getBody() InputStream is = new ByteArrayInputStream(message.getBody()
.getBytes()); .getBytes());
@ -156,7 +156,7 @@ public class PgpEngine {
.getMucOptions().getPgpKeyIds()); .getMucOptions().getPgpKeyIds());
} }
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, message params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, message
.getConversation().getAccount().getJid().toString()); .getConversation().getAccount().getJid().toBareJid().toString());
if (message.getType() == Message.TYPE_TEXT) { if (message.getType() == Message.TYPE_TEXT) {
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true); params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
@ -257,7 +257,7 @@ public class PgpEngine {
Intent params = new Intent(); Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY); params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true); params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid().toString()); params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid().toBareJid().toString());
InputStream is = new ByteArrayInputStream(pgpSig.toString().getBytes()); InputStream is = new ByteArrayInputStream(pgpSig.toString().getBytes());
ByteArrayOutputStream os = new ByteArrayOutputStream(); ByteArrayOutputStream os = new ByteArrayOutputStream();
Intent result = api.executeApi(params, is, os); Intent result = api.executeApi(params, is, os);
@ -284,7 +284,7 @@ public class PgpEngine {
Intent params = new Intent(); Intent params = new Intent();
params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true); params.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true);
params.setAction(OpenPgpApi.ACTION_SIGN); params.setAction(OpenPgpApi.ACTION_SIGN);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid().toString()); params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid().toBareJid().toString());
InputStream is = new ByteArrayInputStream(status.getBytes()); InputStream is = new ByteArrayInputStream(status.getBytes());
final OutputStream os = new ByteArrayOutputStream(); final OutputStream os = new ByteArrayOutputStream();
api.executeApiAsync(params, is, os, new IOpenPgpCallback() { api.executeApiAsync(params, is, os, new IOpenPgpCallback() {
@ -336,7 +336,7 @@ public class PgpEngine {
params.setAction(OpenPgpApi.ACTION_GET_KEY); params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId()); params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId());
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, contact.getAccount() params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, contact.getAccount()
.getJid().toString()); .getJid().toBareJid().toString());
api.executeApiAsync(params, null, null, new IOpenPgpCallback() { api.executeApiAsync(params, null, null, new IOpenPgpCallback() {
@Override @Override
@ -362,7 +362,7 @@ public class PgpEngine {
params.setAction(OpenPgpApi.ACTION_GET_KEY); params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId()); params.putExtra(OpenPgpApi.EXTRA_KEY_ID, contact.getPgpKeyId());
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, contact.getAccount() params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, contact.getAccount()
.getJid().toString()); .getJid().toBareJid().toString());
Intent result = api.executeApi(params, null, null); Intent result = api.executeApi(params, null, null);
return (PendingIntent) result return (PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT); .getParcelableExtra(OpenPgpApi.RESULT_INTENT);
@ -372,7 +372,7 @@ public class PgpEngine {
Intent params = new Intent(); Intent params = new Intent();
params.setAction(OpenPgpApi.ACTION_GET_KEY); params.setAction(OpenPgpApi.ACTION_GET_KEY);
params.putExtra(OpenPgpApi.EXTRA_KEY_ID, pgpKeyId); params.putExtra(OpenPgpApi.EXTRA_KEY_ID, pgpKeyId);
params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid().toString()); params.putExtra(OpenPgpApi.EXTRA_ACCOUNT_NAME, account.getJid().toBareJid().toString());
Intent result = api.executeApi(params, null, null); Intent result = api.executeApi(params, null, null);
return (PendingIntent) result return (PendingIntent) result
.getParcelableExtra(OpenPgpApi.RESULT_INTENT); .getParcelableExtra(OpenPgpApi.RESULT_INTENT);

View File

@ -185,7 +185,7 @@ public class Account extends AbstractEntity {
} }
public Jid getJid() { public Jid getJid() {
return jid.toBareJid(); return jid;
} }
public JSONObject getKeys() { public JSONObject getKeys() {
@ -246,10 +246,6 @@ public class Account extends AbstractEntity {
this.xmppConnection = connection; this.xmppConnection = connection;
} }
public Jid getFullJid() {
return this.jid;
}
public String getOtrFingerprint() { public String getOtrFingerprint() {
if (this.otrFingerprint == null) { if (this.otrFingerprint == null) {
try { try {

View File

@ -38,7 +38,7 @@ public class MessageGenerator extends AbstractGenerator {
packet.setTo(message.getCounterpart().toBareJid()); packet.setTo(message.getCounterpart().toBareJid());
packet.setType(MessagePacket.TYPE_GROUPCHAT); packet.setType(MessagePacket.TYPE_GROUPCHAT);
} }
packet.setFrom(account.getFullJid()); packet.setFrom(account.getJid());
packet.setId(message.getUuid()); packet.setId(message.getUuid());
if (addDelay) { if (addDelay) {
addDelay(packet, message.getTimeSent()); addDelay(packet, message.getTimeSent());
@ -124,7 +124,7 @@ public class MessageGenerator extends AbstractGenerator {
MessagePacket packet = new MessagePacket(); MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_NORMAL); packet.setType(MessagePacket.TYPE_NORMAL);
packet.setTo(to); packet.setTo(to);
packet.setFrom(account.getFullJid()); packet.setFrom(account.getJid());
Element received = packet.addChild("displayed", Element received = packet.addChild("displayed",
"urn:xmpp:chat-markers:0"); "urn:xmpp:chat-markers:0");
received.setAttribute("id", id); received.setAttribute("id", id);
@ -139,7 +139,7 @@ public class MessageGenerator extends AbstractGenerator {
Element subjectChild = new Element("subject"); Element subjectChild = new Element("subject");
subjectChild.setContent(subject); subjectChild.setContent(subject);
packet.addChild(subjectChild); packet.addChild(subjectChild);
packet.setFrom(conversation.getAccount().getJid()); packet.setFrom(conversation.getAccount().getJid().toBareJid());
return packet; return packet;
} }
@ -147,7 +147,7 @@ public class MessageGenerator extends AbstractGenerator {
MessagePacket packet = new MessagePacket(); MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_NORMAL); packet.setType(MessagePacket.TYPE_NORMAL);
packet.setTo(contact); packet.setTo(contact);
packet.setFrom(conversation.getAccount().getFullJid()); packet.setFrom(conversation.getAccount().getJid());
Element x = packet.addChild("x", "jabber:x:conference"); Element x = packet.addChild("x", "jabber:x:conference");
x.setAttribute("jid", conversation.getContactJid().toBareJid().toString()); x.setAttribute("jid", conversation.getContactJid().toBareJid().toString());
return packet; return packet;
@ -156,7 +156,7 @@ public class MessageGenerator extends AbstractGenerator {
public MessagePacket invite(Conversation conversation, String contact) { public MessagePacket invite(Conversation conversation, String contact) {
MessagePacket packet = new MessagePacket(); MessagePacket packet = new MessagePacket();
packet.setTo(conversation.getContactJid().toBareJid()); packet.setTo(conversation.getContactJid().toBareJid());
packet.setFrom(conversation.getAccount().getFullJid()); packet.setFrom(conversation.getAccount().getJid());
Element x = new Element("x"); Element x = new Element("x");
x.setAttribute("xmlns", "http://jabber.org/protocol/muc#user"); x.setAttribute("xmlns", "http://jabber.org/protocol/muc#user");
Element invite = new Element("invite"); Element invite = new Element("invite");
@ -171,7 +171,7 @@ public class MessageGenerator extends AbstractGenerator {
MessagePacket receivedPacket = new MessagePacket(); MessagePacket receivedPacket = new MessagePacket();
receivedPacket.setType(MessagePacket.TYPE_NORMAL); receivedPacket.setType(MessagePacket.TYPE_NORMAL);
receivedPacket.setTo(originalMessage.getFrom()); receivedPacket.setTo(originalMessage.getFrom());
receivedPacket.setFrom(account.getFullJid()); receivedPacket.setFrom(account.getJid());
Element received = receivedPacket.addChild("received", namespace); Element received = receivedPacket.addChild("received", namespace);
received.setAttribute("id", originalMessage.getId()); received.setAttribute("id", originalMessage.getId());
return receivedPacket; return receivedPacket;

View File

@ -16,7 +16,7 @@ public class PresenceGenerator extends AbstractGenerator {
PresencePacket packet = new PresencePacket(); PresencePacket packet = new PresencePacket();
packet.setAttribute("type", type); packet.setAttribute("type", type);
packet.setTo(contact.getJid()); packet.setTo(contact.getJid());
packet.setFrom(contact.getAccount().getJid()); packet.setFrom(contact.getAccount().getJid().toBareJid());
return packet; return packet;
} }
@ -38,7 +38,7 @@ public class PresenceGenerator extends AbstractGenerator {
public PresencePacket sendPresence(Account account) { public PresencePacket sendPresence(Account account) {
PresencePacket packet = new PresencePacket(); PresencePacket packet = new PresencePacket();
packet.setFrom(account.getFullJid()); packet.setFrom(account.getJid());
String sig = account.getPgpSignature(); String sig = account.getPgpSignature();
if (sig != null) { if (sig != null) {
packet.addChild("status").setContent("online"); packet.addChild("status").setContent("online");

View File

@ -68,7 +68,7 @@ public class IqParser extends AbstractParser implements OnIqPacketReceived {
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
if (packet.hasChild("query", "jabber:iq:roster")) { if (packet.hasChild("query", "jabber:iq:roster")) {
final Jid from = packet.getFrom(); final Jid from = packet.getFrom();
if ((from == null) || (from.equals(account.getJid()))) { if ((from == null) || (from.equals(account.getJid().toBareJid()))) {
Element query = packet.findChild("query"); Element query = packet.findChild("query");
this.rosterItems(account, query); this.rosterItems(account, query);
} }

View File

@ -347,7 +347,7 @@ public class MessageParser extends AbstractParser implements
avatar.owner = from; avatar.owner = from;
if (mXmppConnectionService.getFileBackend().isAvatarCached( if (mXmppConnectionService.getFileBackend().isAvatarCached(
avatar)) { avatar)) {
if (account.getJid().equals(from)) { if (account.getJid().toBareJid().equals(from)) {
if (account.setAvatar(avatar.getFilename())) { if (account.setAvatar(avatar.getFilename())) {
mXmppConnectionService.databaseBackend mXmppConnectionService.databaseBackend
.updateAccount(account); .updateAccount(account);

View File

@ -55,7 +55,7 @@ public class PresenceParser extends AbstractParser implements
} }
final Jid from = packet.getFrom(); final Jid from = packet.getFrom();
String type = packet.getAttribute("type"); String type = packet.getAttribute("type");
if (from.toBareJid().equals(account.getJid())) { if (from.toBareJid().equals(account.getJid().toBareJid())) {
if (!from.getResourcepart().isEmpty()) { if (!from.getResourcepart().isEmpty()) {
if (type == null) { if (type == null) {
account.updatePresence(from.getResourcepart(), account.updatePresence(from.getResourcepart(),

View File

@ -69,7 +69,7 @@ public class AvatarService {
this.sizes.add(size); this.sizes.add(size);
} }
} }
return PREFIX_CONTACT + "_" + contact.getAccount().getJid() + "_" return PREFIX_CONTACT + "_" + contact.getAccount().getJid().toBareJid() + "_"
+ contact.getJid() + "_" + String.valueOf(size); + contact.getJid() + "_" + String.valueOf(size);
} }
@ -174,7 +174,7 @@ public class AvatarService {
avatar = mXmppConnectionService.getFileBackend().getAvatar( avatar = mXmppConnectionService.getFileBackend().getAvatar(
account.getAvatar(), size); account.getAvatar(), size);
if (avatar == null) { if (avatar == null) {
avatar = get(account.getJid().toString(), size); avatar = get(account.getJid().toBareJid().toString(), size);
} }
mXmppConnectionService.getBitmapCache().put(KEY, avatar); mXmppConnectionService.getBitmapCache().put(KEY, avatar);
return avatar; return avatar;

View File

@ -190,11 +190,11 @@ public class XmppConnectionService extends Service {
} }
if (connection != null && connection.getFeatures().csi()) { if (connection != null && connection.getFeatures().csi()) {
if (checkListeners()) { if (checkListeners()) {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ " sending csi//inactive"); + " sending csi//inactive");
connection.sendInactive(); connection.sendInactive();
} else { } else {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ " sending csi//active"); + " sending csi//active");
connection.sendActive(); connection.sendActive();
} }
@ -214,7 +214,7 @@ public class XmppConnectionService extends Service {
&& (account.getStatus() != Account.STATUS_NO_INTERNET)) { && (account.getStatus() != Account.STATUS_NO_INTERNET)) {
if (connection != null) { if (connection != null) {
int next = connection.getTimeToNextAttempt(); int next = connection.getTimeToNextAttempt();
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": error connecting account. try again in " + ": error connecting account. try again in "
+ next + "s for the " + next + "s for the "
+ (connection.getAttempt() + 1) + " time"); + (connection.getAttempt() + 1) + " time");
@ -736,10 +736,10 @@ public class XmppConnectionService extends Service {
public void fetchRosterFromServer(Account account) { public void fetchRosterFromServer(Account account) {
IqPacket iqPacket = new IqPacket(IqPacket.TYPE_GET); IqPacket iqPacket = new IqPacket(IqPacket.TYPE_GET);
if (!"".equals(account.getRosterVersion())) { if (!"".equals(account.getRosterVersion())) {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": fetching roster version " + account.getRosterVersion()); + ": fetching roster version " + account.getRosterVersion());
} else { } else {
Log.d(Config.LOGTAG, account.getJid() + ": fetching roster"); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": fetching roster");
} }
iqPacket.query("jabber:iq:roster").setAttribute("ver", iqPacket.query("jabber:iq:roster").setAttribute("ver",
account.getRosterVersion()); account.getRosterVersion());
@ -1276,7 +1276,7 @@ public class XmppConnectionService extends Service {
options.flagAboutToRename(); options.flagAboutToRename();
PresencePacket packet = new PresencePacket(); PresencePacket packet = new PresencePacket();
packet.setTo(options.getJoinJid()); packet.setTo(options.getJoinJid());
packet.setFrom(conversation.getAccount().getFullJid()); packet.setFrom(conversation.getAccount().getJid());
String sig = account.getPgpSignature(); String sig = account.getPgpSignature();
if (sig != null) { if (sig != null) {
@ -1305,12 +1305,12 @@ public class XmppConnectionService extends Service {
if (account.getStatus() == Account.STATUS_ONLINE) { if (account.getStatus() == Account.STATUS_ONLINE) {
PresencePacket packet = new PresencePacket(); PresencePacket packet = new PresencePacket();
packet.setTo(conversation.getMucOptions().getJoinJid()); packet.setTo(conversation.getMucOptions().getJoinJid());
packet.setFrom(conversation.getAccount().getFullJid()); packet.setFrom(conversation.getAccount().getJid());
packet.setAttribute("type", "unavailable"); packet.setAttribute("type", "unavailable");
sendPresencePacket(conversation.getAccount(), packet); sendPresencePacket(conversation.getAccount(), packet);
conversation.getMucOptions().setOffline(); conversation.getMucOptions().setOffline();
conversation.deregisterWithBookmark(); conversation.deregisterWithBookmark();
Log.d(Config.LOGTAG, conversation.getAccount().getJid() Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid()
+ ": leaving muc " + conversation.getContactJid()); + ": leaving muc " + conversation.getContactJid());
} else { } else {
account.pendingConferenceLeaves.add(conversation); account.pendingConferenceLeaves.add(conversation);
@ -1328,7 +1328,7 @@ public class XmppConnectionService extends Service {
leaveMuc(conversation); leaveMuc(conversation);
} else { } else {
if (conversation.endOtrIfNeeded()) { if (conversation.endOtrIfNeeded()) {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": ended otr session with " + ": ended otr session with "
+ conversation.getContactJid()); + conversation.getContactJid());
} }
@ -1376,7 +1376,7 @@ public class XmppConnectionService extends Service {
List<Message> messages = conversation.getMessages(); List<Message> messages = conversation.getMessages();
Session otrSession = conversation.getOtrSession(); Session otrSession = conversation.getOtrSession();
Log.d(Config.LOGTAG, Log.d(Config.LOGTAG,
account.getJid() + " otr session established with " account.getJid().toBareJid() + " otr session established with "
+ conversation.getContactJid() + "/" + conversation.getContactJid() + "/"
+ otrSession.getSessionID().getUserID()); + otrSession.getSessionID().getUserID());
for (Message msg : messages) { for (Message msg : messages) {
@ -1412,7 +1412,7 @@ public class XmppConnectionService extends Service {
if (otrSession != null) { if (otrSession != null) {
MessagePacket packet = new MessagePacket(); MessagePacket packet = new MessagePacket();
packet.setType(MessagePacket.TYPE_CHAT); packet.setType(MessagePacket.TYPE_CHAT);
packet.setFrom(account.getFullJid()); packet.setFrom(account.getJid());
packet.addChild("private", "urn:xmpp:carbons:2"); packet.addChild("private", "urn:xmpp:carbons:2");
packet.addChild("no-copy", "urn:xmpp:hints"); packet.addChild("no-copy", "urn:xmpp:hints");
packet.setAttribute("to", otrSession.getSessionID().getAccountID() + "/" packet.setAttribute("to", otrSession.getSessionID().getAccountID() + "/"
@ -1522,13 +1522,13 @@ public class XmppConnectionService extends Service {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket result) { public void onIqPacketReceived(Account account, IqPacket result) {
final String ERROR = account.getJid() final String ERROR = account.getJid().toBareJid()
+ ": fetching avatar for " + avatar.owner + " failed "; + ": fetching avatar for " + avatar.owner + " failed ";
if (result.getType() == IqPacket.TYPE_RESULT) { if (result.getType() == IqPacket.TYPE_RESULT) {
avatar.image = mIqParser.avatarData(result); avatar.image = mIqParser.avatarData(result);
if (avatar.image != null) { if (avatar.image != null) {
if (getFileBackend().save(avatar)) { if (getFileBackend().save(avatar)) {
if (account.getJid().equals(avatar.owner)) { if (account.getJid().toBareJid().equals(avatar.owner)) {
if (account.setAvatar(avatar.getFilename())) { if (account.setAvatar(avatar.getFilename())) {
databaseBackend.updateAccount(account); databaseBackend.updateAccount(account);
} }
@ -1546,7 +1546,7 @@ public class XmppConnectionService extends Service {
if (callback != null) { if (callback != null) {
callback.success(avatar); callback.success(avatar);
} }
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": succesfully fetched avatar for " + ": succesfully fetched avatar for "
+ avatar.owner); + avatar.owner);
return; return;
@ -1586,7 +1586,7 @@ public class XmppConnectionService extends Service {
if (items != null) { if (items != null) {
Avatar avatar = Avatar.parseMetadata(items); Avatar avatar = Avatar.parseMetadata(items);
if (avatar != null) { if (avatar != null) {
avatar.owner = account.getJid(); avatar.owner = account.getJid().toBareJid();
if (fileBackend.isAvatarCached(avatar)) { if (fileBackend.isAvatarCached(avatar)) {
if (account.setAvatar(avatar.getFilename())) { if (account.setAvatar(avatar.getFilename())) {
databaseBackend.updateAccount(account); databaseBackend.updateAccount(account);
@ -1750,7 +1750,7 @@ public class XmppConnectionService extends Service {
public Account findAccountByJid(final Jid accountJid) { public Account findAccountByJid(final Jid accountJid) {
for (Account account : this.accounts) { for (Account account : this.accounts) {
if (account.getJid().equals(accountJid)) { if (account.getJid().toBareJid().equals(accountJid)) {
return account; return account;
} }
} }
@ -1771,7 +1771,7 @@ public class XmppConnectionService extends Service {
String id = conversation.getLatestMarkableMessageId(); String id = conversation.getLatestMarkableMessageId();
conversation.markRead(); conversation.markRead();
if (confirmMessages() && id != null && calledByUi) { if (confirmMessages() && id != null && calledByUi) {
Log.d(Config.LOGTAG, conversation.getAccount().getJid() Log.d(Config.LOGTAG, conversation.getAccount().getJid().toBareJid()
+ ": sending read marker for " + conversation.getName()); + ": sending read marker for " + conversation.getName());
Account account = conversation.getAccount(); Account account = conversation.getAccount();
final Jid to = conversation.getContactJid(); final Jid to = conversation.getContactJid();

View File

@ -99,7 +99,7 @@ public class ChooseContactActivity extends XmppActivity {
data.putExtra("contact", mListItem.getJid().toString()); data.putExtra("contact", mListItem.getJid().toString());
String account = request.getStringExtra("account"); String account = request.getStringExtra("account");
if (account == null && mListItem instanceof Contact) { if (account == null && mListItem instanceof Contact) {
account = ((Contact) mListItem).getAccount().getJid().toString(); account = ((Contact) mListItem).getAccount().getJid().toBareJid().toString();
} }
data.putExtra("account", account); data.putExtra("account", account);
data.putExtra("conversation", data.putExtra("conversation",

View File

@ -207,7 +207,7 @@ public class ConferenceDetailsActivity extends XmppActivity {
private void populateView() { private void populateView() {
mAccountJid.setText(getString(R.string.using_account, conversation mAccountJid.setText(getString(R.string.using_account, conversation
.getAccount().getJid())); .getAccount().getJid().toBareJid()));
mYourPhoto.setImageBitmap(avatarService().get( mYourPhoto.setImageBitmap(avatarService().get(
conversation.getAccount(), getPixel(48))); conversation.getAccount(), getPixel(48)));
setTitle(conversation.getName()); setTitle(conversation.getName());

View File

@ -329,7 +329,7 @@ public class ContactDetailsActivity extends XmppActivity {
contactJidTv.setText(contact.getJid().toString()); contactJidTv.setText(contact.getJid().toString());
} }
accountJidTv.setText(getString(R.string.using_account, contact accountJidTv.setText(getString(R.string.using_account, contact
.getAccount().getJid())); .getAccount().getJid().toBareJid()));
prepareContactBadge(badge, contact); prepareContactBadge(badge, contact);
if (contact.getSystemAccount() == null) { if (contact.getSystemAccount() == null) {
badge.setOnClickListener(onBadgeClick); badge.setOnClickListener(onBadgeClick);

View File

@ -106,7 +106,7 @@ public class ConversationActivity extends XmppActivity implements
protected String getShareableUri() { protected String getShareableUri() {
Conversation conversation = getSelectedConversation(); Conversation conversation = getSelectedConversation();
if (conversation != null) { if (conversation != null) {
return "xmpp:" + conversation.getAccount().getJid(); return "xmpp:" + conversation.getAccount().getJid().toBareJid();
} else { } else {
return ""; return "";
} }

View File

@ -298,7 +298,7 @@ public class ConversationFragment extends Fragment {
} else { } else {
Account account = message.getConversation().getAccount(); Account account = message.getConversation().getAccount();
Intent intent = new Intent(activity, EditAccountActivity.class); Intent intent = new Intent(activity, EditAccountActivity.class);
intent.putExtra("jid", account.getJid().toString()); intent.putExtra("jid", account.getJid().toBareJid().toString());
startActivity(intent); startActivity(intent);
} }
} }

View File

@ -205,7 +205,7 @@ public class EditAccountActivity extends XmppActivity {
if (mAccount!=null) { if (mAccount!=null) {
Intent intent = new Intent(getApplicationContext(), Intent intent = new Intent(getApplicationContext(),
PublishProfilePictureActivity.class); PublishProfilePictureActivity.class);
intent.putExtra("account", mAccount.getJid().toString()); intent.putExtra("account", mAccount.getJid().toBareJid().toString());
startActivity(intent); startActivity(intent);
} }
} }
@ -223,7 +223,7 @@ public class EditAccountActivity extends XmppActivity {
} else { } else {
intent = new Intent(getApplicationContext(), intent = new Intent(getApplicationContext(),
PublishProfilePictureActivity.class); PublishProfilePictureActivity.class);
intent.putExtra("account", mAccount.getJid().toString()); intent.putExtra("account", mAccount.getJid().toBareJid().toString());
intent.putExtra("setup", true); intent.putExtra("setup", true);
} }
startActivity(intent); startActivity(intent);
@ -264,7 +264,7 @@ public class EditAccountActivity extends XmppActivity {
} }
protected boolean accountInfoEdited() { protected boolean accountInfoEdited() {
return (!this.mAccount.getJid().equals( return (!this.mAccount.getJid().toBareJid().equals(
this.mAccountJid.getText().toString())) this.mAccountJid.getText().toString()))
|| (!this.mAccount.getPassword().equals( || (!this.mAccount.getPassword().equals(
this.mPassword.getText().toString())); this.mPassword.getText().toString()));
@ -273,7 +273,7 @@ public class EditAccountActivity extends XmppActivity {
@Override @Override
protected String getShareableUri() { protected String getShareableUri() {
if (mAccount!=null) { if (mAccount!=null) {
return "xmpp:"+mAccount.getJid(); return "xmpp:"+mAccount.getJid().toBareJid();
} else { } else {
return ""; return "";
} }
@ -378,7 +378,7 @@ public class EditAccountActivity extends XmppActivity {
} }
private void updateAccountInformation() { private void updateAccountInformation() {
this.mAccountJid.setText(this.mAccount.getJid().toString()); this.mAccountJid.setText(this.mAccount.getJid().toBareJid().toString());
this.mPassword.setText(this.mAccount.getPassword()); this.mPassword.setText(this.mAccount.getPassword());
if (this.jidToEdit != null) { if (this.jidToEdit != null) {
this.mAvatar.setVisibility(View.VISIBLE); this.mAvatar.setVisibility(View.VISIBLE);

View File

@ -81,7 +81,7 @@ public class ManageAccountActivity extends XmppActivity {
} else { } else {
menu.findItem(R.id.mgmt_account_enable).setVisible(false); menu.findItem(R.id.mgmt_account_enable).setVisible(false);
} }
menu.setHeaderTitle(this.selectedAccount.getJid().toString()); menu.setHeaderTitle(this.selectedAccount.getJid().toBareJid().toString());
} }
@Override @Override

View File

@ -187,7 +187,7 @@ public class PublishProfilePictureActivity extends XmppActivity {
} else { } else {
loadImageIntoPreview(avatarUri); loadImageIntoPreview(avatarUri);
} }
this.accountTextView.setText(this.account.getJid().toString()); this.accountTextView.setText(this.account.getJid().toBareJid().toString());
} }
} }

View File

@ -574,7 +574,7 @@ public class StartConversationActivity extends XmppActivity {
this.mActivatedAccounts.clear(); this.mActivatedAccounts.clear();
for (Account account : xmppConnectionService.getAccounts()) { for (Account account : xmppConnectionService.getAccounts()) {
if (account.getStatus() != Account.STATUS_DISABLED) { if (account.getStatus() != Account.STATUS_DISABLED) {
this.mActivatedAccounts.add(account.getJid().toString()); this.mActivatedAccounts.add(account.getJid().toBareJid().toString());
} }
} }
this.mKnownHosts = xmppConnectionService.getKnownHosts(); this.mKnownHosts = xmppConnectionService.getKnownHosts();

View File

@ -277,14 +277,14 @@ public abstract class XmppActivity extends Activity {
public void switchToContactDetails(Contact contact) { public void switchToContactDetails(Contact contact) {
Intent intent = new Intent(this, ContactDetailsActivity.class); Intent intent = new Intent(this, ContactDetailsActivity.class);
intent.setAction(ContactDetailsActivity.ACTION_VIEW_CONTACT); intent.setAction(ContactDetailsActivity.ACTION_VIEW_CONTACT);
intent.putExtra("account", contact.getAccount().getJid().toString()); intent.putExtra("account", contact.getAccount().getJid().toBareJid().toString());
intent.putExtra("contact", contact.getJid().toString()); intent.putExtra("contact", contact.getJid().toString());
startActivity(intent); startActivity(intent);
} }
public void switchToAccount(Account account) { public void switchToAccount(Account account) {
Intent intent = new Intent(this, EditAccountActivity.class); Intent intent = new Intent(this, EditAccountActivity.class);
intent.putExtra("jid", account.getJid().toString()); intent.putExtra("jid", account.getJid().toBareJid().toString());
startActivity(intent); startActivity(intent);
} }

View File

@ -31,7 +31,7 @@ public class AccountAdapter extends ArrayAdapter<Account> {
view = inflater.inflate(R.layout.account_row, parent, false); view = inflater.inflate(R.layout.account_row, parent, false);
} }
TextView jid = (TextView) view.findViewById(R.id.account_jid); TextView jid = (TextView) view.findViewById(R.id.account_jid);
jid.setText(account.getJid().toString()); jid.setText(account.getJid().toBareJid().toString());
TextView statusView = (TextView) view.findViewById(R.id.account_status); TextView statusView = (TextView) view.findViewById(R.id.account_status);
ImageView imageView = (ImageView) view.findViewById(R.id.account_image); ImageView imageView = (ImageView) view.findViewById(R.id.account_image);
imageView.setImageBitmap(activity.avatarService().get(account, imageView.setImageBitmap(activity.avatarService().get(account,

View File

@ -90,7 +90,7 @@ public class ExceptionHelper {
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
Log.d(Config.LOGTAG, "using account=" Log.d(Config.LOGTAG, "using account="
+ finalAccount.getJid() + finalAccount.getJid().toBareJid()
+ " to send in stack trace"); + " to send in stack trace");
Conversation conversation = null; Conversation conversation = null;
try { try {

View File

@ -124,7 +124,7 @@ public class UIHelper {
} else if (accountsWproblems.size() == 1) { } else if (accountsWproblems.size() == 1) {
mBuilder.setContentTitle(context mBuilder.setContentTitle(context
.getString(R.string.problem_connecting_to_account)); .getString(R.string.problem_connecting_to_account));
mBuilder.setContentText(accountsWproblems.get(0).getJid().toString()); mBuilder.setContentText(accountsWproblems.get(0).getJid().toBareJid().toString());
} else { } else {
mBuilder.setContentTitle(context mBuilder.setContentTitle(context
.getString(R.string.problem_connecting_to_accounts)); .getString(R.string.problem_connecting_to_accounts));

View File

@ -107,7 +107,7 @@ public class XmppConnection implements Runnable {
public XmppConnection(Account account, XmppConnectionService service) { public XmppConnection(Account account, XmppConnectionService service) {
this.account = account; this.account = account;
this.wakeLock = service.getPowerManager().newWakeLock( this.wakeLock = service.getPowerManager().newWakeLock(
PowerManager.PARTIAL_WAKE_LOCK, account.getJid().toString()); PowerManager.PARTIAL_WAKE_LOCK, account.getJid().toBareJid().toString());
tagWriter = new TagWriter(); tagWriter = new TagWriter();
mXmppConnectionService = service; mXmppConnectionService = service;
applicationContext = service.getApplicationContext(); applicationContext = service.getApplicationContext();
@ -132,7 +132,7 @@ public class XmppConnection implements Runnable {
} }
protected void connect() { protected void connect() {
Log.d(Config.LOGTAG, account.getJid().toString() + ": connecting"); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": connecting");
usingCompression = false; usingCompression = false;
usingEncryption = false; usingEncryption = false;
lastConnect = SystemClock.elapsedRealtime(); lastConnect = SystemClock.elapsedRealtime();
@ -148,7 +148,7 @@ public class XmppConnection implements Runnable {
Bundle result = DNSHelper.getSRVRecord(account.getServer()); Bundle result = DNSHelper.getSRVRecord(account.getServer());
ArrayList<Parcelable> values = result.getParcelableArrayList("values"); ArrayList<Parcelable> values = result.getParcelableArrayList("values");
if ("timeout".equals(result.getString("error"))) { if ("timeout".equals(result.getString("error"))) {
Log.d(Config.LOGTAG, account.getJid().toString() + ": dns timeout"); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": dns timeout");
this.changeStatus(Account.STATUS_OFFLINE); this.changeStatus(Account.STATUS_OFFLINE);
return; return;
} else if (values != null) { } else if (values != null) {
@ -169,12 +169,12 @@ public class XmppConnection implements Runnable {
InetSocketAddress addr; InetSocketAddress addr;
if (srvIpServer != null) { if (srvIpServer != null) {
addr = new InetSocketAddress(srvIpServer, srvRecordPort); addr = new InetSocketAddress(srvIpServer, srvRecordPort);
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": using values from dns " + srvRecordServer + ": using values from dns " + srvRecordServer
+ "[" + srvIpServer + "]:" + srvRecordPort); + "[" + srvIpServer + "]:" + srvRecordPort);
} else { } else {
addr = new InetSocketAddress(srvRecordServer, srvRecordPort); addr = new InetSocketAddress(srvRecordServer, srvRecordPort);
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": using values from dns " + ": using values from dns "
+ srvRecordServer + ":" + srvRecordPort); + srvRecordServer + ":" + srvRecordPort);
} }
@ -182,10 +182,10 @@ public class XmppConnection implements Runnable {
socket.connect(addr, 20000); socket.connect(addr, 20000);
socketError = false; socketError = false;
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
Log.d(Config.LOGTAG, account.getJid().toString() + ": " + e.getMessage()); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage());
i++; i++;
} catch (IOException e) { } catch (IOException e) {
Log.d(Config.LOGTAG, account.getJid().toString() + ": " + e.getMessage()); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage());
i++; i++;
} }
} }
@ -203,7 +203,7 @@ public class XmppConnection implements Runnable {
&& "nosrv".equals(result.getString("error", null))) { && "nosrv".equals(result.getString("error", null))) {
socket = new Socket(account.getServer().getDomainpart(), 5222); socket = new Socket(account.getServer().getDomainpart(), 5222);
} else { } else {
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": timeout in DNS resolution"); + ": timeout in DNS resolution");
changeStatus(Account.STATUS_OFFLINE); changeStatus(Account.STATUS_OFFLINE);
return; return;
@ -237,7 +237,7 @@ public class XmppConnection implements Runnable {
} }
} }
} catch (final IOException | XmlPullParserException e) { } catch (final IOException | XmlPullParserException e) {
Log.d(Config.LOGTAG, account.getJid().toString() + ": " + e.getMessage()); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage());
this.changeStatus(Account.STATUS_OFFLINE); this.changeStatus(Account.STATUS_OFFLINE);
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
try { try {
@ -246,7 +246,7 @@ public class XmppConnection implements Runnable {
} }
} }
} catch (NoSuchAlgorithmException e) { } catch (NoSuchAlgorithmException e) {
Log.d(Config.LOGTAG, account.getJid().toString() + ": " + e.getMessage()); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": " + e.getMessage());
this.changeStatus(Account.STATUS_OFFLINE); this.changeStatus(Account.STATUS_OFFLINE);
Log.d(Config.LOGTAG, "compression exception " + e.getMessage()); Log.d(Config.LOGTAG, "compression exception " + e.getMessage());
if (wakeLock.isHeld()) { if (wakeLock.isHeld()) {
@ -277,7 +277,7 @@ public class XmppConnection implements Runnable {
} else if (nextTag.isStart("compressed")) { } else if (nextTag.isStart("compressed")) {
switchOverToZLib(nextTag); switchOverToZLib(nextTag);
} else if (nextTag.isStart("success")) { } else if (nextTag.isStart("success")) {
Log.d(Config.LOGTAG, account.getJid().toString() + ": logged in"); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": logged in");
tagReader.readTag(); tagReader.readTag();
tagReader.reset(); tagReader.reset();
sendStartStream(); sendStartStream();
@ -298,11 +298,11 @@ public class XmppConnection implements Runnable {
Element enabled = tagReader.readElement(nextTag); Element enabled = tagReader.readElement(nextTag);
if ("true".equals(enabled.getAttribute("resume"))) { if ("true".equals(enabled.getAttribute("resume"))) {
this.streamId = enabled.getAttribute("id"); this.streamId = enabled.getAttribute("id");
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": stream managment(" + smVersion + ": stream managment(" + smVersion
+ ") enabled (resumable)"); + ") enabled (resumable)");
} else { } else {
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": stream managment(" + smVersion + ") enabled"); + ": stream managment(" + smVersion + ") enabled");
} }
this.lastSessionStarted = SystemClock.elapsedRealtime(); this.lastSessionStarted = SystemClock.elapsedRealtime();
@ -316,11 +316,11 @@ public class XmppConnection implements Runnable {
try { try {
int serverCount = Integer.parseInt(h); int serverCount = Integer.parseInt(h);
if (serverCount != stanzasSent) { if (serverCount != stanzasSent) {
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": session resumed with lost packages"); + ": session resumed with lost packages");
stanzasSent = serverCount; stanzasSent = serverCount;
} else { } else {
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": session resumed"); + ": session resumed");
} }
if (acknowledgedListener != null) { if (acknowledgedListener != null) {
@ -355,7 +355,7 @@ public class XmppConnection implements Runnable {
} }
} else if (nextTag.isStart("failed")) { } else if (nextTag.isStart("failed")) {
tagReader.readElement(nextTag); tagReader.readElement(nextTag);
Log.d(Config.LOGTAG, account.getJid().toString() + ": resumption failed"); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": resumption failed");
streamId = null; streamId = null;
if (account.getStatus() != Account.STATUS_ONLINE) { if (account.getStatus() != Account.STATUS_ONLINE) {
sendBindRequest(); sendBindRequest();
@ -378,15 +378,15 @@ public class XmppConnection implements Runnable {
} }
private void sendInitialPing() { private void sendInitialPing() {
Log.d(Config.LOGTAG, account.getJid().toString() + ": sending intial ping"); Log.d(Config.LOGTAG, account.getJid().toBareJid().toString() + ": sending intial ping");
IqPacket iq = new IqPacket(IqPacket.TYPE_GET); IqPacket iq = new IqPacket(IqPacket.TYPE_GET);
iq.setFrom(account.getFullJid()); iq.setFrom(account.getJid());
iq.addChild("ping", "urn:xmpp:ping"); iq.addChild("ping", "urn:xmpp:ping");
this.sendIqPacket(iq, new OnIqPacketReceived() { this.sendIqPacket(iq, new OnIqPacketReceived() {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
Log.d(Config.LOGTAG, account.getJid().toString() Log.d(Config.LOGTAG, account.getJid().toBareJid().toString()
+ ": online with resource " + account.getResource()); + ": online with resource " + account.getResource());
changeStatus(Account.STATUS_ONLINE); changeStatus(Account.STATUS_ONLINE);
} }
@ -515,7 +515,7 @@ public class XmppConnection implements Runnable {
.setInputStream(new ZLibInputStream(tagReader.getInputStream())); .setInputStream(new ZLibInputStream(tagReader.getInputStream()));
sendStartStream(); sendStartStream();
Log.d(Config.LOGTAG, account.getJid() + ": compression enabled"); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": compression enabled");
usingCompression = true; usingCompression = true;
processStream(tagReader.readTag()); processStream(tagReader.readTag());
} }
@ -582,7 +582,7 @@ public class XmppConnection implements Runnable {
tagReader.setInputStream(sslSocket.getInputStream()); tagReader.setInputStream(sslSocket.getInputStream());
tagWriter.setOutputStream(sslSocket.getOutputStream()); tagWriter.setOutputStream(sslSocket.getOutputStream());
sendStartStream(); sendStartStream();
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": TLS connection established"); + ": TLS connection established");
usingEncryption = true; usingEncryption = true;
processStream(tagReader.readTag()); processStream(tagReader.readTag());
@ -642,7 +642,7 @@ public class XmppConnection implements Runnable {
} else if (this.streamFeatures.hasChild("bind") && shouldBind) { } else if (this.streamFeatures.hasChild("bind") && shouldBind) {
sendBindRequest(); sendBindRequest();
} else { } else {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": incompatible server. disconnecting"); + ": incompatible server. disconnecting");
disconnect(true); disconnect(true);
} }
@ -720,7 +720,7 @@ public class XmppConnection implements Runnable {
} else { } else {
changeStatus(Account.STATUS_REGISTRATION_FAILED); changeStatus(Account.STATUS_REGISTRATION_FAILED);
disconnect(true); disconnect(true);
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": could not register. instructions are" + ": could not register. instructions are"
+ instructions.getContent()); + instructions.getContent());
} }
@ -773,7 +773,7 @@ public class XmppConnection implements Runnable {
} }
}); });
if (this.streamFeatures.hasChild("session")) { if (this.streamFeatures.hasChild("session")) {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": sending deprecated session"); + ": sending deprecated session");
IqPacket startSession = new IqPacket(IqPacket.TYPE_SET); IqPacket startSession = new IqPacket(IqPacket.TYPE_SET);
startSession.addChild("session", startSession.addChild("session",
@ -843,10 +843,10 @@ public class XmppConnection implements Runnable {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
if (!packet.hasChild("error")) { if (!packet.hasChild("error")) {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": successfully enabled carbons"); + ": successfully enabled carbons");
} else { } else {
Log.d(Config.LOGTAG, account.getJid() Log.d(Config.LOGTAG, account.getJid().toBareJid()
+ ": error enableing carbons " + packet.toString()); + ": error enableing carbons " + packet.toString());
} }
} }
@ -860,14 +860,14 @@ public class XmppConnection implements Runnable {
final String resource = account.getResource().split("\\.")[0]; final String resource = account.getResource().split("\\.")[0];
account.setResource(resource + "." + nextRandomId()); account.setResource(resource + "." + nextRandomId());
Log.d(Config.LOGTAG, Log.d(Config.LOGTAG,
account.getJid() + ": switching resource due to conflict (" account.getJid().toBareJid() + ": switching resource due to conflict ("
+ account.getResource() + ")"); + account.getResource() + ")");
} }
} }
private void sendStartStream() throws IOException { private void sendStartStream() throws IOException {
Tag stream = Tag.start("stream:stream"); Tag stream = Tag.start("stream:stream");
stream.setAttribute("from", account.getJid().toString()); stream.setAttribute("from", account.getJid().toBareJid().toString());
stream.setAttribute("to", account.getServer().toString()); stream.setAttribute("to", account.getServer().toString());
stream.setAttribute("version", "1.0"); stream.setAttribute("version", "1.0");
stream.setAttribute("xml:lang", "en"); stream.setAttribute("xml:lang", "en");
@ -885,7 +885,7 @@ public class XmppConnection implements Runnable {
String id = nextRandomId(); String id = nextRandomId();
packet.setAttribute("id", id); packet.setAttribute("id", id);
} }
packet.setFrom(account.getFullJid()); packet.setFrom(account.getJid());
this.sendPacket(packet, callback); this.sendPacket(packet, callback);
} }
@ -932,7 +932,7 @@ public class XmppConnection implements Runnable {
tagWriter.writeStanzaAsync(new RequestPacket(smVersion)); tagWriter.writeStanzaAsync(new RequestPacket(smVersion));
} else { } else {
IqPacket iq = new IqPacket(IqPacket.TYPE_GET); IqPacket iq = new IqPacket(IqPacket.TYPE_GET);
iq.setFrom(account.getFullJid()); iq.setFrom(account.getJid());
iq.addChild("ping", "urn:xmpp:ping"); iq.addChild("ping", "urn:xmpp:ping");
this.sendIqPacket(iq, null); this.sendIqPacket(iq, null);
} }
@ -972,7 +972,7 @@ public class XmppConnection implements Runnable {
} }
public void disconnect(boolean force) { public void disconnect(boolean force) {
Log.d(Config.LOGTAG, account.getJid() + ": disconnecting"); Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": disconnecting");
try { try {
if (force) { if (force) {
socket.close(); socket.close();

View File

@ -83,7 +83,7 @@ public class JingleConnection implements Downloadable {
@Override @Override
public void onFileTransmitted(DownloadableFile file) { public void onFileTransmitted(DownloadableFile file) {
if (responder.equals(account.getFullJid())) { if (responder.equals(account.getJid())) {
sendSuccess(); sendSuccess();
if (acceptedAutomatically) { if (acceptedAutomatically) {
message.markUnread(); message.markUnread();
@ -122,7 +122,7 @@ public class JingleConnection implements Downloadable {
@Override @Override
public void success() { public void success() {
if (initiator.equals(account.getFullJid())) { if (initiator.equals(account.getJid())) {
Log.d(Config.LOGTAG, "we were initiating. sending file"); Log.d(Config.LOGTAG, "we were initiating. sending file");
transport.send(file, onFileTransmissionSatusChanged); transport.send(file, onFileTransmissionSatusChanged);
} else { } else {
@ -204,7 +204,7 @@ public class JingleConnection implements Downloadable {
this.contentName = this.mJingleConnectionManager.nextRandomId(); this.contentName = this.mJingleConnectionManager.nextRandomId();
this.message = message; this.message = message;
this.account = message.getConversation().getAccount(); this.account = message.getConversation().getAccount();
this.initiator = this.account.getFullJid(); this.initiator = this.account.getJid();
this.responder = this.message.getCounterpart(); this.responder = this.message.getCounterpart();
this.sessionId = this.mJingleConnectionManager.nextRandomId(); this.sessionId = this.mJingleConnectionManager.nextRandomId();
if (this.candidates.size() > 0) { if (this.candidates.size() > 0) {
@ -265,7 +265,7 @@ public class JingleConnection implements Downloadable {
this.message.setCounterpart(from); this.message.setCounterpart(from);
this.account = account; this.account = account;
this.initiator = packet.getFrom(); this.initiator = packet.getFrom();
this.responder = this.account.getFullJid(); this.responder = this.account.getJid();
this.sessionId = packet.getSessionId(); this.sessionId = packet.getSessionId();
Content content = packet.getJingleContent(); Content content = packet.getJingleContent();
this.contentCreator = content.getAttribute("creator"); this.contentCreator = content.getAttribute("creator");
@ -444,7 +444,7 @@ public class JingleConnection implements Downloadable {
private JinglePacket bootstrapPacket(String action) { private JinglePacket bootstrapPacket(String action) {
JinglePacket packet = new JinglePacket(); JinglePacket packet = new JinglePacket();
packet.setAction(action); packet.setAction(action);
packet.setFrom(account.getFullJid()); packet.setFrom(account.getJid());
packet.setTo(this.message.getCounterpart()); packet.setTo(this.message.getCounterpart());
packet.setSessionId(this.sessionId); packet.setSessionId(this.sessionId);
packet.setInitiator(this.initiator); packet.setInitiator(this.initiator);
@ -533,7 +533,7 @@ public class JingleConnection implements Downloadable {
if (connection == null) { if (connection == null) {
Log.d(Config.LOGTAG, "could not find suitable candidate"); Log.d(Config.LOGTAG, "could not find suitable candidate");
this.disconnect(); this.disconnect();
if (this.initiator.equals(account.getFullJid())) { if (this.initiator.equals(account.getJid())) {
this.sendFallbackToIbb(); this.sendFallbackToIbb();
} }
} else { } else {
@ -571,7 +571,7 @@ public class JingleConnection implements Downloadable {
+ " was a proxy. waiting for other party to activate"); + " was a proxy. waiting for other party to activate");
} }
} else { } else {
if (initiator.equals(account.getFullJid())) { if (initiator.equals(account.getJid())) {
Log.d(Config.LOGTAG, "we were initiating. sending file"); Log.d(Config.LOGTAG, "we were initiating. sending file");
connection.send(file, onFileTransmissionSatusChanged); connection.send(file, onFileTransmissionSatusChanged);
} else { } else {
@ -601,7 +601,7 @@ public class JingleConnection implements Downloadable {
} else if (connection.getCandidate().getPriority() == currentConnection } else if (connection.getCandidate().getPriority() == currentConnection
.getCandidate().getPriority()) { .getCandidate().getPriority()) {
// Log.d(Config.LOGTAG,"found two candidates with same priority"); // Log.d(Config.LOGTAG,"found two candidates with same priority");
if (initiator.equals(account.getFullJid())) { if (initiator.equals(account.getJid())) {
if (currentConnection.getCandidate().isOurs()) { if (currentConnection.getCandidate().isOurs()) {
connection = currentConnection; connection = currentConnection;
} }
@ -710,7 +710,7 @@ public class JingleConnection implements Downloadable {
this.mJingleStatus = JINGLE_STATUS_CANCELED; this.mJingleStatus = JINGLE_STATUS_CANCELED;
this.disconnect(); this.disconnect();
if (this.message != null) { if (this.message != null) {
if (this.responder.equals(account.getFullJid())) { if (this.responder.equals(account.getJid())) {
this.mStatus = Downloadable.STATUS_FAILED; this.mStatus = Downloadable.STATUS_FAILED;
this.mXmppConnectionService.updateConversationUi(); this.mXmppConnectionService.updateConversationUi();
} else { } else {

View File

@ -75,7 +75,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
public void getPrimaryCandidate(Account account, public void getPrimaryCandidate(Account account,
final OnPrimaryCandidateFound listener) { final OnPrimaryCandidateFound listener) {
if (!this.primaryCandidates.containsKey(account.getJid())) { if (!this.primaryCandidates.containsKey(account.getJid().toBareJid())) {
String xmlns = "http://jabber.org/protocol/bytestreams"; String xmlns = "http://jabber.org/protocol/bytestreams";
final String proxy = account.getXmppConnection() final String proxy = account.getXmppConnection()
.findDiscoItemByFeature(xmlns); .findDiscoItemByFeature(xmlns);
@ -109,7 +109,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
candidate.setJid(null); candidate.setJid(null);
} }
candidate.setPriority(655360 + 65535); candidate.setPriority(655360 + 65535);
primaryCandidates.put(account.getJid(), primaryCandidates.put(account.getJid().toBareJid(),
candidate); candidate);
listener.onPrimaryCandidateFound(true, listener.onPrimaryCandidateFound(true,
candidate); candidate);
@ -125,7 +125,7 @@ public class JingleConnectionManager extends AbstractConnectionManager {
} else { } else {
listener.onPrimaryCandidateFound(true, listener.onPrimaryCandidateFound(true,
this.primaryCandidates.get(account.getJid())); this.primaryCandidates.get(account.getJid().toBareJid()));
} }
} }

View File

@ -30,11 +30,11 @@ public class JingleSocks5Transport extends JingleTransport {
StringBuilder destBuilder = new StringBuilder(); StringBuilder destBuilder = new StringBuilder();
destBuilder.append(jingleConnection.getSessionId()); destBuilder.append(jingleConnection.getSessionId());
if (candidate.isOurs()) { if (candidate.isOurs()) {
destBuilder.append(jingleConnection.getAccount().getFullJid()); destBuilder.append(jingleConnection.getAccount().getJid());
destBuilder.append(jingleConnection.getCounterPart()); destBuilder.append(jingleConnection.getCounterPart());
} else { } else {
destBuilder.append(jingleConnection.getCounterPart()); destBuilder.append(jingleConnection.getCounterPart());
destBuilder.append(jingleConnection.getAccount().getFullJid()); destBuilder.append(jingleConnection.getAccount().getJid());
} }
mDigest.reset(); mDigest.reset();
this.destination = CryptoHelper.bytesToHex(mDigest this.destination = CryptoHelper.bytesToHex(mDigest