需要一个解决方案来实现xmpp在群聊中添加朋友并在ios中一次向他们发送消息 [英] Need a solution to implement xmpp add friends in group chat and sending message to them in once in ios

查看:27
本文介绍了需要一个解决方案来实现xmpp在群聊中添加朋友并在ios中一次向他们发送消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在添加朋友、发送邀请以及在群聊中遇到困难,例如使用 xmpp 为所有人发送一条消息.我知道我需要使用 XEP-0045.但我没有成功.谁能告诉我怎么做.

I'm having difficulties to add friends, sending invitations and also in group chat like sending one message for all using xmpp. i know that I need to use XEP-0045. But I am not succeeded. Can anybody tell me how to do it.

  1. 发送一对一聊天的好友请求.
  2. 发送加入聊天室的邀请.
  3. 向聊天室的朋友发送消息.

如果有人有示例代码就好了..

if somebody has sample code that would be great..

提前致谢

推荐答案

对于 #3 :向聊天室的朋友发送消息.

for #3 : send message to chat room's friends.

-(void) sendGroupMessage:(NSString *) groupJID Message:(NSString *)msg{

    XMPPJID *roomJID = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@conference.%@",groupJID,SERVER_URL]];

    XMPPRoom *muc = [[XMPPRoom alloc] initWithRoomStorage:xmppRoomStorage jid:roomJID
                                            dispatchQueue:dispatch_get_main_queue()];

    [muc   activate:xmppStream];

    [muc   addDelegate:self delegateQueue:dispatch_get_main_queue()];

    [muc   sendMessageWithBody:msg];

}

这篇关于需要一个解决方案来实现xmpp在群聊中添加朋友并在ios中一次向他们发送消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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