fixed #123 fixed122
This commit is contained in:
parent
7fc7201abb
commit
e857cf979d
|
@ -726,11 +726,10 @@ public class XmppConnectionService extends Service {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBind(Account account) {
|
public void onBind(Account account) {
|
||||||
databaseBackend.clearPresences(account);
|
databaseBackend.clearPresences(account); //contact presences
|
||||||
account.clearPresences(); // self presences
|
account.clearPresences(); // self presences
|
||||||
if (account.getXmppConnection().hasFeatureRosterManagment()) {
|
updateRoster(account, null);
|
||||||
updateRoster(account, null);
|
sendPresence(account);
|
||||||
}
|
|
||||||
connectMultiModeConversations(account);
|
connectMultiModeConversations(account);
|
||||||
if (convChangedListener != null) {
|
if (convChangedListener != null) {
|
||||||
convChangedListener.onConversationListChanged();
|
convChangedListener.onConversationListChanged();
|
||||||
|
@ -1389,16 +1388,15 @@ public class XmppConnectionService extends Service {
|
||||||
contact.getAccount().getXmppConnection().sendPresencePacket(packet);
|
contact.getAccount().getXmppConnection().sendPresencePacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sendPgpPresence(Account account, String signature) {
|
public void sendPresence(Account account) {
|
||||||
PresencePacket packet = new PresencePacket();
|
PresencePacket packet = new PresencePacket();
|
||||||
packet.setAttribute("from", account.getFullJid());
|
packet.setAttribute("from", account.getFullJid());
|
||||||
Element status = new Element("status");
|
String sig = account.getPgpSignature();
|
||||||
status.setContent("online");
|
if (sig!=null) {
|
||||||
packet.addChild(status);
|
packet.addChild("status").setContent("online");
|
||||||
Element x = new Element("x");
|
packet.addChild("x","jabber:x:signed").setContent(sig);
|
||||||
x.setAttribute("xmlns", "jabber:x:signed");
|
}
|
||||||
x.setContent(signature);
|
Log.d(LOGTAG,packet.toString());
|
||||||
packet.addChild(x);
|
|
||||||
account.getXmppConnection().sendPresencePacket(packet);
|
account.getXmppConnection().sendPresencePacket(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1422,7 +1420,6 @@ public class XmppConnectionService extends Service {
|
||||||
this.tlsException = null;
|
this.tlsException = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO dont let thread sleep but schedule wake up
|
|
||||||
public void reconnectAccount(final Account account, final boolean force) {
|
public void reconnectAccount(final Account account, final boolean force) {
|
||||||
new Thread(new Runnable() {
|
new Thread(new Runnable() {
|
||||||
|
|
||||||
|
|
|
@ -175,7 +175,7 @@ public abstract class XmppActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
public void success() {
|
public void success() {
|
||||||
xmppConnectionService.databaseBackend.updateAccount(account);
|
xmppConnectionService.databaseBackend.updateAccount(account);
|
||||||
xmppConnectionService.sendPgpPresence(account, account.getPgpSignature());
|
xmppConnectionService.sendPresence(account);
|
||||||
if (conversation!=null) {
|
if (conversation!=null) {
|
||||||
conversation.setNextEncryption(Message.ENCRYPTION_PGP);
|
conversation.setNextEncryption(Message.ENCRYPTION_PGP);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,6 @@ import javax.net.ssl.TrustManager;
|
||||||
import javax.net.ssl.TrustManagerFactory;
|
import javax.net.ssl.TrustManagerFactory;
|
||||||
import javax.net.ssl.X509TrustManager;
|
import javax.net.ssl.X509TrustManager;
|
||||||
|
|
||||||
import org.json.JSONException;
|
|
||||||
import org.xmlpull.v1.XmlPullParserException;
|
import org.xmlpull.v1.XmlPullParserException;
|
||||||
|
|
||||||
import android.os.Bundle;
|
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 {
|
private void sendBindRequest() throws IOException {
|
||||||
IqPacket iq = new IqPacket(IqPacket.TYPE_SET);
|
IqPacket iq = new IqPacket(IqPacket.TYPE_SET);
|
||||||
iq.addChild("bind", "urn:ietf:params:xml:ns:xmpp-bind").addChild("resource").setContent(account.getResource());
|
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);
|
EnablePacket enable = new EnablePacket(smVersion);
|
||||||
tagWriter.writeStanzaAsync(enable);
|
tagWriter.writeStanzaAsync(enable);
|
||||||
}
|
}
|
||||||
sendInitialPresence();
|
|
||||||
sendServiceDiscoveryInfo(account.getServer());
|
sendServiceDiscoveryInfo(account.getServer());
|
||||||
sendServiceDiscoveryItems(account.getServer());
|
sendServiceDiscoveryItems(account.getServer());
|
||||||
if (bindListener !=null) {
|
if (bindListener !=null) {
|
||||||
|
|
Loading…
Reference in a new issue