diff options
Diffstat (limited to '')
21 files changed, 126 insertions, 95 deletions
diff --git a/src/eu/siacs/conversations/Config.java b/src/eu/siacs/conversations/Config.java index 6219b6b0..1725eca6 100644 --- a/src/eu/siacs/conversations/Config.java +++ b/src/eu/siacs/conversations/Config.java @@ -14,9 +14,9 @@ public final class Config { public static final int AVATAR_SIZE = 192; public static final Bitmap.CompressFormat AVATAR_FORMAT = Bitmap.CompressFormat.WEBP; - + public static final int MESSAGE_MERGE_WINDOW = 20; - + public static final boolean PARSE_EMOTICONS = false; private Config() { diff --git a/src/eu/siacs/conversations/crypto/OtrEngine.java b/src/eu/siacs/conversations/crypto/OtrEngine.java index 46dd714f..5dfd6fd6 100644 --- a/src/eu/siacs/conversations/crypto/OtrEngine.java +++ b/src/eu/siacs/conversations/crypto/OtrEngine.java @@ -174,7 +174,8 @@ public class OtrEngine implements OtrEngineHost { @Override public void messageFromAnotherInstanceReceived(SessionID id) { - Log.d(Config.LOGTAG,"unreadable message received from "+id.getAccountID()); + Log.d(Config.LOGTAG, + "unreadable message received from " + id.getAccountID()); } @Override diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java index 2f678279..e7058a68 100644 --- a/src/eu/siacs/conversations/crypto/PgpEngine.java +++ b/src/eu/siacs/conversations/crypto/PgpEngine.java @@ -106,8 +106,8 @@ public class PgpEngine { outputFile.getAbsolutePath(), options); int imageHeight = options.outHeight; int imageWidth = options.outWidth; - message.setBody(Long.toString(outputFile.getSize()) + ',' - + imageWidth + ',' + imageHeight); + message.setBody(Long.toString(outputFile.getSize()) + + ',' + imageWidth + ',' + imageHeight); message.setEncryption(Message.ENCRYPTION_DECRYPTED); PgpEngine.this.mXmppConnectionService .updateMessage(message); @@ -301,7 +301,7 @@ public class PgpEngine { os.flush(); String[] lines = os.toString().split("\n"); boolean sig = false; - for(String line : lines) { + for (String line : lines) { if (sig) { if (line.contains("END PGP SIGNATURE")) { sig = false; diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java index 5cbd68dd..ce496d27 100644 --- a/src/eu/siacs/conversations/entities/Message.java +++ b/src/eu/siacs/conversations/entities/Message.java @@ -149,9 +149,11 @@ public class Message extends AbstractEntity { public String getReadableBody(Context context) { if ((encryption == ENCRYPTION_PGP) && (type == TYPE_TEXT)) { - return context.getText(R.string.encrypted_message_received).toString(); + return context.getText(R.string.encrypted_message_received) + .toString(); } else if ((encryption == ENCRYPTION_OTR) && (type == TYPE_IMAGE)) { - return context.getText(R.string.encrypted_image_received).toString(); + return context.getText(R.string.encrypted_image_received) + .toString(); } else if (encryption == ENCRYPTION_DECRYPTION_FAILED) { return context.getText(R.string.decryption_failed).toString(); } else if (type == TYPE_IMAGE) { @@ -339,7 +341,7 @@ public class Message extends AbstractEntity { } return body.trim(); } - + public int getMergedStatus() { Message next = this.next(); if (this.mergable(next)) { @@ -348,7 +350,7 @@ public class Message extends AbstractEntity { return getStatus(); } } - + public long getMergedTimeSent() { Message next = this.next(); if (this.mergable(next)) { diff --git a/src/eu/siacs/conversations/entities/MucOptions.java b/src/eu/siacs/conversations/entities/MucOptions.java index 3988eae0..e9ab6908 100644 --- a/src/eu/siacs/conversations/entities/MucOptions.java +++ b/src/eu/siacs/conversations/entities/MucOptions.java @@ -158,8 +158,8 @@ public class MucOptions { } aboutToRename = false; } - if (conversation.getBookmark() != null && - conversation.getBookmark().isProvidePassword()) { + if (conversation.getBookmark() != null + && conversation.getBookmark().isProvidePassword()) { this.passwordChanged = false; } } else { @@ -194,8 +194,8 @@ public class MucOptions { this.error = ERROR_NICK_IN_USE; } } else if (error.hasChild("not-authorized")) { - if (conversation.getBookmark() != null && - conversation.getBookmark().isProvidePassword()) { + if (conversation.getBookmark() != null + && conversation.getBookmark().isProvidePassword()) { this.passwordChanged = true; } this.error = ERROR_PASSWORD_REQUIRED; @@ -323,17 +323,17 @@ public class MucOptions { } public String getPassword() { - if (conversation.getBookmark() != null && - conversation.getBookmark().getPassword() != null) { + if (conversation.getBookmark() != null + && conversation.getBookmark().getPassword() != null) { return conversation.getBookmark().getPassword(); } else { return this.password; } } - + public void setPassword(String password) { - if (conversation.getBookmark() != null && - conversation.getBookmark().isProvidePassword()) { + if (conversation.getBookmark() != null + && conversation.getBookmark().isProvidePassword()) { conversation.getBookmark().setPassword(password); } else { this.password = password; diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index ed846fe1..bd136a33 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -75,9 +75,8 @@ public class MessageParser extends AbstractParser implements } if (!conversation.hasValidOtrSession()) { if (properlyAddressed) { - conversation.startOtrSession( - mXmppConnectionService, - presence, false); + conversation.startOtrSession(mXmppConnectionService, presence, + false); } else { return null; } @@ -87,8 +86,7 @@ public class MessageParser extends AbstractParser implements if (!foreignPresence.equals(presence)) { conversation.endOtrIfNeeded(); if (properlyAddressed) { - conversation.startOtrSession( - mXmppConnectionService, + conversation.startOtrSession(mXmppConnectionService, presence, false); } else { return null; @@ -289,7 +287,8 @@ public class MessageParser extends AbstractParser implements if (!conversation.getMucOptions().online()) { if (x.hasChild("password")) { Element password = x.findChild("password"); - conversation.getMucOptions().setPassword(password.getContent()); + conversation.getMucOptions().setPassword( + password.getContent()); } mXmppConnectionService.joinMuc(conversation); mXmppConnectionService.updateConversationUi(); @@ -453,7 +452,8 @@ public class MessageParser extends AbstractParser implements Conversation conversation = message.getConversation(); conversation.getMessages().add(message); if (packet.getType() != MessagePacket.TYPE_ERROR) { - if (message.getEncryption() == Message.ENCRYPTION_NONE || mXmppConnectionService.saveEncryptedMessages()) { + if (message.getEncryption() == Message.ENCRYPTION_NONE + || mXmppConnectionService.saveEncryptedMessages()) { mXmppConnectionService.databaseBackend.createMessage(message); } } diff --git a/src/eu/siacs/conversations/parser/PresenceParser.java b/src/eu/siacs/conversations/parser/PresenceParser.java index 18c23060..05ffa67e 100644 --- a/src/eu/siacs/conversations/parser/PresenceParser.java +++ b/src/eu/siacs/conversations/parser/PresenceParser.java @@ -107,7 +107,8 @@ public class PresenceParser extends AbstractParser implements contact.setOption(Contact.Options.PENDING_SUBSCRIPTION_REQUEST); } } - Element nick = packet.findChild("nick", "http://jabber.org/protocol/nick"); + Element nick = packet.findChild("nick", + "http://jabber.org/protocol/nick"); if (nick != null) { contact.setPresenceName(nick.getContent()); } diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java index 2a403fab..cda2f356 100644 --- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java +++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java @@ -163,7 +163,8 @@ public class DatabaseBackend extends SQLiteOpenHelper { + "=?", selectionArgs, null, null, Message.TIME_SENT + " DESC", String.valueOf(limit)); } else { - String[] selectionArgs = { conversation.getUuid(), Long.toString(timestamp) }; + String[] selectionArgs = { conversation.getUuid(), + Long.toString(timestamp) }; cursor = db.query(Message.TABLENAME, null, Message.CONVERSATION + "=? and " + Message.TIME_SENT + "<?", selectionArgs, null, null, Message.TIME_SENT + " DESC", diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index f2e93760..247f602b 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -585,7 +585,8 @@ public class XmppConnectionService extends Service { } if (saveInDb) { - if (message.getEncryption() == Message.ENCRYPTION_NONE || saveEncryptedMessages()) { + if (message.getEncryption() == Message.ENCRYPTION_NONE + || saveEncryptedMessages()) { databaseBackend.createMessage(message); } } @@ -1546,7 +1547,7 @@ public class XmppConnectionService extends Service { return PreferenceManager .getDefaultSharedPreferences(getApplicationContext()); } - + public boolean forceEncryption() { return getPreferences().getBoolean("force_encryption", false); } @@ -1554,7 +1555,7 @@ public class XmppConnectionService extends Service { public boolean confirmMessages() { return getPreferences().getBoolean("confirm_messages", true); } - + public boolean saveEncryptedMessages() { return !getPreferences().getBoolean("dont_save_encrypted", false); } diff --git a/src/eu/siacs/conversations/ui/ChooseContactActivity.java b/src/eu/siacs/conversations/ui/ChooseContactActivity.java index 449fc546..277d21d6 100644 --- a/src/eu/siacs/conversations/ui/ChooseContactActivity.java +++ b/src/eu/siacs/conversations/ui/ChooseContactActivity.java @@ -82,8 +82,7 @@ public class ChooseContactActivity extends XmppActivity { super.onCreate(savedInstanceState); setContentView(R.layout.activity_choose_contact); mListView = (ListView) findViewById(R.id.choose_contact_list); - mContactsAdapter = new ListItemAdapter(getApplicationContext(), - contacts); + mContactsAdapter = new ListItemAdapter(this, contacts); mListView.setAdapter(mContactsAdapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @@ -98,7 +97,7 @@ public class ChooseContactActivity extends XmppActivity { ListItem mListItem = contacts.get(position); data.putExtra("contact", mListItem.getJid()); String account = request.getStringExtra("account"); - if (account==null && mListItem instanceof Contact) { + if (account == null && mListItem instanceof Contact) { account = ((Contact) mListItem).getAccount().getJid(); } data.putExtra("account", account); diff --git a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java index 17ea5f98..8de2ce80 100644 --- a/src/eu/siacs/conversations/ui/ContactDetailsActivity.java +++ b/src/eu/siacs/conversations/ui/ContactDetailsActivity.java @@ -325,16 +325,18 @@ public class ContactDetailsActivity extends XmppActivity { for (Iterator<String> iterator = contact.getOtrFingerprints() .iterator(); iterator.hasNext();) { final String otrFingerprint = iterator.next(); - View view = (View) inflater.inflate(R.layout.contact_key, keys,false); + View view = (View) inflater.inflate(R.layout.contact_key, keys, + false); TextView key = (TextView) view.findViewById(R.id.key); TextView keyType = (TextView) view.findViewById(R.id.key_type); - ImageButton remove = (ImageButton) view.findViewById(R.id.button_remove); + ImageButton remove = (ImageButton) view + .findViewById(R.id.button_remove); remove.setVisibility(View.VISIBLE); keyType.setText("OTR Fingerprint"); key.setText(otrFingerprint); keys.addView(view); remove.setOnClickListener(new OnClickListener() { - + @Override public void onClick(View v) { confirmToDeleteFingerprint(otrFingerprint); @@ -342,7 +344,8 @@ public class ContactDetailsActivity extends XmppActivity { }); } if (contact.getPgpKeyId() != 0) { - View view = (View) inflater.inflate(R.layout.contact_key, keys,false); + View view = (View) inflater.inflate(R.layout.contact_key, keys, + false); TextView key = (TextView) view.findViewById(R.id.key); TextView keyType = (TextView) view.findViewById(R.id.key_type); keyType.setText("PGP Key ID"); @@ -370,23 +373,25 @@ public class ContactDetailsActivity extends XmppActivity { keys.addView(view); } } - + protected void confirmToDeleteFingerprint(final String fingerprint) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.delete_fingerprint); builder.setMessage(R.string.sure_delete_fingerprint); builder.setNegativeButton(R.string.cancel, null); - builder.setPositiveButton(R.string.delete,new android.content.DialogInterface.OnClickListener() { + builder.setPositiveButton(R.string.delete, + new android.content.DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - if (contact.deleteOtrFingerprint(fingerprint)) { - populateView(); - xmppConnectionService.syncRosterToDisk(contact.getAccount()); - } - } - - }); + @Override + public void onClick(DialogInterface dialog, int which) { + if (contact.deleteOtrFingerprint(fingerprint)) { + populateView(); + xmppConnectionService.syncRosterToDisk(contact + .getAccount()); + } + } + + }); builder.create().show(); } diff --git a/src/eu/siacs/conversations/ui/ConversationActivity.java b/src/eu/siacs/conversations/ui/ConversationActivity.java index df0112ae..5eedda1c 100644 --- a/src/eu/siacs/conversations/ui/ConversationActivity.java +++ b/src/eu/siacs/conversations/ui/ConversationActivity.java @@ -324,7 +324,8 @@ public class ConversationActivity extends XmppActivity { } else { showInstallPgpDialog(); } - } else if (getSelectedConversation().getNextEncryption(forceEncryption()) == Message.ENCRYPTION_NONE) { + } else if (getSelectedConversation().getNextEncryption( + forceEncryption()) == Message.ENCRYPTION_NONE) { selectPresenceToAttachFile(attachmentChoice); } else { selectPresenceToAttachFile(attachmentChoice); @@ -440,7 +441,8 @@ public class ConversationActivity extends XmppActivity { popup.inflate(R.menu.encryption_choices); MenuItem otr = popup.getMenu().findItem( R.id.encryption_choice_otr); - MenuItem none = popup.getMenu().findItem(R.id.encryption_choice_none); + MenuItem none = popup.getMenu().findItem( + R.id.encryption_choice_none); if (conversation.getMode() == Conversation.MODE_MULTI) { otr.setEnabled(false); } else { diff --git a/src/eu/siacs/conversations/ui/SettingsActivity.java b/src/eu/siacs/conversations/ui/SettingsActivity.java index c522e058..6b280719 100644 --- a/src/eu/siacs/conversations/ui/SettingsActivity.java +++ b/src/eu/siacs/conversations/ui/SettingsActivity.java @@ -2,6 +2,7 @@ package eu.siacs.conversations.ui; import java.util.Locale; +import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Account; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; diff --git a/src/eu/siacs/conversations/ui/StartConversationActivity.java b/src/eu/siacs/conversations/ui/StartConversationActivity.java index 6adada76..6287070c 100644 --- a/src/eu/siacs/conversations/ui/StartConversationActivity.java +++ b/src/eu/siacs/conversations/ui/StartConversationActivity.java @@ -191,8 +191,7 @@ public class StartConversationActivity extends XmppActivity { } }); - mConferenceAdapter = new ListItemAdapter(getApplicationContext(), - conferences); + mConferenceAdapter = new ListItemAdapter(this, conferences); mConferenceListFragment.setListAdapter(mConferenceAdapter); mConferenceListFragment.setContextMenu(R.menu.conference_context); mConferenceListFragment @@ -205,8 +204,7 @@ public class StartConversationActivity extends XmppActivity { } }); - mContactsAdapter = new ListItemAdapter(getApplicationContext(), - contacts); + mContactsAdapter = new ListItemAdapter(this, contacts); mContactsListFragment.setListAdapter(mContactsAdapter); mContactsListFragment.setContextMenu(R.menu.contact_context); mContactsListFragment diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java index b7cce11d..f13c112a 100644 --- a/src/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/eu/siacs/conversations/ui/XmppActivity.java @@ -21,6 +21,7 @@ import android.app.AlertDialog.Builder; import android.content.ComponentName; import android.content.Context; import android.content.DialogInterface; +import android.content.SharedPreferences; import android.content.DialogInterface.OnClickListener; import android.content.IntentSender.SendIntentException; import android.content.res.Resources; @@ -33,6 +34,7 @@ import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.os.IBinder; +import android.preference.PreferenceManager; import android.text.InputType; import android.util.DisplayMetrics; import android.util.Log; @@ -183,6 +185,14 @@ public abstract class XmppActivity extends Activity { mSecondaryTextColor = getResources().getColor(R.color.secondarytext); mWarningTextColor = getResources().getColor(R.color.warningtext); mPrimaryColor = getResources().getColor(R.color.primary); + if (getPreferences().getBoolean("use_larger_font", false)) { + setTheme(R.style.ConversationsTheme_LargerText); + } + } + + protected SharedPreferences getPreferences() { + return PreferenceManager + .getDefaultSharedPreferences(getApplicationContext()); } public void switchToConversation(Conversation conversation) { @@ -309,26 +319,28 @@ public abstract class XmppActivity extends Activity { @Override public void onClick(DialogInterface dialog, int which) { if (xmppConnectionServiceBound) { - xmppConnectionService.sendPresencePacket(contact.getAccount(), - xmppConnectionService.getPresenceGenerator() - .requestPresenceUpdatesFrom(contact)); + xmppConnectionService.sendPresencePacket(contact + .getAccount(), xmppConnectionService + .getPresenceGenerator() + .requestPresenceUpdatesFrom(contact)); } } }); builder.create().show(); } - - private void warnMutalPresenceSubscription(final Conversation conversation,final OnPresenceSelected listener) { + + private void warnMutalPresenceSubscription(final Conversation conversation, + final OnPresenceSelected listener) { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(conversation.getContact().getJid()); builder.setMessage(R.string.without_mutual_presence_updates); builder.setNegativeButton(R.string.cancel, null); builder.setPositiveButton(R.string.ignore, new OnClickListener() { - + @Override public void onClick(DialogInterface dialog, int which) { conversation.setNextPresence(null); - if (listener!=null) { + if (listener != null) { listener.onPresenceSelected(); } } @@ -388,8 +400,9 @@ public abstract class XmppActivity extends Activity { && !contact.getOption(Contact.Options.ASKING) && contact.getAccount().getStatus() == Account.STATUS_ONLINE) { showAskForPresenceDialog(contact); - } else if (!contact.getOption(Contact.Options.TO) || !contact.getOption(Contact.Options.FROM)) { - warnMutalPresenceSubscription(conversation,listener); + } else if (!contact.getOption(Contact.Options.TO) + || !contact.getOption(Contact.Options.FROM)) { + warnMutalPresenceSubscription(conversation, listener); } else { conversation.setNextPresence(null); listener.onPresenceSelected(); diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 1abd208d..967042d8 100644 --- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -462,7 +462,8 @@ public class MessageAdapter extends ArrayAdapter<Message> { @Override public void onClick(View v) { - Downloadable downloadable = item.getDownloadable(); + Downloadable downloadable = item + .getDownloadable(); if (downloadable != null) { downloadable.start(); } diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java index 896bdb7d..54c370ef 100644 --- a/src/eu/siacs/conversations/utils/UIHelper.java +++ b/src/eu/siacs/conversations/utils/UIHelper.java @@ -215,8 +215,8 @@ public class UIHelper { List<User> members = conversation.getMucOptions().getUsers(); if (members.size() == 0) { return getUnknownContactPicture( - new String[] { conversation.getName() }, size, - bgColor, fgColor); + new String[] { conversation.getName() }, size, bgColor, + fgColor); } ArrayList<String> names = new ArrayList<String>(); names.add(conversation.getMucOptions().getActualNick()); @@ -548,35 +548,37 @@ public class UIHelper { private final static class EmoticonPattern { Pattern pattern; String replacement; + EmoticonPattern(String ascii, int unicode) { - this.pattern = Pattern.compile("(?<=(^|\\s))" + ascii + "(?=(\\s|$))"); - this.replacement = new String(new int[]{unicode, }, 0, 1); + this.pattern = Pattern.compile("(?<=(^|\\s))" + ascii + + "(?=(\\s|$))"); + this.replacement = new String(new int[] { unicode, }, 0, 1); } + String replaceAll(String body) { return pattern.matcher(body).replaceAll(replacement); } } private static final EmoticonPattern[] patterns = new EmoticonPattern[] { - new EmoticonPattern(":-?D", 0x1f600), - new EmoticonPattern("\\^\\^", 0x1f601), - new EmoticonPattern(":'D", 0x1f602), - new EmoticonPattern("\\]-?D", 0x1f608), - new EmoticonPattern(";-?\\)", 0x1f609), - new EmoticonPattern(":-?\\)", 0x1f60a), - new EmoticonPattern("[B8]-?\\)", 0x1f60e), - new EmoticonPattern(":-?\\|", 0x1f610), - new EmoticonPattern(":-?[/\\\\]", 0x1f615), - new EmoticonPattern(":-?\\*", 0x1f617), - new EmoticonPattern(":-?[Ppb]", 0x1f61b), - new EmoticonPattern(":-?\\(", 0x1f61e), - new EmoticonPattern(":-?[0Oo]", 0x1f62e), - new EmoticonPattern("\\\\o/", 0x1F631), - }; + new EmoticonPattern(":-?D", 0x1f600), + new EmoticonPattern("\\^\\^", 0x1f601), + new EmoticonPattern(":'D", 0x1f602), + new EmoticonPattern("\\]-?D", 0x1f608), + new EmoticonPattern(";-?\\)", 0x1f609), + new EmoticonPattern(":-?\\)", 0x1f60a), + new EmoticonPattern("[B8]-?\\)", 0x1f60e), + new EmoticonPattern(":-?\\|", 0x1f610), + new EmoticonPattern(":-?[/\\\\]", 0x1f615), + new EmoticonPattern(":-?\\*", 0x1f617), + new EmoticonPattern(":-?[Ppb]", 0x1f61b), + new EmoticonPattern(":-?\\(", 0x1f61e), + new EmoticonPattern(":-?[0Oo]", 0x1f62e), + new EmoticonPattern("\\\\o/", 0x1F631), }; public static String transformAsciiEmoticons(String body) { if (body != null) { - for (EmoticonPattern p: patterns) { + for (EmoticonPattern p : patterns) { body = p.replaceAll(body); } body = body.trim(); diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 36920929..e7b25e26 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -763,12 +763,15 @@ public class XmppConnection implements Runnable { }); } - private void processStreamError(Tag currentTag) throws XmlPullParserException, IOException { + private void processStreamError(Tag currentTag) + throws XmlPullParserException, IOException { Element streamError = tagReader.readElement(currentTag); - if (streamError!=null && streamError.hasChild("conflict")) { + if (streamError != null && streamError.hasChild("conflict")) { String resource = account.getResource().split("\\.")[0]; - account.setResource(resource+"."+nextRandomId()); - Log.d(Config.LOGTAG,account.getJid()+": switching resource due to conflict ("+account.getResource()+")"); + account.setResource(resource + "." + nextRandomId()); + Log.d(Config.LOGTAG, + account.getJid() + ": switching resource due to conflict (" + + account.getResource() + ")"); } } diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index e26fcad9..f42482e8 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -96,8 +96,8 @@ public class JingleConnection implements Downloadable { BitmapFactory.decodeFile(file.getAbsolutePath(), options); int imageHeight = options.outHeight; int imageWidth = options.outWidth; - message.setBody(Long.toString(file.getSize()) + ',' + imageWidth + ',' - + imageHeight); + message.setBody(Long.toString(file.getSize()) + ',' + + imageWidth + ',' + imageHeight); mXmppConnectionService.databaseBackend.createMessage(message); mXmppConnectionService.markMessage(message, Message.STATUS_RECEIVED); diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java b/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java index cd87552b..c5498075 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java @@ -135,7 +135,8 @@ public class JingleInbandTransport extends JingleTransport { Element data = iq.addChild("data", "http://jabber.org/protocol/ibb"); data.setAttribute("seq", Integer.toString(this.seq)); - data.setAttribute("block-size", Integer.toString(this.blockSize)); + data.setAttribute("block-size", + Integer.toString(this.blockSize)); data.setAttribute("sid", this.sessionId); data.setContent(base64); this.account.getXmppConnection().sendIqPacket(iq, diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java b/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java index 1a8ab9dd..63f5a507 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java @@ -58,9 +58,9 @@ public class JingleSocks5Transport extends JingleTransport { byte[] reply = new byte[2]; outputStream.write(login); inputStream.read(reply); - final String connect = Character.toString('\u0005') + '\u0001' + '\u0000' - + '\u0003' + '\u0028' + destination + '\u0000' - + '\u0000'; + final String connect = Character.toString('\u0005') + + '\u0001' + '\u0000' + '\u0003' + '\u0028' + + destination + '\u0000' + '\u0000'; if (Arrays.equals(reply, expectedReply)) { outputStream.write(connect.getBytes()); byte[] result = new byte[2]; |