");
out.println("
");
+ out.println("
");
+
if (!msgs.isEmpty()) {
out.println("
");
for (int i = msgs.size() - 1; i >= 0; i--) {
@@ -161,11 +179,6 @@ public class PM {
out.println(" ");
out.println(" ");
out.println(" " + txt + "
");
- /*
- out.println("
");
- */
out.println("
");
out.println(" ");
}
@@ -203,4 +216,57 @@ public class PM {
out.close();
}
}
+
+ public void doPostPM(Connection sql, HttpServletRequest request, HttpServletResponse response, Stream xmpp, com.juick.User visitor) throws ServletException, IOException {
+ String uname = request.getParameter("uname");
+ int uid = 0;
+ if (UserQueries.checkUserNameValid(uname)) {
+ uid = UserQueries.getUIDbyName(sql, uname);
+ }
+
+ String body = request.getParameter("body");
+ if (uid == 0 || body == null || body.length() < 1 || body.length() > 10240) {
+ response.sendError(400);
+ return;
+ }
+
+ if (UserQueries.isInBLAny(sql, uid, visitor.UID)) {
+ response.sendError(403);
+ return;
+ }
+
+ if (PMQueries.createPM(sql, visitor.UID, uid, body)) {
+ Message msg = new Message();
+ msg.from = new JID("juick", "juick.com", null);
+ msg.to = new JID(Integer.toString(uid), "push.juick.com", null);
+ JuickMessage jmsg = new JuickMessage();
+ jmsg.User = UserQueries.getUserByUID(sql, visitor.UID);
+ jmsg.Text = body;
+ msg.childs.add(jmsg);
+ xmpp.send(msg);
+
+ msg.to.Host = "ws.juick.com";
+ xmpp.send(msg);
+
+ String jid = UserQueries.getJIDbyUID(sql, uid);
+ if (jid != null) {
+ Message mm = new Message();
+ mm.to = new JID(jid);
+ mm.type = Message.Type.chat;
+ if (PMQueries.havePMinRoster(sql, visitor.UID, jid)) {
+ mm.from = new JID(jmsg.User.UName, "juick.com", "Juick");
+ mm.body = body;
+ } else {
+ mm.from = new JID("juick", "juick.com", "Juick");
+ mm.body = "Private message from @" + jmsg.User.UName + ":\n" + body;
+ }
+ xmpp.send(mm);
+ }
+
+ Utils.sendTemporaryRedirect(response, "/pm/sent");
+
+ } else {
+ response.sendError(500);
+ }
+ }
}
diff --git a/web/scripts3.js b/web/scripts3.js
index a8630b7e..b71eef16 100644
--- a/web/scripts3.js
+++ b/web/scripts3.js
@@ -822,6 +822,17 @@ $(document).ready(function() {
$(this).off('click');
});
+ var pmreply=$('textarea.replypm');
+ pmreply.autoResize({
+ extraSpace: 0,
+ minHeight: 1
+ });
+ pmreply.click(function () {
+ $(this).addClass("narrowpm");
+ $(this).parent().after('
');
+ $(this).off('click');
+ });
+
if(!!$('#column').offset()) {
var stickyTop = $('#column').offset().top;
$(window).scroll(function() {
diff --git a/web/style3.css b/web/style3.css
index c23d2c1d..888c7313 100644
--- a/web/style3.css
+++ b/web/style3.css
@@ -65,6 +65,7 @@ pre { white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap;
.ta-wrapper { display: inline-block; border: 1px solid #DDD; }
.msg-comment textarea { width: 506px; padding: 2px; resize: vertical; vertical-align: top; min-height: 12pt; height: 12pt; border: 0; }
.msg-comment .narrow { width: 425px; }
+.msg-comment .narrowpm { width: 450px; }
.attach-photo { display: inline-block; padding: 2px 4px; cursor: pointer; width: 16px; height: 13px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAQAAAAKsiavAAAAAXNSR0IArs4c6QAAAKRJREFUGNNjZICC6Q5M+xlQwD/HzAMMDEwwLnM9AxqAiDDO/M+AFzCh8B4zhrDwsfAxBjHcggkhm/CY2SDlHYQ5TZD5EoMMmgmMhSnvZnrPfDLzyQyvrPf/CzGs+L2TgYFhBoM0gzTjDAaGX7uwuQG/I1ldGRj+pzM8YXjMmMrAwOGK6cibfy2z3sMdeYpBBTMcHjMU/9zJzsjo8r8DIk1yQGEBAFzpL+AuTCqZAAAAAElFTkSuQmCC") no-repeat 3px 4px; }
.attach-photo-active { display: inline-block; padding: 2px 4px; cursor: pointer; width: 16px; height: 13px; background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAANCAMAAACXZR4WAAAAAXNSR0IArs4c6QAAAEVQTFRFAAAAAJUAAJ0AAJIAAJkAAJYAAJwAAJcAAJoAAJgAAJkAAJoAAJoAAJgAAJkAAJoAAJkAAJkAAJkAAJkAAJkAAJkAAJkA9z3GXQAAABZ0Uk5TAAwNDg8REkBHSktRU1RVv9jZ2+Lj5OeV7PgAAABSSURBVAhbdcjBFkAgFADRIUlE9Or9/6daUC0cs5pzAXD65niKFSJQv/aChHHcrg4yA9jcILCW4tkbDGRVwfzDhs+yEBqcFsCmBiqHmULSDr0P3JdgDbuscEckAAAAAElFTkSuQmCC") no-repeat 3px 4px; }
.msg-comment input { width: 50px; margin-left: 6px; vertical-align: top; border: 1px solid #CCC; background: #EEE; color: #999; }
@@ -104,6 +105,10 @@ blockquote { border-left: 1px dashed #CCC; margin: 10px 0 10px 10px; padding-lef
#pmreplytext { border: 1px solid #999; padding: 4px 5px; width: 515px; margin: 15px 5px 15px 0; }
#pmreplybutton { border: 1px solid #999; padding: 3px 0; width: 35px; background: #CCCCC5}
+.newpm { margin: 20px 60px 30px 60px; }
+.newpm textarea { width: 100%; resize: vertical; }
+.newpm-send input { width: 100px; }
+
/********/
#column { width: 230px; top: 0; padding-top: 10px; overflow: hidden; }
--
cgit v1.2.3