1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-30 13:12:25 -05:00

Allow per-protocol configuration of which wire protocols are

debug-logged
This commit is contained in:
Jesse Vincent 2010-07-13 21:16:42 +00:00
parent eda64bf1e7
commit 8ab165ef31
6 changed files with 43 additions and 12 deletions

View File

@ -58,6 +58,37 @@ public class K9 extends Application
*/ */
public static boolean DEBUG = false; public static boolean DEBUG = false;
/**
* Should K-9 log the conversation it has over the wire with
* SMTP servers?
*/
public static boolean DEBUG_PROTOCOL_SMTP = true;
/**
* Should K-9 log the conversation it has over the wire with
* IMAP servers?
*/
public static boolean DEBUG_PROTOCOL_IMAP = true;
/**
* Should K-9 log the conversation it has over the wire with
* POP3 servers?
*/
public static boolean DEBUG_PROTOCOL_POP3 = true;
/**
* Should K-9 log the conversation it has over the wire with
* WebDAV servers?
*/
public static boolean DEBUG_PROTOCOL_WEBDAV = true;
/** /**
* If this is enabled than logging that normally hides sensitive information * If this is enabled than logging that normally hides sensitive information
* like passwords will show that information. * like passwords will show that information.

View File

@ -65,7 +65,7 @@ public class ImapResponseParser
response.mTag = parseTaggedResponse(); response.mTag = parseTaggedResponse();
readTokens(response); readTokens(response);
} }
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
{ {
Log.v(K9.LOG_TAG, "<<< " + response.toString()); Log.v(K9.LOG_TAG, "<<< " + response.toString());
} }

View File

@ -2168,7 +2168,7 @@ public class ImapStore extends Store
capabilities.clear(); capabilities.clear();
ImapResponse nullResponse = mParser.readResponse(); ImapResponse nullResponse = mParser.readResponse();
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
Log.v(K9.LOG_TAG, getLogId() + "<<<" + nullResponse); Log.v(K9.LOG_TAG, getLogId() + "<<<" + nullResponse);
List<ImapResponse> nullResponses = new LinkedList<ImapResponse>(); List<ImapResponse> nullResponses = new LinkedList<ImapResponse>();
@ -2566,7 +2566,7 @@ public class ImapStore extends Store
try try
{ {
ImapResponse response = mParser.readResponse(callback); ImapResponse response = mParser.readResponse(callback);
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
Log.v(K9.LOG_TAG, getLogId() + "<<<" + response); Log.v(K9.LOG_TAG, getLogId() + "<<<" + response);
return response; return response;
@ -2596,7 +2596,7 @@ public class ImapStore extends Store
mOut.write('\n'); mOut.write('\n');
mOut.flush(); mOut.flush();
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
Log.v(K9.LOG_TAG, getLogId() + ">>> " + continuation); Log.v(K9.LOG_TAG, getLogId() + ">>> " + continuation);
} }
@ -2614,7 +2614,7 @@ public class ImapStore extends Store
mOut.write('\n'); mOut.write('\n');
mOut.flush(); mOut.flush();
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
{ {
if (sensitive && !K9.DEBUG_SENSITIVE) if (sensitive && !K9.DEBUG_SENSITIVE)
{ {
@ -2680,7 +2680,7 @@ public class ImapStore extends Store
do do
{ {
response = mParser.readResponse(); response = mParser.readResponse();
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_IMAP)
Log.v(K9.LOG_TAG, getLogId() + "<<<" + response); Log.v(K9.LOG_TAG, getLogId() + "<<<" + response);
if (response.mTag != null && response.mTag.equalsIgnoreCase(tag) == false) if (response.mTag != null && response.mTag.equalsIgnoreCase(tag) == false)

View File

@ -960,7 +960,7 @@ public class Pop3Store extends Store
String ret = sb.toString(); String ret = sb.toString();
if (Config.LOGD) if (Config.LOGD)
{ {
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3)
{ {
Log.d(K9.LOG_TAG, "<<< " + ret); Log.d(K9.LOG_TAG, "<<< " + ret);
} }
@ -972,7 +972,7 @@ public class Pop3Store extends Store
{ {
if (Config.LOGD) if (Config.LOGD)
{ {
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_POP3)
{ {
Log.d(K9.LOG_TAG, ">>> " + s); Log.d(K9.LOG_TAG, ">>> " + s);
} }

View File

@ -1032,7 +1032,7 @@ public class WebDavStore extends Store
throws MessagingException throws MessagingException
{ {
DataSet dataset = new DataSet(); DataSet dataset = new DataSet();
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
{ {
Log.v(K9.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '" + messageBody + "'"); Log.v(K9.LOG_TAG, "processRequest url = '" + url + "', method = '" + method + "', messageBody = '" + messageBody + "'");
} }
@ -2607,7 +2607,7 @@ public class WebDavStore extends Store
url = urlParts[i]; url = urlParts[i];
} }
} }
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_WEBDAV)
{ {
Log.v(K9.LOG_TAG, "url = '" + url + "' length = " + url.length() Log.v(K9.LOG_TAG, "url = '" + url + "' length = " + url.length()
+ ", end = '" + end + "' length = " + end.length()); + ", end = '" + end + "' length = " + end.length());

View File

@ -416,7 +416,7 @@ public class SmtpTransport extends Transport
} }
} }
String ret = sb.toString(); String ret = sb.toString();
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP)
Log.d(K9.LOG_TAG, "SMTP <<< " + ret); Log.d(K9.LOG_TAG, "SMTP <<< " + ret);
return ret; return ret;
@ -424,7 +424,7 @@ public class SmtpTransport extends Transport
private void writeLine(String s, boolean sensitive) throws IOException private void writeLine(String s, boolean sensitive) throws IOException
{ {
if (K9.DEBUG) if (K9.DEBUG && K9.DEBUG_PROTOCOL_SMTP)
{ {
final String commandToLog; final String commandToLog;
if (sensitive && !K9.DEBUG_SENSITIVE) if (sensitive && !K9.DEBUG_SENSITIVE)