From 84cc8f889b07aa03d2a3bc99752e931f19b5ec63 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Fri, 23 Dec 2011 16:44:25 +0700
Subject: Initial commit
---
.gitignore | 1 +
build.xml | 74 +++
nbproject/build-impl.xml | 1031 +++++++++++++++++++++++++++++++++++++++++
nbproject/genfiles.properties | 8 +
nbproject/project.properties | 69 +++
nbproject/project.xml | 13 +
src/com/juick/Message.java | 162 +++++++
src/com/juick/Place.java | 37 ++
src/com/juick/Tag.java | 34 ++
src/com/juick/User.java | 35 ++
10 files changed, 1464 insertions(+)
create mode 100644 .gitignore
create mode 100644 build.xml
create mode 100644 nbproject/build-impl.xml
create mode 100644 nbproject/genfiles.properties
create mode 100644 nbproject/project.properties
create mode 100644 nbproject/project.xml
create mode 100644 src/com/juick/Message.java
create mode 100644 src/com/juick/Place.java
create mode 100644 src/com/juick/Tag.java
create mode 100644 src/com/juick/User.java
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..14bc68c7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/nbproject/private/
\ No newline at end of file
diff --git a/build.xml b/build.xml
new file mode 100644
index 00000000..d3b97f3c
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project com.juick.
+
+
+
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
new file mode 100644
index 00000000..879dd0a2
--- /dev/null
+++ b/nbproject/build-impl.xml
@@ -0,0 +1,1031 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+
+
+
+
+
+ java -cp "${run.classpath.with.dist.jar}" ${main.class}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
new file mode 100644
index 00000000..a153c6a0
--- /dev/null
+++ b/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=94de2884
+build.xml.script.CRC32=c31a9b77
+build.xml.stylesheet.CRC32=28e38971@1.44.1.45
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=94de2884
+nbproject/build-impl.xml.script.CRC32=f66e0b65
+nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 00000000..7ab562b8
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,69 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=com.juick
+application.vendor=ugnich
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/com.juick.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+excludes=
+includes=**
+jar.compress=false
+javac.classpath=
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=true
+platform.active=default_platform
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 00000000..757a6ebb
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,13 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ com.juick
+
+
+
+
+
+
+
diff --git a/src/com/juick/Message.java b/src/com/juick/Message.java
new file mode 100644
index 00000000..77b87e32
--- /dev/null
+++ b/src/com/juick/Message.java
@@ -0,0 +1,162 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+import java.util.Vector;
+import java.util.Date;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Message {
+
+ public int MID = 0;
+ public int RID = 0;
+ public int ReplyTo = 0;
+ public String Text = null;
+ public User User = null;
+ public Vector tags = new Vector();
+ public Date Timestamp = null;
+ public String TimestampString = null;
+ public int MinutesAgo = 0;
+ public int Privacy = 1;
+ public boolean ReadOnly = false;
+ public int replies = 0;
+ public String AttachmentType = null;
+ public String Photo = null;
+ public String Video = null;
+ public Place place = null;
+ public Vector childs = new Vector();
+
+ public Message() {
+ }
+
+ public Message(Message msg) {
+ MID = msg.MID;
+ RID = msg.RID;
+ ReplyTo = msg.ReplyTo;
+ Text = msg.Text;
+ User = msg.User;
+ tags = msg.tags;
+ Timestamp = msg.Timestamp;
+ TimestampString = msg.TimestampString;
+ MinutesAgo = msg.MinutesAgo;
+ Privacy = msg.Privacy;
+ ReadOnly = msg.ReadOnly;
+ replies = msg.replies;
+ AttachmentType = msg.AttachmentType;
+ Photo = msg.Photo;
+ Video = msg.Video;
+ place = msg.place;
+ childs = msg.childs;
+ }
+
+ public void parseTags(String strTags) {
+ String arrTags[] = strTags.split(" ");
+ for (int i = 0; i < arrTags.length; i++) {
+ tags.add(arrTags[i]);
+ }
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Message)) {
+ return false;
+ }
+ Message jmsg = (Message) obj;
+ return (this.MID == jmsg.MID && this.RID == jmsg.RID);
+ }
+
+ public int compareTo(Object obj) throws ClassCastException {
+ if (!(obj instanceof Message)) {
+ throw new ClassCastException();
+ }
+ Message jmsg = (Message) obj;
+
+ if (this.MID != jmsg.MID) {
+ if (this.MID > jmsg.MID) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+
+ if (this.RID != jmsg.RID) {
+ if (this.RID < jmsg.RID) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+
+ public int getChildsCount() {
+ int cnt = 1;
+ for (int i = 0; i < childs.size(); i++) {
+ cnt += childs.get(i).getChildsCount();
+ }
+ return cnt;
+ }
+
+ public void cleanupChilds() {
+ if (!childs.isEmpty()) {
+ for (int i = 0; i < childs.size(); i++) {
+ childs.get(i).cleanupChilds();
+ }
+ childs.removeAllElements();
+ }
+ }
+
+ public String getAttachmentURL() {
+ if (AttachmentType != null) {
+ String url = "http://i.juick.com/";
+ url += AttachmentType.equals("mp4") ? "video" : "photos-1024";
+ url += "/" + MID;
+ if (RID > 0) {
+ url += "-" + RID;
+ }
+ url += "." + AttachmentType;
+ return url;
+ } else {
+ return null;
+ }
+ }
+
+ public String getTagsString() {
+ String ret = "";
+ if (Privacy == -2) {
+ ret += " *private";
+ }
+ if (Privacy == -1) {
+ ret += " *friends";
+ }
+ if (Privacy == 2) {
+ ret += " *public";
+ }
+ if (ReadOnly) {
+ ret += " *readonly";
+ }
+ for (int i = 0; i < tags.size(); i++) {
+ ret += " *" + tags.elementAt(i);
+ }
+ return ret;
+ }
+}
diff --git a/src/com/juick/Place.java b/src/com/juick/Place.java
new file mode 100644
index 00000000..70fe66c1
--- /dev/null
+++ b/src/com/juick/Place.java
@@ -0,0 +1,37 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+import java.util.Vector;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Place {
+
+ public int pid = 0;
+ public double lat = 0;
+ public double lon = 0;
+ public String name = null;
+ public String description = null;
+ public int users = 0;
+ public int messages = 0;
+ public int distance = 0;
+ public Vector tags = new Vector();
+}
diff --git a/src/com/juick/Tag.java b/src/com/juick/Tag.java
new file mode 100644
index 00000000..3e506fc6
--- /dev/null
+++ b/src/com/juick/Tag.java
@@ -0,0 +1,34 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Tag implements Comparable {
+
+ public String Name = null;
+ public int TID = 0;
+ public int UsageCnt = 0;
+
+ @Override
+ public int compareTo(Tag o) {
+ return this.Name.compareTo(o.Name);
+ }
+}
diff --git a/src/com/juick/User.java b/src/com/juick/User.java
new file mode 100644
index 00000000..66192833
--- /dev/null
+++ b/src/com/juick/User.java
@@ -0,0 +1,35 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class User {
+
+ public int UID = 0;
+ public String UName = null;
+ public Object Avatar = null;
+ public String FullName = null;
+
+ @Override
+ public boolean equals(Object obj) {
+ return (obj instanceof User && ((User) obj).UID == this.UID);
+ }
+}
--
cgit v1.2.3
From 89f98b8601ec901abe1c1c4dbaab9dc8a5102392 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Sun, 4 Nov 2012 22:25:49 +0700
Subject: Vector -> ArrayList
---
.gitignore | 4 +++-
src/com/juick/Message.java | 38 +++++++++++++++++++-------------------
src/com/juick/Place.java | 4 ----
3 files changed, 22 insertions(+), 24 deletions(-)
diff --git a/.gitignore b/.gitignore
index 14bc68c7..2a2d339d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,3 @@
-/nbproject/private/
\ No newline at end of file
+/nbproject/private/
+/dist/
+/build/
\ No newline at end of file
diff --git a/src/com/juick/Message.java b/src/com/juick/Message.java
index 77b87e32..4b2c20ed 100644
--- a/src/com/juick/Message.java
+++ b/src/com/juick/Message.java
@@ -17,7 +17,8 @@
*/
package com.juick;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Date;
/**
@@ -31,18 +32,20 @@ public class Message {
public int ReplyTo = 0;
public String Text = null;
public User User = null;
- public Vector tags = new Vector();
+ public ArrayList Tags = new ArrayList();
public Date Timestamp = null;
public String TimestampString = null;
- public int MinutesAgo = 0;
+ public int TimeAgo = 0;
public int Privacy = 1;
public boolean ReadOnly = false;
- public int replies = 0;
+ public boolean VisitorCanComment = true;
+ public int Replies = 0;
+ public String RepliesBy = null;
public String AttachmentType = null;
public String Photo = null;
public String Video = null;
- public Place place = null;
- public Vector childs = new Vector();
+ public Place Place = null;
+ public ArrayList childs = new ArrayList();
public Message() {
}
@@ -53,25 +56,22 @@ public class Message {
ReplyTo = msg.ReplyTo;
Text = msg.Text;
User = msg.User;
- tags = msg.tags;
+ Tags = msg.Tags;
Timestamp = msg.Timestamp;
TimestampString = msg.TimestampString;
- MinutesAgo = msg.MinutesAgo;
+ TimeAgo = msg.TimeAgo;
Privacy = msg.Privacy;
ReadOnly = msg.ReadOnly;
- replies = msg.replies;
+ Replies = msg.Replies;
AttachmentType = msg.AttachmentType;
Photo = msg.Photo;
Video = msg.Video;
- place = msg.place;
+ Place = msg.Place;
childs = msg.childs;
}
public void parseTags(String strTags) {
- String arrTags[] = strTags.split(" ");
- for (int i = 0; i < arrTags.length; i++) {
- tags.add(arrTags[i]);
- }
+ Tags.addAll(Arrays.asList(strTags.split(" ")));
}
@Override
@@ -109,7 +109,7 @@ public class Message {
}
public int getChildsCount() {
- int cnt = 1;
+ int cnt = childs.size();
for (int i = 0; i < childs.size(); i++) {
cnt += childs.get(i).getChildsCount();
}
@@ -121,7 +121,7 @@ public class Message {
for (int i = 0; i < childs.size(); i++) {
childs.get(i).cleanupChilds();
}
- childs.removeAllElements();
+ childs.clear();
}
}
@@ -142,6 +142,9 @@ public class Message {
public String getTagsString() {
String ret = "";
+ for (int i = 0; i < Tags.size(); i++) {
+ ret += " *" + Tags.get(i);
+ }
if (Privacy == -2) {
ret += " *private";
}
@@ -154,9 +157,6 @@ public class Message {
if (ReadOnly) {
ret += " *readonly";
}
- for (int i = 0; i < tags.size(); i++) {
- ret += " *" + tags.elementAt(i);
- }
return ret;
}
}
diff --git a/src/com/juick/Place.java b/src/com/juick/Place.java
index 70fe66c1..7174ed6e 100644
--- a/src/com/juick/Place.java
+++ b/src/com/juick/Place.java
@@ -17,8 +17,6 @@
*/
package com.juick;
-import java.util.Vector;
-
/**
*
* @author Ugnich Anton
@@ -29,9 +27,7 @@ public class Place {
public double lat = 0;
public double lon = 0;
public String name = null;
- public String description = null;
public int users = 0;
public int messages = 0;
public int distance = 0;
- public Vector tags = new Vector();
}
--
cgit v1.2.3
From dc3b386a39123dddb9051c3a7088f0eb90e253a3 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Fri, 21 Jun 2013 01:03:27 +0700
Subject: Group
---
src/com/juick/Group.java | 29 +++++++++++++++++++++++++++++
1 file changed, 29 insertions(+)
create mode 100644 src/com/juick/Group.java
diff --git a/src/com/juick/Group.java b/src/com/juick/Group.java
new file mode 100644
index 00000000..008d3af2
--- /dev/null
+++ b/src/com/juick/Group.java
@@ -0,0 +1,29 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2013, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Group {
+
+ public String Name = null;
+ public int GID = 0;
+ public int UsersCnt = 0;
+}
--
cgit v1.2.3
From acc42d07d87a31e9ee8b45ad203805ed363c6d05 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Fri, 30 Aug 2013 13:13:25 +0700
Subject: User.JID; User.MessagesCount
---
src/com/juick/User.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/com/juick/User.java b/src/com/juick/User.java
index 66192833..a8b56bbc 100644
--- a/src/com/juick/User.java
+++ b/src/com/juick/User.java
@@ -27,6 +27,8 @@ public class User {
public String UName = null;
public Object Avatar = null;
public String FullName = null;
+ public String JID = null;
+ public int MessagesCount = 0;
@Override
public boolean equals(Object obj) {
--
cgit v1.2.3
From 52f275329479ce18dac7f153c9b28c3aa09bee93 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Thu, 19 Dec 2013 00:56:59 +0700
Subject: Message.FriendsOnly
---
src/com/juick/Message.java | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/com/juick/Message.java b/src/com/juick/Message.java
index 4b2c20ed..4c81e2b7 100644
--- a/src/com/juick/Message.java
+++ b/src/com/juick/Message.java
@@ -37,6 +37,7 @@ public class Message {
public String TimestampString = null;
public int TimeAgo = 0;
public int Privacy = 1;
+ public boolean FriendsOnly = false;
public boolean ReadOnly = false;
public boolean VisitorCanComment = true;
public int Replies = 0;
@@ -61,6 +62,7 @@ public class Message {
TimestampString = msg.TimestampString;
TimeAgo = msg.TimeAgo;
Privacy = msg.Privacy;
+ FriendsOnly = msg.FriendsOnly;
ReadOnly = msg.ReadOnly;
Replies = msg.Replies;
AttachmentType = msg.AttachmentType;
@@ -145,6 +147,9 @@ public class Message {
for (int i = 0; i < Tags.size(); i++) {
ret += " *" + Tags.get(i);
}
+ if (FriendsOnly) {
+ ret += " *friends";
+ }
if (Privacy == -2) {
ret += " *private";
}
--
cgit v1.2.3
From 03cc3783963078ad685b4492101516a67f6be37b Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Tue, 4 Feb 2014 08:52:58 +0700
Subject: User.AuthHash
---
src/com/juick/User.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/com/juick/User.java b/src/com/juick/User.java
index a8b56bbc..7ea9df4c 100644
--- a/src/com/juick/User.java
+++ b/src/com/juick/User.java
@@ -29,6 +29,7 @@ public class User {
public String FullName = null;
public String JID = null;
public int MessagesCount = 0;
+ public String AuthHash = null;
@Override
public boolean equals(Object obj) {
--
cgit v1.2.3
From e516f02b58215d095e3a364b9b86656b484ee1ac Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Sat, 12 Apr 2014 16:16:52 +0700
Subject: User constructors
---
src/com/juick/Message.java | 4 ++++
src/com/juick/User.java | 13 +++++++++++++
2 files changed, 17 insertions(+)
diff --git a/src/com/juick/Message.java b/src/com/juick/Message.java
index 4c81e2b7..eb8f5b9a 100644
--- a/src/com/juick/Message.java
+++ b/src/com/juick/Message.java
@@ -46,6 +46,8 @@ public class Message {
public String Photo = null;
public String Video = null;
public Place Place = null;
+ public int Likes = 0;
+ public boolean UserLike = false;
public ArrayList childs = new ArrayList();
public Message() {
@@ -69,6 +71,8 @@ public class Message {
Photo = msg.Photo;
Video = msg.Video;
Place = msg.Place;
+ Likes = msg.Likes;
+ UserLike = msg.UserLike;
childs = msg.childs;
}
diff --git a/src/com/juick/User.java b/src/com/juick/User.java
index 7ea9df4c..6dc5e90f 100644
--- a/src/com/juick/User.java
+++ b/src/com/juick/User.java
@@ -31,6 +31,19 @@ public class User {
public int MessagesCount = 0;
public String AuthHash = null;
+ public User() {
+ }
+
+ public User(User u) {
+ UID = u.UID;
+ UName = u.UName;
+ Avatar = u.Avatar;
+ FullName = u.FullName;
+ JID = u.JID;
+ MessagesCount = u.MessagesCount;
+ AuthHash = u.AuthHash;
+ }
+
@Override
public boolean equals(Object obj) {
return (obj instanceof User && ((User) obj).UID == this.UID);
--
cgit v1.2.3
From 8513d0eabfeead0aa00a250cd29bec479e61c151 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Wed, 9 Jul 2014 14:01:06 +0700
Subject: Tag.SynonymID
---
src/com/juick/Tag.java | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/com/juick/Tag.java b/src/com/juick/Tag.java
index 3e506fc6..3cee3358 100644
--- a/src/com/juick/Tag.java
+++ b/src/com/juick/Tag.java
@@ -25,6 +25,7 @@ public class Tag implements Comparable {
public String Name = null;
public int TID = 0;
+ public int SynonymID = 0;
public int UsageCnt = 0;
@Override
--
cgit v1.2.3
From 4e1cad0bc390a8f50270b1d424605100f3ea858e Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Tue, 15 Jul 2014 16:56:04 +0700
Subject: User.Banned
---
src/com/juick/User.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/com/juick/User.java b/src/com/juick/User.java
index 6dc5e90f..e3fc0ae7 100644
--- a/src/com/juick/User.java
+++ b/src/com/juick/User.java
@@ -30,6 +30,7 @@ public class User {
public String JID = null;
public int MessagesCount = 0;
public String AuthHash = null;
+ public boolean Banned = false;
public User() {
}
@@ -42,6 +43,7 @@ public class User {
JID = u.JID;
MessagesCount = u.MessagesCount;
AuthHash = u.AuthHash;
+ Banned = u.Banned;
}
@Override
--
cgit v1.2.3
From 5ee91767885dcc7cd9690b612a37cb326f6ac973 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Sun, 3 Aug 2014 15:33:32 +0700
Subject: Message.Hidden
---
src/com/juick/Message.java | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/com/juick/Message.java b/src/com/juick/Message.java
index eb8f5b9a..3d2b8227 100644
--- a/src/com/juick/Message.java
+++ b/src/com/juick/Message.java
@@ -39,6 +39,7 @@ public class Message {
public int Privacy = 1;
public boolean FriendsOnly = false;
public boolean ReadOnly = false;
+ public boolean Hidden = false;
public boolean VisitorCanComment = true;
public int Replies = 0;
public String RepliesBy = null;
@@ -66,6 +67,7 @@ public class Message {
Privacy = msg.Privacy;
FriendsOnly = msg.FriendsOnly;
ReadOnly = msg.ReadOnly;
+ Hidden = msg.Hidden;
Replies = msg.Replies;
AttachmentType = msg.AttachmentType;
Photo = msg.Photo;
--
cgit v1.2.3
From a1a47038e4e37e16211dd7c56aa1051093752db4 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 24 Oct 2015 17:56:52 +0300
Subject: moving to Gradle
---
.gitignore | 5 +-
build.gradle | 1 +
build.xml | 74 ---
nbproject/build-impl.xml | 1031 ----------------------------------
nbproject/genfiles.properties | 8 -
nbproject/project.properties | 69 ---
nbproject/project.xml | 13 -
src/com/juick/Group.java | 29 -
src/com/juick/Message.java | 173 ------
src/com/juick/Place.java | 33 --
src/com/juick/Tag.java | 35 --
src/com/juick/User.java | 53 --
src/main/java/com/juick/Group.java | 29 +
src/main/java/com/juick/Message.java | 173 ++++++
src/main/java/com/juick/Place.java | 33 ++
src/main/java/com/juick/Tag.java | 35 ++
src/main/java/com/juick/User.java | 53 ++
17 files changed, 326 insertions(+), 1521 deletions(-)
create mode 100644 build.gradle
delete mode 100644 build.xml
delete mode 100644 nbproject/build-impl.xml
delete mode 100644 nbproject/genfiles.properties
delete mode 100644 nbproject/project.properties
delete mode 100644 nbproject/project.xml
delete mode 100644 src/com/juick/Group.java
delete mode 100644 src/com/juick/Message.java
delete mode 100644 src/com/juick/Place.java
delete mode 100644 src/com/juick/Tag.java
delete mode 100644 src/com/juick/User.java
create mode 100644 src/main/java/com/juick/Group.java
create mode 100644 src/main/java/com/juick/Message.java
create mode 100644 src/main/java/com/juick/Place.java
create mode 100644 src/main/java/com/juick/Tag.java
create mode 100644 src/main/java/com/juick/User.java
diff --git a/.gitignore b/.gitignore
index 2a2d339d..e51bc30b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,2 @@
-/nbproject/private/
-/dist/
-/build/
\ No newline at end of file
+build/*
+.gradle/*
diff --git a/build.gradle b/build.gradle
new file mode 100644
index 00000000..405a81af
--- /dev/null
+++ b/build.gradle
@@ -0,0 +1 @@
+apply plugin: "java"
diff --git a/build.xml b/build.xml
deleted file mode 100644
index d3b97f3c..00000000
--- a/build.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-
-
-
-
-
-
-
-
-
-
- Builds, tests, and runs the project com.juick.
-
-
-
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
deleted file mode 100644
index 879dd0a2..00000000
--- a/nbproject/build-impl.xml
+++ /dev/null
@@ -1,1031 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set src.dir
- Must set build.dir
- Must set dist.dir
- Must set build.classes.dir
- Must set dist.javadoc.dir
- Must set build.test.classes.dir
- Must set build.test.results.dir
- Must set build.classes.excludes
- Must set dist.jar
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must set JVM to use for profiling in profiler.info.jvm
- Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- To run this application from the command line without Ant, try:
-
-
-
-
-
-
- java -cp "${run.classpath.with.dist.jar}" ${main.class}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- To run this application from the command line without Ant, try:
-
- java -jar "${dist.jar.resolved}"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
- Must select one file in the IDE or set run.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must select one file in the IDE or set debug.class
-
-
-
-
- Must set fix.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set profile.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set javac.includes
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Some tests failed; see details above.
-
-
-
-
-
-
-
-
- Must select some files in the IDE or set test.includes
-
-
-
- Some tests failed; see details above.
-
-
-
-
- Must select one file in the IDE or set test.class
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
- Must select one file in the IDE or set applet.url
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
deleted file mode 100644
index a153c6a0..00000000
--- a/nbproject/genfiles.properties
+++ /dev/null
@@ -1,8 +0,0 @@
-build.xml.data.CRC32=94de2884
-build.xml.script.CRC32=c31a9b77
-build.xml.stylesheet.CRC32=28e38971@1.44.1.45
-# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
-# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=94de2884
-nbproject/build-impl.xml.script.CRC32=f66e0b65
-nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
diff --git a/nbproject/project.properties b/nbproject/project.properties
deleted file mode 100644
index 7ab562b8..00000000
--- a/nbproject/project.properties
+++ /dev/null
@@ -1,69 +0,0 @@
-annotation.processing.enabled=true
-annotation.processing.enabled.in.editor=false
-annotation.processing.run.all.processors=true
-annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
-application.title=com.juick
-application.vendor=ugnich
-build.classes.dir=${build.dir}/classes
-build.classes.excludes=**/*.java,**/*.form
-# This directory is removed when the project is cleaned:
-build.dir=build
-build.generated.dir=${build.dir}/generated
-build.generated.sources.dir=${build.dir}/generated-sources
-# Only compile against the classpath explicitly listed here:
-build.sysclasspath=ignore
-build.test.classes.dir=${build.dir}/test/classes
-build.test.results.dir=${build.dir}/test/results
-# Uncomment to specify the preferred debugger connection transport:
-#debug.transport=dt_socket
-debug.classpath=\
- ${run.classpath}
-debug.test.classpath=\
- ${run.test.classpath}
-# This directory is removed when the project is cleaned:
-dist.dir=dist
-dist.jar=${dist.dir}/com.juick.jar
-dist.javadoc.dir=${dist.dir}/javadoc
-endorsed.classpath=
-excludes=
-includes=**
-jar.compress=false
-javac.classpath=
-# Space-separated list of extra javac options
-javac.compilerargs=
-javac.deprecation=false
-javac.processorpath=\
- ${javac.classpath}
-javac.source=1.6
-javac.target=1.6
-javac.test.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-javac.test.processorpath=\
- ${javac.test.classpath}
-javadoc.additionalparam=
-javadoc.author=false
-javadoc.encoding=${source.encoding}
-javadoc.noindex=false
-javadoc.nonavbar=false
-javadoc.notree=false
-javadoc.private=false
-javadoc.splitindex=true
-javadoc.use=true
-javadoc.version=false
-javadoc.windowtitle=
-meta.inf.dir=${src.dir}/META-INF
-mkdist.disabled=true
-platform.active=default_platform
-run.classpath=\
- ${javac.classpath}:\
- ${build.classes.dir}
-# Space-separated list of JVM arguments used when running the project
-# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
-# or test-sys-prop.name=value to set system properties for unit tests):
-run.jvmargs=
-run.test.classpath=\
- ${javac.test.classpath}:\
- ${build.test.classes.dir}
-source.encoding=UTF-8
-src.dir=src
diff --git a/nbproject/project.xml b/nbproject/project.xml
deleted file mode 100644
index 757a6ebb..00000000
--- a/nbproject/project.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
- org.netbeans.modules.java.j2seproject
-
-
- com.juick
-
-
-
-
-
-
-
diff --git a/src/com/juick/Group.java b/src/com/juick/Group.java
deleted file mode 100644
index 008d3af2..00000000
--- a/src/com/juick/Group.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2013, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Group {
-
- public String Name = null;
- public int GID = 0;
- public int UsersCnt = 0;
-}
diff --git a/src/com/juick/Message.java b/src/com/juick/Message.java
deleted file mode 100644
index 3d2b8227..00000000
--- a/src/com/juick/Message.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2011, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Message {
-
- public int MID = 0;
- public int RID = 0;
- public int ReplyTo = 0;
- public String Text = null;
- public User User = null;
- public ArrayList Tags = new ArrayList();
- public Date Timestamp = null;
- public String TimestampString = null;
- public int TimeAgo = 0;
- public int Privacy = 1;
- public boolean FriendsOnly = false;
- public boolean ReadOnly = false;
- public boolean Hidden = false;
- public boolean VisitorCanComment = true;
- public int Replies = 0;
- public String RepliesBy = null;
- public String AttachmentType = null;
- public String Photo = null;
- public String Video = null;
- public Place Place = null;
- public int Likes = 0;
- public boolean UserLike = false;
- public ArrayList childs = new ArrayList();
-
- public Message() {
- }
-
- public Message(Message msg) {
- MID = msg.MID;
- RID = msg.RID;
- ReplyTo = msg.ReplyTo;
- Text = msg.Text;
- User = msg.User;
- Tags = msg.Tags;
- Timestamp = msg.Timestamp;
- TimestampString = msg.TimestampString;
- TimeAgo = msg.TimeAgo;
- Privacy = msg.Privacy;
- FriendsOnly = msg.FriendsOnly;
- ReadOnly = msg.ReadOnly;
- Hidden = msg.Hidden;
- Replies = msg.Replies;
- AttachmentType = msg.AttachmentType;
- Photo = msg.Photo;
- Video = msg.Video;
- Place = msg.Place;
- Likes = msg.Likes;
- UserLike = msg.UserLike;
- childs = msg.childs;
- }
-
- public void parseTags(String strTags) {
- Tags.addAll(Arrays.asList(strTags.split(" ")));
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof Message)) {
- return false;
- }
- Message jmsg = (Message) obj;
- return (this.MID == jmsg.MID && this.RID == jmsg.RID);
- }
-
- public int compareTo(Object obj) throws ClassCastException {
- if (!(obj instanceof Message)) {
- throw new ClassCastException();
- }
- Message jmsg = (Message) obj;
-
- if (this.MID != jmsg.MID) {
- if (this.MID > jmsg.MID) {
- return -1;
- } else {
- return 1;
- }
- }
-
- if (this.RID != jmsg.RID) {
- if (this.RID < jmsg.RID) {
- return -1;
- } else {
- return 1;
- }
- }
-
- return 0;
- }
-
- public int getChildsCount() {
- int cnt = childs.size();
- for (int i = 0; i < childs.size(); i++) {
- cnt += childs.get(i).getChildsCount();
- }
- return cnt;
- }
-
- public void cleanupChilds() {
- if (!childs.isEmpty()) {
- for (int i = 0; i < childs.size(); i++) {
- childs.get(i).cleanupChilds();
- }
- childs.clear();
- }
- }
-
- public String getAttachmentURL() {
- if (AttachmentType != null) {
- String url = "http://i.juick.com/";
- url += AttachmentType.equals("mp4") ? "video" : "photos-1024";
- url += "/" + MID;
- if (RID > 0) {
- url += "-" + RID;
- }
- url += "." + AttachmentType;
- return url;
- } else {
- return null;
- }
- }
-
- public String getTagsString() {
- String ret = "";
- for (int i = 0; i < Tags.size(); i++) {
- ret += " *" + Tags.get(i);
- }
- if (FriendsOnly) {
- ret += " *friends";
- }
- if (Privacy == -2) {
- ret += " *private";
- }
- if (Privacy == -1) {
- ret += " *friends";
- }
- if (Privacy == 2) {
- ret += " *public";
- }
- if (ReadOnly) {
- ret += " *readonly";
- }
- return ret;
- }
-}
diff --git a/src/com/juick/Place.java b/src/com/juick/Place.java
deleted file mode 100644
index 7174ed6e..00000000
--- a/src/com/juick/Place.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2011, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Place {
-
- public int pid = 0;
- public double lat = 0;
- public double lon = 0;
- public String name = null;
- public int users = 0;
- public int messages = 0;
- public int distance = 0;
-}
diff --git a/src/com/juick/Tag.java b/src/com/juick/Tag.java
deleted file mode 100644
index 3cee3358..00000000
--- a/src/com/juick/Tag.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2011, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class Tag implements Comparable {
-
- public String Name = null;
- public int TID = 0;
- public int SynonymID = 0;
- public int UsageCnt = 0;
-
- @Override
- public int compareTo(Tag o) {
- return this.Name.compareTo(o.Name);
- }
-}
diff --git a/src/com/juick/User.java b/src/com/juick/User.java
deleted file mode 100644
index e3fc0ae7..00000000
--- a/src/com/juick/User.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Juick
- * Copyright (C) 2008-2011, Ugnich Anton
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero 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 Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-package com.juick;
-
-/**
- *
- * @author Ugnich Anton
- */
-public class User {
-
- public int UID = 0;
- public String UName = null;
- public Object Avatar = null;
- public String FullName = null;
- public String JID = null;
- public int MessagesCount = 0;
- public String AuthHash = null;
- public boolean Banned = false;
-
- public User() {
- }
-
- public User(User u) {
- UID = u.UID;
- UName = u.UName;
- Avatar = u.Avatar;
- FullName = u.FullName;
- JID = u.JID;
- MessagesCount = u.MessagesCount;
- AuthHash = u.AuthHash;
- Banned = u.Banned;
- }
-
- @Override
- public boolean equals(Object obj) {
- return (obj instanceof User && ((User) obj).UID == this.UID);
- }
-}
diff --git a/src/main/java/com/juick/Group.java b/src/main/java/com/juick/Group.java
new file mode 100644
index 00000000..008d3af2
--- /dev/null
+++ b/src/main/java/com/juick/Group.java
@@ -0,0 +1,29 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2013, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Group {
+
+ public String Name = null;
+ public int GID = 0;
+ public int UsersCnt = 0;
+}
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
new file mode 100644
index 00000000..3d2b8227
--- /dev/null
+++ b/src/main/java/com/juick/Message.java
@@ -0,0 +1,173 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Message {
+
+ public int MID = 0;
+ public int RID = 0;
+ public int ReplyTo = 0;
+ public String Text = null;
+ public User User = null;
+ public ArrayList Tags = new ArrayList();
+ public Date Timestamp = null;
+ public String TimestampString = null;
+ public int TimeAgo = 0;
+ public int Privacy = 1;
+ public boolean FriendsOnly = false;
+ public boolean ReadOnly = false;
+ public boolean Hidden = false;
+ public boolean VisitorCanComment = true;
+ public int Replies = 0;
+ public String RepliesBy = null;
+ public String AttachmentType = null;
+ public String Photo = null;
+ public String Video = null;
+ public Place Place = null;
+ public int Likes = 0;
+ public boolean UserLike = false;
+ public ArrayList childs = new ArrayList();
+
+ public Message() {
+ }
+
+ public Message(Message msg) {
+ MID = msg.MID;
+ RID = msg.RID;
+ ReplyTo = msg.ReplyTo;
+ Text = msg.Text;
+ User = msg.User;
+ Tags = msg.Tags;
+ Timestamp = msg.Timestamp;
+ TimestampString = msg.TimestampString;
+ TimeAgo = msg.TimeAgo;
+ Privacy = msg.Privacy;
+ FriendsOnly = msg.FriendsOnly;
+ ReadOnly = msg.ReadOnly;
+ Hidden = msg.Hidden;
+ Replies = msg.Replies;
+ AttachmentType = msg.AttachmentType;
+ Photo = msg.Photo;
+ Video = msg.Video;
+ Place = msg.Place;
+ Likes = msg.Likes;
+ UserLike = msg.UserLike;
+ childs = msg.childs;
+ }
+
+ public void parseTags(String strTags) {
+ Tags.addAll(Arrays.asList(strTags.split(" ")));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof Message)) {
+ return false;
+ }
+ Message jmsg = (Message) obj;
+ return (this.MID == jmsg.MID && this.RID == jmsg.RID);
+ }
+
+ public int compareTo(Object obj) throws ClassCastException {
+ if (!(obj instanceof Message)) {
+ throw new ClassCastException();
+ }
+ Message jmsg = (Message) obj;
+
+ if (this.MID != jmsg.MID) {
+ if (this.MID > jmsg.MID) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+
+ if (this.RID != jmsg.RID) {
+ if (this.RID < jmsg.RID) {
+ return -1;
+ } else {
+ return 1;
+ }
+ }
+
+ return 0;
+ }
+
+ public int getChildsCount() {
+ int cnt = childs.size();
+ for (int i = 0; i < childs.size(); i++) {
+ cnt += childs.get(i).getChildsCount();
+ }
+ return cnt;
+ }
+
+ public void cleanupChilds() {
+ if (!childs.isEmpty()) {
+ for (int i = 0; i < childs.size(); i++) {
+ childs.get(i).cleanupChilds();
+ }
+ childs.clear();
+ }
+ }
+
+ public String getAttachmentURL() {
+ if (AttachmentType != null) {
+ String url = "http://i.juick.com/";
+ url += AttachmentType.equals("mp4") ? "video" : "photos-1024";
+ url += "/" + MID;
+ if (RID > 0) {
+ url += "-" + RID;
+ }
+ url += "." + AttachmentType;
+ return url;
+ } else {
+ return null;
+ }
+ }
+
+ public String getTagsString() {
+ String ret = "";
+ for (int i = 0; i < Tags.size(); i++) {
+ ret += " *" + Tags.get(i);
+ }
+ if (FriendsOnly) {
+ ret += " *friends";
+ }
+ if (Privacy == -2) {
+ ret += " *private";
+ }
+ if (Privacy == -1) {
+ ret += " *friends";
+ }
+ if (Privacy == 2) {
+ ret += " *public";
+ }
+ if (ReadOnly) {
+ ret += " *readonly";
+ }
+ return ret;
+ }
+}
diff --git a/src/main/java/com/juick/Place.java b/src/main/java/com/juick/Place.java
new file mode 100644
index 00000000..7174ed6e
--- /dev/null
+++ b/src/main/java/com/juick/Place.java
@@ -0,0 +1,33 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Place {
+
+ public int pid = 0;
+ public double lat = 0;
+ public double lon = 0;
+ public String name = null;
+ public int users = 0;
+ public int messages = 0;
+ public int distance = 0;
+}
diff --git a/src/main/java/com/juick/Tag.java b/src/main/java/com/juick/Tag.java
new file mode 100644
index 00000000..3cee3358
--- /dev/null
+++ b/src/main/java/com/juick/Tag.java
@@ -0,0 +1,35 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Tag implements Comparable {
+
+ public String Name = null;
+ public int TID = 0;
+ public int SynonymID = 0;
+ public int UsageCnt = 0;
+
+ @Override
+ public int compareTo(Tag o) {
+ return this.Name.compareTo(o.Name);
+ }
+}
diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java
new file mode 100644
index 00000000..e3fc0ae7
--- /dev/null
+++ b/src/main/java/com/juick/User.java
@@ -0,0 +1,53 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class User {
+
+ public int UID = 0;
+ public String UName = null;
+ public Object Avatar = null;
+ public String FullName = null;
+ public String JID = null;
+ public int MessagesCount = 0;
+ public String AuthHash = null;
+ public boolean Banned = false;
+
+ public User() {
+ }
+
+ public User(User u) {
+ UID = u.UID;
+ UName = u.UName;
+ Avatar = u.Avatar;
+ FullName = u.FullName;
+ JID = u.JID;
+ MessagesCount = u.MessagesCount;
+ AuthHash = u.AuthHash;
+ Banned = u.Banned;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ return (obj instanceof User && ((User) obj).UID == this.UID);
+ }
+}
--
cgit v1.2.3
From 133ec5b0c451091712d127f3223e0b039dac72ef Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Mon, 26 Oct 2015 16:22:16 +0300
Subject: ignore IDEA files
---
.gitignore | 1 +
1 file changed, 1 insertion(+)
diff --git a/.gitignore b/.gitignore
index e51bc30b..e090eb9b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
build/*
.gradle/*
+*.iml
--
cgit v1.2.3
From a5766d12d6dbd80a44d6d1deee4d454016b37079 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Mon, 26 Oct 2015 17:17:08 +0300
Subject: fix tags string
---
src/main/java/com/juick/Message.java | 36 +++++++++++++++++++-----------------
1 file changed, 19 insertions(+), 17 deletions(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 3d2b8227..4db2620e 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -150,23 +150,25 @@ public class Message {
public String getTagsString() {
String ret = "";
- for (int i = 0; i < Tags.size(); i++) {
- ret += " *" + Tags.get(i);
- }
- if (FriendsOnly) {
- ret += " *friends";
- }
- if (Privacy == -2) {
- ret += " *private";
- }
- if (Privacy == -1) {
- ret += " *friends";
- }
- if (Privacy == 2) {
- ret += " *public";
- }
- if (ReadOnly) {
- ret += " *readonly";
+ if (!Tags.isEmpty()) {
+ for (int i = 0; i < Tags.size(); i++) {
+ ret += " *" + Tags.get(i);
+ }
+ if (FriendsOnly) {
+ ret += " *friends";
+ }
+ if (Privacy == -2) {
+ ret += " *private";
+ }
+ if (Privacy == -1) {
+ ret += " *friends";
+ }
+ if (Privacy == 2) {
+ ret += " *public";
+ }
+ if (ReadOnly) {
+ ret += " *readonly";
+ }
}
return ret;
}
--
cgit v1.2.3
From c98f2e946babbec6b0174e175f49e9cd353223e2 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Wed, 4 Nov 2015 13:40:17 +0300
Subject: add unit tests
---
build.gradle | 4 ++++
src/test/java/com/juick/tests/MessageTests.java | 16 ++++++++++++++++
2 files changed, 20 insertions(+)
create mode 100644 src/test/java/com/juick/tests/MessageTests.java
diff --git a/build.gradle b/build.gradle
index 405a81af..c973749c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1 +1,5 @@
apply plugin: "java"
+
+dependencies {
+ testCompile 'junit:junit:4.12'
+}
diff --git a/src/test/java/com/juick/tests/MessageTests.java b/src/test/java/com/juick/tests/MessageTests.java
new file mode 100644
index 00000000..47b2d13c
--- /dev/null
+++ b/src/test/java/com/juick/tests/MessageTests.java
@@ -0,0 +1,16 @@
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+
+import com.juick.Message;
+
+public class MessageTests {
+ @Test
+ public void messageTagsParser() {
+ Message msg = new Message();
+ msg.parseTags("test test" + (char)0xA0 + "2 test3");
+ assertEquals("First tag must be", "test", msg.Tags.get(0));
+ assertEquals("Third tag must be", "test3", msg.Tags.get(2));
+ assertEquals("Count of tags must be", 3, msg.Tags.size());
+ }
+}
\ No newline at end of file
--
cgit v1.2.3
From c3d949e11a4380a2353fca0abf12292285fde02c Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Wed, 4 Nov 2015 14:19:11 +0300
Subject: initial gson support
---
build.gradle | 1 +
src/main/java/com/juick/Message.java | 7 +++++++
src/test/java/com/juick/tests/MessageTests.java | 2 ++
3 files changed, 10 insertions(+)
diff --git a/build.gradle b/build.gradle
index c973749c..397234a6 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1,6 @@
apply plugin: "java"
dependencies {
+ compile 'com.google.code.gson:gson:2.4'
testCompile 'junit:junit:4.12'
}
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 4db2620e..c87bf445 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -17,6 +17,8 @@
*/
package com.juick;
+import com.google.gson.annotations.SerializedName;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -27,8 +29,13 @@ import java.util.Date;
*/
public class Message {
+ @SerializedName("mid")
public int MID = 0;
+
+ @SerializedName("rid")
public int RID = 0;
+
+ @SerializedName("replyto")
public int ReplyTo = 0;
public String Text = null;
public User User = null;
diff --git a/src/test/java/com/juick/tests/MessageTests.java b/src/test/java/com/juick/tests/MessageTests.java
index 47b2d13c..0392c7b3 100644
--- a/src/test/java/com/juick/tests/MessageTests.java
+++ b/src/test/java/com/juick/tests/MessageTests.java
@@ -1,3 +1,5 @@
+package com.juick.tests;
+
import static org.junit.Assert.assertEquals;
import org.junit.Test;
--
cgit v1.2.3
From 5f08b8b1cfaacf1e78c56e7752277533eb84b02e Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Wed, 4 Nov 2015 15:19:11 +0300
Subject: drop gson
---
build.gradle | 1 -
src/main/java/com/juick/Message.java | 5 -----
2 files changed, 6 deletions(-)
diff --git a/build.gradle b/build.gradle
index 397234a6..c973749c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,6 +1,5 @@
apply plugin: "java"
dependencies {
- compile 'com.google.code.gson:gson:2.4'
testCompile 'junit:junit:4.12'
}
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index c87bf445..7875cea7 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -17,8 +17,6 @@
*/
package com.juick;
-import com.google.gson.annotations.SerializedName;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
@@ -29,13 +27,10 @@ import java.util.Date;
*/
public class Message {
- @SerializedName("mid")
public int MID = 0;
- @SerializedName("rid")
public int RID = 0;
- @SerializedName("replyto")
public int ReplyTo = 0;
public String Text = null;
public User User = null;
--
cgit v1.2.3
From d7f4564910568e289273f575b7972a745661956d Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sun, 10 Jan 2016 19:57:49 +0300
Subject: refactoring
---
src/main/java/com/juick/Message.java | 52 ++++++++++++++++++++++--------
src/main/java/com/juick/User.java | 62 +++++++++++++++++++++++++++++-------
2 files changed, 89 insertions(+), 25 deletions(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 7875cea7..8306dd8b 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -27,13 +27,13 @@ import java.util.Date;
*/
public class Message {
- public int MID = 0;
+ private int MID = 0;
- public int RID = 0;
+ private int RID = 0;
public int ReplyTo = 0;
public String Text = null;
- public User User = null;
+ private User User = null;
public ArrayList Tags = new ArrayList();
public Date Timestamp = null;
public String TimestampString = null;
@@ -57,11 +57,11 @@ public class Message {
}
public Message(Message msg) {
- MID = msg.MID;
- RID = msg.RID;
+ setMID(msg.getMID());
+ setRID(msg.getRID());
ReplyTo = msg.ReplyTo;
Text = msg.Text;
- User = msg.User;
+ setUser(msg.getUser());
Tags = msg.Tags;
Timestamp = msg.Timestamp;
TimestampString = msg.TimestampString;
@@ -90,7 +90,7 @@ public class Message {
return false;
}
Message jmsg = (Message) obj;
- return (this.MID == jmsg.MID && this.RID == jmsg.RID);
+ return (this.getMID() == jmsg.getMID() && this.getRID() == jmsg.getRID());
}
public int compareTo(Object obj) throws ClassCastException {
@@ -99,16 +99,16 @@ public class Message {
}
Message jmsg = (Message) obj;
- if (this.MID != jmsg.MID) {
- if (this.MID > jmsg.MID) {
+ if (this.getMID() != jmsg.getMID()) {
+ if (this.getMID() > jmsg.getMID()) {
return -1;
} else {
return 1;
}
}
- if (this.RID != jmsg.RID) {
- if (this.RID < jmsg.RID) {
+ if (this.getRID() != jmsg.getRID()) {
+ if (this.getRID() < jmsg.getRID()) {
return -1;
} else {
return 1;
@@ -139,9 +139,9 @@ public class Message {
if (AttachmentType != null) {
String url = "http://i.juick.com/";
url += AttachmentType.equals("mp4") ? "video" : "photos-1024";
- url += "/" + MID;
- if (RID > 0) {
- url += "-" + RID;
+ url += "/" + getMID();
+ if (getRID() > 0) {
+ url += "-" + getRID();
}
url += "." + AttachmentType;
return url;
@@ -174,4 +174,28 @@ public class Message {
}
return ret;
}
+
+ public int getMID() {
+ return MID;
+ }
+
+ public void setMID(int MID) {
+ this.MID = MID;
+ }
+
+ public int getRID() {
+ return RID;
+ }
+
+ public void setRID(int RID) {
+ this.RID = RID;
+ }
+
+ public com.juick.User getUser() {
+ return User;
+ }
+
+ public void setUser(com.juick.User user) {
+ User = user;
+ }
}
diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java
index e3fc0ae7..40a3df96 100644
--- a/src/main/java/com/juick/User.java
+++ b/src/main/java/com/juick/User.java
@@ -23,31 +23,71 @@ package com.juick;
*/
public class User {
- public int UID = 0;
- public String UName = null;
+ private int UID = 0;
+ private String UName = null;
public Object Avatar = null;
- public String FullName = null;
- public String JID = null;
+ private String FullName = null;
+ private String JID = null;
public int MessagesCount = 0;
- public String AuthHash = null;
+ private String AuthHash = null;
public boolean Banned = false;
public User() {
}
public User(User u) {
- UID = u.UID;
- UName = u.UName;
+ setUID(u.getUID());
+ setUName(u.getUName());
Avatar = u.Avatar;
- FullName = u.FullName;
- JID = u.JID;
+ setFullName(u.getFullName());
+ setJID(u.getJID());
MessagesCount = u.MessagesCount;
- AuthHash = u.AuthHash;
+ setAuthHash(u.getAuthHash());
Banned = u.Banned;
}
@Override
public boolean equals(Object obj) {
- return (obj instanceof User && ((User) obj).UID == this.UID);
+ return (obj instanceof User && ((User) obj).getUID() == this.getUID());
+ }
+
+ public int getUID() {
+ return UID;
+ }
+
+ public void setUID(int UID) {
+ this.UID = UID;
+ }
+
+ public String getUName() {
+ return UName;
+ }
+
+ public void setUName(String UName) {
+ this.UName = UName;
+ }
+
+ public String getFullName() {
+ return FullName;
+ }
+
+ public void setFullName(String fullName) {
+ FullName = fullName;
+ }
+
+ public String getJID() {
+ return JID;
+ }
+
+ public void setJID(String JID) {
+ this.JID = JID;
+ }
+
+ public String getAuthHash() {
+ return AuthHash;
+ }
+
+ public void setAuthHash(String authHash) {
+ AuthHash = authHash;
}
}
--
cgit v1.2.3
From 1df19b47f7f463e6cafa7dcf877cb42967fff166 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sun, 10 Jan 2016 20:09:38 +0300
Subject: refactoring, part 2
---
src/main/java/com/juick/Message.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 8306dd8b..03573aed 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -32,7 +32,7 @@ public class Message {
private int RID = 0;
public int ReplyTo = 0;
- public String Text = null;
+ private String Text = null;
private User User = null;
public ArrayList Tags = new ArrayList();
public Date Timestamp = null;
@@ -60,7 +60,7 @@ public class Message {
setMID(msg.getMID());
setRID(msg.getRID());
ReplyTo = msg.ReplyTo;
- Text = msg.Text;
+ setText(msg.getText());
setUser(msg.getUser());
Tags = msg.Tags;
Timestamp = msg.Timestamp;
@@ -198,4 +198,12 @@ public class Message {
public void setUser(com.juick.User user) {
User = user;
}
+
+ public String getText() {
+ return Text;
+ }
+
+ public void setText(String text) {
+ Text = text;
+ }
}
--
cgit v1.2.3
From a4eb42bf34b42d0abb0ed0bf2619a0ba96edd0d8 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 16 Jan 2016 17:37:02 +0300
Subject: fix possible NPE
---
src/main/java/com/juick/Message.java | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 03573aed..ea1d550b 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -81,7 +81,9 @@ public class Message {
}
public void parseTags(String strTags) {
- Tags.addAll(Arrays.asList(strTags.split(" ")));
+ if (strTags != null) {
+ Tags.addAll(Arrays.asList(strTags.split(" ")));
+ }
}
@Override
--
cgit v1.2.3
From 39ec74abe77cdab5aa8f50c2524e6f71c2dbbd01 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Sat, 16 Jan 2016 18:23:47 +0300
Subject: get date
---
src/main/java/com/juick/Message.java | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index ea1d550b..003622ec 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -35,8 +35,7 @@ public class Message {
private String Text = null;
private User User = null;
public ArrayList Tags = new ArrayList();
- public Date Timestamp = null;
- public String TimestampString = null;
+ private Date date = null;
public int TimeAgo = 0;
public int Privacy = 1;
public boolean FriendsOnly = false;
@@ -63,8 +62,7 @@ public class Message {
setText(msg.getText());
setUser(msg.getUser());
Tags = msg.Tags;
- Timestamp = msg.Timestamp;
- TimestampString = msg.TimestampString;
+ setDate(msg.getDate());
TimeAgo = msg.TimeAgo;
Privacy = msg.Privacy;
FriendsOnly = msg.FriendsOnly;
@@ -208,4 +206,13 @@ public class Message {
public void setText(String text) {
Text = text;
}
+
+ public Date getDate() {
+ return date;
+ }
+
+ public void setDate(Date date) {
+
+ this.date = date;
+ }
}
--
cgit v1.2.3
From e001fdc08bc50d73b2920bb96e85c481bdee1c1f Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Mon, 8 Feb 2016 20:44:19 +0300
Subject: add pm and recommendations
---
src/main/java/com/juick/Message.java | 27 ++++++++++++++++++++++-----
src/main/java/com/juick/PM.java | 16 ++++++++++++++++
src/main/java/com/juick/Recommendation.java | 16 ++++++++++++++++
3 files changed, 54 insertions(+), 5 deletions(-)
create mode 100644 src/main/java/com/juick/PM.java
create mode 100644 src/main/java/com/juick/Recommendation.java
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 003622ec..c6e10214 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -17,9 +17,7 @@
*/
package com.juick;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
+import java.util.*;
/**
*
@@ -34,7 +32,7 @@ public class Message {
public int ReplyTo = 0;
private String Text = null;
private User User = null;
- public ArrayList Tags = new ArrayList();
+ public List Tags = new ArrayList<>();
private Date date = null;
public int TimeAgo = 0;
public int Privacy = 1;
@@ -50,7 +48,9 @@ public class Message {
public Place Place = null;
public int Likes = 0;
public boolean UserLike = false;
- public ArrayList childs = new ArrayList();
+ public ArrayList childs = new ArrayList<>();
+ private Optional PM = Optional.empty();
+ Optional Recommendation = Optional.empty();
public Message() {
}
@@ -76,6 +76,8 @@ public class Message {
Likes = msg.Likes;
UserLike = msg.UserLike;
childs = msg.childs;
+ PM = msg.PM;
+ Recommendation = msg.Recommendation;
}
public void parseTags(String strTags) {
@@ -215,4 +217,19 @@ public class Message {
this.date = date;
}
+
+ public Optional getPM() {
+ return PM;
+ }
+
+ public void setPM(com.juick.PM PM) {
+ this.PM = Optional.ofNullable(PM);
+ }
+
+ public Optional getRecommendation() {
+ return Recommendation;
+ }
+ public void setRecommendation(Recommendation recommendation) {
+ this.Recommendation = Optional.ofNullable(recommendation);
+ }
}
diff --git a/src/main/java/com/juick/PM.java b/src/main/java/com/juick/PM.java
new file mode 100644
index 00000000..658cafc9
--- /dev/null
+++ b/src/main/java/com/juick/PM.java
@@ -0,0 +1,16 @@
+package com.juick;
+
+/**
+ * Created by vt on 08/02/16.
+ */
+public class PM {
+ private User to;
+
+ public User getTo() {
+ return to;
+ }
+
+ public PM(User to) {
+ this.to = to;
+ }
+}
diff --git a/src/main/java/com/juick/Recommendation.java b/src/main/java/com/juick/Recommendation.java
new file mode 100644
index 00000000..4cfa67c2
--- /dev/null
+++ b/src/main/java/com/juick/Recommendation.java
@@ -0,0 +1,16 @@
+package com.juick;
+
+/**
+ * Created by vt on 08/02/16.
+ */
+public class Recommendation {
+ User from;
+
+ public User getFrom() {
+ return from;
+ }
+
+ public Recommendation(User from) {
+ this.from = from;
+ }
+}
--
cgit v1.2.3
From c84041327cbac8d67fd75ff4c223cf43f7fc73e7 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Mon, 8 Feb 2016 21:15:49 +0300
Subject: cleanup
---
src/main/java/com/juick/Message.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index c6e10214..10f7c698 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -33,7 +33,7 @@ public class Message {
private String Text = null;
private User User = null;
public List Tags = new ArrayList<>();
- private Date date = null;
+ private Date date;
public int TimeAgo = 0;
public int Privacy = 1;
public boolean FriendsOnly = false;
@@ -48,7 +48,7 @@ public class Message {
public Place Place = null;
public int Likes = 0;
public boolean UserLike = false;
- public ArrayList childs = new ArrayList<>();
+ public List childs = new ArrayList<>();
private Optional PM = Optional.empty();
Optional Recommendation = Optional.empty();
@@ -122,16 +122,16 @@ public class Message {
public int getChildsCount() {
int cnt = childs.size();
- for (int i = 0; i < childs.size(); i++) {
- cnt += childs.get(i).getChildsCount();
+ for (Message child : childs) {
+ cnt += child.getChildsCount();
}
return cnt;
}
public void cleanupChilds() {
if (!childs.isEmpty()) {
- for (int i = 0; i < childs.size(); i++) {
- childs.get(i).cleanupChilds();
+ for (Message child : childs) {
+ child.cleanupChilds();
}
childs.clear();
}
--
cgit v1.2.3
From d23e7fff4da9bbfd7ee85ff34c78de631d55c4a5 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Fri, 26 Feb 2016 17:04:42 +0300
Subject: Message is Comparable
---
src/main/java/com/juick/Message.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 10f7c698..263a247d 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -23,7 +23,7 @@ import java.util.*;
*
* @author Ugnich Anton
*/
-public class Message {
+public class Message implements Comparable {
private int MID = 0;
@@ -95,6 +95,7 @@ public class Message {
return (this.getMID() == jmsg.getMID() && this.getRID() == jmsg.getRID());
}
+ @Override
public int compareTo(Object obj) throws ClassCastException {
if (!(obj instanceof Message)) {
throw new ClassCastException();
--
cgit v1.2.3
From 80cd101bf9291cd9e8b1a883e3148ff95c445cc1 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Fri, 8 Apr 2016 16:22:07 +0300
Subject: encapsulate some properties
---
src/main/java/com/juick/Message.java | 18 +++++++++++++-----
src/main/java/com/juick/User.java | 24 ++++++++++++++++++++----
2 files changed, 33 insertions(+), 9 deletions(-)
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index 263a247d..c128b4f2 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -47,10 +47,10 @@ public class Message implements Comparable {
public String Video = null;
public Place Place = null;
public int Likes = 0;
- public boolean UserLike = false;
+ private boolean liked = false;
public List childs = new ArrayList<>();
private Optional PM = Optional.empty();
- Optional Recommendation = Optional.empty();
+ private Optional Recommendation = Optional.empty();
public Message() {
}
@@ -74,7 +74,7 @@ public class Message implements Comparable {
Video = msg.Video;
Place = msg.Place;
Likes = msg.Likes;
- UserLike = msg.UserLike;
+ setLiked(msg.isLiked());
childs = msg.childs;
PM = msg.PM;
Recommendation = msg.Recommendation;
@@ -156,8 +156,8 @@ public class Message implements Comparable {
public String getTagsString() {
String ret = "";
if (!Tags.isEmpty()) {
- for (int i = 0; i < Tags.size(); i++) {
- ret += " *" + Tags.get(i);
+ for (String Tag : Tags) {
+ ret += " *" + Tag;
}
if (FriendsOnly) {
ret += " *friends";
@@ -233,4 +233,12 @@ public class Message implements Comparable {
public void setRecommendation(Recommendation recommendation) {
this.Recommendation = Optional.ofNullable(recommendation);
}
+
+ public boolean isLiked() {
+ return liked;
+ }
+
+ public void setLiked(boolean liked) {
+ this.liked = liked;
+ }
}
diff --git a/src/main/java/com/juick/User.java b/src/main/java/com/juick/User.java
index 40a3df96..13df2058 100644
--- a/src/main/java/com/juick/User.java
+++ b/src/main/java/com/juick/User.java
@@ -28,9 +28,9 @@ public class User {
public Object Avatar = null;
private String FullName = null;
private String JID = null;
- public int MessagesCount = 0;
+ private int unreadCount;
private String AuthHash = null;
- public boolean Banned = false;
+ private boolean banned = false;
public User() {
}
@@ -41,9 +41,9 @@ public class User {
Avatar = u.Avatar;
setFullName(u.getFullName());
setJID(u.getJID());
- MessagesCount = u.MessagesCount;
+ setUnreadCount(u.getUnreadCount());
setAuthHash(u.getAuthHash());
- Banned = u.Banned;
+ setBanned(u.isBanned());
}
@Override
@@ -90,4 +90,20 @@ public class User {
public void setAuthHash(String authHash) {
AuthHash = authHash;
}
+
+ public int getUnreadCount() {
+ return unreadCount;
+ }
+
+ public void setUnreadCount(int unreadCount) {
+ this.unreadCount = unreadCount;
+ }
+
+ public boolean isBanned() {
+ return banned;
+ }
+
+ public void setBanned(boolean banned) {
+ this.banned = banned;
+ }
}
--
cgit v1.2.3
From 277077cd978b708f6cdcf9132154342d17978c55 Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Fri, 22 Apr 2016 16:41:31 +0300
Subject: fix tag equality
---
src/main/java/com/juick/Tag.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/main/java/com/juick/Tag.java b/src/main/java/com/juick/Tag.java
index 3cee3358..119aad99 100644
--- a/src/main/java/com/juick/Tag.java
+++ b/src/main/java/com/juick/Tag.java
@@ -17,11 +17,13 @@
*/
package com.juick;
+import java.util.Objects;
+
/**
*
* @author Ugnich Anton
*/
-public class Tag implements Comparable {
+public class Tag {
public String Name = null;
public int TID = 0;
@@ -29,7 +31,11 @@ public class Tag implements Comparable {
public int UsageCnt = 0;
@Override
- public int compareTo(Tag o) {
- return this.Name.compareTo(o.Name);
+ public boolean equals(Object o) {
+ boolean equal = false;
+ if (o != null && o instanceof Tag) {
+ equal = Objects.equals(Name, ((Tag) o).Name);
+ }
+ return equal;
}
}
--
cgit v1.2.3
From fb4dfa3fbc04e44e808bbd4d1ad764fa979bb3ca Mon Sep 17 00:00:00 2001
From: Vitaly Takmazov
Date: Fri, 22 Apr 2016 16:59:50 +0300
Subject: drop tags parser
---
build.gradle | 6 +-----
src/main/java/com/juick/Message.java | 6 ------
src/test/java/com/juick/tests/MessageTests.java | 18 ------------------
3 files changed, 1 insertion(+), 29 deletions(-)
delete mode 100644 src/test/java/com/juick/tests/MessageTests.java
diff --git a/build.gradle b/build.gradle
index c973749c..e9bf9cdc 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,5 +1 @@
-apply plugin: "java"
-
-dependencies {
- testCompile 'junit:junit:4.12'
-}
+apply plugin: "java"
\ No newline at end of file
diff --git a/src/main/java/com/juick/Message.java b/src/main/java/com/juick/Message.java
index c128b4f2..1a690106 100644
--- a/src/main/java/com/juick/Message.java
+++ b/src/main/java/com/juick/Message.java
@@ -80,12 +80,6 @@ public class Message implements Comparable {
Recommendation = msg.Recommendation;
}
- public void parseTags(String strTags) {
- if (strTags != null) {
- Tags.addAll(Arrays.asList(strTags.split(" ")));
- }
- }
-
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Message)) {
diff --git a/src/test/java/com/juick/tests/MessageTests.java b/src/test/java/com/juick/tests/MessageTests.java
deleted file mode 100644
index 0392c7b3..00000000
--- a/src/test/java/com/juick/tests/MessageTests.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.juick.tests;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-import com.juick.Message;
-
-public class MessageTests {
- @Test
- public void messageTagsParser() {
- Message msg = new Message();
- msg.parseTags("test test" + (char)0xA0 + "2 test3");
- assertEquals("First tag must be", "test", msg.Tags.get(0));
- assertEquals("Third tag must be", "test3", msg.Tags.get(2));
- assertEquals("Count of tags must be", 3, msg.Tags.size());
- }
-}
\ No newline at end of file
--
cgit v1.2.3