diff --git a/app/build.gradle b/app/build.gradle index c7dc1920..a5af6136 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -20,8 +20,8 @@ android { proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } debug { - //def date = new Date().format('ddMMyy_HHmm'); - def date = 1; + def date = new Date().format('ddMMyy_HHmm'); + //def date = 1; archivesBaseName = archivesBaseName + "-$date" } } diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java index 5d854eef..ec0c2b25 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/BookmarkActivity.java @@ -114,7 +114,7 @@ public class BookmarkActivity extends BaseActivity { Intent intent = new Intent(BookmarkActivity.this, TopicActivity.class); Bundle extras = new Bundle(); extras.putString(BUNDLE_TOPIC_URL, "https://www.thmmy.gr/smf/index.php?topic=" - + bookmarkedTopic.getId() + ".0"); + + bookmarkedTopic.getId() + "." + 2147483647); extras.putString(BUNDLE_TOPIC_TITLE, bookmarkedTopic.getTitle()); intent.putExtras(extras); startActivity(intent); diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java new file mode 100644 index 00000000..7c42b8cd --- /dev/null +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/Posting.java @@ -0,0 +1,263 @@ +package gr.thmmy.mthmmy.activities.topic; + +import android.util.Log; + +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; + +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; +import java.util.regex.Matcher; + +import okhttp3.Response; + +class Posting { + enum REPLY_STATUS { + SUCCESSFUL, NO_SUBJECT, EMPTY_BODY, NEW_REPLY_WHILE_POSTING, NOT_FOUND, SESSION_ENDED, OTHER_ERROR + } + + static REPLY_STATUS replyStatus(Response response) throws IOException { + if (response.code() == 404) return REPLY_STATUS.NOT_FOUND; + if (response.code() < 200 || response.code() >= 400) return REPLY_STATUS.OTHER_ERROR; + String finalUrl = response.request().url().toString(); + if (finalUrl.contains("action=post")) { + Document postErrorPage = Jsoup.parse(response.body().string()); + String[] errors = postErrorPage.select("tr[id=errors] div[id=error_list]").first() + .toString().split("
"); + for (int i = 0; i < errors.length; ++i) { //TODO test + Log.d("TAG", String.valueOf(i)); + Log.d("TAG", errors[i]); + } + for (String error : errors) { + if (error.contains("Your session timed out while posting") || + error.contains("Υπερβήκατε τον μέγιστο χρόνο σύνδεσης κατά την αποστολή")) + return REPLY_STATUS.SESSION_ENDED; + if (error.contains("No subject was filled in") + || error.contains("Δεν δόθηκε τίτλος")) + return REPLY_STATUS.NO_SUBJECT; + if (error.contains("The message body was left empty") + || error.contains("Δεν δόθηκε κείμενο για το μήνυμα")) + return REPLY_STATUS.EMPTY_BODY; + } + return REPLY_STATUS.NEW_REPLY_WHILE_POSTING; + } + return REPLY_STATUS.SUCCESSFUL; + } + + static String htmlToBBcode(String html) { + Map bbMap = new HashMap<>(); + Map smileysMap1 = new HashMap<>(); + Map smileysMap2 = new HashMap<>(); + smileysMap1.put("Smiley", ":)"); + smileysMap1.put("Wink", ";)"); + smileysMap1.put("Cheesy", ":D"); + smileysMap1.put("Grin", ";D"); + smileysMap1.put("Angry", ">:("); + smileysMap1.put("Sad", ":("); + smileysMap1.put("Shocked", ":o"); + smileysMap1.put("Cool", "8))"); + smileysMap1.put("Huh", ":???:"); + smileysMap1.put("Roll Eyes", "::)"); + smileysMap1.put("Tongue", ":P"); + smileysMap1.put("Embarrassed", ":-["); + smileysMap1.put("Lips Sealed", ":-X"); + smileysMap1.put("Kiss", ":-*"); + smileysMap1.put("Cry", ":'("); + smileysMap1.put("heart", "<3"); + smileysMap1.put("kleidaria", "^locked^"); + smileysMap1.put("roll_over", "^rollover^"); + smileysMap1.put("redface", "^redface^"); + smileysMap1.put("confused", "^confused^"); + smileysMap1.put("innocent", "^innocent^"); + smileysMap1.put("sleep", "^sleep^"); + smileysMap1.put("lips_sealed", "^sealed^"); + smileysMap1.put("cool", "^cool^"); + smileysMap1.put("crazy", "^crazy^"); + smileysMap1.put("mad", "^mad^"); + smileysMap1.put("wav", "^wav^"); + smileysMap1.put("BinkyBaby", "^binkybaby^"); + smileysMap1.put("DontKnow", "^dontknow^"); + smileysMap1.put("angry4", ":angry4:"); + smileysMap1.put("angryAndHot", "^angryhot^"); + smileysMap1.put("angry", "^angry^"); + smileysMap1.put("bang_head", "^banghead^"); + smileysMap1.put("CryBaby", "^crybaby^"); + smileysMap1.put("Hello", "^hello^"); + smileysMap1.put("jerk", "^jerk^"); + smileysMap1.put("NoNo", "^nono^"); + smileysMap1.put("NotWorthy", "^notworthy^"); + smileysMap1.put("Off-topic", "^off-topic^"); + smileysMap1.put("Puke", "^puke^"); + smileysMap1.put("Shout", "^shout^"); + smileysMap1.put("Slurp", "^slurp^"); + smileysMap1.put("SuperConfused", "^superconfused^"); + smileysMap1.put("SuperInnocent", "^superinnocent^"); + smileysMap1.put("CellPhone", "^cellPhone^"); + smileysMap1.put("Idiot", "^idiot^"); + smileysMap1.put("Knuppel", "^knuppel^"); + smileysMap1.put("TickedOff", "^tickedOff^"); + smileysMap1.put("Peace", "^peace^"); + smileysMap1.put("Suspicious", "^suspicious^"); + smileysMap1.put("Caffine", "^caffine^"); + smileysMap1.put("argue", "^argue^"); + smileysMap1.put("banned2", "^banned2^"); + smileysMap1.put("banned", "^banned^"); + smileysMap1.put("bath", "^bath^"); + smileysMap1.put("beg", "^beg^"); + smileysMap1.put("bluescreen", "^bluescreen^"); + smileysMap1.put("boil", "^boil^"); + smileysMap1.put("bye", "^bye^"); + smileysMap1.put("callmerip", "^callmerip^"); + smileysMap1.put("carnaval", "^carnaval^"); + smileysMap1.put("clap", "^clap^"); + smileysMap1.put("coffepot", "^coffepot^"); + smileysMap1.put("crap", "^crap^"); + smileysMap1.put("curses", "^curses^"); + smileysMap1.put("funny", "^funny^"); + smileysMap1.put("guitar", "^guitar^"); + smileysMap1.put("kissy", "^kissy^"); + smileysMap1.put("band", "^band^"); + smileysMap1.put("ivres", "^ivres^"); + smileysMap1.put("kaloe", "^kaloe^"); + smileysMap1.put("kremala", "^kremala^"); + smileysMap1.put("moon", "^moon^"); + smileysMap1.put("mopping", "^mopping^"); + smileysMap1.put("mountza", "^mountza^"); + smileysMap1.put("pcsleep", "^pcsleep^"); + smileysMap1.put("pinokio", "^pinokio^"); + smileysMap1.put("poke", "^poke^"); + smileysMap1.put("seestars", "^seestars^"); + smileysMap1.put("sfyri", "^sfyri^"); + smileysMap1.put("spam", "^spam^"); + smileysMap1.put("super", "^super^"); + smileysMap1.put("tafos", "^tafos^"); + smileysMap1.put("tomato", "^tomato^"); + smileysMap1.put("ytold", "^ytold^"); + smileysMap1.put("beer", "^beer^"); + smileysMap1.put("ο fritz!!!", "^fritz^"); + smileysMap1.put("o Wade!!!", "^wade^"); + smileysMap1.put("bonjour", "^hat^"); + smileysMap1.put("bonjour2", "^miss^"); + smileysMap1.put("question", "^que^"); + smileysMap1.put("shifty", "^shifty^"); + smileysMap1.put("shy", "^shy^"); + smileysMap1.put("music_listenning", "^music_listen^"); + smileysMap1.put("bag_face", "^bagface^"); + smileysMap1.put("rotation", "^rotate^"); + smileysMap1.put("love", "^love^"); + smileysMap1.put("speech", "^speech^"); + smileysMap1.put("shocked", "^shocked^"); + smileysMap1.put("extremely_shocked", "^ex_shocked^"); + smileysMap1.put("smurf", "^smurf^"); + smileysMap1.put("monster", "^monster^"); + smileysMap1.put("pig", "^pig^"); + smileysMap1.put("lol", "^lol^"); + + smileysMap2.put("Police", "^Police^"); + smileysMap2.put("foyska", "^fouska^"); + smileysMap2.put("nista", "^nysta^"); + smileysMap2.put("10_7_3", "^sfinaki^"); + smileysMap2.put("yu", "^yue^"); + smileysMap2.put("a-eatpaper", "^eatpaper^"); + smileysMap2.put("lypi", "^lypi^"); + smileysMap2.put("megashok1wq", "^aytoxeir^"); + smileysMap2.put("victory", "^victory^"); + smileysMap2.put("filarakia", "^filarakia^"); + smileysMap2.put("rofl", "^rolfmao^"); + smileysMap2.put("locked", "^lock^"); + smileysMap2.put("facepalm", "^facepalm^"); + + //html stuff on the beginning + bbMap.put("\n ", ""); + //quotes and code headers + bbMap.put("\n\\s+?
\n (.+?)\n
", ""); + bbMap.put("\n\\s+?
\n (.+?)\n
", ""); + bbMap.put("\n\\s+?
\n (.+?)\n
", ""); + bbMap.put("
", "\n"); + //bold + bbMap.put("\n\\s+?(.+?)", "\\[b\\]$1\\[/b\\]"); + //italics + bbMap.put("\n\\s+?(.+?)", "\\[i\\]$1\\[/i\\]"); + //underline + bbMap.put("\n\\s+?(.+?)", "\\[u\\]$1\\[/u\\]"); + //deleted + bbMap.put("\n\\s+?(.+?)", "\\[s\\]$1\\[/s\\]"); + //text color + bbMap.put("\n\\s+?(.+?)", "\\[color=$1\\]$2\\[/color\\]"); + //glow + bbMap.put("\n\\s+?(.+?)", "\\[glow=$1,2,300\\]$2\\[/glow\\]"); + //shadow + bbMap.put("\n\\s+?(.+?)", "\\[shadow=$1,$2\\]$3\\[/shadow\\]"); + //running text + bbMap.put("\\s+?\n (.+?)\n ", "\\[move\\]$1\\[/move\\]"); + //alignment + bbMap.put("\n\\s+?
\n (.+?)\n
", "\\[center\\]$1\\[/center\\]"); + bbMap.put("\n\\s+?
\n (.+?)\n
", "\\[$1\\]$2\\[/$1\\]"); + //preformated + bbMap.put("\n\\s+?
(.+?)
", "\\[pre\\]$1\\[/pre\\]"); + //horizontal rule + bbMap.put("\n\\s+?
", "\\[hr\\]"); + //resize + bbMap.put("\n\\s+?(.+?)", "\\[size=$1\\]$3\\[/size\\]"); + //font + bbMap.put("\n\\s+?(.+?)", "\\[font=$1\\]$2\\[/font\\]"); + //lists + bbMap.put("\\s+
  • (.+?)
  • ", "\\[li\\]$1\\[/li\\]"); + bbMap.put("\n\\s+
      ([\\S\\s]+?)\n\\s+
    ", + "\\[list\\]\n$1\n\\[/list\\]"); + //latex code + bbMap.put("\n\\s+?", "\\[tex\\]$1\\[/tex\\]"); + //code + bbMap.put("\n\\s+?
    \n (.+?)\n
    ", "\\[code\\]$1\\[/code\\]"); + //teletype + bbMap.put("\n\\s+?(.+?)", "\\[tt\\]$1\\[/tt\\]"); + //superscript/subscript + bbMap.put("\n\\s+?(.+?)", "\\[sub\\]$1\\[/sub\\]"); + bbMap.put("\n\\s+?(.+?)", "\\[sup\\]$1\\[/sup\\]"); + //tables + bbMap.put("\\s+?([\\S\\s]+?)", "\\[td\\]$1\\[/td\\]"); + bbMap.put("([\\S\\s]+?)\n ", "\\[tr\\]$1\\[/tr\\]"); + bbMap.put("\n\\s+?\n \n ([\\S\\s]+?)\n \n
    " + , "\\[table\\]$2\\[/table\\]"); + //videos + bbMap.put("\n\\s+?
    \n", + "[youtube]https://www.youtube.com/watch?v=$1[/youtube]"); + //ftp + bbMap.put("([\\S\\s]+?)", "\\[fpt=ftp:$1\\]$2\\[/ftp\\]"); + //mailto + bbMap.put("\n\\s+?([\\S\\s]+?)", "\\[email\\]$2\\[/email\\]"); + //links + bbMap.put("\n\\s+?([\\S\\s]+?)", "\\[url=$1\\]$2\\[/url\\]"); + //smileys + for (Map.Entry entry : smileysMap1.entrySet()) { + bbMap.put("\n \""", entry.getValue().toString()); + } + for (Map.Entry entry : smileysMap2.entrySet()) { //Those that have empty alt tag + bbMap.put("\n ", entry.getValue().toString()); + } + + bbMap.put("\n \"Undecided\"" + , Matcher.quoteReplacement(":-\\")); + + //html stuff on the end + bbMap.put("\n
    ", ""); + + for (Map.Entry entry : bbMap.entrySet()) { + html = html.replaceAll(entry.getKey().toString(), entry.getValue().toString()); + } + + //img need to be done last or it messes up everything else + html = html.replaceAll("\\s+", + "\\[img width=$2 height=$3\\]$1\\[/img\\]"); + html = html.replaceAll("\\s+", + "\\[img height=$2 width=$3\\]$1\\[/img\\]"); + html = html.replaceAll("\\s+", "\\[img width=$2\\]$1\\[/img\\]"); + html = html.replaceAll("\\s+", "\\[img height=$2\\]$1\\[/img\\]"); + html = html.replaceAll("\\s+", "\\[img\\]$1\\[/img\\]"); + + return html; + } +} diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/ReplyParser.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/ReplyParser.java deleted file mode 100644 index ca47585a..00000000 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/ReplyParser.java +++ /dev/null @@ -1,44 +0,0 @@ -package gr.thmmy.mthmmy.activities.topic; - -import android.util.Log; - -import org.jsoup.Jsoup; -import org.jsoup.nodes.Document; - -import java.io.IOException; - -import okhttp3.Response; - -class ReplyParser { - enum REPLY_STATUS { - SUCCESSFUL, NO_SUBJECT, EMPTY_BODY, NEW_REPLY_WHILE_POSTING, NOT_FOUND, SESSION_ENDED, OTHER_ERROR - } - - static REPLY_STATUS replyStatus(Response response) throws IOException { - if (response.code() == 404) return REPLY_STATUS.NOT_FOUND; - if (response.code() < 200 || response.code() >= 400) return REPLY_STATUS.OTHER_ERROR; - String finalUrl = response.request().url().toString(); - if (finalUrl.contains("action=post")) { - Document postErrorPage = Jsoup.parse(response.body().string()); - String[] errors = postErrorPage.select("tr[id=errors] div[id=error_list]").first() - .toString().split("
    "); - for (int i = 0; i < errors.length; ++i) { //TODO test - Log.d("TAG", String.valueOf(i)); - Log.d("TAG", errors[i]); - } - for (String error : errors) { - if (error.contains("Your session timed out while posting") || - error.contains("Υπερβήκατε τον μέγιστο χρόνο σύνδεσης κατά την αποστολή")) - return REPLY_STATUS.SESSION_ENDED; - if (error.contains("No subject was filled in") - || error.contains("Δεν δόθηκε τίτλος")) - return REPLY_STATUS.NO_SUBJECT; - if (error.contains("The message body was left empty") - || error.contains("Δεν δόθηκε κείμενο για το μήνυμα")) - return REPLY_STATUS.EMPTY_BODY; - } - return REPLY_STATUS.NEW_REPLY_WHILE_POSTING; - } - return REPLY_STATUS.SUCCESSFUL; - } -} diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java index 942dd50c..9e35e942 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicActivity.java @@ -1,5 +1,6 @@ package gr.thmmy.mthmmy.activities.topic; +import android.content.Context; import android.content.Intent; import android.graphics.Rect; import android.net.Uri; @@ -17,12 +18,14 @@ import android.text.method.LinkMovementMethod; import android.text.method.ScrollingMovementMethod; import android.text.style.ClickableSpan; import android.text.style.URLSpan; +import android.util.Log; import android.util.SparseArray; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.MotionEvent; import android.view.View; +import android.view.inputmethod.InputMethodManager; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.ProgressBar; @@ -60,7 +63,7 @@ import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_THUMBNAIL_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_USERNAME; -import static gr.thmmy.mthmmy.activities.topic.ReplyParser.replyStatus; +import static gr.thmmy.mthmmy.activities.topic.Posting.replyStatus; /** * Activity for topics. When creating an Intent of this activity you need to bundle a String @@ -117,6 +120,7 @@ public class TopicActivity extends BaseActivity { private String parsedTitle; private RecyclerView recyclerView; private String loadedPageUrl = ""; + private boolean reloadingPage = false; @Override @@ -480,7 +484,7 @@ public class TopicActivity extends BaseActivity { } } //Checks if the page to be loaded is the one already shown - if (!Objects.equals(loadedPageUrl, "") && loadedPageUrl.contains(base_url)) { + if (!reloadingPage && !Objects.equals(loadedPageUrl, "") && loadedPageUrl.contains(base_url)) { if (newPageUrl.contains("topicseen#new") || newPageUrl.contains("#new")) if (thisPage == numberOfPages) return SAME_PAGE; @@ -497,6 +501,7 @@ public class TopicActivity extends BaseActivity { } else if (Integer.parseInt(newPageUrl.substring(base_url.length() + 1)) / 15 + 1 == thisPage) //TODO fix bug return SAME_PAGE; } else if (!Objects.equals(loadedPageUrl, "")) topicTitle = null; + if (reloadingPage) reloadingPage = !reloadingPage; loadedPageUrl = newPageUrl; replyPageUrl = null; @@ -735,13 +740,34 @@ public class TopicActivity extends BaseActivity { @Override protected void onPostExecute(Boolean result) { + View view = getCurrentFocus(); + if (view != null) { + InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); + imm.hideSoftInputFromWindow(view.getWindowToken(), 0); + } + + postsList.remove(postsList.size() - 1); + topicAdapter.notifyItemRemoved(postsList.size()); + progressBar.setVisibility(ProgressBar.GONE); replyFAB.setVisibility(View.VISIBLE); bottomNavBar.setVisibility(View.VISIBLE); + if (!result) Toast.makeText(TopicActivity.this, "Post failed!", Toast.LENGTH_SHORT).show(); paginationEnabled(true); replyFAB.setEnabled(true); + + if (result) { + topicTask = new TopicTask(); + if ((postsList.get(postsList.size() - 1).getPostNumber() + 1) % 15 == 0) + topicTask.execute(base_url + "." + 2147483647); + else { + reloadingPage = true; + topicTask.execute(loadedPageUrl); + } + Log.d("TAG", "sent"); + } } } } \ No newline at end of file diff --git a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java index 6f1d438c..db548985 100644 --- a/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java +++ b/app/src/main/java/gr/thmmy/mthmmy/activities/topic/TopicAdapter.java @@ -42,12 +42,9 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; -import java.util.HashMap; import java.util.List; import java.util.Locale; -import java.util.Map; import java.util.Objects; -import java.util.regex.Matcher; import gr.thmmy.mthmmy.R; import gr.thmmy.mthmmy.activities.board.BoardActivity; @@ -66,6 +63,7 @@ import static gr.thmmy.mthmmy.activities.board.BoardActivity.BUNDLE_BOARD_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_THUMBNAIL_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_URL; import static gr.thmmy.mthmmy.activities.profile.ProfileActivity.BUNDLE_PROFILE_USERNAME; +import static gr.thmmy.mthmmy.activities.topic.Posting.htmlToBBcode; import static gr.thmmy.mthmmy.base.BaseActivity.getSessionManager; /** @@ -144,6 +142,7 @@ class TopicAdapter extends RecyclerView.Adapter { } else if (viewType == VIEW_TYPE_QUICK_REPLY) { View view = LayoutInflater.from(parent.getContext()). inflate(R.layout.activity_topic_quick_reply_row, parent, false); + view.findViewById(R.id.quick_reply_submit).setEnabled(true); //Default post subject replyDataHolder[replySubject] = "Re: " + topicTitle; //Build quotes @@ -467,9 +466,14 @@ class TopicAdapter extends RecyclerView.Adapter { holder.submitButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { + if (holder.quickReplySubject.getText().toString().isEmpty()) return; if (holder.quickReply.getText().toString().isEmpty()) return; holder.submitButton.setEnabled(false); - replyTask.execute(holder.quickReply.getText().toString()); + replyTask.execute(holder.quickReplySubject.getText().toString(), + holder.quickReply.getText().toString()); + replyDataHolder[replySubject] = "Re: " + topicTitle; + replyDataHolder[replyText] = ""; + holder.quickReply.setText(""); } }); } @@ -782,222 +786,6 @@ class TopicAdapter extends RecyclerView.Adapter { return null; } - private String htmlToBBcode(String html) { - Map bbMap = new HashMap<>(); - Map smileysMap1 = new HashMap<>(); - Map smileysMap2 = new HashMap<>(); - smileysMap1.put("Smiley", ":)"); - smileysMap1.put("Wink", ";)"); - smileysMap1.put("Cheesy", ":D"); - smileysMap1.put("Grin", ";D"); - smileysMap1.put("Angry", ">:("); - smileysMap1.put("Sad", ":("); - smileysMap1.put("Shocked", ":o"); - smileysMap1.put("Cool", "8))"); - smileysMap1.put("Huh", ":???:"); - smileysMap1.put("Roll Eyes", "::)"); - smileysMap1.put("Tongue", ":P"); - smileysMap1.put("Embarrassed", ":-["); - smileysMap1.put("Lips Sealed", ":-X"); - smileysMap1.put("Kiss", ":-*"); - smileysMap1.put("Cry", ":'("); - smileysMap1.put("heart", "<3"); - smileysMap1.put("kleidaria", "^locked^"); - smileysMap1.put("roll_over", "^rollover^"); - smileysMap1.put("redface", "^redface^"); - smileysMap1.put("confused", "^confused^"); - smileysMap1.put("innocent", "^innocent^"); - smileysMap1.put("sleep", "^sleep^"); - smileysMap1.put("lips_sealed", "^sealed^"); - smileysMap1.put("cool", "^cool^"); - smileysMap1.put("crazy", "^crazy^"); - smileysMap1.put("mad", "^mad^"); - smileysMap1.put("wav", "^wav^"); - smileysMap1.put("BinkyBaby", "^binkybaby^"); - smileysMap1.put("DontKnow", "^dontknow^"); - smileysMap1.put("angry4", ":angry4:"); - smileysMap1.put("angryAndHot", "^angryhot^"); - smileysMap1.put("angry", "^angry^"); - smileysMap1.put("bang_head", "^banghead^"); - smileysMap1.put("CryBaby", "^crybaby^"); - smileysMap1.put("Hello", "^hello^"); - smileysMap1.put("jerk", "^jerk^"); - smileysMap1.put("NoNo", "^nono^"); - smileysMap1.put("NotWorthy", "^notworthy^"); - smileysMap1.put("Off-topic", "^off-topic^"); - smileysMap1.put("Puke", "^puke^"); - smileysMap1.put("Shout", "^shout^"); - smileysMap1.put("Slurp", "^slurp^"); - smileysMap1.put("SuperConfused", "^superconfused^"); - smileysMap1.put("SuperInnocent", "^superinnocent^"); - smileysMap1.put("CellPhone", "^cellPhone^"); - smileysMap1.put("Idiot", "^idiot^"); - smileysMap1.put("Knuppel", "^knuppel^"); - smileysMap1.put("TickedOff", "^tickedOff^"); - smileysMap1.put("Peace", "^peace^"); - smileysMap1.put("Suspicious", "^suspicious^"); - smileysMap1.put("Caffine", "^caffine^"); - smileysMap1.put("argue", "^argue^"); - smileysMap1.put("banned2", "^banned2^"); - smileysMap1.put("banned", "^banned^"); - smileysMap1.put("bath", "^bath^"); - smileysMap1.put("beg", "^beg^"); - smileysMap1.put("bluescreen", "^bluescreen^"); - smileysMap1.put("boil", "^boil^"); - smileysMap1.put("bye", "^bye^"); - smileysMap1.put("callmerip", "^callmerip^"); - smileysMap1.put("carnaval", "^carnaval^"); - smileysMap1.put("clap", "^clap^"); - smileysMap1.put("coffepot", "^coffepot^"); - smileysMap1.put("crap", "^crap^"); - smileysMap1.put("curses", "^curses^"); - smileysMap1.put("funny", "^funny^"); - smileysMap1.put("guitar", "^guitar^"); - smileysMap1.put("kissy", "^kissy^"); - smileysMap1.put("band", "^band^"); - smileysMap1.put("ivres", "^ivres^"); - smileysMap1.put("kaloe", "^kaloe^"); - smileysMap1.put("kremala", "^kremala^"); - smileysMap1.put("moon", "^moon^"); - smileysMap1.put("mopping", "^mopping^"); - smileysMap1.put("mountza", "^mountza^"); - smileysMap1.put("pcsleep", "^pcsleep^"); - smileysMap1.put("pinokio", "^pinokio^"); - smileysMap1.put("poke", "^poke^"); - smileysMap1.put("seestars", "^seestars^"); - smileysMap1.put("sfyri", "^sfyri^"); - smileysMap1.put("spam", "^spam^"); - smileysMap1.put("super", "^super^"); - smileysMap1.put("tafos", "^tafos^"); - smileysMap1.put("tomato", "^tomato^"); - smileysMap1.put("ytold", "^ytold^"); - smileysMap1.put("beer", "^beer^"); - smileysMap1.put("ο fritz!!!", "^fritz^"); - smileysMap1.put("o Wade!!!", "^wade^"); - smileysMap1.put("bonjour", "^hat^"); - smileysMap1.put("bonjour2", "^miss^"); - smileysMap1.put("question", "^que^"); - smileysMap1.put("shifty", "^shifty^"); - smileysMap1.put("shy", "^shy^"); - smileysMap1.put("music_listenning", "^music_listen^"); - smileysMap1.put("bag_face", "^bagface^"); - smileysMap1.put("rotation", "^rotate^"); - smileysMap1.put("love", "^love^"); - smileysMap1.put("speech", "^speech^"); - smileysMap1.put("shocked", "^shocked^"); - smileysMap1.put("extremely_shocked", "^ex_shocked^"); - smileysMap1.put("smurf", "^smurf^"); - smileysMap1.put("monster", "^monster^"); - smileysMap1.put("pig", "^pig^"); - smileysMap1.put("lol", "^lol^"); - - smileysMap2.put("Police", "^Police^"); - smileysMap2.put("foyska", "^fouska^"); - smileysMap2.put("nista", "^nysta^"); - smileysMap2.put("10_7_3", "^sfinaki^"); - smileysMap2.put("yu", "^yue^"); - smileysMap2.put("a-eatpaper", "^eatpaper^"); - smileysMap2.put("lypi", "^lypi^"); - smileysMap2.put("megashok1wq", "^aytoxeir^"); - smileysMap2.put("victory", "^victory^"); - smileysMap2.put("filarakia", "^filarakia^"); - smileysMap2.put("rofl", "^rolfmao^"); - smileysMap2.put("locked", "^lock^"); - smileysMap2.put("facepalm", "^facepalm^"); - - //html stuff on the beginning - bbMap.put("\n ", ""); - //quotes and code headers - bbMap.put("\n\\s+?
    \n (.+?)\n
    ", ""); - bbMap.put("\n\\s+?
    \n (.+?)\n
    ", ""); - bbMap.put("\n\\s+?
    \n (.+?)\n
    ", ""); - bbMap.put("
    ", "\n"); - //bold - bbMap.put("\n\\s+?(.+?)", "\\[b\\]$1\\[/b\\]"); - //italics - bbMap.put("\n\\s+?(.+?)", "\\[i\\]$1\\[/i\\]"); - //underline - bbMap.put("\n\\s+?(.+?)", "\\[u\\]$1\\[/u\\]"); - //deleted - bbMap.put("\n\\s+?(.+?)", "\\[s\\]$1\\[/s\\]"); - //text color - bbMap.put("\n\\s+?(.+?)", "\\[color=$1\\]$2\\[/color\\]"); - //glow - bbMap.put("\n\\s+?(.+?)", "\\[glow=$1,2,300\\]$2\\[/glow\\]"); - //shadow - bbMap.put("\n\\s+?(.+?)", "\\[shadow=$1,$2\\]$3\\[/shadow\\]"); - //running text - bbMap.put("\\s+?\n (.+?)\n ", "\\[move\\]$1\\[/move\\]"); - //alignment - bbMap.put("\n\\s+?
    \n (.+?)\n
    ", "\\[center\\]$1\\[/center\\]"); - bbMap.put("\n\\s+?
    \n (.+?)\n
    ", "\\[$1\\]$2\\[/$1\\]"); - //preformated - bbMap.put("\n\\s+?
    (.+?)
    ", "\\[pre\\]$1\\[/pre\\]"); - //horizontal rule - bbMap.put("\n\\s+?
    ", "\\[hr\\]"); - //resize - bbMap.put("\n\\s+?(.+?)", "\\[size=$1\\]$3\\[/size\\]"); - //font - bbMap.put("\n\\s+?(.+?)", "\\[font=$1\\]$2\\[/font\\]"); - //lists - bbMap.put("\\s+
  • (.+?)
  • ", "\\[li\\]$1\\[/li\\]"); - bbMap.put("\n\\s+
      ([\\S\\s]+?)\n\\s+
    ", - "\\[list\\]\n$1\n\\[/list\\]"); - //latex code - bbMap.put("\n\\s+?", "\\[tex\\]$1\\[/tex\\]"); - //code - bbMap.put("\n\\s+?
    \n (.+?)\n
    ", "\\[code\\]$1\\[/code\\]"); - //teletype - bbMap.put("\n\\s+?(.+?)", "\\[tt\\]$1\\[/tt\\]"); - //superscript/subscript - bbMap.put("\n\\s+?(.+?)", "\\[sub\\]$1\\[/sub\\]"); - bbMap.put("\n\\s+?(.+?)", "\\[sup\\]$1\\[/sup\\]"); - //tables - bbMap.put("\\s+?([\\S\\s]+?)", "\\[td\\]$1\\[/td\\]"); - bbMap.put("([\\S\\s]+?)\n ", "\\[tr\\]$1\\[/tr\\]"); - bbMap.put("\n\\s+?\n \n ([\\S\\s]+?)\n \n
    " - , "\\[table\\]$2\\[/table\\]"); - //videos - bbMap.put("\n\\s+?
    \n", - "[youtube]https://www.youtube.com/watch?v=$1[/youtube]"); - //ftp - bbMap.put("([\\S\\s]+?)", "\\[fpt=ftp:$1\\]$2\\[/ftp\\]"); - //mailto - bbMap.put("\n\\s+?([\\S\\s]+?)", "\\[email\\]$2\\[/email\\]"); - //links - bbMap.put("\n\\s+?([\\S\\s]+?)", "\\[url=$1\\]$2\\[/url\\]"); - //smileys - for (Map.Entry entry : smileysMap1.entrySet()) { - bbMap.put("\n \""", entry.getValue().toString()); - } - for (Map.Entry entry : smileysMap2.entrySet()) { //Those that have empty alt tag - bbMap.put("\n ", entry.getValue().toString()); - } - - bbMap.put("\n \"Undecided\"" - , Matcher.quoteReplacement(":-\\")); - - //html stuff on the end - bbMap.put("\n
    ", ""); - - for (Map.Entry entry : bbMap.entrySet()) { - html = html.replaceAll(entry.getKey().toString(), entry.getValue().toString()); - } - - //img need to be done last or it messes up everything else - html = html.replaceAll("\\s+", - "\\[img width=$2 height=$3\\]$1\\[/img\\]"); - html = html.replaceAll("\\s+", - "\\[img height=$2 width=$3\\]$1\\[/img\\]"); - html = html.replaceAll("\\s+", "\\[img width=$2\\]$1\\[/img\\]"); - html = html.replaceAll("\\s+", "\\[img height=$2\\]$1\\[/img\\]"); - html = html.replaceAll("\\s+", "\\[img\\]$1\\[/img\\]"); - - return html; - } - /** * Returns a String with a single FontAwesome typeface character corresponding to this file's * extension.