【问题标题】:how to create custom invitation message to join users in chatroom - smack如何创建自定义邀请消息以加入聊天室中的用户 - smack
【发布时间】:2016-07-19 06:36:24
【问题描述】:

我正在邀请离线用户加入群组,如下图,

myChattingRoom.invite("user7@10.10.1.105", "Please join my chatting room");

由于默认情况下邀请消息没有正文,因此openfire没有保留邀请消息,当它重新上线时需要发送给user7(据我研究)。

当前发送的邀请信息如下,

<message to="user7@10.10.1.105" from="mychattingroom@conference.10.10.1.105"><x xmlns="http://jabber.org/protocol/muc#user"><invite  from="user1@10.10.1.105"><reason>Please join my chatting room</reason></invite></x><x xmlns="jabber:x:conference" jid="mychattingroom@conference.10.10.1.105"/></message>

现在,我如何邀请包含空正文的邀请消息的用户?

提前致谢。

【问题讨论】:

    标签: java xmpp openfire smack


    【解决方案1】:

    这是我使用 Smack 2.7.7 的解决方案:

    Message messageWithBody = new Message();
    messageWithBody.addBody("", " ");
    messageWithBody.setType(Message.Type.normal);
    muc.invite(messageWithBody, "user7@10.10.1.105", "Please join my chatting room");
    

    请记住,延迟传递消息有几个限制,因此离线用户上线时可能不是即时的。

    【讨论】:

      猜你喜欢
      • 2021-10-11
      • 2013-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-03-05
      • 1970-01-01
      • 1970-01-01
      • 2014-10-31
      相关资源
      最近更新 更多