407 |
this.out = new CRLFOutputStream(out); |
this.out = new CRLFOutputStream(out); |
408 |
return true; |
return true; |
409 |
} |
} |
410 |
catch(ClassNotFoundException e) |
catch (RuntimeException e) |
411 |
{ |
{ |
412 |
return false; // No javax.net classes in runtime |
return false; // No javax.net classes in runtime |
413 |
} |
} |
443 |
{ |
{ |
444 |
try |
try |
445 |
{ |
{ |
446 |
String[]m = new String[] |
String[] m = new String[] { mechanism }; |
|
{ |
|
|
mechanism}; |
|
447 |
CallbackHandler ch = new SaslCallbackHandler(username, password); |
CallbackHandler ch = new SaslCallbackHandler(username, password); |
448 |
// Avoid lengthy callback procedure for GNU Crypto |
// Avoid lengthy callback procedure for GNU Crypto |
449 |
Properties p = new Properties(); |
Properties p = new Properties(); |
459 |
if (sasl.hasInitialResponse()) |
if (sasl.hasInitialResponse()) |
460 |
{ |
{ |
461 |
cmd.append(' '); |
cmd.append(' '); |
462 |
byte[]init = sasl.evaluateChallenge(new byte[0]); |
byte[] init = sasl.evaluateChallenge(new byte[0]); |
463 |
cmd.append(new String(init, US_ASCII)); |
cmd.append(new String(init, US_ASCII)); |
464 |
} |
} |
465 |
String tag = newTag(); |
String tag = newTag(); |
497 |
{ |
{ |
498 |
try |
try |
499 |
{ |
{ |
500 |
byte[]c0 = response.getText().getBytes(US_ASCII); |
byte[] c0 = response.getText().getBytes(US_ASCII); |
501 |
byte[]c1 = BASE64.decode(c0); // challenge |
byte[] c1 = BASE64.decode(c0); // challenge |
502 |
byte[]r0 = sasl.evaluateChallenge(c1); |
byte[] r0 = sasl.evaluateChallenge(c1); |
503 |
byte[]r1 = BASE64.encode(r0); // response |
byte[] r1 = BASE64.encode(r0); // response |
504 |
out.write(r1); |
out.write(r1); |
505 |
out.writeln(); |
out.writeln(); |
506 |
out.flush(); |
out.flush(); |
517 |
asyncResponses.add(response); |
asyncResponses.add(response); |
518 |
} |
} |
519 |
} |
} |
520 |
catch(SaslException e) |
catch (SaslException e) |
521 |
{ |
{ |
522 |
return false; // No provider for mechanism |
return false; // No provider for mechanism |
523 |
} |
} |
524 |
catch(ClassNotFoundException e) |
catch (RuntimeException e) |
525 |
{ |
{ |
526 |
return false; // No javax.security.sasl classes |
return false; // No javax.security.sasl classes |
527 |
} |
} |
938 |
processAlerts(response); |
processAlerts(response); |
939 |
if (id == OK) |
if (id == OK) |
940 |
{ |
{ |
941 |
ListEntry[]entries = new ListEntry[acc.size()]; |
ListEntry[] entries = new ListEntry[acc.size()]; |
942 |
acc.toArray(entries); |
acc.toArray(entries); |
943 |
return entries; |
return entries; |
944 |
} |
} |
953 |
/** |
/** |
954 |
* Requests the status of the specified mailbox. |
* Requests the status of the specified mailbox. |
955 |
*/ |
*/ |
956 |
public MailboxStatus status(String mailbox, String[]statusNames) |
public MailboxStatus status(String mailbox, String[] statusNames) |
957 |
throws IOException |
throws IOException |
958 |
{ |
{ |
959 |
String tag = newTag(); |
String tag = newTag(); |
1027 |
* @param content the message body (including headers) |
* @param content the message body (including headers) |
1028 |
* @return true if successful, false if error in flags/text |
* @return true if successful, false if error in flags/text |
1029 |
*/ |
*/ |
1030 |
public boolean append(String mailbox, String[]flags, byte[]content) |
public boolean append(String mailbox, String[] flags, byte[] content) |
1031 |
throws IOException |
throws IOException |
1032 |
{ |
{ |
1033 |
String tag = newTag(); |
String tag = newTag(); |
1138 |
* Searches the currently selected mailbox for messages matching the |
* Searches the currently selected mailbox for messages matching the |
1139 |
* specified criteria. |
* specified criteria. |
1140 |
*/ |
*/ |
1141 |
public int[] search(String charset, String[]criteria) throws IOException |
public int[] search(String charset, String[] criteria) throws IOException |
1142 |
{ |
{ |
1143 |
String tag = newTag(); |
String tag = newTag(); |
1144 |
StringBuffer buffer = new StringBuffer(SEARCH); |
StringBuffer buffer = new StringBuffer(SEARCH); |
1207 |
* Retrieves data associated with messages in the mailbox. |
* Retrieves data associated with messages in the mailbox. |
1208 |
* @param messages the message numbers |
* @param messages the message numbers |
1209 |
*/ |
*/ |
1210 |
public MessageStatus[] fetch(int[]messages, String[]fetchCommands) |
public MessageStatus[] fetch(int[] messages, String[] fetchCommands) |
1211 |
throws IOException |
throws IOException |
1212 |
{ |
{ |
1213 |
String tag = newTag(); |
String tag = newTag(); |
1251 |
processAlerts(response); |
processAlerts(response); |
1252 |
if (id == OK) |
if (id == OK) |
1253 |
{ |
{ |
1254 |
MessageStatus[]statuses = new MessageStatus[list.size()]; |
MessageStatus[] statuses = new MessageStatus[list.size()]; |
1255 |
list.toArray(statuses); |
list.toArray(statuses); |
1256 |
return statuses; |
return statuses; |
1257 |
} |
} |
1270 |
* @param flags message flags to set |
* @param flags message flags to set |
1271 |
* @return a list of message-number to current flags |
* @return a list of message-number to current flags |
1272 |
*/ |
*/ |
1273 |
public MessageStatus[] store(int[]messages, |
public MessageStatus[] store(int[] messages, |
1274 |
String flagCommand, |
String flagCommand, |
1275 |
String[]flags) throws IOException |
String[] flags) throws IOException |
1276 |
{ |
{ |
1277 |
String tag = newTag(); |
String tag = newTag(); |
1278 |
StringBuffer buffer = new StringBuffer(STORE); |
StringBuffer buffer = new StringBuffer(STORE); |
1326 |
processAlerts(response); |
processAlerts(response); |
1327 |
if (id == OK) |
if (id == OK) |
1328 |
{ |
{ |
1329 |
MessageStatus[]mf = new MessageStatus[list.size()]; |
MessageStatus[] mf = new MessageStatus[list.size()]; |
1330 |
list.toArray(mf); |
list.toArray(mf); |
1331 |
return mf; |
return mf; |
1332 |
} |
} |
1343 |
* @param messages the message numbers |
* @param messages the message numbers |
1344 |
* @param mailbox the destination mailbox |
* @param mailbox the destination mailbox |
1345 |
*/ |
*/ |
1346 |
public boolean copy(int[]messages, String mailbox) throws IOException |
public boolean copy(int[] messages, String mailbox) throws IOException |
1347 |
{ |
{ |
1348 |
if (messages == null || messages.length < 1) |
if (messages == null || messages.length < 1) |
1349 |
return true; |
return true; |