diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-10-20 21:08:33 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-10-20 21:08:33 +0200 |
commit | 21961673cbcb3132d2405c3d276058b94cbdbbfc (patch) | |
tree | a4cb9ef7f8c6395c2e7fc406f2c5a5e73ef1edcb /src/eu/siacs/conversations/xmpp | |
parent | 0bb2c3c4d5b2a4b676610276fafd50ea55f43706 (diff) |
refactored avatar generation. first step
Diffstat (limited to 'src/eu/siacs/conversations/xmpp')
-rw-r--r-- | src/eu/siacs/conversations/xmpp/XmppConnection.java | 44 | ||||
-rw-r--r-- | src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java | 10 |
2 files changed, 30 insertions, 24 deletions
diff --git a/src/eu/siacs/conversations/xmpp/XmppConnection.java b/src/eu/siacs/conversations/xmpp/XmppConnection.java index 34ff70c9a..ffa438bdb 100644 --- a/src/eu/siacs/conversations/xmpp/XmppConnection.java +++ b/src/eu/siacs/conversations/xmpp/XmppConnection.java @@ -110,7 +110,7 @@ public class XmppConnection implements Runnable { private OnBindListener bindListener = null; private OnMessageAcknowledged acknowledgedListener = null; private MemorizingTrustManager mMemorizingTrustManager; - private final Context applicationContext; + private final Context applicationContext; public XmppConnection(Account account, XmppConnectionService service) { this.mRandom = service.getRNG(); @@ -119,7 +119,7 @@ public class XmppConnection implements Runnable { this.wakeLock = service.getPowerManager().newWakeLock( PowerManager.PARTIAL_WAKE_LOCK, account.getJid()); tagWriter = new TagWriter(); - applicationContext = service.getApplicationContext(); + applicationContext = service.getApplicationContext(); } protected void changeStatus(int nextStatus) { @@ -172,13 +172,15 @@ public class XmppConnection implements Runnable { } else { boolean socketError = true; int srvIndex = 0; - while (socketError && namePort.containsKey("name" + srvIndex)){ + while (socketError + && namePort.containsKey("name" + srvIndex)) { try { - srvRecordServer = namePort.getString("name" + srvIndex); + srvRecordServer = namePort.getString("name" + + srvIndex); srvRecordPort = namePort.getInt("port" + srvIndex); Log.d(Config.LOGTAG, account.getJid() - + ": using values from dns " + srvRecordServer - + ":" + srvRecordPort); + + ": using values from dns " + + srvRecordServer + ":" + srvRecordPort); socket = new Socket(srvRecordServer, srvRecordPort); socketError = false; } catch (UnknownHostException e) { @@ -384,13 +386,13 @@ public class XmppConnection implements Runnable { iq.addChild("ping", "urn:xmpp:ping"); this.sendIqPacket(iq, new OnIqPacketReceived() { - @Override - public void onIqPacketReceived(Account account, IqPacket packet) { - Log.d(Config.LOGTAG, account.getJid() - + ": online with resource " + account.getResource()); - changeStatus(Account.STATUS_ONLINE); - } - }); + @Override + public void onIqPacketReceived(Account account, IqPacket packet) { + Log.d(Config.LOGTAG, account.getJid() + + ": online with resource " + account.getResource()); + changeStatus(Account.STATUS_ONLINE); + } + }); } private Element processPacket(Tag currentTag, int packetType) @@ -527,7 +529,8 @@ public class XmppConnection implements Runnable { } private SharedPreferences getPreferences() { - return PreferenceManager.getDefaultSharedPreferences(applicationContext); + return PreferenceManager + .getDefaultSharedPreferences(applicationContext); } private boolean enableLegacySSL() { @@ -551,14 +554,15 @@ public class XmppConnection implements Runnable { true); // Support all protocols except legacy SSL. - // The min SDK version prevents us having to worry about SSLv2. In future, this may be + // The min SDK version prevents us having to worry about SSLv2. In + // future, this may be // true of SSLv3 as well. final String[] supportProtocols; if (enableLegacySSL()) { supportProtocols = sslSocket.getSupportedProtocols(); } else { - final List<String> supportedProtocols = new LinkedList<String>(Arrays.asList( - sslSocket.getSupportedProtocols())); + final List<String> supportedProtocols = new LinkedList<String>( + Arrays.asList(sslSocket.getSupportedProtocols())); supportedProtocols.remove("SSLv3"); supportProtocols = new String[supportedProtocols.size()]; supportedProtocols.toArray(supportProtocols); @@ -613,7 +617,8 @@ public class XmppConnection implements Runnable { } else if (compressionAvailable()) { sendCompressionZlib(); } else if (this.streamFeatures.hasChild("register") - && account.isOptionSet(Account.OPTION_REGISTER) && usingEncryption) { + && account.isOptionSet(Account.OPTION_REGISTER) + && usingEncryption) { sendRegistryRequest(); } else if (!this.streamFeatures.hasChild("register") && account.isOptionSet(Account.OPTION_REGISTER)) { @@ -637,7 +642,8 @@ public class XmppConnection implements Runnable { } else if (this.streamFeatures.hasChild("bind") && shouldBind) { sendBindRequest(); } else { - Log.d(Config.LOGTAG,account.getJid()+": incompatible server. disconnecting"); + Log.d(Config.LOGTAG, account.getJid() + + ": incompatible server. disconnecting"); disconnect(true); } } diff --git a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java index 5b3dfbff0..330a4ebb4 100644 --- a/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java +++ b/src/eu/siacs/conversations/xmpp/jingle/JingleConnection.java @@ -358,8 +358,8 @@ public class JingleConnection implements Downloadable { Content content = new Content(this.contentCreator, this.contentName); if (message.getType() == Message.TYPE_IMAGE) { content.setTransportId(this.transportId); - this.file = this.mXmppConnectionService.getFileBackend() - .getFile(message, false); + this.file = this.mXmppConnectionService.getFileBackend().getFile( + message, false); if (message.getEncryption() == Message.ENCRYPTION_OTR) { Conversation conversation = this.message.getConversation(); this.mXmppConnectionService.renewSymmetricKey(conversation); @@ -634,7 +634,7 @@ public class JingleConnection implements Downloadable { } private void sendFallbackToIbb() { - Log.d(Config.LOGTAG,"sending fallback to ibb"); + Log.d(Config.LOGTAG, "sending fallback to ibb"); JinglePacket packet = this.bootstrapPacket("transport-replace"); Content content = new Content(this.contentCreator, this.contentName); this.transportId = this.mJingleConnectionManager.nextRandomId(); @@ -646,7 +646,7 @@ public class JingleConnection implements Downloadable { } private boolean receiveFallbackToIbb(JinglePacket packet) { - Log.d(Config.LOGTAG,"receiving fallack to ibb"); + Log.d(Config.LOGTAG, "receiving fallack to ibb"); String receivedBlockSize = packet.getJingleContent().ibbTransport() .getAttribute("block-size"); if (receivedBlockSize != null) { @@ -881,7 +881,7 @@ public class JingleConnection implements Downloadable { if (account.getStatus() == Account.STATUS_ONLINE) { if (mJingleStatus == JINGLE_STATUS_INITIATED) { new Thread(new Runnable() { - + @Override public void run() { sendAccept(); |