Skip to content

Commit

Permalink
Remove really verbose logging
Browse files Browse the repository at this point in the history
  • Loading branch information
markwinter committed Apr 20, 2014
1 parent 132adcc commit 3a3902d
Show file tree
Hide file tree
Showing 18 changed files with 1 addition and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,6 @@ protected Void doInBackground(String... params) {
String user = params[0].substring(0, params[0].indexOf("@"));
String domain = params[0].substring(params[0].indexOf("@")+1);
String lookup = user + "._tox." + domain;
Log.d("DNSLOOKUP", lookup);

TXTRecord txt = null;
try {
Expand All @@ -384,19 +383,15 @@ protected Void doInBackground(String... params) {

if(txt != null) {
String txtString = txt.toString().substring(txt.toString().indexOf('"'));
Log.d("DNSLOOKUP", txtString);

if(txtString.contains("tox1")) {
String key = txtString.substring(11, txtString.length()-1);
Log.d("DNSLOOKUP", "V1KEY: " + key);
_friendID = key;

} else if (txtString.contains("tox2")) {
isV2 = true;
String key = txtString.substring(12, 12+64);
String check = txtString.substring(12+64+7,12+64+7+4);
Log.d("DNSLOOKUP", "V2KEY: " + key);
Log.d("DNSLOOKUP", "V2CHECK: " + check);
_friendID = key;
_friendCHECK = check;
}
Expand Down
7 changes: 0 additions & 7 deletions app/src/main/java/im/tox/antox/activities/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,6 @@ public void onReceive(Context context, Intent intent) {
Toast toast = Toast.makeText(ctx, text, duration);
toast.show();
} else if (action.equals(Constants.UPDATE_MESSAGES)) {
Log.d(TAG, "UPDATE_MESSAGES, intent key = " + intent.getStringExtra("key") + ", activeFriendKey = " + toxSingleton.activeFriendKey);

updateLeftPane();
if (intent.getStringExtra("key").equals(toxSingleton.activeFriendKey)) {
updateChat(toxSingleton.activeFriendKey);
Expand All @@ -157,7 +155,6 @@ public void onReceive(Context context, Intent intent) {


public void updateChat(String key) {
Log.d(TAG, "updating chat");
if(toxSingleton.friendsList.getById(key)!=null
&& toxSingleton.friendsList.getById(key).getName()!=null ){
AntoxDB db = new AntoxDB(this);
Expand Down Expand Up @@ -336,7 +333,6 @@ protected void onCreate(Bundle savedInstanceState) {
//String[] items = getResources().getStringArray(R.array.actions);
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
Log.d("NavigationItemSelected", groups.get(itemPosition));
SharedPreferences settingsPref = getSharedPreferences("settings", Context.MODE_PRIVATE);
if (itemPosition != settingsPref.getInt("group_option", -1)) {
SharedPreferences.Editor editor = settingsPref.edit();
Expand Down Expand Up @@ -499,7 +495,6 @@ void updateGroupsList() {
ActionBar.OnNavigationListener callback = new ActionBar.OnNavigationListener() {
@Override
public boolean onNavigationItemSelected(int itemPosition, long itemId) {
Log.d("NavigationItemSelected", groupsClone.get(itemPosition));
SharedPreferences settingsPref = getSharedPreferences("settings", Context.MODE_PRIVATE);
if (itemPosition != settingsPref.getInt("group_option", -1)) {
SharedPreferences.Editor editor = settingsPref.edit();
Expand Down Expand Up @@ -912,8 +907,6 @@ protected Void doInBackground(Void... params) {
}

Log.d(TAG, "DhtNode size: " + DhtNode.ipv4.size());
Log.d(TAG, "About to ping servers...");

/**
* Ping servers to find quickest connection - Threading this would be goood
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ private String iconColor (int i) {
} else {
color = "#FFFFFF";
}
Log.d("ICON", ""+i);
return color;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public AntoxOnActionCallback(Context ctx) {

@Override
public void execute(AntoxFriend friend, String action) {
Log.d(TAG, "OnActionCallback received");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ public AntoxOnConnectionStatusCallback(Context ctx) {

@Override
public void execute(AntoxFriend friend, boolean online) {
Log.d(TAG, "OnConnectionStatusCallback received");
AntoxDB db = new AntoxDB(ctx);
db.updateUserOnline(friend.getId(), online);
db.close();
Log.d(TAG, "OnConnectionStatusCallback id: " + friend.getId() + " status: " + online);
Intent update = new Intent(Constants.BROADCAST_ACTION);
update.putExtra("action", Constants.UPDATE);
LocalBroadcastManager.getInstance(ctx).sendBroadcast(update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public AntoxOnFriendRequestCallback(Context ctx) {

@Override
public void execute(String publicKey, String message){
Log.d(TAG, "Friend request callback");
Intent intent = new Intent(this.ctx, ToxService.class);
intent.setAction(Constants.FRIEND_REQUEST);
intent.putExtra(FRIEND_KEY, publicKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public AntoxOnMessageCallback(Context ctx) {

@Override
public void execute(AntoxFriend friend, String message) {
Log.d(TAG, "OnMessageCallback received");
Intent intent = new Intent(this.ctx, ToxService.class);
intent.setAction(Constants.ON_MESSAGE);
intent.putExtra(MESSAGE, message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ public AntoxOnNameChangeCallback(Context ctx) {

@Override
public void execute(AntoxFriend friend, String newName) {
Log.d(TAG, "OnNameChangeCallback received");
AntoxDB db = new AntoxDB(ctx);
db.updateFriendName(friend.getId(), newName);
db.close();
Log.d(TAG, "OnNameChangeCallback id: " + friend.getId() + " name: " + newName);
Intent update = new Intent(Constants.BROADCAST_ACTION);
update.putExtra("action", Constants.UPDATE);
LocalBroadcastManager.getInstance(ctx).sendBroadcast(update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public AntoxOnReadReceiptCallback(Context ctx) {

@Override
public void execute(AntoxFriend friend, int receipt) {
Log.d(TAG, "OnReadReceiptCallback received, receipt id = " + receipt);
Intent intent = new Intent(this.ctx, ToxService.class);
intent.setAction(Constants.DELIVERY_RECEIPT);
intent.putExtra("receipt", receipt);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ public AntoxOnStatusMessageCallback(Context ctx) {

@Override
public void execute(AntoxFriend friend, String newStatus) {
Log.d(TAG, "OnStatusMessageCallback received");
AntoxDB db = new AntoxDB(ctx);
db.updateStatusMessage(friend.getId(), newStatus);
db.close();
Log.d(TAG, "OnStatusMessageCallback id: " + friend.getId() + " status: " + newStatus);
Intent update = new Intent(Constants.BROADCAST_ACTION);
update.putExtra("action", Constants.UPDATE);
LocalBroadcastManager.getInstance(ctx).sendBroadcast(update);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,5 @@ public class AntoxOnTypingChangeCallback implements OnTypingChangeCallback<Antox
public AntoxOnTypingChangeCallback(Context ctx) { this.ctx = ctx; };

public void execute(AntoxFriend friend, boolean typing) {
Log.d(TAG, "Typing Callback received from: " + friend.getName() + " value: " + typing);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,9 @@ public AntoxOnUserStatusCallback(Context ctx) {

@Override
public void execute(AntoxFriend friend, ToxUserStatus newStatus) {
Log.d(TAG, "OnUserStatusCallback received");
AntoxDB db = new AntoxDB(ctx);
db.updateUserStatus(friend.getId(), newStatus);
db.close();
Log.d(TAG, "OnUserStatusCallback id: " + friend.getId() + " userStatus: " + newStatus.toString());
Intent update = new Intent(Constants.BROADCAST_ACTION);
update.putExtra("action", Constants.UPDATE);
LocalBroadcastManager.getInstance(ctx).sendBroadcast(update);
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/im/tox/antox/data/AntoxDB.java
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ public ArrayList<Friend> getFriendList(int option) {
String note = cursor.getString(4);
String alias = cursor.getString(5);
int online = cursor.getInt(6);
Log.d("DB", online + "");
boolean isBlocked = cursor.getInt(7)>0;
String group = cursor.getString(8);

Expand Down Expand Up @@ -499,7 +498,6 @@ public String[] getFriendDetails(String key) {

SQLiteDatabase db = this.getReadableDatabase();
String selectQuery = "SELECT * FROM " + Constants.TABLE_FRIENDS + " WHERE " + Constants.COLUMN_NAME_KEY + "='" + key + "'";
Log.d("DB", selectQuery);
Cursor cursor = db.rawQuery(selectQuery, null);

if (cursor.moveToFirst()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ public boolean onItemLongClick(AdapterView<?> parent, View itemView, int index,
.setCancelable(true)
.setItems(items, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int index) {
Log.d("picked", "" + items[index]);
//item.first equals the key
if(isFriendRequest){
switch (index){
Expand Down Expand Up @@ -295,7 +294,6 @@ public void onClick(DialogInterface dialogInterface, int i) {
break;
case 2:
//Delete friend
Log.d("ContactsFragment","Delete Friend selected");
if (!key.equals("")) {
showAlertDialog(getActivity(),key);
}
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/java/im/tox/antox/tox/ToxDoService.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,11 @@ protected void onHandleIntent(Intent intent) {
}

try {
Log.d(TAG, "Handling intent START_TOX");
toxSingleton.initTox(getApplicationContext());

AntoxDB db = new AntoxDB(getApplicationContext());
ArrayList<FriendRequest> friendRequests = db.getFriendRequestsList();
toxSingleton.friend_requests = friendRequests;
Log.d(TAG, "Loaded requests from database");

Intent notify = new Intent(Constants.BROADCAST_ACTION);
notify.putExtra("action", Constants.UPDATE_LEFT_PANE);
Expand All @@ -86,7 +84,6 @@ protected void onHandleIntent(Intent intent) {
toxSingleton.friendsList = (AntoxFriendList) toxSingleton.jTox.getFriendList();

if(friends.size() > 0) {
Log.d(TAG, "Adding friends to tox friendlist");
for (int i = 0; i < friends.size(); i++) {
try {
toxSingleton.jTox.confirmRequest(friends.get(i).friendKey);
Expand Down Expand Up @@ -166,7 +163,6 @@ else if (settingsPref.getString("saved_status_hint", "").equals(getString(R.stri
Log.d(TAG, e.getError().toString());
e.printStackTrace();
}
Log.d("Service", "Start do_tox");
toxScheduleTaskExecutor.scheduleAtFixedRate(new DoTox(), 0, 20, TimeUnit.MILLISECONDS);
toxSingleton.toxStarted = true;
} else if (intent.getAction().equals(Constants.STOP_TOX)) {
Expand Down
19 changes: 1 addition & 18 deletions app/src/main/java/im/tox/antox/tox/ToxService.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ protected void onHandleIntent(Intent intent) {
break;

case Constants.ON_MESSAGE:
Log.d(TAG, "Constants.ON_MESSAGE");
String key = intent.getStringExtra(AntoxOnMessageCallback.KEY);
String message = intent.getStringExtra(AntoxOnMessageCallback.MESSAGE);
String name = toxSingleton.friendsList.getById(key).getName();
Expand All @@ -87,7 +86,7 @@ protected void onHandleIntent(Intent intent) {
/* Notifications */
if (!(toxSingleton.rightPaneActive && toxSingleton.activeFriendKey.equals(key))
&& !(toxSingleton.leftPaneActive)) {
Log.d(TAG, "right pane active = " + toxSingleton.rightPaneActive + ", activeFriendkey = " + toxSingleton.activeFriendKey + ", key = " + key);

/* Notification */
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(this)
Expand Down Expand Up @@ -122,7 +121,6 @@ protected void onHandleIntent(Intent intent) {
break;

case Constants.DELETE_FRIEND:
Log.d(TAG, "Constants.DELETE_FRIEND");
key = intent.getStringExtra("key");
boolean wasException = false;
// Remove friend from tox friend list
Expand All @@ -136,7 +134,6 @@ protected void onHandleIntent(Intent intent) {
Log.d(TAG, e.getError().toString());
e.printStackTrace();
}
Log.d(TAG, "Friend deleted from tox list. New size: " + toxSingleton.friendsList.all().size());
if (!wasException) {
//Delete friend from list
toxSingleton.friendsList.removeFriend(friend.getFriendnumber());
Expand All @@ -150,7 +147,6 @@ protected void onHandleIntent(Intent intent) {
break;

case Constants.DELETE_FRIEND_AND_CHAT:
Log.d(TAG, "Constants.DELETE_FRIEND");
key = intent.getStringExtra("key");
wasException = false;
// Remove friend from tox friend list
Expand All @@ -164,7 +160,6 @@ protected void onHandleIntent(Intent intent) {
Log.d(TAG, e.getError().toString());
e.printStackTrace();
}
Log.d(TAG, "Friend deleted from tox list. New size: " + toxSingleton.friendsList.all().size());
if (!wasException) {
//Delete friend from list
toxSingleton.friendsList.removeFriend(friend.getFriendnumber());
Expand All @@ -178,10 +173,8 @@ protected void onHandleIntent(Intent intent) {
break;

case Constants.SEND_UNSENT_MESSAGES:
Log.d(TAG, "Constants.SEND_UNSENT_MESSAGES");
db = new AntoxDB(getApplicationContext());
ArrayList<Message> unsentMessageList = db.getUnsentMessageList();
Log.d(TAG, "unsent message list size is " + unsentMessageList.size());
for (int i = 0; i<unsentMessageList.size(); i++) {
friend = null;
int id = unsentMessageList.get(i).message_id;
Expand All @@ -195,7 +188,6 @@ protected void onHandleIntent(Intent intent) {
}
try {
if (friend != null) {
Log.d(TAG, "Sending message to " + friend.getName());
toxSingleton.jTox.sendMessage(friend, message, id);
}
} catch (ToxException e) {
Expand All @@ -218,7 +210,6 @@ protected void onHandleIntent(Intent intent) {
break;

case Constants.SEND_MESSAGE:
Log.d(TAG, "Constants.SEND_MESSAGE");
key = intent.getStringExtra("key");
message = intent.getStringExtra("message");
/* Send message */
Expand All @@ -233,7 +224,6 @@ protected void onHandleIntent(Intent intent) {
}
try {
if (friend != null) {
Log.d(TAG, "Sending message to " + friend.getName());
toxSingleton.jTox.sendMessage(friend, message, id);
}
} catch (ToxException e) {
Expand Down Expand Up @@ -264,7 +254,6 @@ protected void onHandleIntent(Intent intent) {
break;

case Constants.FRIEND_REQUEST:
Log.d(TAG, "Constants.FRIEND_REQUEST");
key = intent.getStringExtra(AntoxOnFriendRequestCallback.FRIEND_KEY);
message = intent.getStringExtra(AntoxOnFriendRequestCallback.FRIEND_MESSAGE);
/* Add friend request to arraylist */
Expand Down Expand Up @@ -321,7 +310,6 @@ protected void onHandleIntent(Intent intent) {
db = new AntoxDB(getApplicationContext());
key = db.setMessageReceived(receipt);
db.close();
Log.d("DELIVERY RECEIPT FOR KEY: ", key);
/* Broadcast */
notify = new Intent(Constants.BROADCAST_ACTION);
notify.putExtra("action", Constants.UPDATE_MESSAGES);
Expand Down Expand Up @@ -354,11 +342,6 @@ protected void onHandleIntent(Intent intent) {
}

toxSingleton.jTox.save();
Log.d(TAG, "Saving request");

Log.d(TAG, "Tox friend list updated. New size: " + toxSingleton.friendsList.all().size());


} catch (Exception e) {

}
Expand Down
2 changes: 0 additions & 2 deletions app/src/main/java/im/tox/antox/tox/ToxSingleton.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ public void initTox(Context ctx) {

/* Choose appropriate constructor depending on if data file exists */
if(!dataFile.doesFileExist()) {
Log.d(TAG, "Data file not found");
jTox = new JTox(antoxFriendList, callbackHandler);

} else {
Log.d(TAG, "Data file has been found");
jTox = new JTox(dataFile.loadFile(), antoxFriendList, callbackHandler);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ protected Void doInBackground(Void... params) {
e.printStackTrace();
}

Log.d(TAG, "About to ping servers...");
/**
* Ping servers to find quickest connection
*/
Expand Down

0 comments on commit 3a3902d

Please sign in to comment.