diff options
author | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2016-11-15 14:21:27 +0300 |
commit | 51d9de02265d6cc9d6045d79497d2a987ae2f7f7 (patch) | |
tree | d7dd2e534452cab45b8ebdba1e52c498951c5035 /juick-xmpp/src/main | |
parent | 32a6feb195171e06d60117ad758cc8beb50e5ca3 (diff) |
core classes are now serializeable with JAXB (to use as babbler extension)
Diffstat (limited to 'juick-xmpp/src/main')
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java | 52 | ||||
-rw-r--r-- | juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java | 28 |
2 files changed, 40 insertions, 40 deletions
diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java index c603a4d3..9400aad7 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/ConnectionRouter.java @@ -106,9 +106,9 @@ public class ConnectionRouter extends Connection implements Runnable { if (jid.Username != null && jid.Username.equals("recomm")) { sendJuickRecommendation(jmsg); } else { - if (jmsg.getRID() > 0) { + if (jmsg.getRid() > 0) { sendJuickComment(jmsg); - } else if (jmsg.getMID() > 0) { + } else if (jmsg.getMid() > 0) { sendJuickMessage(jmsg); } } @@ -142,32 +142,32 @@ public class ConnectionRouter extends Connection implements Runnable { List<String> jids = new ArrayList<>(); if (jmsg.FriendsOnly) { - jids = SubscriptionsQueries.getJIDSubscribedToUser(xmpp.jdbc, jmsg.getUser().getUID(), jmsg.FriendsOnly); + jids = SubscriptionsQueries.getJIDSubscribedToUser(xmpp.jdbc, jmsg.getUser().getUid(), jmsg.FriendsOnly); } else { - List<User> users = SubscriptionsQueries.getSubscribedUsers(xmpp.jdbc, jmsg.getUser().getUID(), jmsg.getMID()); + List<User> users = SubscriptionsQueries.getSubscribedUsers(xmpp.jdbc, jmsg.getUser().getUid(), jmsg.getMid()); for (User user : users) { - for (String jid : UserQueries.getJIDsbyUID(xmpp.jdbc, user.getUID())) { + for (String jid : UserQueries.getJIDsbyUID(xmpp.jdbc, user.getUid())) { jids.add(jid); } } } - String txt = "@" + jmsg.getUser().getUName() + ":" + jmsg.getTagsString() + "\n"; + String txt = "@" + jmsg.getUser().getName() + ":" + jmsg.getTagsString() + "\n"; String attachment = jmsg.getAttachmentURL(); if (attachment != null) { txt += attachment + "\n"; } txt += jmsg.getText() + "\n\n"; - txt += "#" + jmsg.getMID() + " http://juick.com/" + jmsg.getMID(); + txt += "#" + jmsg.getMid() + " http://juick.com/" + jmsg.getMid(); Nickname nick = new Nickname(); - nick.Nickname = "@" + jmsg.getUser().getUName(); + nick.Nickname = "@" + jmsg.getUser().getName(); com.juick.xmpp.Message msg = new com.juick.xmpp.Message(); msg.from = xmpp.bot.getJid(); msg.body = txt; msg.type = Message.Type.chat; - msg.thread = "juick-" + jmsg.getMID(); + msg.thread = "juick-" + jmsg.getMid(); msg.addChild(jmsg); msg.addChild(nick); if (attachment != null) { @@ -187,19 +187,19 @@ public class ConnectionRouter extends Connection implements Runnable { String replyQuote; String replyTo; - users = SubscriptionsQueries.getUsersSubscribedToComments(xmpp.jdbc, jmsg.getMID(), jmsg.getUser().getUID()); - com.juick.Message replyMessage = jmsg.ReplyTo > 0 ? MessagesQueries.getReply(xmpp.jdbc, jmsg.getMID(), jmsg.ReplyTo) - : MessagesQueries.getMessage(xmpp.jdbc, jmsg.getMID()); - replyTo = replyMessage.getUser().getUName(); - com.juick.Message fullReply = MessagesQueries.getReply(xmpp.jdbc, jmsg.getMID(), jmsg.getRID()); + users = SubscriptionsQueries.getUsersSubscribedToComments(xmpp.jdbc, jmsg.getMid(), jmsg.getUser().getUid()); + com.juick.Message replyMessage = jmsg.getReplyto() > 0 ? MessagesQueries.getReply(xmpp.jdbc, jmsg.getMid(), jmsg.getReplyto()) + : MessagesQueries.getMessage(xmpp.jdbc, jmsg.getMid()); + replyTo = replyMessage.getUser().getName(); + com.juick.Message fullReply = MessagesQueries.getReply(xmpp.jdbc, jmsg.getMid(), jmsg.getRid()); replyQuote = fullReply.getReplyQuote(); - String txt = "Reply by @" + jmsg.getUser().getUName() + ":\n" + replyQuote + "\n@" + replyTo + " "; + String txt = "Reply by @" + jmsg.getUser().getName() + ":\n" + replyQuote + "\n@" + replyTo + " "; String attachment = jmsg.getAttachmentURL(); if (attachment != null) { txt += attachment + "\n"; } - txt += jmsg.getText() + "\n\n" + "#" + jmsg.getMID() + "/" + jmsg.getRID() + " http://juick.com/" + jmsg.getMID() + "#" + jmsg.getRID(); + txt += jmsg.getText() + "\n\n" + "#" + jmsg.getMid() + "/" + jmsg.getRid() + " http://juick.com/" + jmsg.getMid() + "#" + jmsg.getRid(); com.juick.xmpp.Message msg = new com.juick.xmpp.Message(); msg.from = xmpp.bot.getJid(); @@ -207,7 +207,7 @@ public class ConnectionRouter extends Connection implements Runnable { msg.type = Message.Type.chat; msg.addChild(jmsg); for (User user : users) { - for (String jid : UserQueries.getJIDsbyUID(xmpp.jdbc, user.getUID())) { + for (String jid : UserQueries.getJIDsbyUID(xmpp.jdbc, user.getUid())) { msg.to = new JID(jid); xmpp.sendOut(msg); } @@ -217,18 +217,18 @@ public class ConnectionRouter extends Connection implements Runnable { public void sendJuickRecommendation(JuickMessage recomm) { List<User> users; JuickMessage jmsg; - jmsg = new JuickMessage(MessagesQueries.getMessage(xmpp.jdbc, recomm.getMID())); + jmsg = new JuickMessage(MessagesQueries.getMessage(xmpp.jdbc, recomm.getMid())); users = SubscriptionsQueries.getUsersSubscribedToUserRecommendations(xmpp.jdbc, - recomm.getUser().getUID(), recomm.getMID(), jmsg.getUser().getUID()); + recomm.getUser().getUid(), recomm.getMid(), jmsg.getUser().getUid()); - String txt = "Recommended by @" + recomm.getUser().getUName() + ":\n"; - txt += "@" + jmsg.getUser().getUName() + ":" + jmsg.getTagsString() + "\n"; + String txt = "Recommended by @" + recomm.getUser().getName() + ":\n"; + txt += "@" + jmsg.getUser().getName() + ":" + jmsg.getTagsString() + "\n"; String attachment = jmsg.getAttachmentURL(); if (attachment != null) { txt += attachment + "\n"; } txt += jmsg.getText() + "\n\n"; - txt += "#" + jmsg.getMID(); + txt += "#" + jmsg.getMid(); if (jmsg.Replies > 0) { if (jmsg.Replies % 10 == 1 && jmsg.Replies % 100 != 11) { txt += " (" + jmsg.Replies + " reply)"; @@ -236,16 +236,16 @@ public class ConnectionRouter extends Connection implements Runnable { txt += " (" + jmsg.Replies + " replies)"; } } - txt += " http://juick.com/" + jmsg.getMID(); + txt += " http://juick.com/" + jmsg.getMid(); Nickname nick = new Nickname(); - nick.Nickname = "@" + jmsg.getUser().getUName(); + nick.Nickname = "@" + jmsg.getUser().getName(); com.juick.xmpp.Message msg = new com.juick.xmpp.Message(); msg.from = xmpp.bot.getJid(); msg.body = txt; msg.type = Message.Type.chat; - msg.thread = "juick-" + jmsg.getMID(); + msg.thread = "juick-" + jmsg.getMid(); msg.addChild(jmsg); msg.addChild(nick); if (attachment != null) { @@ -255,7 +255,7 @@ public class ConnectionRouter extends Connection implements Runnable { } for (User user : users) { - for (String jid : UserQueries.getJIDsbyUID(xmpp.jdbc, user.getUID())) { + for (String jid : UserQueries.getJIDsbyUID(xmpp.jdbc, user.getUid())) { msg.to = new JID(jid); xmpp.sendOut(msg); } diff --git a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java index 7458d892..7bb1b230 100644 --- a/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java +++ b/juick-xmpp/src/main/java/com/juick/components/s2s/JuickBot.java @@ -177,8 +177,8 @@ public class JuickBot { } boolean success = false; - if (!UserQueries.isInBLAny(xmpp.jdbc, uid_to, user_from.getUID())) { - success = PMQueries.createPM(xmpp.jdbc, user_from.getUID(), uid_to, msg.body); + if (!UserQueries.isInBLAny(xmpp.jdbc, uid_to, user_from.getUid())) { + success = PMQueries.createPM(xmpp.jdbc, user_from.getUid(), uid_to, msg.body); } if (success) { @@ -201,13 +201,13 @@ public class JuickBot { Message mm = new Message(); mm.to = new JID(jid); mm.type = Message.Type.chat; - inroster = PMQueries.havePMinRoster(xmpp.jdbc, user_from.getUID(), jid); + inroster = PMQueries.havePMinRoster(xmpp.jdbc, user_from.getUid(), jid); if (inroster) { - mm.from = new JID(jmsg.getUser().getUName(), "juick.com", "Juick"); + mm.from = new JID(jmsg.getUser().getName(), "juick.com", "Juick"); mm.body = msg.body; } else { mm.from = new JID("juick", "juick.com", "Juick"); - mm.body = "Private message from @" + jmsg.getUser().getUName() + ":\n" + msg.body; + mm.body = "Private message from @" + jmsg.getUser().getName() + ":\n" + msg.body; } xmpp.sendOut(mm); } @@ -277,7 +277,7 @@ public class JuickBot { private void commandLogin(Message m, User user_from) throws Exception { Message reply = new Message(jid, m.from, Message.Type.chat); - reply.body = "http://juick.com/login?" + UserQueries.getHashByUID(xmpp.jdbc, user_from.getUID()); + reply.body = "http://juick.com/login?" + UserQueries.getHashByUID(xmpp.jdbc, user_from.getUid()); xmpp.sendOut(reply); } @@ -295,8 +295,8 @@ public class JuickBot { } if (uid_to > 0) { - if (!UserQueries.isInBLAny(xmpp.jdbc, uid_to, user_from.getUID())) { - if (PMQueries.createPM(xmpp.jdbc, user_from.getUID(), uid_to, body)) { + if (!UserQueries.isInBLAny(xmpp.jdbc, uid_to, user_from.getUid())) { + if (PMQueries.createPM(xmpp.jdbc, user_from.getUid(), uid_to, body)) { jids_to = UserQueries.getJIDsbyUID(xmpp.jdbc, uid_to); ret = 200; } else { @@ -326,13 +326,13 @@ public class JuickBot { Message mm = new Message(); mm.to = new JID(jid); mm.type = Message.Type.chat; - haveInRoster = PMQueries.havePMinRoster(xmpp.jdbc, user_from.getUID(), jid); + haveInRoster = PMQueries.havePMinRoster(xmpp.jdbc, user_from.getUid(), jid); if (haveInRoster) { - mm.from = new JID(user_from.getUName(), "juick.com", "Juick"); + mm.from = new JID(user_from.getName(), "juick.com", "Juick"); mm.body = body; } else { mm.from = new JID("juick", "juick.com", "Juick"); - mm.body = "Private message from @" + user_from.getUName() + ":\n" + body; + mm.body = "Private message from @" + user_from.getName() + ":\n" + body; } xmpp.sendOut(mm); } @@ -350,8 +350,8 @@ public class JuickBot { } private void commandBLShow(Message m, User user_from) throws Exception { - List<User> blusers = UserQueries.getUserBLUsers(xmpp.jdbc, user_from.getUID()); - List<String> bltags = TagQueries.getUserBLTags(xmpp.jdbc, user_from.getUID()); + List<User> blusers = UserQueries.getUserBLUsers(xmpp.jdbc, user_from.getUid()); + List<String> bltags = TagQueries.getUserBLTags(xmpp.jdbc, user_from.getUid()); String txt = ""; if (bltags.size() > 0) { @@ -365,7 +365,7 @@ public class JuickBot { } if (blusers.size() > 0) { for (User bluser : blusers) { - txt += "@" + bluser.getUName() + "\n"; + txt += "@" + bluser.getName() + "\n"; } } if (txt.isEmpty()) { |