mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-30 20:52:21 -05:00
code clean up
This commit is contained in:
parent
b519411d34
commit
933538a39d
@ -409,19 +409,9 @@ public class AxolotlService {
|
||||
publishDeviceBundle(signedPreKeyRecord, preKeyRecords, announceAfter, wipe);
|
||||
}
|
||||
});
|
||||
} catch (KeyChainException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
Log.d(Config.LOGTAG,"no such algo "+e.getMessage());
|
||||
e.printStackTrace();
|
||||
} catch (java.security.InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (SignatureException e) {
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void publishBundlesIfNeeded(final boolean announce, final boolean wipe) {
|
||||
@ -530,7 +520,6 @@ public class AxolotlService {
|
||||
}
|
||||
} catch (InvalidKeyException e) {
|
||||
Log.e(Config.LOGTAG, AxolotlService.getLogprefix(account) + "Failed to publish bundle " + getOwnDeviceId() + ", reason: " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -639,7 +628,6 @@ public class AxolotlService {
|
||||
fetchStatusMap.put(address, FetchStatus.ERROR);
|
||||
Log.d(Config.LOGTAG, getLogprefix(account) + "Error received while building session:" + packet.findChild("error"));
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -11,7 +11,7 @@ public abstract class SaslMechanism {
|
||||
final protected Account account;
|
||||
final protected SecureRandom rng;
|
||||
|
||||
protected static enum State {
|
||||
protected enum State {
|
||||
INITIAL,
|
||||
AUTH_TEXT_SENT,
|
||||
RESPONSE_SENT,
|
||||
|
@ -21,7 +21,6 @@ public class ScramSha1 extends SaslMechanism {
|
||||
// TODO: When channel binding (SCRAM-SHA1-PLUS) is supported in future, generalize this to indicate support and/or usage.
|
||||
final private static String GS2_HEADER = "n,,";
|
||||
private String clientFirstMessageBare;
|
||||
private byte[] serverFirstMessage;
|
||||
final private String clientNonce;
|
||||
private byte[] serverSignature = null;
|
||||
private static HMac HMAC;
|
||||
@ -104,7 +103,7 @@ public class ScramSha1 extends SaslMechanism {
|
||||
if (challenge == null) {
|
||||
throw new AuthenticationException("challenge can not be null");
|
||||
}
|
||||
serverFirstMessage = Base64.decode(challenge, Base64.DEFAULT);
|
||||
byte[] serverFirstMessage = Base64.decode(challenge, Base64.DEFAULT);
|
||||
final Tokenizer tokenizer = new Tokenizer(serverFirstMessage);
|
||||
String nonce = "";
|
||||
int iterationCount = -1;
|
||||
|
@ -3,9 +3,9 @@ package eu.siacs.conversations.ui;
|
||||
import android.app.PendingIntent;
|
||||
|
||||
public interface UiCallback<T> {
|
||||
public void success(T object);
|
||||
void success(T object);
|
||||
|
||||
public void error(int errorCode, T object);
|
||||
void error(int errorCode, T object);
|
||||
|
||||
public void userInputRequried(PendingIntent pi, T object);
|
||||
void userInputRequried(PendingIntent pi, T object);
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class KnownHostsAdapter extends ArrayAdapter<String> {
|
||||
@Override
|
||||
protected FilterResults performFiltering(CharSequence constraint) {
|
||||
if (constraint != null) {
|
||||
ArrayList<String> suggestions = new ArrayList<String>();
|
||||
ArrayList<String> suggestions = new ArrayList<>();
|
||||
final String[] split = constraint.toString().split("@");
|
||||
if (split.length == 1) {
|
||||
for (String domain : domains) {
|
||||
@ -58,10 +58,9 @@ public class KnownHostsAdapter extends ArrayAdapter<String> {
|
||||
}
|
||||
};
|
||||
|
||||
public KnownHostsAdapter(Context context, int viewResourceId,
|
||||
List<String> mKnownHosts) {
|
||||
public KnownHostsAdapter(Context context, int viewResourceId, List<String> mKnownHosts) {
|
||||
super(context, viewResourceId, new ArrayList<String>());
|
||||
domains = new ArrayList<String>(mKnownHosts);
|
||||
domains = new ArrayList<>(mKnownHosts);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -92,7 +92,7 @@ public class ListItemAdapter extends ArrayAdapter<ListItem> {
|
||||
}
|
||||
|
||||
public interface OnTagClickedListener {
|
||||
public void onTagClicked(String tag);
|
||||
void onTagClicked(String tag);
|
||||
}
|
||||
|
||||
class BitmapWorkerTask extends AsyncTask<ListItem, Void, Bitmap> {
|
||||
|
@ -1,16 +1,13 @@
|
||||
package eu.siacs.conversations.xmpp;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.net.wifi.WifiConfiguration;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcelable;
|
||||
import android.os.PowerManager;
|
||||
import android.os.PowerManager.WakeLock;
|
||||
import android.os.SystemClock;
|
||||
import android.security.KeyChain;
|
||||
import android.security.KeyChainException;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
@ -35,8 +32,6 @@ import java.net.UnknownHostException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.KeyStore;
|
||||
import java.security.KeyStoreException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.Principal;
|
||||
import java.security.PrivateKey;
|
||||
@ -177,7 +172,7 @@ public class XmppConnection implements Runnable {
|
||||
};
|
||||
|
||||
private OnIqPacketReceived createPacketReceiveHandler() {
|
||||
OnIqPacketReceived receiver = new OnIqPacketReceived() {
|
||||
return new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||
@ -195,8 +190,6 @@ public class XmppConnection implements Runnable {
|
||||
disconnect(true);
|
||||
}
|
||||
};
|
||||
|
||||
return receiver;
|
||||
}
|
||||
|
||||
public XmppConnection(final Account account, final XmppConnectionService service) {
|
||||
@ -775,17 +768,14 @@ public class XmppConnection implements Runnable {
|
||||
InputStream stream = new ByteArrayInputStream(strBlob);
|
||||
captcha = BitmapFactory.decodeStream(stream);
|
||||
} catch (Exception e) {
|
||||
|
||||
//ignored
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Field url = data.getFieldByName("url");
|
||||
String urlString = url.findChildContent("value");
|
||||
|
||||
URL uri = new URL(urlString);
|
||||
captcha = BitmapFactory.decodeStream(uri.openConnection().getInputStream());
|
||||
} catch(MalformedURLException e) {
|
||||
Log.e(Config.LOGTAG, e.toString());
|
||||
} catch(IOException e) {
|
||||
Log.e(Config.LOGTAG, e.toString());
|
||||
}
|
||||
@ -885,11 +875,9 @@ public class XmppConnection implements Runnable {
|
||||
this.sendUnmodifiedIqPacket(startSession, new OnIqPacketReceived() {
|
||||
@Override
|
||||
public void onIqPacketReceived(Account account, IqPacket packet) {
|
||||
if (packet.getType() == IqPacket.TYPE.TIMEOUT) {
|
||||
return;
|
||||
} else if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||
if (packet.getType() == IqPacket.TYPE.RESULT) {
|
||||
sendPostBindInitialization();
|
||||
} else {
|
||||
} else if (packet.getType() != IqPacket.TYPE.TIMEOUT){
|
||||
Log.d(Config.LOGTAG, account.getJid().toBareJid() + ": could not init sessions");
|
||||
disconnect(true);
|
||||
}
|
||||
|
@ -737,8 +737,7 @@ public class JingleConnection implements Transferable {
|
||||
JinglePacket answer = bootstrapPacket("transport-accept");
|
||||
Content content = new Content("initiator", "a-file-offer");
|
||||
content.setTransportId(this.transportId);
|
||||
content.ibbTransport().setAttribute("block-size",
|
||||
Integer.toString(this.ibbBlockSize));
|
||||
content.ibbTransport().setAttribute("block-size",this.ibbBlockSize);
|
||||
answer.setContent(content);
|
||||
this.sendJinglePacket(answer);
|
||||
return true;
|
||||
|
@ -3,7 +3,7 @@ package eu.siacs.conversations.xmpp.jingle;
|
||||
import eu.siacs.conversations.entities.DownloadableFile;
|
||||
|
||||
public interface OnFileTransmissionStatusChanged {
|
||||
public void onFileTransmitted(DownloadableFile file);
|
||||
void onFileTransmitted(DownloadableFile file);
|
||||
|
||||
public void onFileTransferAborted();
|
||||
void onFileTransferAborted();
|
||||
}
|
||||
|
@ -5,5 +5,5 @@ import eu.siacs.conversations.xmpp.PacketReceived;
|
||||
import eu.siacs.conversations.xmpp.jingle.stanzas.JinglePacket;
|
||||
|
||||
public interface OnJinglePacketReceived extends PacketReceived {
|
||||
public void onJinglePacketReceived(Account account, JinglePacket packet);
|
||||
void onJinglePacketReceived(Account account, JinglePacket packet);
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
package eu.siacs.conversations.xmpp.jingle;
|
||||
|
||||
public interface OnPrimaryCandidateFound {
|
||||
public void onPrimaryCandidateFound(boolean success,
|
||||
JingleCandidate canditate);
|
||||
void onPrimaryCandidateFound(boolean success, JingleCandidate canditate);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user