XMPP:未读邮件数 [英] XMPP: count of unread messages

查看:87
本文介绍了XMPP:未读邮件数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过以下功能为我的Web应用程序实现聊天:

I'm trying to implement chat for my webapp with following features:

  • 用户登录时,他应该看到许多未读消息(既是脱机消息又是看不见的",我将在下一步中解释看不见的").
  • 当用户在应用程序中但在聊天窗口中的任何位置时,应通知他有新消息.邮件应标记为看不见",并且必须添加到未读邮件的数量中.

使用XEP-0013可以轻松实现第一点:灵活的脱机消息检索.因此,我可以检索脱机消息,并在确定用户已看到脱机消息时将其从未读列表中删除.但是问题是:对于看不见的"消息,我如何实现相同的目的?

The first point is quite easily achieved using XEP-0013: Flexible Offline Message Retrieval. So I can retrieve offline messages and when I'm sure user has seen them - I remove them from unread list. But the problem is: how do I achieve same thing for "unseen" messages?

简而言之,我需要的是:任何消息都应标记为脱机,除非用户看到该消息,并且通过明确的请求将其从列表中删除.

In short what I need is: any message should be marked as offline, unless user sees it and it's removed from the list by explicit request.

我可以使用XMPP来实现吗?

Can I achieve that with XMPP and how do I do that?

谢谢.

推荐答案

您要尝试的工作基本上是在您的帐户中存储一个看不见的东西的计数器.我认为您不需要灵活的脱机检索,因为当您连接邮件时,这些邮件只会变得看不见.因此,您只需要处理一种情况:看不见.

What you are trying to do is to basically store a counter of unseen stuff in your account. I think you do not need flexible offline retrieval as when you connect the messages would simply become unseen. You thus only have to deal with one case: Unseen.

我将从ejabberd的角度回答,作为开发人员之一,我会更好:我将使用私有存储来存储您当前看不见的次数和对话的状态.

I will reply from the perspective of ejabberd, that I know better as one of the developer: I would use private storage to store your current state of unseen count and conversation.

这篇关于XMPP:未读邮件数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆