mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Make title optional. Trim title, sel if the message is too long.
This commit is contained in:
@@ -71,11 +71,21 @@ public class SendServlet extends HttpServlet {
|
||||
|
||||
String url = req.getParameter("url");
|
||||
String title = req.getParameter("title");
|
||||
if (url == null || title == null) {
|
||||
if (url == null) {
|
||||
resp.setStatus(400);
|
||||
resp.getWriter().println(ERROR_STATUS + " (Must specify url and title parameters)");
|
||||
return;
|
||||
}
|
||||
if (title == null || url.length() + title.length() + sel.length() >
|
||||
1000) {
|
||||
// Shorten the title - C2DM has a 1024 limit, some padding for keys
|
||||
title = ""; // any better default ?
|
||||
if (url.length() + sel.length() > 1000) {
|
||||
sel = "";
|
||||
}
|
||||
// TODO: when we have history, save the url/title/sel in the history
|
||||
// and send a pointer, have device fetch it.
|
||||
}
|
||||
|
||||
String deviceId = req.getParameter("deviceId");
|
||||
String deviceName = req.getParameter("deviceName");
|
||||
|
||||
Reference in New Issue
Block a user