openfire插件开发-简单插件

xiaoxiao2021-02-28  126

openfire插件开发-简单插件

标签: openfirejava   32人阅读  评论(0)  收藏  举报   分类: openfire(13) 

1.点击项目反键,新建source folder,并建相应的插件包org.jivesoftware.openfire.plugin

2.建完后在src/plugins下面会出现example文件夹,并按照如下目录新建对应的文件:

3.文件介绍

ExamplePlugin.Java

[java]  view plain  copy public class ExamplePlugin implements PacketInterceptor, Plugin {          private static PluginManager pluginManager;       private InterceptorManager interceptoerManager;       private String domain = JiveProperties.getInstance().get("xmpp.domain");                     public ExamplePlugin() {           interceptoerManager = InterceptorManager.getInstance();       }          @Override       public void initializePlugin(PluginManager manager, File pluginDirectory) {           pluginManager = manager;                       interceptoerManager.addInterceptor(this);           System.out.println("Exampple add success");           System.out.println("domain = " + domain);       }          @Override       public void destroyPlugin() {           interceptoerManager.removeInterceptor(this);           System.out.println("Exampple destroy success");       }   }  

plugin.xml

[html]  view plain  copy <plugin>       <class>org.jivesoftware.openfire.plugin.ExamplePlugin</class>       <name>Example</name>       <description>Example messages to users.</description>       <author>Jive Software</author>       <version>1.9.0</version>       <date>9/13/2013</date>       <url>http://www.igniterealtime.org</url>       <minServerVersion>3.9.0</minServerVersion>       </plugin>  

4.运行后如图

转载请注明原文地址: https://www.6miu.com/read-31190.html

最新回复(0)