1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-27 00:32:07 +01:00
Smack/build
Florian Schmaus bfefbdb777 Implement XEP-0184 delivery notifications
This patch provides three components required to implement XEP-0184:

 * DeliveryReceiptRequest is a PacketExtension to request a receipt
 * DeliveryReceipt is a PacketExtension that contains the receipt
 * DeliveryReceiptManager to handle sending/receiving of requests and
   receipts.

Implementation:

For requesting a receipt, just add a new DeliveryReceiptRequest() to
your message or use the helper function:

    DeliveryReceiptManager.addDeliveryReceiptRequest(packet);

Register a ReceiptReceivedListener to find out if your packet arrived:

    DeliveryReceiptManager.getInstanceFor(myConnection)
	.registerReceiptReceivedListener(new ReceiptReceivedListener() {
	    @Override public void onReceiptReceived(String fromJid,
				    String toJid, String receiptId) {
		// receipt received for packet id receiptId
	    }

To answer a receipt request, you can either check incoming packets
manually:

    if (DeliveryReceiptManager.hasDeliveryReceiptRequest(packet)) {
	// send receipt
    }

Or you can enable automatic receipt transmission with:

    DeliveryReceiptManager.getInstanceFor(myConnection)
	    .setAutoReceiptsEnabled(true);

Signed-Off-By: Georg Lukas <georg@op-co.de>

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@13431 b35dd754-fafc-0310-a699-88a17e54d16e
2013-02-04 09:53:56 +00:00
..
build SMACK-343 Added bnd wrap task to build to generate OSGi attributes in the manifest files. 2011-12-21 14:27:06 +00:00
eclipse Eclipse config: Disable 'save actions' 2013-01-29 22:49:07 +00:00
merge Updated XPP to 1.1.4c. SMACK-259 2008-10-31 04:03:15 +00:00
projects Intellij 8 settings? 2008-11-13 18:33:07 +00:00
resources Implement XEP-0184 delivery notifications 2013-02-04 09:53:56 +00:00
ant-contrib.jar Initial check-in. 2003-04-05 01:13:16 +00:00
asm.jar add pmd for codecheck 2009-06-04 09:56:20 +00:00
build.properties cleanup 2010-02-18 13:41:01 +00:00
build.xml build.xml: Added jar-test-smackx target and let test-unit depend on that, so that clean calls of 'ant test-unit' won't fail. 2013-01-21 11:35:56 +00:00
javassist-3.10.0.GA.jar merged branch improve_bytestreams in trunk 2010-08-15 11:57:11 +00:00
jaxen.jar add pmd for codecheck 2009-06-04 09:56:20 +00:00
junit-4.10.jar SMACK-392 Updated test targets in ant build. Fix integration tests and added target for unit tests. 2012-11-22 02:05:04 +00:00
mockito-all-1.8.2.jar merged branch improve_bytestreams in trunk 2010-08-15 11:57:11 +00:00
objenesis-1.1.jar merged branch improve_bytestreams in trunk 2010-08-15 11:57:11 +00:00
pmd.jar add pmd for codecheck 2009-06-04 09:56:20 +00:00
powermock-mockito-1.3.5-full.jar merged branch improve_bytestreams in trunk 2010-08-15 11:57:11 +00:00
README.html HTML and comment cleanup. Small API refactors. Moved use of StringBuffer to StringBuilder. 2008-11-03 16:28:57 +00:00
release.xml Build fix for release 2012-02-05 01:51:29 +00:00

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Smack Source Distribution</title>
    <style type="text/css">
        BODY {
            font-size : 100%;
        }
        BODY, TD, TH {
            font-family : tahoma, verdana, arial, helvetica, sans-serif;
            font-size : 0.8em;
        }
        A:hover {
            text-decoration : none;
        }
        TT {
            font-family : courier new, monospace;
            font-weight : bold;
            color : #060;
        }
        PRE, CODE {
            font-family : courier new, monospace;
            font-size : 100%;
        }
    </style>
</head>

<body>

<font size=4>
Smack Source Distribution<br>
</font><br>
<p>

This document provides detailed information for developers that wish to 
compile and make changes to the Smack source code.

<p>For additional developer resources, please visit: 
<a href="http://www.jivesoftware.org/smack/">
http://www.jivesoftware.org/smack/</a>. The Smack build process is based on Ant. Visit the
<a href="http://jakarta.apache.org/ant/index.html">Ant website</a>
for more information and downloads.
<p>
This documentation is divided into two sections:
<ol>
	<li> <a href="#setup">Setup</a> -- how to setup your environment for Smack development.
	<li> <a href="#tasks">Build tasks</a> -- tasks that can be performed using the build program.
</ol>

<p><a name="setup"><b><font color="#0066cc">1.</font> Setup Your Environment</b></a><p>

Getting your machine ready for Smack development requires a few steps. Wherever
possible, instructions are provided for both Unix/Linux and Windows users.
<p>
<b><a name="javaSetup">Configure Java</a></b>
<ul>
	Java 5 (JDK 1.5 or later) must be installed and setup on your machine. To test the installation,
	open a shell in a Unix or a MS-DOS prompt in Windows. Check your version of
	Java with "java -version" -- it must version 1.5 or greater.
	If Java isn't installed, download a copy from the 
	<a href="http://java.sun.com/">Java website</a>.
	<p>
	<font color="red">Important!</font> -- the Smack build tool needs to know
	where Java is installed on your system. You must configure the "JAVA_HOME"
	environment variable to point to the correct directory. Instructions on
	how to set this variable for various platforms are as follows:
	<p>
	<ul>
		<li> Unix/Linux
			<ol>
				<li>Edit the ".profile" file in your home directory (or 
					corresponding file for your shell).
				<li>Set the JAVA_HOME environment variable by adding the
					following line to the file:
					<p><code>
					export JAVA_HOME=/usr/local/jdk1.5
					</code><font face="verdana, arial, helvetica" size=2>
					<p>
					The value "/usr/local/jdk1.5" should be replaced with your actual
					Java directory. Be sure there are no spaces after the end of 
					the directory name. Do not add an extra slash after the directory name.
				<li>Save changes to the file and then "source" it:
					<p></font><code>
					source .profile
					</code><font face="verdana, arial, helvetica" size=2>
					<p>
					The JAVA_HOME variable should now be configured correctly.</font>
			</ol>
         </li>
         <p>
		<li> Windows 
			<ol>
				<li>Navigate to your desktop and right click on "My Computer";
					choose properties.
				<li>Select the "Advanced" tab and click on the 
					"Environment Variables" button.
				<li>Click the "New..." button in the System variables section.
					Enter the variable name "JAVA_HOME" and set the variable 
					value to the full path of your Java installation. For example,
					"c:\jdk1.5". Be sure to not add an extra slash to the end
					of the directory name.
				<li>Click "OK" in all of the menus to accept the changes.
				<li>Close any open command prompt windows. The next time you
					open a command prompt, the "JAVA_HOME" variable will be set
					correctly.
			</ol>
	</ul>
</ul>

<b><a name="antSetup">Configure Ant</a></b>
<ul>
Download the Ant build tool from the <a href="http://ant.apache.org">Ant website</a>. Follow
the setup instructions for your operating system.
</ul>

<p><b><a name="checkout">Test the Build Script</a></b><p>
<ul>
Navigate into the subdirectory of this distribution named "build" via the command-line.<p>

<table border=0 cellpadding=2 cellspacing=0><td bgcolor="#EEEEEE">
<font face="verdana, arial, helvetica" size=2> 
<font color="red">Linux/Unix users only:</font>You must make the ant script
executable. From the build directory, type:
<p></font><code>
chmod u+x ant
</code>
</td></table>

<p>
Now, invoke the build tool to compile the Smack source code

<p>
<font face="verdana, arial, helvetica" size=2> Windows:</font><code> ant  <br>
</code><font face="verdana, arial, helvetica" size=2>
Unix/Linux:</font><code> ./ant 
</code><font face="verdana, arial, helvetica" size=2>
<p>

If the build tool is invoked correctly and Smack compiles, you've correctly
configured your copy of the Smack developer distribution.
</font>
</ul>

<p><b>Finished!</b><p>
<ul>
If you've gotten this far, you've finished setting up the Smack developer
distribution. Now, read below to learn about all of the tasks that you can perform
with the build tool.
</ul>

<br><br>
	
<p><b><a name="tasks"><font color="#0066cc">2.</font> Build Tasks</a></b><p>

	The list of build tasks is below. All build commands should be
	run from the "build" directory of your Smack distribution.

	<br><br>

	For a list of the commands and a brief description from the command line, type
	<code>ant -projecthelp</code>. For more complete help, read the documentation below.

	<br><br>

	To execute a build task, type <code>ant [options] targetname</code> where "targetname" is
	one of the targets listed below:
	
	<ul>
        <li><a href="#noparams"><i>Default</i></a>
        <li><a href="#compile">compile</a>
        <li><a href="#jar">jar</a>
        <li><a href="#javadoc">javadoc</a>
        <li><a href="#clean">clean</a>
	</ul>
<p>
Each task is documented with a syntax guide and description. Optional paramaters 
for each task are enclosed with braces.
	
<!--COMPILE-->	
<p><b><a name="noparams"><i>Default</i></a></b>	
<ul>
<i>Syntax:</i><p>

<code>
ant<br>
</code>

<p><i>Description:</i></p>

Equivalent of calling "ant <a href="#jar">jar</a>".

<p>[<a href="#tasks">return to task list</a>]
</ul>
	
<!--COMPILE-->	
<p><b><a name="compile">compile</a></b>	
<ul>
<i>Syntax:</i><p>

<code>
ant compile <br>
</code>

<p><i>Description:</i></p>

Compiles all the Smack source code.
The build directory is the "target/classes" directory under your Smack source distribution.

<p>[<a href="#tasks">return to task list</a>]
</ul>


<!--JAR-->
<p><b><a name="jar">jar</a></b>	
<ul>
<i>Syntax:</i><p>

<code>
ant jar <br>
</code>

<p><i>Description:</i></p>

Bundles the Smack class files into a JAR file (smack.jar)
that is suitable for adding
into the classpath of an application server.
<p>[<a href="#tasks">return to task list</a>]
</ul>


<!--JAVADOC-->
<p><b><a name="javadoc">javadoc</a></b>
<ul>
<i>Syntax:</i><p>

<code>
ant javadoc <br>
</code>

<p><i>Description:</i></p>

JavaDocs all Smack source code in the source directory.

<p>[<a href="#tasks">return to task list</a>]
</ul>

<!--CLEAN-->
<p><b><a name="clean">clean</a></b>	
<ul>
<i>Syntax:</i><p>

<code>
ant clean<br>
</code>

<p><i>Description:</i></p>

Cleans your Smack distribution directory by deleting compiled class files, the
smack.jar file and Javadoc files.<p>

<p>[<a href="#tasks">return to task list</a>]
</ul>

</body>
</html>