aboutsummaryrefslogtreecommitdiff
path: root/juick-core/src/main/java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-07-11 13:30:37 +0300
committerGravatar Vitaly Takmazov2016-07-11 13:30:37 +0300
commitafadc6521ac2643a389fe11fe6b5863a0e6aa88a (patch)
treefc7c504a2af39de1848f47ee6e723c28dff1a4f0 /juick-core/src/main/java
parentd6fb4288688294d2f76325f14410db3091fea0fa (diff)
fix protocol and tests
Diffstat (limited to 'juick-core/src/main/java')
-rw-r--r--juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java2
-rw-r--r--juick-core/src/main/java/com/juick/server/protocol/JuickProtocol.java2
2 files changed, 2 insertions, 2 deletions
diff --git a/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java b/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java
index 21a07e05..a0b91447 100644
--- a/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java
+++ b/juick-core/src/main/java/com/juick/server/SubscriptionsQueries.java
@@ -80,7 +80,7 @@ public class SubscriptionsQueries {
}
public static boolean subscribeUser(JdbcTemplate sql, User user, User toUser) {
return sql.update("INSERT IGNORE INTO subscr_users(user_id,suser_id) VALUES (?,?)",
- user.getUID(), toUser.getUID()) == 1;
+ toUser.getUID(), user.getUID()) == 1;
}
public static boolean unSubscribeUser(JdbcTemplate sql, User user, User fromUser) {
return sql.update("DELETE FROM subscr_users WHERE suser_id=? AND user_id=?",
diff --git a/juick-core/src/main/java/com/juick/server/protocol/JuickProtocol.java b/juick-core/src/main/java/com/juick/server/protocol/JuickProtocol.java
index 1a2e5333..033417a8 100644
--- a/juick-core/src/main/java/com/juick/server/protocol/JuickProtocol.java
+++ b/juick-core/src/main/java/com/juick/server/protocol/JuickProtocol.java
@@ -152,7 +152,7 @@ public class JuickProtocol {
@UserCommand(pattern = "^(#+)$", help = "# - Show last messages from your feed (## - second page, ...)")
public ProtocolReply commandMyFeed(User user, String... arguments) {
// number of # is the page count
- int page = arguments[0].length();
+ int page = arguments[0].length() - 1;
List<Integer> mids = MessagesQueries.getMyFeed(sql, user.getUID(), page);
List<Message> messages = MessagesQueries.getMessages(sql, mids);
// TODO: add instructions for empty feed