aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs
diff options
context:
space:
mode:
Diffstat (limited to 'src/eu/siacs')
-rw-r--r--src/eu/siacs/conversations/services/XmppConnectionService.java18
-rw-r--r--src/eu/siacs/conversations/xml/Element.java13
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java2
3 files changed, 20 insertions, 13 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index 815e06af..0e4852af 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -1082,14 +1082,16 @@ public class XmppConnectionService extends Service {
public void disconnect(Account account, boolean force) {
if ((account.getStatus() == Account.STATUS_ONLINE)||(account.getStatus() == Account.STATUS_DISABLED)) {
- List<Conversation> conversations = getConversations();
- for (int i = 0; i < conversations.size(); i++) {
- Conversation conversation = conversations.get(i);
- if (conversation.getAccount() == account) {
- if (conversation.getMode() == Conversation.MODE_MULTI) {
- leaveMuc(conversation);
- } else {
- conversation.endOtrIfNeeded();
+ if (!force) {
+ List<Conversation> conversations = getConversations();
+ for (int i = 0; i < conversations.size(); i++) {
+ Conversation conversation = conversations.get(i);
+ if (conversation.getAccount() == account) {
+ if (conversation.getMode() == Conversation.MODE_MULTI) {
+ leaveMuc(conversation);
+ } else {
+ conversation.endOtrIfNeeded();
+ }
}
}
}
diff --git a/src/eu/siacs/conversations/xml/Element.java b/src/eu/siacs/conversations/xml/Element.java
index ad95ef9c..6cf6d3a5 100644
--- a/src/eu/siacs/conversations/xml/Element.java
+++ b/src/eu/siacs/conversations/xml/Element.java
@@ -4,8 +4,6 @@ import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
-import android.util.Log;
-
public class Element {
protected String name;
protected Hashtable<String, String> attributes = new Hashtable<String, String>();
@@ -83,7 +81,7 @@ public class Element {
startTag.setAtttributes(this.attributes);
elementOutput.append(startTag);
if (content!=null) {
- elementOutput.append(content);
+ elementOutput.append(encodeEntities(content));
} else {
for(Element child : children) {
elementOutput.append(child.toString());
@@ -98,4 +96,13 @@ public class Element {
public String getName() {
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;
+ }
}
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index 0fbd6f77..fd8242c0 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -676,10 +676,8 @@ public class XmppConnection implements Runnable {
public void sendPing() {
if (streamFeatures.hasChild("sm")) {
- Log.d(LOGTAG,account.getJid()+": sending r as ping");
tagWriter.writeStanzaAsync(new RequestPacket());
} else {
- Log.d(LOGTAG,account.getJid()+": sending iq as ping");
IqPacket iq = new IqPacket(IqPacket.TYPE_GET);
Element ping = new Element("ping");
iq.setAttribute("from",account.getFullJid());