1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2025-09-09 18:29:45 +02:00

Move sample/ into resources/

This commit is contained in:
Florian Schmaus 2014-03-17 23:26:48 +01:00
parent ae64b0ad4b
commit ec82f63191
18 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!-- Servlet 2.3 is required for Jive Forums 3 -->
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<display-name>Smack Client UI</display-name>
<description>Smack sample UI</description>
<!-- Welcome file list -->
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
</web-app>

View file

@ -0,0 +1,138 @@
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2002-2003 Jive Software.
-
- The Jive Software License (based on Apache Software License, Version 1.1)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by
- Jive Software (http://www.jivesoftware.com)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Smack" and "Jive Software" must not be used to
- endorse or promote products derived from this software without
- prior written permission. For written permission, please
- contact webmaster@jivesoftware.com.
-
- 5. Products derived from this software may not be called "Smack",
- nor may "Smack" appear in their name, without prior written
- permission of Jive Software.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
--%>
<%@ page import="java.util.*,
org.jivesoftware.smack.*,
org.jivesoftware.smack.packet.*,
org.jivesoftware.smack.util.*"%>
<%@ include file="global.jsp" %>
<%
// If we don't have a valid connection then proceed to login
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
if (conn == null || !conn.isConnected()) {
response.sendRedirect("login.jsp");
return;
}
Roster roster = conn.getRoster();
// Get parameters
String user = getParameter(request, "user");
String nickname = getParameter(request, "nickname");
String group1 = getParameter(request, "group1");
String group2 = getParameter(request, "group2");
// Create a new entry in the roster that belongs to a certain groups
if (user != null) {
roster.createEntry(user, nickname, new String[] {group1, group2});
response.sendRedirect("viewRoster.jsp");
return;
}
%>
<html>
<head>
<title>Add Contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/general.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0">
<tr>
<td><span id="bigBlack">Add contact to roster</span></td>
<td align="right"><a href="viewRoster.jsp"><img src="images/address_book.png" alt="View roster" border="0"></a></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0">
<tr>
<td width="20%">&nbsp;</td>
<td width="60%"> <table cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<tr bgcolor="#AAAAAA">
<td class=text id=bigWhite height=16 align="center"> <b>Contact
Information</b> </td>
</tr>
<tr>
<td align="center"> <table width="100%" border="0">
<form method="post" action="addContact.jsp">
<tr>
<td class=text id=black height=16>Username:</td>
<td><input type="text" name="user"> &nbsp;<span class=text id=black height=16>(e.g.
johndoe@jabber.org)</span></td>
</tr>
<tr>
<td class=text id=black height=16>Nickname:</td>
<td><input type="text" name="nickname"></td>
</tr>
<tr>
<td class=text id=black height=16>Group 1:</td>
<td><input type="text" name="group1" value="<%= (group1!=null)?group1:"" %>"></td>
</tr>
<tr>
<td class=text id=black height=16>Group 2:</td>
<td><input type="text" name="group2"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td colspan=2 align="center"> <input type="submit" value="Add Contact"></td>
</tr>
</form>
</table></td>
</tr>
</table></td>
<td width="20%">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,60 @@
<%--
- $$RCSfile$$
- $$Revision$$
- $$Date$$
-
- Copyright (C) 2002-2003 Jive Software.
-
- The Jive Software License (based on Apache Software License, Version 1.1)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by
- Jive Software (http://www.jivesoftware.com)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Smack" and "Jive Software" must not be used to
- endorse or promote products derived from this software without
- prior written permission. For written permission, please
- contact webmaster@jivesoftware.com.
-
- 5. Products derived from this software may not be called "Smack",
- nor may "Smack" appear in their name, without prior written
- permission of Jive Software.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
--%>
<html>
<head>
<title>Chat with contact</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/general.css" rel="stylesheet" type="text/css">
</head>
<body>
Not implemented yet! <a href="viewRoster.jsp"><img src="images/address_book.png" alt="View roster" border="0"></a>
</body>
</html>

View file

@ -0,0 +1,36 @@
BODY
{
FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;
FONT-SIZE: 10px;
margin-left: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-top: 0px;
background-color: #FFFFFF;
}
.text {
FONT-FAMILY: Verdana, Geneva, Arial, Helvetica, sans-serif;
FONT-SIZE: 10px;
}
input,textarea,select
{
font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;
font-size: 10px;
}
#black {
color: #000000;
font-weight: BOLD;
}
#white {
color: FFFFFF;
font-weight: BOLD;
}
#bigWhite {
color: FFFFFF;
font-weight: BOLD;
font-size: 14px;
}
#bigBlack {
font-weight: BOLD;
font-size: 18px;
}

View file

@ -0,0 +1,66 @@
<%--
- $$RCSfile$$
- $$Revision$$
- $$Date$$
-
- Copyright (C) 2002-2003 Jive Software.
-
- The Jive Software License (based on Apache Software License, Version 1.1)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by
- Jive Software (http://www.jivesoftware.com)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Smack" and "Jive Software" must not be used to
- endorse or promote products derived from this software without
- prior written permission. For written permission, please
- contact webmaster@jivesoftware.com.
-
- 5. Products derived from this software may not be called "Smack",
- nor may "Smack" appear in their name, without prior written
- permission of Jive Software.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
--%>
<%!
public static String getParameter(HttpServletRequest request, String name)
{
String temp = request.getParameter(name);
if (temp != null) {
if (temp.equals("")) {
return null;
}
else {
return temp;
}
}
else {
return null;
}
}
%>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 761 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 790 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 905 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 756 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,53 @@
<%--
- $$RCSfile$$
- $$Revision$$
- $$Date$$
-
- Copyright (C) 2002-2003 Jive Software.
-
- The Jive Software License (based on Apache Software License, Version 1.1)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by
- Jive Software (http://www.jivesoftware.com)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Smack" and "Jive Software" must not be used to
- endorse or promote products derived from this software without
- prior written permission. For written permission, please
- contact webmaster@jivesoftware.com.
-
- 5. Products derived from this software may not be called "Smack",
- nor may "Smack" appear in their name, without prior written
- permission of Jive Software.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
--%>
<% response.sendRedirect("login.jsp");
return;
%>

View file

@ -0,0 +1,192 @@
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2002-2003 Jive Software.
-
- The Jive Software License (based on Apache Software License, Version 1.1)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by
- Jive Software (http://www.jivesoftware.com)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Smack" and "Jive Software" must not be used to
- endorse or promote products derived from this software without
- prior written permission. For written permission, please
- contact webmaster@jivesoftware.com.
-
- 5. Products derived from this software may not be called "Smack",
- nor may "Smack" appear in their name, without prior written
- permission of Jive Software.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
--%>
<%@ page import="org.jivesoftware.smack.*"%>
<%@ include file="global.jsp" %>
<%
// If we already got a connection then proceed to view the roster
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
if (conn != null && conn.isConnected()) {
response.sendRedirect("viewRoster.jsp");
return;
}
// Get parameters
String host = getParameter(request, "host");
String port = getParameter(request, "port");
String ssl = getParameter(request, "ssl");
String debug = getParameter(request, "debug");
String username = getParameter(request, "username");
String password = getParameter(request, "password");
String resource = getParameter(request, "resource");
String error = getParameter(request, "error");
// Try to connect to the server
if (error == null && host != null && port != null) {
TCPConnection.DEBUG_ENABLED = "Yes".equals(debug);
try {
if ("No".equals(ssl)) {
conn = new TCPConnection(host);
}
else {
conn = new TCPConnection(host);
}
conn.connect();
// Add listener for messages (offline messages will be listen here)
// Set the roster subscription mode to use
// Login to the server
conn.login(username, password, resource);
session.setAttribute("connection", conn);
}
catch (Exception e) {
error = e.getMessage();
// Replace any char : because otherwise the URL will get corrupted
error = error.replace(':', '-');
response.sendRedirect("login.jsp?host="+host+"&port="+port+"&ssl="+ssl+"&error="+error);
return;
}
// Redirect to the next page
response.sendRedirect("viewRoster.jsp");
return;
}
%>
<html>
<head>
<title>Login</title>
<link href="css/general.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0">
<tr>
<td><span id="bigBlack">Smack Demo Application</span></td>
</tr>
<tr>
<td align="center">
<% if (error != null) { %>
<p><font color="#FF0000"><%= error %></font></p>
<%} else {%>
&nbsp;
<%}%>
</td>
</tr>
<tr>
<td><table width="100%" border="0">
<tr>
<td width="20%">&nbsp;</td>
<td width="60%"> <table cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<tr bgcolor="#AAAAAA">
<td class=text id=bigWhite height=16 align="center"> <b>Login
Information</b> </td>
</tr>
<tr>
<td><form action="login.jsp" method="post">
<table width=100% border=0>
<tr>
<td class=text id=black height=16>Host:</td>
<td><input type="text" name="host" size="30" maxlength="50" value="<%= (host!=null)?host:"" %>"></td>
</tr>
<tr>
<td class=text id=black height=16>Port:</td>
<td><input type="text" name="port" size="5" maxlength="10" value="<%= (port!=null)?port:"5222" %>"></td>
</tr>
<tr>
<td class=text id=black height=16>Use SSL:</td>
<td><select size="1" name="ssl">
<option <%= ("No".equals(ssl))?"selected":""%>>No</option>
<option <%= ("Yes".equals(ssl))?"selected":""%>>Yes</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class=text id=black height=16>Debug XMPPConnection:</td>
<td><select size="1" name="debug">
<option <%= ("No".equals(debug))?"selected":""%>>No</option>
<option <%= ("Yes".equals(debug))?"selected":""%>>Yes</option>
</select></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td class=text id=black height=16>Username:</td>
<td><input type="text" name="username" size="30" maxlength="50" value="<%= (username!=null)?username:"" %>"></td>
</tr>
<tr>
<td class=text id=black height=16>Password:</td>
<td><input type="password" name="password" size="30" maxlength="50" value="<%= (password!=null)?password:"" %>"></td>
</tr>
<tr>
<td class=text id=black height=16>Resource:</td>
<td><input type="text" name="resource" size="30" maxlength="50" value="<%= (resource!=null)?resource:"" %>"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr align="center">
<td colspan="2"> <input type="submit" value="Login"> </td>
</tr>
</table></form></td>
</tr>
</table></td>
<td width="20%">&nbsp;</td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,208 @@
<%--
- $RCSfile$
- $Revision$
- $Date$
-
- Copyright (C) 2002-2003 Jive Software.
-
- The Jive Software License (based on Apache Software License, Version 1.1)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by
- Jive Software (http://www.jivesoftware.com)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Smack" and "Jive Software" must not be used to
- endorse or promote products derived from this software without
- prior written permission. For written permission, please
- contact webmaster@jivesoftware.com.
-
- 5. Products derived from this software may not be called "Smack",
- nor may "Smack" appear in their name, without prior written
- permission of Jive Software.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
--%>
<%@ page import="java.util.*,
org.jivesoftware.smack.*,
org.jivesoftware.smack.packet.*,
org.jivesoftware.smack.util.*"%>
<%@ include file="global.jsp" %>
<%
// If we don't have a valid connection then proceed to login
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
if (conn == null || !conn.isConnected()) {
response.sendRedirect("login.jsp");
return;
}
Roster roster = conn.getRoster();
// Get parameters
String action = getParameter(request, "action");
String user = getParameter(request, "user");
String fromGroup = getParameter(request, "fromGroup");
String toGroup = getParameter(request, "toGroup");
// Move the entry from the existing group to a new group
if ("move".equals(action)) {
RosterEntry entry = roster.getEntry(user);
// Remove the entry from the existing group
RosterGroup rosterGroup = roster.getGroup(fromGroup);
rosterGroup.removeEntry(entry);
// Get the new group or create it if it doesn't exist
rosterGroup = roster.getGroup(toGroup);
if (rosterGroup == null) {
rosterGroup = roster.createGroup(toGroup);
}
// Add the new entry to the group
rosterGroup.addEntry(entry);
response.sendRedirect("viewRoster.jsp");
return;
}
// Add the entry to a new group
if ("add".equals(action)) {
RosterEntry entry = roster.getEntry(user);
// Get the new group or create it if it doesn't exist
RosterGroup rosterGroup = roster.getGroup(toGroup);
if (rosterGroup == null) {
rosterGroup = roster.createGroup(toGroup);
}
// Add the new entry to the group
rosterGroup.addEntry(entry);
response.sendRedirect("viewRoster.jsp");
return;
}
// Delete the entry from a group
if ("delete".equals(action)) {
RosterEntry entry = roster.getEntry(user);
RosterGroup rosterGroup = roster.getGroup(fromGroup);
rosterGroup.removeEntry(entry);
response.sendRedirect("viewRoster.jsp");
return;
}
%>
<html>
<head>
<title>Groups Management</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/general.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0">
<tr>
<td><span id="bigBlack">Groups for entry: <%= user%></span></td>
<td align="right"><a href="viewRoster.jsp"><img src="images/address_book.png" alt="View roster" border="0"></a></td>
</tr>
<tr>
<td colspan="2">&nbsp;</td>
</tr><tr><td colspan="2">
<table width="100%" border="0"><tr>
<td valign="top" width="48%"><table cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<tr bgcolor="#AAAAAA">
<td class=text id=bigWhite height=16 align="center"> <b>Add to new group</b>
</td>
</tr>
<tr>
<td> <table width="100%" border="0">
<form method="post" action="moveContact.jsp">
<input type="hidden" name="action" value="add">
<input type="hidden" name="user" value="<%= user%>">
<tr>
<td width="40%" height=16 align="center" class=text>Group:</td>
<td width="20%">&nbsp;</td>
<td width="40%" align="center"><input type="text" name="toGroup"></td>
</tr>
<tr>
<td colspan=3 align="center"> <input type="submit" value="Add"></td>
</tr>
</form>
</table></td>
</tr>
</table></td>
<td width="4%">&nbsp;</td><td valign="top" width="48%">
<table cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<tr bgcolor="#AAAAAA">
<td colspan="3" class=text id=bigWhite height=16 align="center"> <b>Move
to new group</b> </td>
</tr>
<tr vAlign=center align=middle bgcolor="#AAAAAA">
<td align="center" width="40%" class=text id=white height=16>From</td>
<td width="20%">&nbsp;</td>
<td align="center" width="40%" class=text id=white height=16>To</td>
</tr>
<% if (fromGroup != null) { %>
<form method="post" action="moveContact.jsp">
<input type="hidden" name="action" value="move">
<input type="hidden" name="user" value="<%= user%>">
<input type="hidden" name="fromGroup" value="<%= fromGroup%>">
<tr>
<td colspan="3"> <table width="100%" border="0">
<tr>
<td width="40%" align="center" valign="middle" class=text height=16><%=fromGroup%></td>
<td width="20%" align="center" valign="middle"><img src="images/nav_right_blue.png" alt="Move contact to group" border="0"></td>
<td width="40%" align="center" valign="middle"> <input type="text" name="toGroup">
</tr>
<tr>
<td colspan="3" align="center"> <input type="submit" value="Move">
</tr>
</table></td>
</tr>
</form>
<% } else { %>
<tr>
<td colspan="3" align="center" class=text id=black height=16>Entry does
not belong to a group (unfiled entry) </td>
</tr>
<% } %>
</table></td></tr>
<tr>
<td colspan="3">&nbsp;</td>
</tr>
<tr>
<td colspan="3" align="center"> <table cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=50% align=center borderColorLight=#000000 border=1>
<tr bgcolor="#AAAAAA">
<td colspan="2" class=text id=bigWhite height=16 align="center"> <b>Remove
from groups</b> </td>
</tr>
<%
RosterEntry entry = roster.getEntry(user);
RosterGroup group;
for (Iterator<RosterGroup> it=entry.getGroups().iterator(); it.hasNext();) {
group = it.next();%>
<tr>
<td align="center" width="80%" class=text height=16><%=group.getName()%></td>
<td valign="middle" align="center" width="20%"><a href="moveContact.jsp?action=delete&user=<%=user%>&fromGroup=<%=group.getName()%>"><img src="images/garbage.png" alt="Remove contact from the group" border="0"></a></td>
</tr>
<% } %>
</table></td>
</tr>
</table></td></tr>
</table>
</body>
</html>

View file

@ -0,0 +1,230 @@
<%--
- $$RCSfile$$
- $$Revision$$
- $$Date$$
-
- Copyright (C) 2002-2003 Jive Software.
-
- The Jive Software License (based on Apache Software License, Version 1.1)
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
-
- 1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
- 3. The end-user documentation included with the redistribution,
- if any, must include the following acknowledgment:
- "This product includes software developed by
- Jive Software (http://www.jivesoftware.com)."
- Alternately, this acknowledgment may appear in the software itself,
- if and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Smack" and "Jive Software" must not be used to
- endorse or promote products derived from this software without
- prior written permission. For written permission, please
- contact webmaster@jivesoftware.com.
-
- 5. Products derived from this software may not be called "Smack",
- nor may "Smack" appear in their name, without prior written
- permission of Jive Software.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
- WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL JIVE SOFTWARE OR
- ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- SUCH DAMAGE.
--%>
<%@ page import="java.util.*,
org.jivesoftware.smack.*,
org.jivesoftware.smack.packet.*,
org.jivesoftware.smack.util.*"%>
<%@ include file="global.jsp" %>
<%
// If we don't have a valid connection then proceed to login
TCPConnection conn = (XMPPConnection) session.getAttribute("connection");
if (conn == null || !conn.isConnected()) {
response.sendRedirect("login.jsp");
return;
}
Roster roster = conn.getRoster();
// Get parameters
String action = getParameter(request, "action");
String user = getParameter(request, "user");
String groupName = getParameter(request, "group");
// Remove the selected user from the roster (and all the groups)
if ("rosterDelete".equals(action)) {
RosterEntry entry = roster.getEntry(user);
roster.removeEntry(entry);
response.sendRedirect("viewRoster.jsp");
return;
}
// Remove the selected user from the selected group
if ("groupDelete".equals(action)) {
RosterEntry entry = roster.getEntry(user);
RosterGroup rosterGroup = roster.getGroup(groupName);
rosterGroup.removeEntry(entry);
response.sendRedirect("viewRoster.jsp");
return;
}
// Close the connection to the XMPP server
if ("close".equals(action)) {
conn.disconnect();
session.invalidate();
response.sendRedirect("login.jsp");
return;
}
%>
<html>
<head>
<title>Viewing roster</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="css/general.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0">
<tr>
<td width="50%"><span id="bigBlack"><%= StringUtils.parseName(conn.getUser())%>'s roster</span></td>
<td width="50%"><table width="100%" border="0">
<tr>
<td>&nbsp;</td>
<td width="24"><a href="viewRoster.jsp"><img src="images/refresh.png" alt="Refresh roster" border="0"></a></td>
<td width="24"><a href="viewRoster.jsp?action=close"><img src="images/plug_delete.png" alt="Close connection" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td colspan="2"><table width="100%" border="0">
<tr>
<td width="49%" valign="top"> <TABLE cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<tr bgcolor="#AAAAAA">
<td class=text id=bigWhite height=16 align="center"> <b>Roster entries</b> </td>
</tr>
<tr>
<td> <TABLE cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<% for (Iterator<RosterGroup> groups = roster.getGroups().iterator(); groups.hasNext();) {
RosterGroup group = groups.next();%>
<tr>
<td bgcolor="#AAAAAA" colspan="6" class=text id=white height=16>Group:
<%= group.getName()%></td>
</tr>
<TR vAlign=center align=middle bgcolor="#AAAAAA">
<TD class=text id=white height=16>User</TD>
<TD class=text id=white height=16>Name</TD>
<TD class=text id=white height=16>Subscription</TD>
<TD colspan="3" class=text id=white height=16><a href="addContact.jsp?group1=<%=group.getName()%>"><img src="images/businessman_add.png" alt="Add contact to group" border="0"></a></TD>
</TR>
<% for (Iterator<RosterEntry> it = group.getEntries().iterator(); it.hasNext();) {
RosterEntry entry = it.next();%>
<TR vAlign=center align=middle bgColor=#ffffff>
<TD class=text height=16><%= entry.getUser()%></TD>
<TD class=text height=16><%= entry.getName()%></TD>
<TD class=text height=16><%= entry.getType()%></TD>
<TD class=text height=16><a href="moveContact.jsp?user=<%=entry.getUser()%>&fromGroup=<%=group.getName()%>"><img src="images/businessmen.png" alt="Groups management" border="0"></a></TD>
<TD class=text height=16><a href="viewRoster.jsp?action=groupDelete&user=<%=entry.getUser()%>&group=<%=group.getName()%>"><img src="images/businessman_delete.png" alt="Remove contact from the group" border="0"></a></TD>
<TD class=text height=16><a href="viewRoster.jsp?action=rosterDelete&user=<%=entry.getUser()%>"><img src="images/garbage.png" alt="Remove contact from the roster" border="0"></a></TD>
</TR>
<% }%>
<% }%>
<tr>
<td bgcolor="#AAAAAA" colspan="6" class=text id=white height=16>Unfiled
entries</td>
</tr>
<TR vAlign=center align=middle bgcolor="#AAAAAA">
<TD class=text id=white height=16>User</TD>
<TD class=text id=white height=16>Name</TD>
<TD class=text id=white height=16>Subscription</TD>
<TD colspan="3" class=text id=white height=16><a href="addContact.jsp"><img src="images/businessman_add.png" alt="Add contact" border="0"></a></TD>
</TR>
<% for (Iterator<RosterEntry> it = roster.getUnfiledEntries().iterator(); it.hasNext();) {
RosterEntry entry = it.next();%>
<tr vAlign=center align=middle bgColor=#ffffff>
<td class=text height=16><%= entry.getUser()%></td>
<td class=text height=16><%= entry.getName()%></td>
<td class=text height=16><%= entry.getType()%></td>
<TD class=text height=16><a href="moveContact.jsp?user=<%=entry.getUser()%>"><img src="images/businessmen.png" alt="Groups management" border="0"></a></td>
<TD class=text height=16>&nbsp;</TD>
<TD class=text height=16><a href="viewRoster.jsp?action=rosterDelete&user=<%=entry.getUser()%>"><img src="images/garbage.png" alt="Remove contact from roster" border="0"></a></td>
</tr>
<% }%>
</table></td>
</tr>
</table></td>
<td width="2%" valign="top">&nbsp;</td>
<td width="49%" valign="top"> <TABLE cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<tr bgcolor="#AAAAAA">
<td class=text id=bigWhite height=16 align="center"> <b>Presences</b>
</td>
</tr>
<tr>
<td> <TABLE cellSpacing=0 borderColorDark=#E0E0E0 cellPadding=0 width=100% align=center borderColorLight=#000000 border=1>
<tr>
<td bgcolor="#AAAAAA" colspan="5" class=text id=white height=16>Roster´s presences</td>
</tr>
<TR vAlign=center align=middle bgcolor="#AAAAAA">
<TD class=text id=white height=16>User</TD>
<TD class=text id=white height=16>Mode</TD>
<TD class=text id=white height=16>Type</TD>
<TD class=text id=white height=16>&nbsp;</TD>
</TR>
<% for (Iterator<RosterEntry> entries = roster.getEntries().iterator(); entries.hasNext();) {
RosterEntry entry = entries.next();
Iterator presences = roster.getPresences(entry.getUser());
if (presences != null) {
while (presences.hasNext()) {
Presence presence = (Presence)presences.next(); %>
<TR vAlign=center align=middle bgColor=#ffffff>
<TD class=text height=16><%= presence.getFrom()%></TD>
<TD class=text height=16><%= presence.getMode()%></TD>
<TD class=text height=16><%= presence.getType()%></TD>
<TD class=text height=16><a href="chat.jsp?user=<%=presence.getFrom()%>"><img src="images/messages.png" alt="Chat" border="0"></a></a></TD>
</TR>
<% }%>
<% }%>
<% }%>
<tr>
<td bgcolor="#AAAAAA" colspan="5" class=text id=white height=16>My other resources</td>
</tr>
<TR vAlign=center align=middle bgcolor="#AAAAAA">
<TD class=text id=white height=16>User</TD>
<TD class=text id=white height=16>Mode</TD>
<TD class=text id=white height=16>Type</TD>
<TD class=text id=white height=16>&nbsp;</TD>
</TR>
<% // Show other presences of the current user
Iterator presences = roster.getPresences(conn.getUser());
if (presences != null) {
while (presences.hasNext()) {
Presence presence = (Presence)presences.next(); %>
<tr vAlign=center align=middle bgColor=#ffffff>
<TD class=text height=16><%= presence.getFrom()%></TD>
<TD class=text height=16><%= presence.getMode()%></TD>
<TD class=text height=16><%= presence.getType()%></TD>
<TD class=text height=16><a href="chat.jsp?user=<%=presence.getFrom()%>"><img src="images/messages.png" alt="Chat" border="0"></a></a></TD>
</tr>
<% }%>
<% }%>
</table></td>
</tr>
</table></tr>
</table></td>
</tr>
</table>
</body>
</html>