- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有 XMPP 服务器(openfire)和一堆客户端(spark),分为几个组(部门)。我正在寻找能够将它们留在 session 室中的能力。我的意思是 Skype 具有的类似功能;当用户关闭带有群组对话的窗口时,他的客户端会不断跟踪该房间的事件,当出现新消息时,用户会自动再次加入该 session 。我已经发现 spark+openfire 没有这样的能力,虽然有很好的群聊书签功能和自动加入,但是它并不能阻止用户简单地离开房间并且无法注意到进一步的事件。我想问一下是否有任何XMPP客户端实现了这个功能。
我想我可以设置我自己的具有管理权限的机器人坐在每个房间里,并可能让它在用户离开 session 并且他没有结束 session 时强制踢/重新连接(例如通过 openfire 的 HTTP 功能管理)用户,所以连接上的自动加入会让他回来。但是,如果有替代方案,我认为简单地更改客户端应用程序会更容易也更好。
更新:我刚刚在 spark 中找到了“自动接受群聊邀请”选项,所以如果我在他们不知情的情况下重新配置所有客户端并设置此机器人以在该人离开 channel 时简单地发送邀请,它应该可以解决问题。还有其他想法吗?
更新2:
好的,伙计们,我已经成功测试了“Spark->首选项->群聊->自动接受群聊邀请”选项,它正在工作;我的 spark 会自动加入我被邀请参加的每个 session 。所以我在基于 JAXL 3.0 的机器人中实现了 session 观看 -> 自动重新邀请功能。唯一的问题是 jaxl 发送的邀请对我不起作用。
这是源代码:
<?php
### JAXL message bot composed by ewilded
require 'JAXL-3.x/jaxl.php';
$jabber_conf=array('jid' => 'messagebot@localhost','host'=>'openfire','user'=>'messagebot','domain'=>'localhost','logLevel'=>4, 'strict'=>true, 'port'=>5222, 'pass'=>'somepass','log_level' => JAXL_INFO);
error_reporting(E_ALL);
$conference_rooms=array('tech@conference.localhost');
$client=null;
## Creating the object
$client = new JAXL($jabber_conf);
$client->require_xep(array(
'0045', // MUC
'0203', // Delayed Delivery
'0199', // XMPP Ping
'0249' // direct invite
));
## connect up callbacks
$client->add_cb('on_auth_success', function() use($client,$conference_rooms,$cron_interval) {
echo "Auth success.\n";
echo "My full jid: ".$client->full_jid->to_string()."\n";
$client->set_status("Mesasge bot - available!"); // set your status
$client->get_vcard(); // fetch your vcard
$client->get_roster(); // fetch your roster list
foreach($conference_rooms as $conference)
{
echo "Joining conference $conference.\n";
$room_full_jid=new XMPPJid("$conference/messagebot");
$client->xeps['0045']->join_room($room_full_jid);
}
});
$client->add_cb('on_chat_message', function($msg) use($client) {
$to=$msg->from;
echo "Sending answer to: ".$to."\n";
$client->send_chat_msg($to,"I am just simple bot written in PHP with JAXL XMPP library.");
});
$client->add_cb('on_connect_error',function(){echo "Connection error :(\n";});
$client->add_cb('on_disconnect', function() {
echo "Got disconnected.\n";
_debug("got on_disconnect cb");
});
$client->add_cb('on_error_stanza',function($msg)
{
echo "Error stanza.";
#print_r($msg);
});
$client->add_cb('on_presence_stanza',function($msg) use($client)
{
echo "Presence stanza.\n";
### joins and lefts are shown here, so here we simply send reinvite if we see that someone's left
if(isset($msg->attrs['type'])&&$msg->attrs['type']=='unavailable')
{
if(isset($msg->childrens[0])&&isset($msg->childrens[0]->childrens[0])&&isset($msg->childrens[0]->childrens[0]->attrs['jid']))
{
echo "Sending invite.\n";
$jid=$msg->childrens[0]->childrens[0]->attrs['jid'];
$bare_jid=explode("/",$jid);
$from_room=$msg->attrs['from'];
$bare_from_room=explode("/",$from_room);
echo $bare_jid[0]."\n";
echo $bare_from_room[0]."\n";
$client->xeps['0249']->invite($jid,$from_room); ### for some reason it does not work :(
echo "Invite ($jid to $from_room) sent.\n";
}
else
{
echo "Ignoring.\n";
}
}
echo "After presence stanza.\n";
});
$client->add_cb('on_normal_stanza',function()
{
echo "Normal stanza.\n";
});
$client->add_cb('on_groupchat_message',function($msg) use ($client) {
echo "Groupchat event received.\n";
});
echo "Start called.\n";
$client->start();
?>
最佳答案
您是否在日志中看到发送了邀请数据包?
对于下一级调试,您可能需要直接调用 $invite_pkt = $client->xeps['0249']->get_invite_pkt($to_bare_jid, $room_jid)
.两者 $to_bare_jid
和 $room_jid
必须作为字符串传递。 get_invite_pkt
将返回您需要按照 direct MUC invitation xmpp extension 发送的必要节.如果您发现返回的节一切正常,只需调用 $client->send($invite_pkt)
发送即可。 .
希望这可以帮助您进行更好的调试并解决问题。
关于XMPP 持久 session 室状态,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13495167/
我是Hibernate的新手。当我保存特定实体时,它将从现有实体中重写数据。 我将ID用作自动生成,如下所示: @Id @GeneratedValue(strategy=GenerationType.
我正在尝试以连续模式使用CouchDB更改通知API,所以我想发送此消息 _changes?feed = continuous?include_docs = true作为GET请求到达我的CouchD
我有 XMPP 服务器(openfire)和一堆客户端(spark),分为几个组(部门)。我正在寻找能够将它们留在 session 室中的能力。我的意思是 Skype 具有的类似功能;当用户关闭带有群
我发布这个问题是为了看看我是否正确理解 Azure Functions 中的并行性,特别是 Durable Functions。 最近使用 az cli 在 Azure Functions 中添加了设
我在 Dev Env 上有一个 AKS 集群,上面运行着一些容器。我还启用了 Azure Log Analytics。但我可以看到正在运行的当前容器的日志,而不是已被终止或停止的旧容器的日志。 我想知
在 Akka 中,当一个 actor 在处理消息时死亡(在 onReceive(...) { ... } 内),该消息就会丢失。有没有办法保证无损?有一种配置 Akka 在将消息发送到 onRecei
我试图让 selectOneMany 取得有限的成功。 我有以下数据库模型 User email Text verkey Text Maybe verified Bool password T
我需要使用持久性(Yesod)从键列表中获取实体列表 假设我有一个 Model 及其相应的 ModelId。我身边有: keys :: [ModelId] 我需要得到 models :: [Model
我有一个使用 GWT、请求工厂和地点/Activity 构建的网络应用程序。我很好奇我使用的历史 token 是否持久。该任务基本上就是让 URL 定义我的网络应用程序的确切位置(读作“文件/文件夹结
我正在寻找一种 jQuery 方法来在刷新页面时使页面元素持久保留在用户屏幕上。当我刷新页面并且丢失 jQuery 页面中的内容时,它会发生变化。 我需要页面持久。如何刷新页面并保持元素不刷新(持久)
当我尝试使用 gcc 编译带有 -fopenmp 标志的 C 代码时,我已经持续收到此错误超过 6 小时了。 错误:控制谓词无效 for ( int i = 0; i #include #ifde
我有带有验证注释的实体,例如@NotNull。我不知道如何防止容器管理的事务在批量持久操作中出现 ConstraintViolationException 的情况下回滚,例如: public void
这是我的代码: http://jsfiddle.net/KCb5z/8/embedded/result/ http://jsfiddle.net/KCb5z/8/ $(function () {
我正在与服务器通信,理想情况下,我希望输入流和输出流始终处于运行状态。我收到未经请求的响应,因此我必须始终准备好接收输入流上的数据。 在我进一步深入之前,我应该说我建立的任何连接都必须能够支持 SSL
我正在寻找一种正确扩展 Azure Functions 的方法,但遇到了问题。 我有一组 IoT 设备,通过 HTTP 向 Azure 发送数据(为此,有一组自动扩展的 Azure Functions
1.临时态(瞬时态) 不存在于session中,也不存在于数据库中的数据,被称为临时态。 比如:刚刚使用new关键字创建出的对象。 2.持久态 存在于session中,事务还未提交,提交之后
我在 Kohana v2 中使用数据库 session 驱动程序。为了使 session 持久化,Kohana 创建了一个 token cookie。这个 cookie 使用了我想的 cookie 配
有谁知道是否有办法使用 PyWinrm 打开一个持久的 PowerShell session ,该 session 保持状态并且可以多次调用?我正在尝试执行以下操作: #!/bin/python im
在运行的Elasticsearch集群中,配置文件中的index.number_of_replicas设置为1。 我可以通过运行以下命令在运行的集群上将其更新为2 # curl -XPUT "http
我在“这么长的帖子必须意味着大量的代码和配置”部分下一对一地使用指南代码。 http://blog.springsource.com/2006/08/07/using-jpa-in-spring-wi
我是一名优秀的程序员,十分优秀!