From a5b5fe42c3ccef860ac56527dfcb79a3a0ecbfa4 Mon Sep 17 00:00:00 2001 From: Ugnich Anton Date: Mon, 27 Jan 2014 05:20:28 +0700 Subject: postPM --- src/java/com/juick/http/www/Main.java | 8 ++++ src/java/com/juick/http/www/PM.java | 84 +++++++++++++++++++++++++++++++---- 2 files changed, 83 insertions(+), 9 deletions(-) (limited to 'src/java/com/juick') diff --git a/src/java/com/juick/http/www/Main.java b/src/java/com/juick/http/www/Main.java index fa4f9850..7564664a 100644 --- a/src/java/com/juick/http/www/Main.java +++ b/src/java/com/juick/http/www/Main.java @@ -28,6 +28,7 @@ import java.sql.DriverManager; import java.sql.SQLException; import java.util.Properties; import javax.servlet.ServletException; +import javax.servlet.annotation.MultipartConfig; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; @@ -39,6 +40,7 @@ import ru.sape.Sape; * @author Ugnich Anton */ @WebServlet(name = "Main", urlPatterns = {"/"}) +@MultipartConfig public class Main extends HttpServlet implements Stream.StreamListener { Connection sql; @@ -270,6 +272,12 @@ public class Main extends HttpServlet implements Stream.StreamListener { if (uri.equals("/post")) { pagesNewMessage.doPostNewMessage(sql, request, response); } else if (uri.equals("/pm/send")) { + com.juick.User visitor = Utils.getVisitorUser(sql, request, response); + if (visitor != null) { + pm.doPostPM(sql, request, response, xmpp, visitor); + } else { + response.sendError(403); + } } else if (uri.equals("/login")) { login.doPostLogin(sql, request, response); } else if (uri.equals("/signup")) { diff --git a/src/java/com/juick/http/www/PM.java b/src/java/com/juick/http/www/PM.java index e709af6b..bc43f1ee 100644 --- a/src/java/com/juick/http/www/PM.java +++ b/src/java/com/juick/http/www/PM.java @@ -18,6 +18,11 @@ package com.juick.http.www; import com.juick.server.PMQueries; +import com.juick.server.UserQueries; +import com.juick.xmpp.JID; +import com.juick.xmpp.Message; +import com.juick.xmpp.Stream; +import com.juick.xmpp.extensions.JuickMessage; import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; @@ -76,11 +81,11 @@ public class PM { out.println("
"); out.println(" "); out.println("