如果您想在groupchat中添加用户,则需要更新组对话。
QBChatDialog *updateDialog = [[QBChatDialog alloc] initWithDialogID:@"53aac645535c12bd3b008a40" type:QBChatDialogTypeGroup];
updateDialog.pushOccupantsIDs = @[@"300", @"301", @"302"];
updateDialog.name = @"school friends";
[QBRequest updateDialog:updateDialog successBlock:^(QBResponse *responce, QBChatDialog *dialog) {
} errorBlock:^(QBResponse *response) {
}];
对于更详细检查此Update_group_dialog
以及在集体对话检查聊天Chat_in_group_dialog
不要忘记使用委托方法。
编译标志QBChatDelegate
- (void)chatRoomDidReceiveMessage:(QBChatMessage *)message fromDialogId:(NSString *)dialogId{
}
编辑1: -你会得到DialogId与retriving所有对话。
QBResponsePage *page = [QBResponsePage responsePageWithLimit:100 skip:0];
[QBRequest dialogsForPage:page extendedRequest:nil successBlock:^(QBResponse *response, NSArray *dialogObjects, NSSet *dialogsUsersIDs, QBResponsePage *page) {
} errorBlock:^(QBResponse *response) {
}];
编辑2: -要知道dialogId创造新的对话框使用createChatNotificationForGroupChatCreation方法时。
- (QBChatMessage *)createChatNotificationForGroupChatCreation:(QBDialog *)dialog
{
// create message:
QBChatMessage *inviteMessage = [QBChatMessage message];
NSMutableDictionary *customParams = [NSMutableDictionary new];
customParams[@"xmpp_room_jid"] = dialog.roomJID;
customParams[@"name"] = dialog.name;
customParams[@"_id"] = dialog.ID;
customParams[@"type"] = @(dialog.type);
customParams[@"occupants_ids"] = [dialog.occupantIDs componentsJoinedByString:@","];
// Add notification_type=1 to extra params when you created a group chat
//
customParams[@"notification_type"] = @"1";
inviteMessage.customParameters = customParams;
return inviteMessage;
}
你想对话只为A和B或像A,B,C,D这样的组? –
嗨巴达尔,我想它像A,B,C,D可以有很多用户。所以我想要一个组 –