XMPPFrameWork IOS 开发(五)获取好友信息和添加删除好友
来源:互联网 发布:时间线管理软件 编辑:程序博客网 时间:2024/05/17 22:33
原始地址: XMPPFrameWork IOS 开发(五)获取好友信息和添加删除好友
好友列表和好友名片
- [_xmppRoster fetchRoster];//获取好友列表
- //获取到一个好友节点
- - (void)xmppRoster:(XMPPRoster *)sender didRecieveRosterItem:(NSXMLElement *)item
- //获取完好友列表
- - (void)xmppRosterDidEndPopulating:(XMPPRoster *)sender
- //到服务器上请求联系人名片信息
- - (void)fetchvCardTempForJID:(XMPPJID *)jid;
- //请求联系人的名片,如果数据库有就不请求,没有就发送名片请求
- - (void)fetchvCardTempForJID:(XMPPJID *)jid ignoreStorage:(BOOL)ignoreStorage;
- //获取联系人的名片,如果数据库有就返回,没有返回空,并到服务器上抓取
- - (XMPPvCardTemp *)vCardTempForJID:(XMPPJID *)jid shouldFetch:(BOOL)shouldFetch;
- //更新自己的名片信息
- - (void)updateMyvCardTemp:(XMPPvCardTemp *)vCardTemp;
- //获取到一盒联系人的名片信息的回调
- - (void)xmppvCardTempModule:(XMPPvCardTempModule *)vCardTempModule
- didReceivevCardTemp:(XMPPvCardTemp *)vCardTemp
- forJID:(XMPPJID *)jid
添加好友
- //name为用户账号
- - (void)XMPPAddFriendSubscribe:(NSString *)name
- {
- //XMPPHOST 就是服务器名, 主机名
- XMPPJID *jid = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@%@",name,XMPPHOST]];
- //[presence addAttributeWithName:@"subscription" stringValue:@"好友"];
- [xmppRoster subscribePresenceToUser:jid];
- }
- //收到添加好友的请求
- - (void)xmppRoster:(XMPPRoster *)sender didReceivePresenceSubscriptionRequest:(XMPPPresence *)presence
- {
- //取得好友状态
- NSString *presenceType = [NSString stringWithFormat:@"%@", [presence type]]; //online/offline
- //请求的用户
- NSString *presenceFromUser =[NSString stringWithFormat:@"%@", [[presence from] user]];
- NSLog(@"presenceType:%@",presenceType);
- NSLog(@"presence2:%@ sender2:%@",presence,sender);
- XMPPJID *jid = [XMPPJID jidWithString:presenceFromUser];
- //接收添加好友请求
- [xmppRoster acceptPresenceSubscriptionRequestFrom:jid andAddToRoster:YES];
- }
删除好友
- //删除好友,name为好友账号
- - (void)removeBuddy:(NSString *)name
- {
- XMPPJID *jid = [XMPPJID jidWithString:[NSString stringWithFormat:@"%@@%@",name,XMPPHOST]];
- [self xmppRoster] removeUser:jid];
- }
0 0
- XMPPFrameWork IOS 开发(五)获取好友信息和添加删除好友
- XMPPFrameWork IOS 开发(五)获取好友信息和添加删除好友
- [置顶] XMPPFrameWork IOS 开发(五)获取好友信息和添加删除好友
- XMPPFrameWork IOS 开发(五)获取好友信息和添加删除好友
- XMPPFrameWork IOS 开发(四)消息和好友上下线
- XMPPFrameWork IOS 开发(四)消息和好友上下线
- XMPPFrameWork IOS 开发(四)消息和好友上下线
- xmpp-iOS-添加好友和删除好友
- XMPPFramework iOS开发(六)好友列表
- XMPP学习记录五:添加好友和删除好友
- [置顶] XMPPFrameWork IOS 开发(四)消息和好友上下线
- IOS使用XMPP最新教程(五)添加好友和接受好友请求
- XMPP-好友列表模块的注册和好友列表获取,添加,删除
- 十二,iOS通讯录好友信息的获取
- Android 开发即时聊天工具 YQ :(八) 添加/删除好友
- XMPP系列(三)---获取好友列表、添加好友
- iOS开发-环信添加好友
- 获取QQ好友共同好友列表信息
- XMPPFrameWork IOS 开发(四)消息和好友上下线
- struts2 配置文件详解 type="stream chain dispatcher、redirect(redirect-action)"
- JPA,EJB
- Codeforces 427E. Police Patrol
- spring开发_spring中Bean的作用域_singleton_prototype
- XMPPFrameWork IOS 开发(五)获取好友信息和添加删除好友
- 汇编中的除法溢出的解决
- db2日期和时间常用汇总
- [2013山东ACM省赛] The number of steps (概率DP,数学期望)
- 改变ViewPager的翻页速率
- Mac 10.9.2 安装thrift
- 编译生成wireless-regdb
- HDU 1542 Atlantis 矩形面积并
- Android-Universal-Image-Loader(UIL)使用分析