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 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore (limited to '.gitignore') 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 -- 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(-) (limited to '.gitignore') 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 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 (limited to '.gitignore') 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(+) (limited to '.gitignore') 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