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.java23
-rw-r--r--src/eu/siacs/conversations/ui/XmppActivity.java2
-rw-r--r--src/eu/siacs/conversations/xmpp/XmppConnection.java17
3 files changed, 11 insertions, 31 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java
index e5ed6a55..3a02b40e 100644
--- a/src/eu/siacs/conversations/services/XmppConnectionService.java
+++ b/src/eu/siacs/conversations/services/XmppConnectionService.java
@@ -726,11 +726,10 @@ public class XmppConnectionService extends Service {
@Override
public void onBind(Account account) {
- databaseBackend.clearPresences(account);
+ databaseBackend.clearPresences(account); //contact presences
account.clearPresences(); // self presences
- if (account.getXmppConnection().hasFeatureRosterManagment()) {
- updateRoster(account, null);
- }
+ updateRoster(account, null);
+ sendPresence(account);
connectMultiModeConversations(account);
if (convChangedListener != null) {
convChangedListener.onConversationListChanged();
@@ -1389,16 +1388,15 @@ public class XmppConnectionService extends Service {
contact.getAccount().getXmppConnection().sendPresencePacket(packet);
}
- public void sendPgpPresence(Account account, String signature) {
+ public void sendPresence(Account account) {
PresencePacket packet = new PresencePacket();
packet.setAttribute("from", account.getFullJid());
- Element status = new Element("status");
- status.setContent("online");
- packet.addChild(status);
- Element x = new Element("x");
- x.setAttribute("xmlns", "jabber:x:signed");
- x.setContent(signature);
- packet.addChild(x);
+ String sig = account.getPgpSignature();
+ if (sig!=null) {
+ packet.addChild("status").setContent("online");
+ packet.addChild("x","jabber:x:signed").setContent(sig);
+ }
+ Log.d(LOGTAG,packet.toString());
account.getXmppConnection().sendPresencePacket(packet);
}
@@ -1422,7 +1420,6 @@ public class XmppConnectionService extends Service {
this.tlsException = null;
}
- // TODO dont let thread sleep but schedule wake up
public void reconnectAccount(final Account account, final boolean force) {
new Thread(new Runnable() {
diff --git a/src/eu/siacs/conversations/ui/XmppActivity.java b/src/eu/siacs/conversations/ui/XmppActivity.java
index 1fe7cf13..02900ac8 100644
--- a/src/eu/siacs/conversations/ui/XmppActivity.java
+++ b/src/eu/siacs/conversations/ui/XmppActivity.java
@@ -175,7 +175,7 @@ public abstract class XmppActivity extends Activity {
@Override
public void success() {
xmppConnectionService.databaseBackend.updateAccount(account);
- xmppConnectionService.sendPgpPresence(account, account.getPgpSignature());
+ xmppConnectionService.sendPresence(account);
if (conversation!=null) {
conversation.setNextEncryption(Message.ENCRYPTION_PGP);
}
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java
index ab17d5d5..f7f25dcc 100644
--- a/src/eu/siacs/conversations/xmpp/XmppConnection.java
+++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java
@@ -30,7 +30,6 @@ import javax.net.ssl.TrustManager;
import javax.net.ssl.TrustManagerFactory;
import javax.net.ssl.X509TrustManager;
-import org.json.JSONException;
import org.xmlpull.v1.XmlPullParserException;
import android.os.Bundle;
@@ -615,21 +614,6 @@ public class XmppConnection implements Runnable {
});
}
- private void sendInitialPresence() {
- PresencePacket packet = new PresencePacket();
- packet.setAttribute("from", account.getFullJid());
- if (account.getKeys().has("pgp_signature")) {
- try {
- String signature = account.getKeys().getString("pgp_signature");
- packet.addChild("status").setContent("online");
- packet.addChild("x","jabber:x:signed").setContent(signature);
- } catch (JSONException e) {
- //
- }
- }
- this.sendPresencePacket(packet);
- }
-
private void sendBindRequest() throws IOException {
IqPacket iq = new IqPacket(IqPacket.TYPE_SET);
iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind").addChild("resource").setContent(account.getResource());
@@ -648,7 +632,6 @@ public class XmppConnection implements Runnable {
EnablePacket enable = new EnablePacket(smVersion);
tagWriter.writeStanzaAsync(enable);
}
- sendInitialPresence();
sendServiceDiscoveryInfo(account.getServer());
sendServiceDiscoveryItems(account.getServer());
if (bindListener !=null) {