- 注册时间
- 2011-3-22
- 最后登录
- 2013-6-27
- 在线时间
- 11644 小时
- 阅读权限
- 150
- 积分
- 62779
- 帖子
- 28923
- 精华
- 1
- UID
- 6
|
- Example:
-
- Re: How to register Plugin as IQHandler?
-
- public class AddressbookPlugin implements Plugin{
-
-
- public AddressbookPlugin() {
- IQHandler iqAddressbookHandler = new IQAddressbookHandler();
- IQRouter iqRouter = XMPPServer.getInstance().getIQRouter();
- iqRouter.addHandler(iqAddressbookHandler);
- }
-
- public void initializePlugin(PluginManager manager, File pluginDirectory) {
- }
-
- public void destroyPlugin() {
- }
-
- }
-
- protected class IQAddressbookHandler extends IQHandler {
- public IQAddressbookHandler () {
- super("Addressbook Handler");
- }
- /* (non-Javadoc)
-
- @see org.jivesoftware.wildfire.handler.IQHandler#getInfo()
- */
- public IQHandlerInfo getInfo() {
- // TODO Auto-generated method stub
- return new IQHandlerInfo("query","http://www.hupoo.net/protocol/addressbook");
- }
- /* (non-Javadoc)
-
- @see org.jivesoftware.wildfire.handler.IQHandler#handleIQ(org.xmpp.packet.IQ)
- */
- public IQ handleIQ(IQ packet) throws UnauthorizedException {
- System.out.println("pa: "+packet);
- return null;
- }
-
- }
复制代码 |
|