aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--src/eu/siacs/conversations/crypto/PgpEngine.java4
-rw-r--r--src/eu/siacs/conversations/entities/Message.java8
-rw-r--r--src/eu/siacs/conversations/persistance/DatabaseBackend.java4
-rw-r--r--src/eu/siacs/conversations/persistance/FileBackend.java2
-rw-r--r--src/eu/siacs/conversations/utils/XmlHelper.java12
-rw-r--r--src/eu/siacs/conversations/xml/Element.java17
-rw-r--r--src/eu/siacs/conversations/xml/Tag.java4
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java4
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java8
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java6
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java6
-rw-r--r--src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java2
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java2
-rw-r--r--src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java2
15 files changed, 48 insertions, 38 deletions
diff --git a/README.md b/README.md
index 839ce2da..49d8de66 100644
--- a/README.md
+++ b/README.md
@@ -40,6 +40,9 @@ These XEPs are - as of now:
your desktop client and thus allows you to switch seamlessly from your mobile
client to your desktop client and back within one conversation.
* XEP-0237: Roster Versioning mainly to save bandwidth on poor mobile connections
+* XEP-0352: Client State Indication let the server know whether or not
+ Conversations is in the background. Allows the server to save bandwidth by
+ withholding unimportent packages.
##Contributors
(In order of appearance)
@@ -201,7 +204,7 @@ However with adb (android debug bridge) you squeeze some more information out of
Conversations. These information are especially useful if you are experiencing
troubles with your connection or with file transfer.
````
-adb -d logcat -v time -s xmppService
+adb -d logcat -v time -s conversations
````
####I found a bug
Please report it to our issue tracker. If your app crashes please provide a
diff --git a/src/eu/siacs/conversations/crypto/PgpEngine.java b/src/eu/siacs/conversations/crypto/PgpEngine.java
index 47b1a0cb..430aaf99 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("" + outputFile.getSize() + ","
- + imageWidth + "," + imageHeight);
+ message.setBody(Long.toString(outputFile.getSize()) + ','
+ + imageWidth + ',' + imageHeight);
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
PgpEngine.this.mXmppConnectionService
.updateMessage(message);
diff --git a/src/eu/siacs/conversations/entities/Message.java b/src/eu/siacs/conversations/entities/Message.java
index 84aac4f5..f36ffa90 100644
--- a/src/eu/siacs/conversations/entities/Message.java
+++ b/src/eu/siacs/conversations/entities/Message.java
@@ -150,13 +150,13 @@ 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);
+ 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);
+ return context.getText(R.string.encrypted_image_received).toString();
} else if (encryption == ENCRYPTION_DECRYPTION_FAILED) {
- return "" + context.getText(R.string.decryption_failed);
+ return context.getText(R.string.decryption_failed).toString();
} else if (type == TYPE_IMAGE) {
- return "" + context.getText(R.string.image_file);
+ return context.getText(R.string.image_file).toString();
} else {
return body.trim();
}
diff --git a/src/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
index 22871a9e..2a403fab 100644
--- a/src/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -137,7 +137,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
public CopyOnWriteArrayList<Conversation> getConversations(int status) {
CopyOnWriteArrayList<Conversation> list = new CopyOnWriteArrayList<Conversation>();
SQLiteDatabase db = this.getReadableDatabase();
- String[] selectionArgs = { "" + status };
+ String[] selectionArgs = { Integer.toString(status) };
Cursor cursor = db.rawQuery("select * from " + Conversation.TABLENAME
+ " where " + Conversation.STATUS + " = ? order by "
+ Conversation.CREATED + " desc", selectionArgs);
@@ -163,7 +163,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ "=?", selectionArgs, null, null, Message.TIME_SENT
+ " DESC", String.valueOf(limit));
} else {
- String[] selectionArgs = { conversation.getUuid(), "" + 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/persistance/FileBackend.java b/src/eu/siacs/conversations/persistance/FileBackend.java
index 6e16240d..0af9c6e2 100644
--- a/src/eu/siacs/conversations/persistance/FileBackend.java
+++ b/src/eu/siacs/conversations/persistance/FileBackend.java
@@ -180,7 +180,7 @@ public class FileBackend {
long size = file.getSize();
int width = scalledBitmap.getWidth();
int height = scalledBitmap.getHeight();
- message.setBody("" + size + "," + width + "," + height);
+ message.setBody(Long.toString(size) + ',' + width + ',' + height);
return file;
} catch (FileNotFoundException e) {
throw new ImageCopyException(R.string.error_file_not_found);
diff --git a/src/eu/siacs/conversations/utils/XmlHelper.java b/src/eu/siacs/conversations/utils/XmlHelper.java
new file mode 100644
index 00000000..4dee07cf
--- /dev/null
+++ b/src/eu/siacs/conversations/utils/XmlHelper.java
@@ -0,0 +1,12 @@
+package eu.siacs.conversations.utils;
+
+public class XmlHelper {
+ public static String encodeEntities(String content) {
+ content = content.replace("&", "&amp;");
+ content = content.replace("<", "&lt;");
+ content = content.replace(">", "&gt;");
+ content = content.replace("\"", "&quot;");
+ content = content.replace("'", "&apos;");
+ return content;
+ }
+}
diff --git a/src/eu/siacs/conversations/xml/Element.java b/src/eu/siacs/conversations/xml/Element.java
index d23a81ba..4e11ee2c 100644
--- a/src/eu/siacs/conversations/xml/Element.java
+++ b/src/eu/siacs/conversations/xml/Element.java
@@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+import eu.siacs.conversations.utils.XmlHelper;
+
public class Element {
protected String name;
protected Hashtable<String, String> attributes = new Hashtable<String, String>();
@@ -116,7 +118,7 @@ public class Element {
startTag.setAtttributes(this.attributes);
elementOutput.append(startTag);
if (content != null) {
- elementOutput.append(encodeEntities(content));
+ elementOutput.append(XmlHelper.encodeEntities(content));
} else {
for (Element child : children) {
elementOutput.append(child.toString());
@@ -132,24 +134,15 @@ public class Element {
return name;
}
- private String encodeEntities(String content) {
- content = content.replace("&", "&amp;");
- content = content.replace("<", "&lt;");
- content = content.replace(">", "&gt;");
- content = content.replace("\"", "&quot;");
- content = content.replace("'", "&apos;");
- return content;
- }
-
public void clearChildren() {
this.children.clear();
}
public void setAttribute(String name, long value) {
- this.setAttribute(name, "" + value);
+ this.setAttribute(name, Long.toString(value));
}
public void setAttribute(String name, int value) {
- this.setAttribute(name, "" + value);
+ this.setAttribute(name, Integer.toString(value));
}
}
diff --git a/src/eu/siacs/conversations/xml/Tag.java b/src/eu/siacs/conversations/xml/Tag.java
index 2b393397..b9ef979f 100644
--- a/src/eu/siacs/conversations/xml/Tag.java
+++ b/src/eu/siacs/conversations/xml/Tag.java
@@ -5,6 +5,8 @@ import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Set;
+import eu.siacs.conversations.utils.XmlHelper;
+
public class Tag {
public static final int NO = -1;
public static final int START = 0;
@@ -85,7 +87,7 @@ public class Tag {
tagOutput.append(' ');
tagOutput.append(entry.getKey());
tagOutput.append("=\"");
- tagOutput.append(entry.getValue());
+ tagOutput.append(XmlHelper.encodeEntities(entry.getValue()));
tagOutput.append('"');
}
}
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java b/src/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java
index 2874b9a5..3e7c7b68 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleCandidate.java
@@ -117,9 +117,9 @@ public class JingleCandidate {
Element element = new Element("candidate");
element.setAttribute("cid", this.getCid());
element.setAttribute("host", this.getHost());
- element.setAttribute("port", "" + this.getPort());
+ element.setAttribute("port", Integer.toString(this.getPort()));
element.setAttribute("jid", this.getJid());
- element.setAttribute("priority", "" + this.getPriority());
+ element.setAttribute("priority", Integer.toString(this.getPriority()));
if (this.getType() == TYPE_DIRECT) {
element.setAttribute("type", "direct");
} else if (this.getType() == TYPE_PROXY) {
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
index 317838fd..a5cc2c49 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java
@@ -95,7 +95,7 @@ public class JingleConnection {
BitmapFactory.decodeFile(file.getAbsolutePath(), options);
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
- message.setBody("" + file.getSize() + "," + imageWidth + ","
+ message.setBody(Long.toString(file.getSize()) + ',' + imageWidth + ','
+ imageHeight);
mXmppConnectionService.databaseBackend.createMessage(message);
mXmppConnectionService.markMessage(message,
@@ -302,7 +302,7 @@ public class JingleConnection {
}
if (supportedFile) {
long size = Long.parseLong(fileSize.getContent());
- message.setBody("" + size);
+ message.setBody(Long.toString(size));
conversation.getMessages().add(message);
if (size <= this.mJingleConnectionManager
.getAutoAcceptFileSize()) {
@@ -630,7 +630,7 @@ public class JingleConnection {
this.transportId = this.mJingleConnectionManager.nextRandomId();
content.setTransportId(this.transportId);
content.ibbTransport().setAttribute("block-size",
- "" + this.ibbBlockSize);
+ Integer.toString(this.ibbBlockSize));
packet.setContent(content);
this.sendJinglePacket(packet);
}
@@ -652,7 +652,7 @@ public class JingleConnection {
Content content = new Content("initiator", "a-file-offer");
content.setTransportId(this.transportId);
content.ibbTransport().setAttribute("block-size",
- "" + this.ibbBlockSize);
+ Integer.toString(this.ibbBlockSize));
answer.setContent(content);
this.sendJinglePacket(answer);
return true;
diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java b/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java
index 331b53de..cd87552b 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleInbandTransport.java
@@ -59,7 +59,7 @@ public class JingleInbandTransport extends JingleTransport {
Element open = iq.addChild("open", "http://jabber.org/protocol/ibb");
open.setAttribute("sid", this.sessionId);
open.setAttribute("stanza", "iq");
- open.setAttribute("block-size", "" + this.blockSize);
+ open.setAttribute("block-size", Integer.toString(this.blockSize));
this.account.getXmppConnection().sendIqPacket(iq,
new OnIqPacketReceived() {
@@ -134,8 +134,8 @@ public class JingleInbandTransport extends JingleTransport {
iq.setTo(this.counterpart);
Element data = iq.addChild("data",
"http://jabber.org/protocol/ibb");
- data.setAttribute("seq", "" + this.seq);
- data.setAttribute("block-size", "" + this.blockSize);
+ data.setAttribute("seq", Integer.toString(this.seq));
+ 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 e476decc..1a8ab9dd 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/JingleSocks5Transport.java
@@ -58,10 +58,10 @@ 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';
if (Arrays.equals(reply, expectedReply)) {
- String connect = "" + '\u0005' + '\u0001' + '\u0000'
- + '\u0003' + '\u0028' + destination + '\u0000'
- + '\u0000';
outputStream.write(connect.getBytes());
byte[] result = new byte[2];
inputStream.read(result);
diff --git a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java
index 1e8e3fd6..d19e6dfd 100644
--- a/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java
+++ b/src/eu/siacs/conversations/xmpp/jingle/stanzas/Content.java
@@ -30,7 +30,7 @@ public class Content extends Element {
"urn:xmpp:jingle:apps:file-transfer:3");
Element offer = description.addChild("offer");
Element file = offer.addChild("file");
- file.addChild("size").setContent("" + actualFile.getSize());
+ file.addChild("size").setContent(Long.toString(actualFile.getSize()));
if (otr) {
file.addChild("name").setContent(actualFile.getName() + ".otr");
} else {
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java
index c936891c..f93b5d87 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/AckPacket.java
@@ -7,7 +7,7 @@ public class AckPacket extends AbstractStanza {
public AckPacket(int sequence, int smVersion) {
super("a");
this.setAttribute("xmlns", "urn:xmpp:sm:" + smVersion);
- this.setAttribute("h", "" + sequence);
+ this.setAttribute("h", Integer.toString(sequence));
}
}
diff --git a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java
index df039d5a..9cdcfa5e 100644
--- a/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java
+++ b/src/eu/siacs/conversations/xmpp/stanzas/streammgmt/ResumePacket.java
@@ -8,7 +8,7 @@ public class ResumePacket extends AbstractStanza {
super("resume");
this.setAttribute("xmlns", "urn:xmpp:sm:" + smVersion);
this.setAttribute("previd", id);
- this.setAttribute("h", "" + sequence);
+ this.setAttribute("h", Integer.toString(sequence));
}
}