1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-25 00:58:50 -05:00
This commit is contained in:
Jesse Vincent 2011-01-31 23:45:23 +00:00
parent 6550151684
commit 3d090e9626
6 changed files with 100 additions and 91 deletions

View File

@ -11,4 +11,4 @@ public class AccountStats implements Serializable
public long size = -1;
public int unreadMessageCount = 0;
public int flaggedMessageCount = 0;
}
}

View File

@ -136,4 +136,4 @@ public class SearchAccount implements BaseAccount, SearchSpecification, Serializ
{
this.folderNames = folderNames;
}
}
}

View File

@ -819,7 +819,8 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
return true;
}
private static String[][] USED_LIBRARIES = new String[][] {
private static String[][] USED_LIBRARIES = new String[][]
{
new String[] {"jutf7", "http://jutf7.sourceforge.net/"},
new String[] {"JZlib", "http://www.jcraft.com/jzlib/"},
new String[] {"Commons IO", "http://commons.apache.org/io/"},
@ -832,30 +833,30 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
String year = "2011";
WebView wv = new WebView(this);
StringBuilder html = new StringBuilder()
.append("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />")
.append("<img src=\"file:///android_asset/icon.png\" alt=\"").append(appName).append("\"/>")
.append("<h1>")
.append(String.format(getString(R.string.about_title_fmt),
"<a href=\"" + getString(R.string.app_webpage_url)) + "\">")
.append(appName)
.append("</a>")
.append("</h1><p>")
.append(appName)
.append(" ")
.append(String.format(getString(R.string.debug_version_fmt), getVersionNumber()))
.append("</p><p>")
.append(String.format(getString(R.string.app_authors_fmt),
getString(R.string.app_authors)))
.append("</p><p>")
.append(String.format(getString(R.string.app_revision_fmt),
"<a href=\"" + getString(R.string.app_revision_url) + "\">" +
getString(R.string.app_revision_url) +
"</a>"))
.append("</p><hr/><p>")
.append(String.format(getString(R.string.app_copyright_fmt), year, year))
.append("</p><hr/><p>")
.append(getString(R.string.app_license))
.append("</p><hr/><p>");
.append("<meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />")
.append("<img src=\"file:///android_asset/icon.png\" alt=\"").append(appName).append("\"/>")
.append("<h1>")
.append(String.format(getString(R.string.about_title_fmt),
"<a href=\"" + getString(R.string.app_webpage_url)) + "\">")
.append(appName)
.append("</a>")
.append("</h1><p>")
.append(appName)
.append(" ")
.append(String.format(getString(R.string.debug_version_fmt), getVersionNumber()))
.append("</p><p>")
.append(String.format(getString(R.string.app_authors_fmt),
getString(R.string.app_authors)))
.append("</p><p>")
.append(String.format(getString(R.string.app_revision_fmt),
"<a href=\"" + getString(R.string.app_revision_url) + "\">" +
getString(R.string.app_revision_url) +
"</a>"))
.append("</p><hr/><p>")
.append(String.format(getString(R.string.app_copyright_fmt), year, year))
.append("</p><hr/><p>")
.append(getString(R.string.app_license))
.append("</p><hr/><p>");
StringBuilder libs = new StringBuilder().append("<ul>");
for (String[] library : USED_LIBRARIES)
@ -865,12 +866,12 @@ public class Accounts extends K9ListActivity implements OnItemClickListener, OnC
libs.append("</ul>");
html.append(String.format(getString(R.string.app_libraries), libs.toString()))
.append("</p><hr/><p>")
.append(String.format(getString(R.string.app_emoji_icons),
"<div>TypePad \u7d75\u6587\u5b57\u30a2\u30a4\u30b3\u30f3\u753b\u50cf " +
"(<a href=\"http://typepad.jp/\">Six Apart Ltd</a>) / " +
"<a href=\"http://creativecommons.org/licenses/by/2.1/jp/\">CC BY 2.1</a></div>"))
.append("</p>");
.append("</p><hr/><p>")
.append(String.format(getString(R.string.app_emoji_icons),
"<div>TypePad \u7d75\u6587\u5b57\u30a2\u30a4\u30b3\u30f3\u753b\u50cf " +
"(<a href=\"http://typepad.jp/\">Six Apart Ltd</a>) / " +
"<a href=\"http://creativecommons.org/licenses/by/2.1/jp/\">CC BY 2.1</a></div>"))
.append("</p>");
wv.loadDataWithBaseURL("file:///android_res/drawable/", html.toString(), "text/html", "utf-8", null);
new AlertDialog.Builder(this)

View File

@ -36,11 +36,11 @@ public class ContactsSdk5p extends ContactsSdk5
final String filter = constraint.toString();
final Uri uri = Uri.withAppendedPath(Email.CONTENT_FILTER_URI, Uri.encode(filter));
final Cursor cursor = mContentResolver.query(
uri,
new String[] {Email.CONTACT_ID},
null,
null,
null);
uri,
new String[] {Email.CONTACT_ID},
null,
null,
null);
final StringBuilder matches = new StringBuilder();
if ((cursor != null) && (cursor.getCount() > 0))
@ -64,29 +64,29 @@ public class ContactsSdk5p extends ContactsSdk5
// Find contacts with email addresses that have been found using
// Email.CONTENT_FILTER_URI above or ones that have a matching phonetic name.
final String where = Data.MIMETYPE + " = '" + Email.CONTENT_ITEM_TYPE + "'" +
" AND " +
"(" +
// Match if found by Email.CONTENT_FILTER_URI
Email.CONTACT_ID + " IN (" + matches.toString() + ")" +
" OR " +
// Match if phonetic given name starts with "constraint"
StructuredName.PHONETIC_GIVEN_NAME + " LIKE ?" +
" OR " +
// Match if phonetic given name contains a word that starts with "constraint"
StructuredName.PHONETIC_GIVEN_NAME + " LIKE ?" +
" OR " +
// Match if phonetic middle name starts with "constraint"
StructuredName.PHONETIC_MIDDLE_NAME + " LIKE ?" +
" OR " +
// Match if phonetic middle name contains a word that starts with "constraint"
StructuredName.PHONETIC_MIDDLE_NAME + " LIKE ?" +
" OR " +
// Match if phonetic family name starts with "constraint"
StructuredName.PHONETIC_FAMILY_NAME + " LIKE ?" +
" OR " +
// Match if phonetic family name contains a word that starts with "constraint"
StructuredName.PHONETIC_FAMILY_NAME + " LIKE ?" +
")";
" AND " +
"(" +
// Match if found by Email.CONTENT_FILTER_URI
Email.CONTACT_ID + " IN (" + matches.toString() + ")" +
" OR " +
// Match if phonetic given name starts with "constraint"
StructuredName.PHONETIC_GIVEN_NAME + " LIKE ?" +
" OR " +
// Match if phonetic given name contains a word that starts with "constraint"
StructuredName.PHONETIC_GIVEN_NAME + " LIKE ?" +
" OR " +
// Match if phonetic middle name starts with "constraint"
StructuredName.PHONETIC_MIDDLE_NAME + " LIKE ?" +
" OR " +
// Match if phonetic middle name contains a word that starts with "constraint"
StructuredName.PHONETIC_MIDDLE_NAME + " LIKE ?" +
" OR " +
// Match if phonetic family name starts with "constraint"
StructuredName.PHONETIC_FAMILY_NAME + " LIKE ?" +
" OR " +
// Match if phonetic family name contains a word that starts with "constraint"
StructuredName.PHONETIC_FAMILY_NAME + " LIKE ?" +
")";
final String filter1 = constraint.toString() + "%";
final String filter2 = "% " + filter1;
final String[] args = new String[] {filter1, filter2, filter1, filter2, filter1, filter2};

View File

@ -1288,6 +1288,9 @@ public class LocalStore extends Store implements Serializable
public class LocalFolder extends Folder implements Serializable
{
/**
*
*/
private static final long serialVersionUID = -1973296520918624767L;
private String mName = null;
private long mFolderId = -1;

View File

@ -152,37 +152,42 @@ public class SmtpTransport extends Transport
{
try
{
InetAddress[] addresses = InetAddress.getAllByName(mHost);
for (int i = 0; i < addresses.length; i++) {
try {
SocketAddress socketAddress = new InetSocketAddress(addresses[i], mPort);
if (mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED ||
mConnectionSecurity == CONNECTION_SECURITY_SSL_OPTIONAL)
{
SSLContext sslContext = SSLContext.getInstance("TLS");
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
sslContext.init(null, new TrustManager[]
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
mSocket = sslContext.getSocketFactory().createSocket();
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
mSecure = true;
}
else
{
mSocket = new Socket();
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
}
} catch (ConnectException e) {
if (i < (addresses.length - 1)) {
// there are still other addresses for that host to try
continue;
}
InetAddress[] addresses = InetAddress.getAllByName(mHost);
for (int i = 0; i < addresses.length; i++)
{
try
{
SocketAddress socketAddress = new InetSocketAddress(addresses[i], mPort);
if (mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED ||
mConnectionSecurity == CONNECTION_SECURITY_SSL_OPTIONAL)
{
SSLContext sslContext = SSLContext.getInstance("TLS");
boolean secure = mConnectionSecurity == CONNECTION_SECURITY_SSL_REQUIRED;
sslContext.init(null, new TrustManager[]
{
TrustManagerFactory.get(mHost, secure)
}, new SecureRandom());
mSocket = sslContext.getSocketFactory().createSocket();
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
mSecure = true;
}
else
{
mSocket = new Socket();
mSocket.connect(socketAddress, SOCKET_CONNECT_TIMEOUT);
}
}
catch (ConnectException e)
{
if (i < (addresses.length - 1))
{
// there are still other addresses for that host to try
continue;
}
throw new MessagingException("Cannot connect to host", e);
}
break; // connection success
}
}
break; // connection success
}
// RFC 1047
mSocket.setSoTimeout(SOCKET_READ_TIMEOUT);