cleanup; removed unnecessary imports and log outputs

This commit is contained in:
iNPUTmice 2014-06-16 12:18:04 +02:00
parent e6b5713c12
commit b9477edb53
13 changed files with 5 additions and 41 deletions

View File

@ -1,7 +1,6 @@
package eu.siacs.conversations.entities; package eu.siacs.conversations.entities;
import java.util.HashSet; import java.util.HashSet;
import java.util.Hashtable;
import java.util.Set; import java.util.Set;
import org.json.JSONArray; import org.json.JSONArray;

View File

@ -16,7 +16,6 @@ import android.content.ContentValues;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.net.Uri; import android.net.Uri;
import android.util.Log;
public class Conversation extends AbstractEntity { public class Conversation extends AbstractEntity {

View File

@ -8,8 +8,6 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import org.bouncycastle.crypto.engines.ISAACEngine;
import android.content.Context; import android.content.Context;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;

View File

@ -18,7 +18,6 @@ import android.os.Bundle;
import android.preference.PreferenceManager; import android.preference.PreferenceManager;
import android.text.Editable; import android.text.Editable;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.util.Log;
import android.util.SparseBooleanArray; import android.util.SparseBooleanArray;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.LayoutInflater; import android.view.LayoutInflater;

View File

@ -3,7 +3,6 @@ package eu.siacs.conversations.ui;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.lang.ref.WeakReference; import java.lang.ref.WeakReference;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List; import java.util.List;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;

View File

@ -7,7 +7,6 @@ import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
import android.app.DialogFragment; import android.app.DialogFragment;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.widget.Button; import android.widget.Button;

View File

@ -3,25 +3,19 @@ package eu.siacs.conversations.ui;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.openintents.openpgp.OpenPgpError;
import eu.siacs.conversations.R; import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.PgpEngine;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.ui.EditAccount.EditAccountListener; import eu.siacs.conversations.ui.EditAccount.EditAccountListener;
import eu.siacs.conversations.xmpp.OnTLSExceptionReceived; import eu.siacs.conversations.xmpp.OnTLSExceptionReceived;
import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.XmppConnection;
import android.app.Activity; import android.app.Activity;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.PendingIntent;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener; import android.content.DialogInterface.OnClickListener;
import android.content.Intent; import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.os.Bundle; import android.os.Bundle;
import android.os.SystemClock; import android.os.SystemClock;
import android.util.Log;
import android.view.ActionMode; import android.view.ActionMode;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.Menu; import android.view.Menu;

View File

@ -24,8 +24,6 @@ import android.view.Menu;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View; import android.view.View;
import android.view.View.OnClickListener; import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.EditText; import android.widget.EditText;
import android.widget.ImageButton; import android.widget.ImageButton;

View File

@ -10,7 +10,6 @@ import java.util.Random;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import android.util.Base64; import android.util.Base64;
import android.util.Log;
public class CryptoHelper { public class CryptoHelper {
final protected static char[] hexArray = "0123456789ABCDEF".toCharArray(); final protected static char[] hexArray = "0123456789ABCDEF".toCharArray();

View File

@ -17,7 +17,6 @@ import java.security.cert.CertificateException;
import java.security.cert.X509Certificate; import java.security.cert.X509Certificate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -241,7 +240,7 @@ public class XmppConnection implements Runnable {
processStream(tagReader.readTag()); processStream(tagReader.readTag());
break; break;
} else if (nextTag.isStart("failure")) { } else if (nextTag.isStart("failure")) {
Element failure = tagReader.readElement(nextTag); tagReader.readElement(nextTag);
changeStatus(Account.STATUS_UNAUTHORIZED); changeStatus(Account.STATUS_UNAUTHORIZED);
} else if (nextTag.isStart("challenge")) { } else if (nextTag.isStart("challenge")) {
String challange = tagReader.readElement(nextTag).getContent(); String challange = tagReader.readElement(nextTag).getContent();
@ -442,17 +441,14 @@ public class XmppConnection implements Runnable {
private void switchOverToTls(Tag currentTag) throws XmlPullParserException, private void switchOverToTls(Tag currentTag) throws XmlPullParserException,
IOException { IOException {
Tag nextTag = tagReader.readTag(); // should be proceed end tag tagReader.readTag();
try { try {
SSLContext sc = SSLContext.getInstance("TLS"); SSLContext sc = SSLContext.getInstance("TLS");
TrustManagerFactory tmf = TrustManagerFactory TrustManagerFactory tmf = TrustManagerFactory
.getInstance(TrustManagerFactory.getDefaultAlgorithm()); .getInstance(TrustManagerFactory.getDefaultAlgorithm());
// Initialise the TMF as you normally would, for example:
// tmf.in
try { try {
tmf.init((KeyStore) null); tmf.init((KeyStore) null);
} catch (KeyStoreException e1) { } catch (KeyStoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace(); e1.printStackTrace();
} }

View File

@ -8,12 +8,10 @@ import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException; import java.security.NoSuchAlgorithmException;
import android.util.Base64; import android.util.Base64;
import android.util.Log;
import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.xml.Element; import eu.siacs.conversations.xml.Element;
import eu.siacs.conversations.xmpp.OnIqPacketReceived; import eu.siacs.conversations.xmpp.OnIqPacketReceived;
import eu.siacs.conversations.xmpp.PacketReceived;
import eu.siacs.conversations.xmpp.stanzas.IqPacket; import eu.siacs.conversations.xmpp.stanzas.IqPacket;
public class JingleInbandTransport extends JingleTransport { public class JingleInbandTransport extends JingleTransport {
@ -39,7 +37,6 @@ public class JingleInbandTransport extends JingleTransport {
private OnIqPacketReceived onAckReceived = new OnIqPacketReceived() { private OnIqPacketReceived onAckReceived = new OnIqPacketReceived() {
@Override @Override
public void onIqPacketReceived(Account account, IqPacket packet) { public void onIqPacketReceived(Account account, IqPacket packet) {
Log.d("xmppService", "on ack received");
if (packet.getType() == IqPacket.TYPE_RESULT) { if (packet.getType() == IqPacket.TYPE_RESULT) {
sendNextBlock(); sendNextBlock();
} }
@ -82,7 +79,6 @@ public class JingleInbandTransport extends JingleTransport {
public void receive(JingleFile file, OnFileTransmitted callback) { public void receive(JingleFile file, OnFileTransmitted callback) {
this.onFileTransmitted = callback; this.onFileTransmitted = callback;
this.file = file; this.file = file;
Log.d("xmppService", "receiving file over ibb");
try { try {
this.digest = MessageDigest.getInstance("SHA-1"); this.digest = MessageDigest.getInstance("SHA-1");
digest.reset(); digest.reset();
@ -101,7 +97,6 @@ public class JingleInbandTransport extends JingleTransport {
public void send(JingleFile file, OnFileTransmitted callback) { public void send(JingleFile file, OnFileTransmitted callback) {
this.onFileTransmitted = callback; this.onFileTransmitted = callback;
this.file = file; this.file = file;
Log.d("xmppService", "sending file over ibb");
try { try {
this.digest = MessageDigest.getInstance("SHA-1"); this.digest = MessageDigest.getInstance("SHA-1");
this.digest.reset(); this.digest.reset();
@ -151,10 +146,8 @@ public class JingleInbandTransport extends JingleTransport {
this.fileOutputStream.write(buffer); this.fileOutputStream.write(buffer);
this.digest.update(buffer); this.digest.update(buffer);
Log.d("xmppService", "remaining file size:" + this.remainingSize);
if (this.remainingSize <= 0) { if (this.remainingSize <= 0) {
file.setSha1Sum(CryptoHelper.bytesToHex(digest.digest())); file.setSha1Sum(CryptoHelper.bytesToHex(digest.digest()));
Log.d("xmppService","file name: "+file.getAbsolutePath());
fileOutputStream.flush(); fileOutputStream.flush();
fileOutputStream.close(); fileOutputStream.close();
this.onFileTransmitted.onFileTransmitted(file); this.onFileTransmitted.onFileTransmitted(file);
@ -179,7 +172,7 @@ public class JingleInbandTransport extends JingleTransport {
this.account.getXmppConnection().sendIqPacket( this.account.getXmppConnection().sendIqPacket(
packet.generateRespone(IqPacket.TYPE_RESULT), null); packet.generateRespone(IqPacket.TYPE_RESULT), null);
} else { } else {
Log.d("xmppServic","couldnt deliver payload "+packet.toString()); //TODO some sort of exception
} }
} }
} }

View File

@ -13,10 +13,6 @@ import java.security.NoSuchAlgorithmException;
import java.util.Arrays; import java.util.Arrays;
import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.utils.CryptoHelper;
import eu.siacs.conversations.xml.Element;
import android.util.Log;
import android.widget.Button;
public class JingleSocks5Transport extends JingleTransport { public class JingleSocks5Transport extends JingleTransport {
private JingleCandidate candidate; private JingleCandidate candidate;
@ -150,13 +146,12 @@ public class JingleSocks5Transport extends JingleTransport {
byte[] buffer = new byte[8192]; byte[] buffer = new byte[8192];
int count = buffer.length; int count = buffer.length;
while(remainingSize > 0) { while(remainingSize > 0) {
Log.d("xmppService","remaning size:"+remainingSize);
if (remainingSize<=count) { if (remainingSize<=count) {
count = (int) remainingSize; count = (int) remainingSize;
} }
count = inputStream.read(buffer, 0, count); count = inputStream.read(buffer, 0, count);
if (count==-1) { if (count==-1) {
Log.d("xmppService","end of stream"); // TODO throw exception
} else { } else {
fileOutputStream.write(buffer, 0, count); fileOutputStream.write(buffer, 0, count);
digest.update(buffer, 0, count); digest.update(buffer, 0, count);
@ -166,7 +161,6 @@ public class JingleSocks5Transport extends JingleTransport {
fileOutputStream.flush(); fileOutputStream.flush();
fileOutputStream.close(); fileOutputStream.close();
file.setSha1Sum(CryptoHelper.bytesToHex(digest.digest())); file.setSha1Sum(CryptoHelper.bytesToHex(digest.digest()));
Log.d("xmppService","transmitted filename was: "+file.getAbsolutePath());
callback.onFileTransmitted(file); callback.onFileTransmitted(file);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
@ -194,9 +188,8 @@ public class JingleSocks5Transport extends JingleTransport {
if (this.socket!=null) { if (this.socket!=null) {
try { try {
this.socket.close(); this.socket.close();
Log.d("xmppService","cloesd socket with "+candidate.getHost()+":"+candidate.getPort());
} catch (IOException e) { } catch (IOException e) {
Log.d("xmppService","error closing socket with "+candidate.getHost()+":"+candidate.getPort());
} }
} }
} }

View File

@ -1,7 +1,5 @@
package eu.siacs.conversations.xmpp.jingle; package eu.siacs.conversations.xmpp.jingle;
import eu.siacs.conversations.xml.Element;
public abstract class JingleTransport { public abstract class JingleTransport {
public abstract void connect(final OnTransportConnected callback); public abstract void connect(final OnTransportConnected callback);
public abstract void receive(final JingleFile file, final OnFileTransmitted callback); public abstract void receive(final JingleFile file, final OnFileTransmitted callback);