Four Methods for openfire plug-in development

Source: Internet
Author: User
The openfire plug-in can access all openfire APIs. This provides great flexibility for our plug-in implementation. The following provides four commonly used plug-in integration methods. 1. Register a plugin as a component. Components can receive all packages of a specific sub-domain. For example, test_componet.example.com. Therefore, a packet sent to the joe@test_componet.example.com will be forwarded to this componet.2, register a plugin as an iqhandler. The name or namespace of a specific element in the IQ handlers package. The following code registers an iqhandler. iqhandler myhandler = new myiqhander ();
Iqrouter = xmppserver. getinstance (). getiqrouter ();
Iqrouter. addhandler (myhandler); 3. Register a plugin as a packetinterceptor. This method can receive all packets transmitted by the system and discard them as needed. For example, an interceptor can intercept and discard all messages containing unhealthy information, or report them to the system administrator. 4. Use the jiveglobals. getproperty (string) and jiveglobals. setproperty (string, string) Methods to set our plug-in as a global attribute of openfire. By implementing the org. jivesoftware. util. propertyeventlistener method, we can make our plug-in an attribute listener to listen to any attribute changes. You can use the propertyeventdispatcher. addlistener (propertyeventlistener) method to register a listener. Note that the registered listener must be logged out in the destroyplugin () method.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.