tigase增加离线消息和保存历史记录
2014-11-12 16:51
357 查看
http://www.verydemo.com/article_c81_i83197.html
init.properties增加配置
--comp-name-1=message-archive --comp-class-1=tigase.archive.MessageArchiveComponent message-archive/archive-repo-uri=jdbc:mysql://192.168.1.15:3306/tigasedb?user=tigase&password=tigase&useUnicode=true&characterEncoding=UTF-8 --sm-plugins=+message-archive-xep-0136 sess-man/plugins-conf/message-archive-xep-0136/component-jid=message-archive@s3-1 sess-man/plugins-conf/message-archive-xep-0136/default-store-method=body sess-man/plugins-conf/message-archive-xep-0136/required-store-method=body
历史记录全部保存,和记录类型指定为body,修改类MessageArchivePlugin
//~--- get methods ---------------------------------------------------------- private boolean getAutoSave(final XMPPResourceConnection session) throws NotAuthorizedException { /** comment by guahao if (requiredStoreMethod != StoreMethod.False) return true; Boolean auto = (Boolean) session.getCommonSessionData(ID + "/" + AUTO); if (auto == null) { try { String data = session.getData(SETTINGS, AUTO, "false"); auto = Boolean.parseBoolean(data); session.putCommonSessionData(ID + "/" + AUTO, auto); } catch (TigaseDBException ex) { log.log(Level.WARNING, "Error getting Message Archive state: {0}", ex .getMessage()); auto = false; } } return auto; **/ //modified for all save; return true; } private StoreMethod getStoreMethod(XMPPResourceConnection session) throws NotAuthorizedException { /**comment by guahao StoreMethod save = (StoreMethod) session.getCommonSessionData(ID + "/" + DEFAULT_S***E); if (save == null) { try { String data = session.getData(SETTINGS, DEFAULT_S***E, defaultStoreMethod.toString()); save = StoreMethod.valueof(data); session.putCommonSessionData(ID + "/" + DEFAULT_S***E, save); } catch (TigaseDBException ex) { log.log(Level.WARNING, "Error getting Message Archive state: {0}", ex .getMessage()); save = StoreMethod.False; } } if (save.ordinal() < requiredStoreMethod.ordinal()) { save = requiredStoreMethod; session.putCommonSessionData(ID + "/" + DEFAULT_S***E, save); try { setStoreMethod(session, save); } catch (TigaseDBException ex) { log.log(Level.WARNING, "Error updating message archiving level to required level {0}", ex.getMessage()); } } return save; **/ StoreMethod save = requiredStoreMethod; session.putCommonSessionData(ID + "/" + DEFAULT_S***E, save); try { setStoreMethod(session, save); } catch (TigaseDBException ex) { log.log(Level.WARNING, "Error updating message archiving level to required level {0}", ex.getMessage()); } return save; }
知道这个后,你会知道,并非安装了message-archive 组件后,日志就可以记录了;而是要客户端允许了;
那么如何安装?
把message-archive.jar 拷贝到 jars/tigase-message-archiving.jar 然后再 etc/init.properties 写下如下配置;
####begin
--comp-name-1=m
参考如下文章一切ok
http://hi.baidu.com/bngoogle/archive/tag/tigase https://projects.tigase.org/projects/message-archiving/wiki/Configuration https://projects.tigase.org/projects/message-archiving/wiki/Configuration
Configuration
Basic configuration
Below is example configuration required by component:--comp-name-3=message-archive --comp-class-3=tigase.archive.MessageArchiveComponent message-archive/archive-repo-uri=jdbc:mysql://localhost/messagearchivedb?user=test&password=test --sm-plugins=message-archive-xep-0136 sess-man/plugins-conf/message-archive-xep-0136/component-jid=message-archive@local-machine-name
In this example configuration is passed connection string to database (if connection string is empty default user repository will be used as database to store archived messages) and JID of message
archive component.
If
component-jidoption is omitted message-archive@local-machine-name will be used as
component-jid.
Additional options
We added following additional features, which are available since 1.0.1 release.
Setting default value of archiving level for messages on a server
Settting this property will change default archiving level for messages for every account on server for which per account default archiving level is not set. User will be able to change this valuesetting default modes as described in XEP-0136 section 2.4
Example in which we set default server message archiving level to
message:
sess-man/plugins-conf/message-archive-xep-0136/default-store-method=message
Setting required value of archiving level for messages on a server
Settting this property will change required archiving level for messages for every account on server. User will be able to change this to any lower value by setting default modes as described in XEP-0136section 2.4, but user will be allowed to set higher archiving level. If this property is set to higher value then default archiving level is set then this setting will be used as default archiving level setting.
Example in which we set required server message archiving level to
body:
sess-man/plugins-conf/message-archive-xep-0136/required-store-method=body
相关文章推荐
- tigase增加离线消息,message-archive
- 让input表单不保存历史记录的方法
- show一下最近的开发成果,离线消息、查看聊天记录、帮助机器人等
- tortoisesvn rename会保存历史记录
- 取消root命令历史记录以增加安全性
- 天气预报--保存已查询城市,历史记录功能实现
- TM2013自定义消息记录保存目录
- 左轮网吧IE历史QQ记录自动保存工具
- Delphi 菜单的应用(系统菜单添加一项、主菜单增加历史记录、弹出菜单的动态合并、菜单中画图、显示状态)
- asp.net网站如何保存历史访问记录
- [PHP]如何让input表单TextBox 不保存历史记录
- 不想让表单保存用户输入历史记录
- sap系统下拉框会自动保存历史记录的原理
- 调试AVIN后视注册消息BUG改正记录保存
- 系统保存客户操作历史记录
- 客户端不保存表单搜索历史记录
- TextBox 不保存历史记录
- 使用Cookies保存网站历史浏览记录实例
- 自定义cardpanel改进NavigationView支持路由,历史记录,加入消息提示组件(废弃 仅参考)
- 取消root命令历史记录增加安全性