Store thread no in ReplyResponse

captchafix
Floens 11 years ago
parent 5ea729891e
commit 189a122dfc
  1. 30
      Clover/app/src/main/java/org/floens/chan/core/manager/ReplyManager.java

@ -387,17 +387,27 @@ public class ReplyManager {
if (e.isSuccessful) { if (e.isSuccessful) {
Matcher matcher = responsePattern.matcher(e.responseData); Matcher matcher = responsePattern.matcher(e.responseData);
if (matcher.find() && matcher.groupCount() == 2) { int threadNo = -1;
int no = -1;
if (matcher.find()) {
try { try {
threadNo = Integer.parseInt(matcher.group(1));
no = Integer.parseInt(matcher.group(2));
} catch (NumberFormatException err) {
err.printStackTrace();
}
}
if (threadNo >= 0 && no >= 0) {
SavedReply savedReply = new SavedReply(); SavedReply savedReply = new SavedReply();
savedReply.board = reply.board; savedReply.board = reply.board;
savedReply.no = Integer.parseInt(matcher.group(2)); savedReply.no = no;
savedReply.password = reply.password; savedReply.password = reply.password;
ChanApplication.getDatabaseManager().saveReply(savedReply); ChanApplication.getDatabaseManager().saveReply(savedReply);
} catch (NumberFormatException err) {
err.printStackTrace(); e.threadNo = threadNo;
} e.no = no;
} else { } else {
Logger.w(TAG, "No thread & no in the response"); Logger.w(TAG, "No thread & no in the response");
} }
@ -443,6 +453,16 @@ public class ReplyManager {
* client, when the error was not recognized by Clover. * client, when the error was not recognized by Clover.
*/ */
public String responseData = ""; public String responseData = "";
/**
* The no the post has
*/
public int no = -1;
/**
* The thread no the post has
*/
public int threadNo = -1;
} }
/** /**

Loading…
Cancel
Save