From 0116551ca9b99c58e0459d52f66d5d9bfa1c2afa Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Sun, 16 Mar 2014 14:12:30 +0100 Subject: bug fixes with leaving muc on connection loss. --- AndroidManifest.xml | 4 ++-- .../conversations/services/XmppConnectionService.java | 18 ++++++++++-------- src/eu/siacs/conversations/xml/Element.java | 13 ++++++++++--- src/eu/siacs/conversations/xmpp/XmppConnection.java | 2 -- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 6a13ae92..a5445c7a 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="2" + android:versionName="0.1-rc2" > 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 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 attributes = new Hashtable(); @@ -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("&","&"); + content = content.replace("<","<"); + content = content.replace(">",">"); + content = content.replace("\"","""); + content = content.replace("'","'"); + 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()); -- cgit v1.2.3