简体   繁体   English

quickblox-删除私人(1对1)聊天

[英]quickblox - remove private (1 to 1) chat

Hi to everyone and first of all sorry for my english. 大家好,首先,对不起我的英语。 Second, thanks in advance for your answers. 第二,预先感谢您的回答。 I've been able to retrieve a list of current loged-user dialogs using: 我已经能够使用以下方法检索当前登录用户对话框的列表:

[QBChat dialogsWithExtendedRequest:nil delegate:self];

and

if ([result isKindOfClass:[QBDialogsPagedResult class]] && result.success) {


    QBDialogsPagedResult *pagedResult = (QBDialogsPagedResult *)result;

    NSArray *dials = pagedResult.dialogs;
    self.dialogs = [dials mutableCopy];
    ...
}

I've been able to modify dialogs where type == QBChatDialogTypeGroup in order to remove the loged user ID from them using: 我已经能够修改其中== QBChatDialogTypeGroup类型的对话框,以便使用以下命令从其中删除记录的用户ID:

QBChatDialog *selectedDialog = self.dialogs[sender.tag];

if (selectedDialog.type == QBChatDialogTypeGroup) {

    NSMutableDictionary *extendedRequest = [NSMutableDictionary new];
    extendedRequest[@"pull_all[occupants_ids][]"] = [NSString stringWithFormat:@"%ld",(unsigned long)self.logedUser.ID];
    [QBChat updateDialogWithID:selectedDialog.ID extendedRequest:extendedRequest delegate:self];
}

This makes that the next time i ask for dialog list to QuickBlox all of them except from the one just "updated" are listed back. 这使得下次我向QuickBlox请求对话框列表时,除了刚刚“更新”的对话框外,所有其他对话框都将重新列出。 The problem is that if i use the same "extendedRequest" request when selectedDialog.type == QBChatDialogTypePrivate i always get Wrong permission from QuickBlox. 问题是,如果我在selectedDialog.type == QBChatDialogTypePrivate时使用相同的“ extendedRequest”请求,我总是会从QuickBlox获得错误的权限。 Is there anyway to make that dialogs with type == QBChatDialogTypePrivate won't be listed again when i request dialog list from QuickBlox??? 无论如何,当我向QuickBlox请求对话框列表时,不会再次列出类型为== QBChatDialogTypePrivate的对话框??? I hope everything is clear. 我希望一切都清楚。 Thx in advance =) 提前Thx =)

You can't use pull_all[occupants_ids][] and push_all[occupants_ids][] for private dialogs, only for group 您不能将pull_all [occupants_ids] []push_all [occupants_ids] []用于私人对话框,而只能用于组

With private dialog there 2 users in it - you and your opponent. 使用私人对话,其中有2个用户-您和您的对手。 And you can't remove or add anyone else because it's a private chat, not a group chat 而且您无法删除或添加其他任何人,因为这是私人聊天,而不是群聊

To delete a chat dialog, 要删除聊天对话框,

[QBChat deleteDialogWithID:dialogID delegate:self];

Handle delegate (conform to QBActionStatusDelegate ) 处理委托(符合QBActionStatusDelegate

- (void)completedWithResult:(QBResult *)result{ {
    if([result isKindOfClass:[QBChatDialogResult class]]) {
        QBChatDialogResult *qbDialog = (QBChatDialogResult *)result;
        if(qbDialog.success) {
            NSLog(@"Dialog has been deleted!");
        } else {
            NSLog(@"Uh no, something wrong!");
        }
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM