diff --git a/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBActions.java b/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBActions.java
index fb446a6..973b114 100644
--- a/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBActions.java
+++ b/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBActions.java
@@ -1,96 +1,95 @@
- /*
- * Clover - 4chan browser https://github.com/Floens/Clover/
- * Copyright (C) 2014 Floens
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- */
- package org.floens.chan.core.site.common.tinyib;
+/*
+ * Clover - 4chan browser https://github.com/Floens/Clover/
+ * Copyright (C) 2014 Floens
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package org.floens.chan.core.site.common.tinyib;
- import static android.text.TextUtils.isEmpty;
+import org.floens.chan.core.site.SiteAuthentication;
+import org.floens.chan.core.site.common.CommonSite;
+import org.floens.chan.core.site.common.MultipartHttpCall;
+import org.floens.chan.core.site.http.Reply;
+import org.floens.chan.core.site.http.ReplyResponse;
+import org.jsoup.Jsoup;
- import org.floens.chan.core.site.SiteAuthentication;
- import org.floens.chan.core.site.common.CommonSite;
- import org.floens.chan.core.site.common.MultipartHttpCall;
- import org.floens.chan.core.site.http.Reply;
- import org.floens.chan.core.site.http.ReplyResponse;
- import org.jsoup.Jsoup;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
- import java.util.regex.Matcher;
- import java.util.regex.Pattern;
+import okhttp3.Response;
- import okhttp3.Response;
+import static android.text.TextUtils.isEmpty;
- public class TinyIBActions extends CommonSite.CommonActions {
- public TinyIBActions(CommonSite commonSite) {
- super(commonSite);
- }
+public class TinyIBActions extends CommonSite.CommonActions {
+ public TinyIBActions(CommonSite commonSite) {
+ super(commonSite);
+ }
- @Override
- public void setupPost(Reply reply, MultipartHttpCall call) {
- call.parameter("email", reply.options);
+ @Override
+ public void setupPost(Reply reply, MultipartHttpCall call) {
+ call.parameter("email", reply.options);
- if (reply.file != null) {
- call.fileParameter("file", reply.fileName, reply.file);
- }
+ if (reply.file != null) {
+ call.fileParameter("file", reply.fileName, reply.file);
+ }
- call.parameter("message", reply.comment);
- call.parameter("name", reply.name);
+ call.parameter("message", reply.comment);
+ call.parameter("name", reply.name);
- if (reply.loadable.isThreadMode()) {
- call.parameter("parent", String.valueOf(reply.loadable.no));
- }
+ if (reply.loadable.isThreadMode()) {
+ call.parameter("parent", String.valueOf(reply.loadable.no));
+ }
- if (!isEmpty(reply.password)) {
- call.parameter("password", reply.password);
- }
+ if (!isEmpty(reply.password)) {
+ call.parameter("password", reply.password);
+ }
- if (!isEmpty(reply.subject)) {
- call.parameter("subject", reply.subject);
- }
- }
+ if (!isEmpty(reply.subject)) {
+ call.parameter("subject", reply.subject);
+ }
+ }
- @Override
- public void handlePost(ReplyResponse replyResponse, Response response, String result) {
- // extract the data we need from matching the result
- int threadNo = 0;
- int postNo = 0;
- Matcher res = resultPattern().matcher(result);
- if (res.find()) {
- threadNo = Integer.parseInt(res.group(1));
- postNo = Integer.parseInt(res.group(2));
- }
- Matcher err = errorPattern().matcher(result);
- if (err.find()) {
- replyResponse.errorMessage = Jsoup.parse(err.group(1)).body().text();
- } else {
- replyResponse.threadNo = threadNo;
- replyResponse.postNo = postNo;
- replyResponse.posted = true;
- }
- }
+ @Override
+ public void handlePost(ReplyResponse replyResponse, Response response, String result) {
+ // extract the data we need from matching the result
+ int threadNo = 0;
+ int postNo = 0;
+ Matcher res = resultPattern().matcher(result);
+ if (res.find()) {
+ threadNo = Integer.parseInt(res.group(1));
+ postNo = Integer.parseInt(res.group(2));
+ }
+ Matcher err = errorPattern().matcher(result);
+ if (err.find()) {
+ replyResponse.errorMessage = Jsoup.parse(err.group(1)).body().text();
+ } else {
+ replyResponse.threadNo = threadNo;
+ replyResponse.postNo = postNo;
+ replyResponse.posted = true;
+ }
+ }
- public Pattern resultPattern() {
- return Pattern.compile(".+url=res/(\\d+).html#(\\d+)\">");
- }
+ public Pattern resultPattern() {
+ return Pattern.compile(".+url=res/(\\d+).html#(\\d+)\">");
+ }
+ //TODO: match the error pattern
+ public Pattern errorPattern() {
+ return Pattern.compile("
]*>Error
.*]*>(.*?)
");
+ }
- //TODO: match the error pattern
- public Pattern errorPattern() {
- return Pattern.compile("]*>Error
.*]*>(.*?)
");
- }
-
- @Override
- public SiteAuthentication postAuthenticate() {
- return SiteAuthentication.fromNone();
- }
- }
+ @Override
+ public SiteAuthentication postAuthenticate() {
+ return SiteAuthentication.fromNone();
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBApi.java b/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBApi.java
index a04a223..3027e52 100644
--- a/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBApi.java
+++ b/app/src/main/java/org/floens/chan/core/site/common/tinyib/TinyIBApi.java
@@ -61,8 +61,7 @@ public void loadCatalog(JsonReader reader, ChanReaderProcessingQueue queue) thro
reader.skipValue();
}
}
-
- reader.endObject();
+ reader.endObject();
}
@Override
@@ -86,7 +85,8 @@ public void readPostObject(JsonReader reader, ChanReaderProcessingQueue queue) t
String thumbnailpath = null;
String originalName = null;
- /* prevent API parse error
+ /* prevent API parse error
+
resto is not available on opening board overview the first time
so, we manually set the opId to 0, builder.op to true and builder.opId to 0 */
int opId = 0;
@@ -183,9 +183,16 @@ public void readPostObject(JsonReader reader, ChanReaderProcessingQueue queue) t
// The file from between the other values.
if (file != null && file.length() > 0) {
- fileName = file.substring(0, file.lastIndexOf("."));
- fileExt = file.substring(file.lastIndexOf(".") + 1);
- Map args = makeArgument("path", file,
+ if (file.contains("